summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-08-05 07:01:08 -0700
committerKaz Kylheku <kaz@kylheku.com>2014-08-05 07:01:08 -0700
commitcfef6286fa1beaf2072dfb3240e40539250dc527 (patch)
tree0e9125ee7ccb62fdda0ab2a6aace4791f5099b52
parent894c655f0214531ad7eff3d68d72792ae18d40cd (diff)
downloadtxr-cfef6286fa1beaf2072dfb3240e40539250dc527.tar.gz
txr-cfef6286fa1beaf2072dfb3240e40539250dc527.tar.bz2
txr-cfef6286fa1beaf2072dfb3240e40539250dc527.zip
* parser.y: Back port from Berkeley Yacc to GNU Bison.
We need a prototype of yylex that is in scope of the grammar, but YYSTYPE is not defined there. * parser.l: Bison 3 declares yyparse in y.tab.h, so we have to reorder some #includes.
-rw-r--r--ChangeLog9
-rw-r--r--parser.l2
-rw-r--r--parser.y5
3 files changed, 15 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 1ef3dc72..5bd3c216 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2014-08-05 Kaz Kylheku <kaz@kylheku.com>
+
+ * parser.y: Back port from Berkeley Yacc to GNU Bison.
+ We need a prototype of yylex that is in scope of the grammar,
+ but YYSTYPE is not defined there.
+
+ * parser.l: Bison 3 declares yyparse in y.tab.h, so we have to
+ reorder some #includes.
+
2014-08-02 Kaz Kylheku <kaz@kylheku.com>
Big switch to reentrant lexing and parsing.
diff --git a/parser.l b/parser.l
index 550e1db9..315b5ab8 100644
--- a/parser.l
+++ b/parser.l
@@ -41,7 +41,6 @@
#include <unistd.h>
#endif
#include "lib.h"
-#include "y.tab.h"
#include "gc.h"
#include "stream.h"
#include "utf8.h"
@@ -49,6 +48,7 @@
#include "unwind.h"
#include "hash.h"
#include "parser.h"
+#include "y.tab.h"
#define YY_INPUT(buf, result, max_size) \
do { \
diff --git a/parser.y b/parser.y
index e1510091..65a7b55b 100644
--- a/parser.y
+++ b/parser.y
@@ -59,6 +59,11 @@ static val rlrec(parser_t *, val form, val line);
static wchar_t char_from_name(const wchar_t *name);
static val make_expr(parser_t *, val sym, val rest, val lineno);
+#if YYBISON
+union YYSTYPE;
+int yylex(union YYSTYPE *, void *scanner);
+#endif
+
#define rl(form, line) rlrec(parser, form, line)
#define mkexp(sym, rest, lineno) make_expr(parser, sym, rest, lineno)
#define symhlpr(lexeme, meta_allowed) sym_helper(scnr, lexeme, meta_allowed)