542 |
"{"|"<"{splice}"%" STRING_GROW; braces_level++; |
"{"|"<"{splice}"%" STRING_GROW; braces_level++; |
543 |
"%"{splice}">" STRING_GROW; braces_level--; |
"%"{splice}">" STRING_GROW; braces_level--; |
544 |
"}" { |
"}" { |
545 |
STRING_GROW; |
bool outer_brace = --braces_level < 0; |
546 |
braces_level--; |
|
547 |
if (braces_level < 0) |
/* As an undocumented Bison extension, append `;' before the last |
548 |
|
brace in braced code, so that the user code can omit trailing |
549 |
|
`;'. But do not append `;' if emulating Yacc, since Yacc does |
550 |
|
not append one. |
551 |
|
|
552 |
|
FIXME: Bison should warn if a semicolon seems to be necessary |
553 |
|
here, and should omit the semicolon if it seems unnecessary |
554 |
|
(e.g., after ';', '{', or '}', each followed by comments or |
555 |
|
white space). Such a warning shouldn't depend on --yacc; it |
556 |
|
should depend on a new --pedantic option, which would cause |
557 |
|
Bison to warn if it detects an extension to POSIX. --pedantic |
558 |
|
should also diagnose other Bison extensions like %yacc. |
559 |
|
Perhaps there should also be a GCC-style --pedantic-errors |
560 |
|
option, so that such warnings are diagnosed as errors. */ |
561 |
|
if (outer_brace && ! yacc_flag) |
562 |
|
obstack_1grow (&obstack_for_string, ';'); |
563 |
|
|
564 |
|
obstack_1grow (&obstack_for_string, '}'); |
565 |
|
|
566 |
|
if (outer_brace) |
567 |
{ |
{ |
568 |
STRING_FINISH; |
STRING_FINISH; |
569 |
rule_length++; |
rule_length++; |