]> granicus.if.org Git - flex/commitdiff
Working checkpoint prior to adding <scon>{ stuff
authorVern Paxson <vern@ee.lbl.gov>
Sun, 26 Dec 1993 15:04:47 +0000 (15:04 +0000)
committerVern Paxson <vern@ee.lbl.gov>
Sun, 26 Dec 1993 15:04:47 +0000 (15:04 +0000)
parse.y

diff --git a/parse.y b/parse.y
index 9b5e9916ae38b8d84f0bff383d3fedd1af2f4477..596e3876631685bccb54e6a4ed0e8fc39808a974 100644 (file)
--- a/parse.y
+++ b/parse.y
@@ -60,7 +60,10 @@ char *alloca ();
 
 int pat, scnum, eps, headcnt, trailcnt, anyccl, lastchar, i, actvp, rulelen;
 int trlcontxt, xcluflg, cclsorted, varlength, variable_trail_rule;
-int *active_ss;
+
+int *actvsc, *active_ss, *scon_stk;
+int scon_stk_ptr, max_scon_stk;
+
 Char clower();
 void build_eof_action();
 void yyerror();
@@ -133,10 +136,15 @@ sect1end  :  SECTEND
                         * are, so create the "activity" map indicating
                         * which conditions are active.
                         */
+                       actvsc = allocate_integer_array( lastsc + 1 );
                        active_ss = allocate_integer_array( lastsc + 1 );
 
                        for ( i = 1; i <= lastsc; ++i )
                                active_ss[i] = 0;
+
+                       max_scon_stk = lastsc + 1;
+                       scon_stk = allocate_integer_array( max_scon_stk );
+                       scon_stk_ptr = 0;
                        }
                ;
 
@@ -158,7 +166,8 @@ namelist1   :  namelist1 NAME
                ;
 
 sect2          :  sect2 initforrule flexrule '\n'
-               |  sect2 '{' '\n' sect2 '}' '\n'
+               |  sect2 '\n' scons '{' sect2 '}'
+                       { scon_stk_ptr = $2; }
                |
                ;
 
@@ -169,6 +178,7 @@ initforrule :
                        trailcnt = headcnt = rulelen = 0;
                        current_state_type = STATE_NORMAL;
                        previous_continued_action = continued_action;
+                       in_rule = true;
                        new_rule();
                        }
                ;
@@ -265,6 +275,23 @@ flexrule   :  scon '^' rule
                        { synerr( "unrecognized rule" ); }
                ;
 
+scons          : scon
+                       {
+                       $$ = scon_stk_ptr;
+
+                       scon_stk_ptr += actvp;
+
+                       while ( scon_stk_ptr >= max_scon_stk )
+                               {
+                               max_scon_stk *= 2;
+                               scon_stk = reallocate_integer_array( scon_stk,
+                                               max_scon_stk );
+                               }
+
+                       for ( i = 1; i <= actvp; ++i )
+                               scon_stk[$$ + i] = actvsc[i];
+                       }
+
 scon           :  '<' namelist2 '>'
 
                |  '<' '*' '>'