From 972562bf68a236b4580b6074415cbf4e07b0a0c6 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Wed, 16 Dec 2015 04:08:19 -0800 Subject: [PATCH] Verify lexer tokens are always default reductions. --- Makefile.am | 1 + Makefile.in | 1 + Parser.ypp.in | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 3e7e0e5..0f567cb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -116,5 +116,6 @@ CLEANFILES += Parser.cpp Parser.hpp stack.hh Parser.output Parser.cpp Parser.hpp stack.hh Parser.output: Parser.ypp $(BISON) -v --report=state -Werror -o Parser.cpp $< ! grep -n '^State [0-9]* conflicts:' Parser.output + ! grep -n '^ *.* *reduce using rule [0-9]* (Lex[A-Z][^)]*)$$' Parser.output | grep -v '$$default' ! grep -n '^ *$$default *reduce using rule [0-9]* (Lex[A-Z][^)]*)$$' Parser.output -B 2 | grep 'shift, and go to state [0-9]*$$' ! grep -n '^ *$$default *reduce using rule [0-9]* (Lex[A-Z][^)]*)$$' Parser.output -B 2 | grep -v '$$default' | grep 'reduce using rule [0-9]* ([^)]*)$$' diff --git a/Makefile.in b/Makefile.in index e7ef78c..3ca299b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1318,6 +1318,7 @@ Scanner.lo: Parser.hpp IdentifierStart.h IdentifierContinue.h Parser.cpp Parser.hpp stack.hh Parser.output: Parser.ypp $(BISON) -v --report=state -Werror -o Parser.cpp $< ! grep -n '^State [0-9]* conflicts:' Parser.output + ! grep -n '^ *.* *reduce using rule [0-9]* (Lex[A-Z][^)]*)$$' Parser.output | grep -v '$$default' ! grep -n '^ *$$default *reduce using rule [0-9]* (Lex[A-Z][^)]*)$$' Parser.output -B 2 | grep 'shift, and go to state [0-9]*$$' ! grep -n '^ *$$default *reduce using rule [0-9]* (Lex[A-Z][^)]*)$$' Parser.output -B 2 | grep -v '$$default' | grep 'reduce using rule [0-9]* ([^)]*)$$' diff --git a/Parser.ypp.in b/Parser.ypp.in index 6acefbc..f7f0f0f 100644 --- a/Parser.ypp.in +++ b/Parser.ypp.in @@ -1916,7 +1916,7 @@ ClassSuperOpt ; ImplementationFieldListOpt - : TypedIdentifier ";" ImplementationFieldListOpt { $$ = CYNew CYImplementationField($1, $3); } + : LexSetRegExp TypedIdentifier ";" ImplementationFieldListOpt { $$ = CYNew CYImplementationField($2, $4); } | LexSetRegExp { $$ = NULL; } ; @@ -2388,7 +2388,7 @@ RubyProcParameters RubyProcParametersOpt : RubyProcParameters { $$ = $1; } - | { $$ = NULL; } + | LexSetRegExp { $$ = NULL; } ; RubyProcExpression -- 2.49.0