Initialize to zero if the compiler is being picky.
(INITIAL): Clear braces_level instead of incrementing it.
(SC_BRACED_CODE): Treat <% and %> as { and } when inside C code,
as POSIX 1003.1-2001 requires.
-static int braces_level = 0;
static int percent_percent_count = 0;
/* Within well-formed rules, RULE_LENGTH is the number of values in
static int percent_percent_count = 0;
/* Within well-formed rules, RULE_LENGTH is the number of values in
+ int braces_level IF_LINT (= 0);
+
/* At each yylex invocation, mark the current position as the
start of the next token. */
YY_STEP;
/* At each yylex invocation, mark the current position as the
start of the next token. */
YY_STEP;
"%{" yy_push_state (SC_PROLOGUE);
/* Code in between braces. */
"%{" yy_push_state (SC_PROLOGUE);
/* Code in between braces. */
- "{" YY_OBS_GROW; ++braces_level; yy_push_state (SC_BRACED_CODE);
+ "{" YY_OBS_GROW; braces_level = 0; yy_push_state (SC_BRACED_CODE);
/* A type. */
"<"{tag}">" {
/* A type. */
"<"{tag}">" {
+ "{"|"<"{splice}"%" YY_OBS_GROW; braces_level++;
+ "%"{splice}">" YY_OBS_GROW; braces_level--;
- if (--braces_level == 0)
+ braces_level--;
+ if (braces_level < 0)
{
yy_pop_state ();
YY_OBS_FINISH;
{
yy_pop_state ();
YY_OBS_FINISH;
- "{" YY_OBS_GROW; braces_level++;
-
"$"("<"{tag}">")?(-?[0-9]+|"$") { handle_dollar (current_braced_code,
yytext, *yylloc); }
"@"(-?[0-9]+|"$") { handle_at (current_braced_code,
yytext, *yylloc); }
"$"("<"{tag}">")?(-?[0-9]+|"$") { handle_dollar (current_braced_code,
yytext, *yylloc); }
"@"(-?[0-9]+|"$") { handle_at (current_braced_code,
yytext, *yylloc); }
- [^$@\[\]/\'\"\{\}]+ YY_OBS_GROW;
-
- /* A stray $, or /, or etc. */
- . YY_OBS_GROW;
+ /* `"<"{splice}"<"' tokenizes `<<%' correctly (as `<<' `%') rather
+ than incorrrectly (as `<' `<%'). */
+ [^\"$%\'/<@\[\]\{\}]+|[$%/<@]|"<"{splice}"<" YY_OBS_GROW;
<<EOF>> {
complain_at (*yylloc, _("unexpected end of file in a braced code"));
<<EOF>> {
complain_at (*yylloc, _("unexpected end of file in a braced code"));