stmt : expr ';' $2 { $$ = ]$[1; }
| decl $3
- | error ';' { $$ = "<error>"; }
- | '@' { YYACCEPT; }
+ | error ';' { static char error_msg[] = "<error>"; $$ = error_msg; }
+ | '@' { YYACCEPT; }
;
expr : ID
break;
case ' ': case '\f':
colNum += 1;
- break;
+ break;
case '\n':
lineNum += 1;
colNum = 0;
}
else
{
+ static char empty_string[] = "";
colNum += 1;
tok = c;
- yylval = "";
+ yylval = empty_string;
}
#if YYLSP_NEEDED
yylloc.last_column = colNum-1;
AT_SETUP([GLR: Resolve ambiguity, impure, no locations])
_AT_TEST_GLR_CXXTYPES([],
[%dprec 1], [%dprec 2])
-AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0,
+AT_PARSER_CHECK([[./types test-input]], 0,
_AT_RESOLVED_GLR_OUTPUT, _AT_GLR_STDERR)
AT_CLEANUP
AT_SETUP([GLR: Resolve ambiguity, impure, locations])
_AT_TEST_GLR_CXXTYPES([%locations],[%dprec 1],[%dprec 2])
-AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0,
+AT_PARSER_CHECK([[./types test-input]], 0,
_AT_RESOLVED_GLR_OUTPUT_WITH_LOC, _AT_GLR_STDERR)
AT_CLEANUP
AT_SETUP([GLR: Resolve ambiguity, pure, no locations])
_AT_TEST_GLR_CXXTYPES([%pure-parser],
[%dprec 1], [%dprec 2])
-AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0,
+AT_PARSER_CHECK([[./types test-input]], 0,
_AT_RESOLVED_GLR_OUTPUT, _AT_GLR_STDERR)
AT_CLEANUP
AT_SETUP([GLR: Resolve ambiguity, pure, locations])
_AT_TEST_GLR_CXXTYPES([%pure-parser %locations],
[%dprec 1], [%dprec 2])
-AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0,
+AT_PARSER_CHECK([[./types test-input]], 0,
_AT_RESOLVED_GLR_OUTPUT_WITH_LOC, _AT_GLR_STDERR)
AT_CLEANUP
AT_SETUP([GLR: Merge conflicting parses, impure, no locations])
_AT_TEST_GLR_CXXTYPES([],
[%merge <stmtMerge>], [%merge <stmtMerge>])
-AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0,
+AT_PARSER_CHECK([[./types test-input]], 0,
_AT_AMBIG_GLR_OUTPUT, _AT_GLR_STDERR)
AT_CLEANUP
AT_SETUP([GLR: Merge conflicting parses, impure, locations])
_AT_TEST_GLR_CXXTYPES([%locations],
[%merge <stmtMerge>], [%merge <stmtMerge>])
-AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0,
+AT_PARSER_CHECK([[./types test-input]], 0,
_AT_AMBIG_GLR_OUTPUT_WITH_LOC, _AT_GLR_STDERR)
AT_CLEANUP
AT_SETUP([GLR: Merge conflicting parses, pure, no locations])
_AT_TEST_GLR_CXXTYPES([%pure-parser],
[%merge <stmtMerge>], [%merge <stmtMerge>])
-AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0,
+AT_PARSER_CHECK([[./types test-input]], 0,
_AT_AMBIG_GLR_OUTPUT, _AT_GLR_STDERR)
AT_CLEANUP
AT_SETUP([GLR: Merge conflicting parses, pure, locations])
_AT_TEST_GLR_CXXTYPES([%pure-parser %locations],
[%merge <stmtMerge>],[%merge <stmtMerge>])
-AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0,
+AT_PARSER_CHECK([[./types test-input]], 0,
_AT_AMBIG_GLR_OUTPUT_WITH_LOC, _AT_GLR_STDERR)
AT_CLEANUP
AT_SETUP([GLR: Verbose messages, resolve ambiguity, impure, no locations])
_AT_TEST_GLR_CXXTYPES([%error-verbose],
[%merge <stmtMerge>], [%merge <stmtMerge>])
-AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0,
+AT_PARSER_CHECK([[./types test-input]], 0,
_AT_AMBIG_GLR_OUTPUT, _AT_VERBOSE_GLR_STDERR)
AT_CLEANUP