char *cp, location_t location);
static void handle_syncline (char *args, location_t *location);
static int convert_ucn_to_byte (char const *hex_text);
-static void unexpected_end_of_file (location_t, char const *);
+static void unexpected_end_of_file (location_t *, char const *);
%}
%x SC_COMMENT SC_LINE_COMMENT SC_YACC_COMMENT
}
.|\n ;
- <<EOF>> unexpected_end_of_file (*yylloc, "*/");
+ <<EOF>> unexpected_end_of_file (yylloc, "*/");
}
<SC_COMMENT>
{
"*"{splice}"/" YY_OBS_GROW; BEGIN c_context;
- <<EOF>> unexpected_end_of_file (*yylloc, "*/");
+ <<EOF>> unexpected_end_of_file (yylloc, "*/");
}
}
.|\n YY_OBS_GROW;
- <<EOF>> unexpected_end_of_file (*yylloc, "\"");
+ <<EOF>> unexpected_end_of_file (yylloc, "\"");
}
/*---------------------------------------------------------------.
}
.|\n YY_OBS_GROW;
- <<EOF>> unexpected_end_of_file (*yylloc, "'");
+ <<EOF>> unexpected_end_of_file (yylloc, "'");
}
<SC_CHARACTER>
{
- "'" YY_OBS_GROW; BEGIN c_context;
- \\{splice}[^\[\]] YY_OBS_GROW;
- {splice} YY_OBS_GROW;
- <<EOF>> unexpected_end_of_file (*yylloc, "'");
+ "'" YY_OBS_GROW; BEGIN c_context;
+ \\{splice}[\'\\] YY_OBS_GROW;
+ <<EOF>> unexpected_end_of_file (yylloc, "'");
}
<SC_STRING>
{
- "\"" YY_OBS_GROW; BEGIN c_context;
- \\{splice}[^\[\]] YY_OBS_GROW;
- {splice} YY_OBS_GROW;
- <<EOF>> unexpected_end_of_file (*yylloc, "\"");
+ "\"" YY_OBS_GROW; BEGIN c_context;
+ \\{splice}[\"\\] YY_OBS_GROW;
+ <<EOF>> unexpected_end_of_file (yylloc, "\"");
}
"@"(-?[0-9]+|"$") { handle_at (current_braced_code,
yytext, *yylloc); }
- <<EOF>> unexpected_end_of_file (*yylloc, "}");
+ <<EOF>> unexpected_end_of_file (yylloc, "}");
}
return PROLOGUE;
}
- <<EOF>> unexpected_end_of_file (*yylloc, "%}");
+ <<EOF>> unexpected_end_of_file (yylloc, "%}");
}
<SC_COMMENT,SC_LINE_COMMENT,SC_STRING,SC_CHARACTER,SC_BRACED_CODE,SC_PROLOGUE,SC_EPILOGUE>
{
- \[ obstack_sgrow (&string_obstack, "@<:@");
- \] obstack_sgrow (&string_obstack, "@:>@");
+ \$ obstack_sgrow (&string_obstack, "$][");
+ \@ obstack_sgrow (&string_obstack, "@@");
+ \[ obstack_sgrow (&string_obstack, "@{");
+ \] obstack_sgrow (&string_obstack, "@}");
.|\n YY_OBS_GROW;
}
`-------------------------------------------------------------*/
static void
-unexpected_end_of_file (location_t loc, char const *token_end)
+unexpected_end_of_file (location_t *loc, char const *token_end)
{
- size_t i;
+ size_t i = strlen (token_end);
- complain_at (loc, _("missing `%s' at end of file"), token_end);
- for (i = strlen (token_end); i != 0; i--)
- unput (token_end[i - 1]);
+ complain_at (*loc, _("missing `%s' at end of file"), token_end);
+
+ /* Adjust location's last column so that any later message does not
+ mention the characters just inserted. */
+ loc->last_column -= i;
+
+ while (i != 0)
+ unput (token_end[--i]);
}