From: Akim Demaille Date: Thu, 4 Oct 2012 13:36:00 +0000 (+0200) Subject: scan-skel: use the scanner to reject all invalid directives X-Git-Tag: v2.7.90~304 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/fc5618b3387fb1311c9d88187655191088f09cc2 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. --- 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; <> { 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;