gawk-diffs
[Top][All Lists]
Advanced

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

[SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4407-g24595f47


From: Arnold Robbins
Subject: [SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4407-g24595f47
Date: Fri, 3 Jun 2022 05:16:44 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, gawk-5.1-stable has been updated
       via  24595f4703988fa7b797438a97121b72d08f302a (commit)
      from  09eaaaf6608e63813087fb746d2bf2b1701d9e81 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=24595f4703988fa7b797438a97121b72d08f302a

commit 24595f4703988fa7b797438a97121b72d08f302a
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Fri Jun 3 12:16:27 2022 +0300

    Update dfa.

diff --git a/support/ChangeLog b/support/ChangeLog
index b422af16..94c37434 100644
--- a/support/ChangeLog
+++ b/support/ChangeLog
@@ -1,3 +1,7 @@
+2022-06-03         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * dfa.c, dfa.h: Sync with GNULIB.
+
 2022-05-23         Arnold D. Robbins     <arnold@skeeve.com>
 
        * cdefs.h, dfa.c, dfa.h, libc-config.h: Sync with GNULIB.
diff --git a/support/dfa.c b/support/dfa.c
index 5d92b38b..bd4c5f05 100644
--- a/support/dfa.c
+++ b/support/dfa.c
@@ -1311,17 +1311,25 @@ lex (struct dfa *dfa)
             goto default_case;
           if (backslash != ((dfa->syntax.syntax_bits & RE_BK_PLUS_QM) != 0))
             goto normal_char;
-          if (!(dfa->syntax.syntax_bits & RE_CONTEXT_INDEP_OPS)
-              && dfa->lex.laststart)
-            goto normal_char;
+          if (dfa->lex.laststart)
+            {
+              if (!(dfa->syntax.syntax_bits & RE_CONTEXT_INDEP_OPS))
+                goto default_case;
+              if (dfa->syntax.dfaopts & DFA_PLUS_WARN)
+                dfawarn (_("? at start of expression"));
+            }
           return dfa->lex.lasttok = QMARK;
 
         case '*':
           if (backslash)
             goto normal_char;
-          if (!(dfa->syntax.syntax_bits & RE_CONTEXT_INDEP_OPS)
-              && dfa->lex.laststart)
-            goto normal_char;
+          if (dfa->lex.laststart)
+            {
+              if (!(dfa->syntax.syntax_bits & RE_CONTEXT_INDEP_OPS))
+                goto default_case;
+              if (dfa->syntax.dfaopts & DFA_STAR_WARN)
+                dfawarn (_("* at start of expression"));
+            }
           return dfa->lex.lasttok = STAR;
 
         case '+':
@@ -1329,9 +1337,13 @@ lex (struct dfa *dfa)
             goto default_case;
           if (backslash != ((dfa->syntax.syntax_bits & RE_BK_PLUS_QM) != 0))
             goto normal_char;
-          if (!(dfa->syntax.syntax_bits & RE_CONTEXT_INDEP_OPS)
-              && dfa->lex.laststart)
-            goto normal_char;
+          if (dfa->lex.laststart)
+            {
+              if (!(dfa->syntax.syntax_bits & RE_CONTEXT_INDEP_OPS))
+                goto default_case;
+              if (dfa->syntax.dfaopts & DFA_PLUS_WARN)
+                dfawarn (_("+ at start of expression"));
+            }
           return dfa->lex.lasttok = PLUS;
 
         case '{':
@@ -1339,9 +1351,6 @@ lex (struct dfa *dfa)
             goto default_case;
           if (backslash != ((dfa->syntax.syntax_bits & RE_NO_BK_BRACES) == 0))
             goto normal_char;
-          if (!(dfa->syntax.syntax_bits & RE_CONTEXT_INDEP_OPS)
-              && dfa->lex.laststart)
-            goto normal_char;
 
           /* Cases:
              {M} - exact count
@@ -1374,16 +1383,24 @@ lex (struct dfa *dfa)
                                   dfa->lex.maxrep * 10 + *p - '0'));
                   }
               }
-            if (! ((! backslash || (p != lim && *p++ == '\\'))
+            bool invalid_content
+              = ! ((! backslash || (p != lim && *p++ == '\\'))
                    && p != lim && *p++ == '}'
                    && 0 <= dfa->lex.minrep
                    && (dfa->lex.maxrep < 0
-                       || dfa->lex.minrep <= dfa->lex.maxrep)))
+                       || dfa->lex.minrep <= dfa->lex.maxrep));
+            if (invalid_content
+                && (dfa->syntax.syntax_bits & RE_INVALID_INTERVAL_ORD))
+              goto normal_char;
+            if (dfa->lex.laststart)
               {
-                if (dfa->syntax.syntax_bits & RE_INVALID_INTERVAL_ORD)
-                  goto normal_char;
-                dfaerror (_("invalid content of \\{\\}"));
+                if (!(dfa->syntax.syntax_bits & RE_CONTEXT_INDEP_OPS))
+                  goto default_case;
+                if (dfa->syntax.dfaopts & DFA_PLUS_WARN)
+                  dfawarn (_("{...} at start of expression"));
               }
+            if (invalid_content)
+              dfaerror (_("invalid content of \\{\\}"));
             if (RE_DUP_MAX < dfa->lex.maxrep)
               dfaerror (_("regular expression too big"));
             dfa->lex.ptr = p;
diff --git a/support/dfa.h b/support/dfa.h
index 8674929e..91ec1d80 100644
--- a/support/dfa.h
+++ b/support/dfa.h
@@ -81,6 +81,14 @@ enum
 
     /* Warn about stray backslashes before ordinary characters.  */
     DFA_STRAY_BACKSLASH_WARN = 1 << 3,
+
+    /* Warn about * appearing out of context at the start of an
+       expression or subexpression.  */
+    DFA_STAR_WARN = 1 << 4,
+
+    /* Warn about +, ?, {...} appearing out of context at the start of
+       an expression or subexpression.  */
+    DFA_PLUS_WARN = 1 << 5,
   };
 
 /* Initialize or reinitialize a DFA.  The arguments are:

-----------------------------------------------------------------------

Summary of changes:
 support/ChangeLog |  4 ++++
 support/dfa.c     | 51 ++++++++++++++++++++++++++++++++++-----------------
 support/dfa.h     |  8 ++++++++
 3 files changed, 46 insertions(+), 17 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

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