summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authorVern Paxson <vern@ee.lbl.gov>1993-12-09 13:57:23 +0000
committerVern Paxson <vern@ee.lbl.gov>1993-12-09 13:57:23 +0000
commitd865c176c6e5bf6768dbc4577595cdfe20d0baab (patch)
tree8d57a18eb093f03ae9bad944f88d8423cbe69e57 /parse.y
parent5e755f3efe7ca80c5ffb9336933b97ea004f7ab9 (diff)
Fixed bug in treating '$' as variable trailing context
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y23
1 files changed, 9 insertions, 14 deletions
diff --git a/parse.y b/parse.y
index beb6e11..b3f517f 100644
--- 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 );