Enable push parsers to operate in impure mode. Thus, %push-parser no

longer implies %pure-parser.  The point of this change is to move
towards being able to test the push parser code by running the entire
test suite as if %push-parser had been declared.
* data/push.c (yypush_parse): For impure mode, remove the
yypushed_char, yypushed_val, and yypushed_loc arguments.
Instead, declare these as local variables initialized to the global
yychar, yylval, and yylloc.
For the first yypush_parse invocation only, restore the initial values
of these global variables when it's time to read a token since they
have been overwritten.
* src/parse-gram.y (prologue_declaration): Don't set pure_parser for
%push-parser.
* tests/calc.at (Simple LALR(1) Calculator): Always declare
%pure-parser along with %push-parser since this test case was designed
for pure push parsers.
* tests/local.at (AT_PURE_OR_PUSH_IF): Remove unused.
(AT_YACC_OR_PUSH_IF): New.
(AT_YYERROR_SEES_LOC_IF): Fix enough that the test suite passes, but
add a note that it's still wrong for some cases (as it has been for a
while).
(AT_PURE_LEX_IF): Use AT_PURE_IF instead of AT_PURE_OR_PUSH_IF since
%push-parser no longer implies %pure-parser.
This commit is contained in:
Joel E. Denny
2006-12-25 17:25:39 +00:00
parent a063317885
commit 94ebeba53f
7 changed files with 67 additions and 28 deletions

View File

@@ -308,7 +308,7 @@ static int current_prec = 0;
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{
/* Line 191 of yacc.c */
/* Line 198 of yacc.c */
#line 97 "parse-gram.y"
symbol *symbol;
@@ -321,7 +321,7 @@ typedef union YYSTYPE
unsigned char character;
}
/* Line 191 of yacc.c */
/* Line 198 of yacc.c */
#line 326 "parse-gram.c"
YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
@@ -1698,7 +1698,7 @@ YYLTYPE yylloc;
/* User initialization code. */
/* Line 1076 of yacc.c */
/* Line 1082 of yacc.c */
#line 89 "parse-gram.y"
{
/* Bison's grammar can initial empty locations, hence a default
@@ -1707,7 +1707,7 @@ YYLTYPE yylloc;
boundary_set (&yylloc.end, current_file, 1, 1);
}
/* Line 1076 of yacc.c */
/* Line 1082 of yacc.c */
#line 1712 "parse-gram.c"
yylsp[0] = yylloc;
goto yysetstate;
@@ -2064,7 +2064,7 @@ yyreduce:
/* Line 1269 of yacc.c */
#line 260 "parse-gram.y"
{ push_parser = true; pure_parser = true; }
{ push_parser = true; }
break;
case 30:

View File

@@ -168,7 +168,7 @@
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{
/* Line 1487 of yacc.c */
/* Line 1535 of yacc.c */
#line 97 "parse-gram.y"
symbol *symbol;
@@ -181,7 +181,7 @@ typedef union YYSTYPE
unsigned char character;
}
/* Line 1487 of yacc.c */
/* Line 1535 of yacc.c */
#line 186 "parse-gram.h"
YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1

View File

@@ -257,7 +257,7 @@ prologue_declaration:
| "%output" "=" STRING { spec_outfile = $3; } /* deprecated */
| "%parse-param" "{...}" { add_param ("parse_param", $2, @2); }
| "%pure-parser" { pure_parser = true; }
| "%push-parser" { push_parser = true; pure_parser = true; }
| "%push-parser" { push_parser = true; }
| "%require" STRING { version_check (&@2, $2); }
| "%skeleton" STRING { skeleton_arg ($2, 1, &@1); }
| "%token-table" { token_table_flag = true; }