diff options
author | Patrick McHardy <kaber@trash.net> | 2010-07-06 05:57:00 +0200 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2010-07-06 05:57:00 +0200 |
commit | 882a58ec5c8405470cf7550218682b3144dd7cb8 (patch) | |
tree | ae455b1d36fbf71dd169b0082245cc2b1c6a393f /src/parser.y | |
parent | 236838e0a2b1694c72098411802f411eccba7d12 (diff) |
parser: support bison >= 2.4
Work around stange behaviour in bison >= 2.4 (see large comment in parser.y for
details) and remove the skeleton file since it does not work with 2.4 anymore.
Its only purpose was to increase the amount of possible tokens reported in error
messages anyways.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'src/parser.y')
-rw-r--r-- | src/parser.y | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/parser.y b/src/parser.y index 3004cb25..7668cbf2 100644 --- a/src/parser.y +++ b/src/parser.y @@ -482,7 +482,25 @@ common_block : INCLUDE QUOTED_STRING stmt_seperator line : common_block { $$ = NULL; } | stmt_seperator { $$ = NULL; } | base_cmd stmt_seperator { $$ = $1; } - | base_cmd TOKEN_EOF { $$ = $1; } + | base_cmd TOKEN_EOF + { + /* + * Very hackish workaround for bison >= 2.4: previous versions + * terminated parsing after EOF, 2.4+ tries to get further input + * in 'input' and calls the scanner again, causing a crash when + * the final input buffer has been popped. Terminate manually to + * avoid this. The correct fix should be to adjust the grammar + * to accept EOF in input, but for unknown reasons it does not + * work. + */ + if ($1 != NULL) { + $1->location = @1; + list_add_tail(&$1->list, &state->cmds); + } + $$ = NULL; + + YYACCEPT; + } | base_cmd error { $$ = $1; } ; |