]> granicus.if.org Git - flex/commitdiff
Fixed bug in treating '$' as variable trailing context
authorVern Paxson <vern@ee.lbl.gov>
Thu, 9 Dec 1993 13:57:23 +0000 (13:57 +0000)
committerVern Paxson <vern@ee.lbl.gov>
Thu, 9 Dec 1993 13:57:23 +0000 (13:57 +0000)
parse.y

diff --git a/parse.y b/parse.y
index beb6e112bee1124a3f89615275f9c0ee638d06ce..b3f517faa150cd587d2cd63a9c8c25f7a791873b 100644 (file)
--- a/parse.y
+++ b/parse.y
@@ -364,6 +364,13 @@ rule               :  re2 re
 
                |  re '$'
                        {
+                       headcnt = 0;
+                       trailcnt = 1;
+                       rulelen = 1;
+                       varlength = false;
+
+                       current_state_type = STATE_TRAILING_CONTEXT;
+
                        if ( trlcontxt )
                                {
                                synerr( "trailing context used twice" );
@@ -375,16 +382,13 @@ rule              :  re2 re
                                /* See the comment in the rule for "re2 re"
                                 * above.
                                 */
-                               if ( ! varlength || headcnt != 0 )
-                                       warn(
+                               warn(
                "trailing context made variable due to preceding '|' action" );
 
-                               /* Mark as variable. */
                                varlength = true;
-                               headcnt = 0;
                                }
 
-                       if ( lex_compat || (varlength && headcnt == 0) )
+                       if ( lex_compat || varlength )
                                {
                                /* Again, see the comment in the rule for
                                 * "re2 re" above.
@@ -394,15 +398,6 @@ rule               :  re2 re
                                variable_trail_rule = true;
                                }
 
-                       else
-                               {
-                               if ( ! varlength )
-                                       headcnt = rulelen;
-
-                               ++rulelen;
-                               trailcnt = 1;
-                               }
-
                        trlcontxt = true;
 
                        eps = mkstate( SYM_EPSILON );