bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 6/6] scan-skel.l: change fail_for_invalid_at prototype


From: Akim Demaille
Subject: Re: [PATCH 6/6] scan-skel.l: change fail_for_invalid_at prototype
Date: Thu, 4 Oct 2012 15:39:04 +0200

Le 4 oct. 2012 à 12:35, Theophile Ranquet a écrit :

> It now has the same as at_ptr, so factor further.
> 
> * src/scan-skel.l (fail_for_invalid_at): Treat like at_directive functions.

Thanks.  Installed, and again, I made some changes:
the scanner suffices to catch invalid directives now,
there is no need to check it again downstream.

This change the patch is significantly different so
that I sign it myself.

commit 500d1bfa355493b1d35e72c6a13db5d9d3449730
Author: Akim Demaille <address@hidden>
Date:   Thu Oct 4 15:36:00 2012 +0200

    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 de85b4e..c3844f1 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);
 
address@hidden"("    at_init (&argc, argv, &at_ptr, &at_basename);
address@hidden"("    at_init (&argc, argv, &at_ptr, &at_complain);
address@hidden"("      at_init (&argc, argv, &at_ptr, &at_output);
address@hidden"("     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. */
address@hidden@{}`(\n]* fail_for_invalid_at (yytext);
-\n         out_lineno++; ECHO;
address@hidden    ECHO;
address@hidden@{}`(\n]*    fail_for_invalid_at (yytext);
+\n              out_lineno++; ECHO;
address@hidden         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;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]