texinfo-commits
[Top][All Lists]
Advanced

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

[7513] parsetexi values


From: gavinsmith0123
Subject: [7513] parsetexi values
Date: Thu, 17 Nov 2016 18:47:42 +0000 (UTC)

Revision: 7513
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7513
Author:   gavin
Date:     2016-11-17 18:47:42 +0000 (Thu, 17 Nov 2016)
Log Message:
-----------
parsetexi values

Modified Paths:
--------------
    trunk/tp/parsetexi/end_line.c
    trunk/tp/parsetexi/parser.c

Modified: trunk/tp/parsetexi/end_line.c
===================================================================
--- trunk/tp/parsetexi/end_line.c       2016-11-15 18:49:01 UTC (rev 7512)
+++ trunk/tp/parsetexi/end_line.c       2016-11-17 18:47:42 UTC (rev 7513)
@@ -152,14 +152,6 @@
     {
     case CM_set:
       {
-        
-        /* Check if the line matches the Perl regular expression
-
-        /^\s+([\w\-][^\s{\\}~`\^+"<>|@]*)
-        (\@(c|comment)((\@|\s+).*)?|[^\S\f]+(.*?))?[^\S\f]*$/
-
-          */
-
       p = line;
       p += strspn (p, whitespace_chars);
       if (!*p)
@@ -170,16 +162,25 @@
                    " \t\f\r\n"       /* whitespace */
                    "{\\}~^+\"<>|@"); /* other bytes that aren't allowed */
 
+      r = skip_comment (p);
+
+      if (!strchr (whitespace_chars, *q) && *q != '@')
+        goto set_invalid;
+
+      if (*q == '@')
+        {
+          /* Check for a comment, e.g. "@set address@hidden comment" */
+          if (q != r)
+            goto set_invalid;
+        }
+
       ADD_ARG(p, q - p); /* name */
 
-
       p = q + strspn (q, whitespace_chars);
       /* Actually, whitespace characters except form feed. */
 
-      q = skip_comment (p);
-
-      if (q >= p)
-        ADD_ARG(p, q - p); /* value */
+      if (r >= p)
+        ADD_ARG(p, r - p); /* value */
       else
         ADD_ARG("", 0);
 

Modified: trunk/tp/parsetexi/parser.c
===================================================================
--- trunk/tp/parsetexi/parser.c 2016-11-15 18:49:01 UTC (rev 7512)
+++ trunk/tp/parsetexi/parser.c 2016-11-17 18:47:42 UTC (rev 7513)
@@ -368,6 +368,7 @@
       && (last_child->text.space > 0
             && !strchr (last_child->text.text, '\n')
              ) //|| last_child->type == ET_empty_spaces_before_argument)
+      && last_child->cmd != CM_value
       && !no_merge_with_following_text)
     {
       /* Append text to contents */
@@ -1188,7 +1189,10 @@
 
           line++;
           if (!isalnum (*line) && *line != '-' && *line != '_')
-            goto value_invalid;
+            {
+              line--;
+              goto value_invalid;
+            }
           arg_start = line;
 
           line++;
@@ -1196,7 +1200,10 @@
                    " \t\f\r\n"       /* whitespace */
                    "{\\}~^+\"<>|@"); /* other bytes that aren't allowed */
           if (*line != '}')
-            goto value_invalid;
+            {
+              line = arg_start - 1;
+              goto value_invalid;
+            }
 
           if (1) /* @value syntax is valid */
             {
@@ -1211,8 +1218,8 @@
                      in undefined values. */
                   ELEMENT *value_elt;
 
-                  line_error ("undefined flag: %.*s", line - arg_start, 
-                               arg_start);
+                  line_warn ("undefined flag: %.*s", line - arg_start, 
+                             arg_start);
 
                   abort_empty_line (&current, NULL);
                   value_elt = new_element (ET_NONE);
@@ -1226,9 +1233,6 @@
 
                   add_to_element_contents (current, value_elt);
 
-                  /* Prevent merging with following.  TODO: Check why
-                     this happens in the first place. */
-                  add_to_element_contents (current, new_element (ET_NONE));
                   line++; /* past '}' */
                   retval = STILL_MORE_TO_PROCESS;
                 }
@@ -1246,6 +1250,8 @@
             {
 value_invalid:
               line_error ("bad syntax for @value");
+              retval = STILL_MORE_TO_PROCESS;
+              goto funexit;
             }
         }
 




reply via email to

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