diff options
author | Akim Demaille <akim@lrde.epita.fr> | 2012-10-04 15:36:00 +0200 |
---|---|---|
committer | Akim Demaille <akim@lrde.epita.fr> | 2012-10-04 17:13:38 +0200 |
commit | fc5618b3387fb1311c9d88187655191088f09cc2 (patch) | |
tree | 8e98eb2198aa6646c547b6df235872a923c380b1 /src/scan-skel.l | |
parent | 92f39ba6dc740ac1f9597e256014ae8740b0477d (diff) | |
download | bison-fc5618b3387fb1311c9d88187655191088f09cc2.tar.gz |
scan-skel: use the scanner to reject all invalid directives
* src/scan-skel.l: Use a simpler and more consistent pattern escaping
scheme.
Catch all the invalid directives here by just removing the previous
catch-all-but-alphabetical rule.
Diffstat (limited to 'src/scan-skel.l')
-rw-r--r-- | src/scan-skel.l | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/scan-skel.l b/src/scan-skel.l index de85b4e0..c3844f13 100644 --- a/src/scan-skel.l +++ b/src/scan-skel.l @@ -78,15 +78,14 @@ static void fail_for_invalid_at (char const *at); "@oline@" fprintf (yyout, "%d", out_lineno + 1); "@ofile@" fputs (quotearg_style (c_quoting_style, out_name), yyout); -@basename"(" at_init (&argc, argv, &at_ptr, &at_basename); -@complain"(" at_init (&argc, argv, &at_ptr, &at_complain); -@output"(" at_init (&argc, argv, &at_ptr, &at_output); -@[a-z_]+"(" at_init (&argc, argv, &at_ptr, NULL); +"@basename(" at_init (&argc, argv, &at_ptr, &at_basename); +"@complain(" at_init (&argc, argv, &at_ptr, &at_complain); +"@output(" at_init (&argc, argv, &at_ptr, &at_output); /* This pattern must not match more than the previous @ patterns. */ -@[^@{}`(\n]* fail_for_invalid_at (yytext); -\n out_lineno++; ECHO; -[^@\n]+ ECHO; +@[^@{}`(\n]* fail_for_invalid_at (yytext); +\n out_lineno++; ECHO; +[^@\n]+ ECHO; <INITIAL><<EOF>> { if (out_name) @@ -118,11 +117,8 @@ static void fail_for_invalid_at (char const *at); BEGIN SC_AT_DIRECTIVE_SKIP_WS; else { - if (at_ptr) - at_ptr (argc, argv, &out_name, &out_lineno); - else - fail_for_invalid_at (argv[0]); - + aver (at_ptr); + at_ptr (argc, argv, &out_name, &out_lineno); obstack_free (&obstack_for_string, argv[0]); argc = 0; BEGIN INITIAL; |