Implement the FIXME that ends an user action with a semicolon

if it seems necessary.

* src/scan-code.l (flex rules section): Flag cpp directive from
any `#' to the first unescaped end-of-line.  Semicolon is not
needed after `;', `{', '}', or cpp directives and is needed after
any other token (whitespaces and comments have no effect).
* tests/actions.at (Fix user actions without a trailing semicolon):
New test.
* tests/input.at (AT_CHECK_UNUSED_VALUES): Add semicolons to
to make user actions complete statements.
Adjust column numbers in error messages.
* tests/regression.at (Fix user actions without a trailing semicolon):
Remove.  Covered by new test.
This commit is contained in:
Di-an Jan
2008-12-07 21:54:45 -08:00
parent ce9447fc6a
commit e8cd1ad655
5 changed files with 198 additions and 57 deletions

View File

@@ -1238,27 +1238,3 @@ AT_COMPILE([[input]])
AT_PARSER_CHECK([[./input]])
AT_CLEANUP
## ----------------------------------------------- ##
## Fix user actions without a trailing semicolon. ##
## ----------------------------------------------- ##
AT_SETUP([[Fix user actions without a trailing semicolon]])
# This feature is undocumented, but we accidentally broke it in 2.3a, and there
# was a complaint at:
# <http://lists.gnu.org/archive/html/bug-bison/2008-11/msg00001.html>.
AT_DATA([input.y],
[[%%
start: {asdffdsa} ;
]])
AT_BISON_CHECK([[-o input.c input.y]])
AT_CHECK([[sed -n '/asdffdsa/s/^ *//p' input.c]], [[0]],
[[{asdffdsa;}
]])
AT_CLEANUP