From cfef6286fa1beaf2072dfb3240e40539250dc527 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 5 Aug 2014 07:01:08 -0700 Subject: * 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. --- ChangeLog | 9 +++++++++ parser.l | 2 +- parser.y | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1ef3dc72..5bd3c216 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2014-08-05 Kaz Kylheku + + * 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 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 #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) -- cgit v1.2.3