summaryrefslogtreecommitdiff
path: root/gen.c
diff options
context:
space:
mode:
authorVern Paxson <vern@ee.lbl.gov>1993-11-26 15:08:34 +0000
committerVern Paxson <vern@ee.lbl.gov>1993-11-26 15:08:34 +0000
commite0636c8ad09f2152137cf77f2e64528218b566c1 (patch)
tree74c247960bf1ddd68aef99927c459aa73e425eec /gen.c
parent7438e63861cb1317977fc1f6fea29589a3276539 (diff)
-l lex compatibility flag
Diffstat (limited to 'gen.c')
-rw-r--r--gen.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gen.c b/gen.c
index d4d6c06..1c47e0a 100644
--- a/gen.c
+++ b/gen.c
@@ -1255,6 +1255,24 @@ void make_tables()
gen_find_action();
skelout();
+ if ( lex_compat )
+ {
+ indent_puts( "if ( yy_act != YY_END_OF_BUFFER )" );
+ indent_up();
+ indent_puts( "{" );
+ indent_puts( "int yyl;" );
+ indent_puts( "for ( yyl = 0; yyl < yyleng; ++yyl )" );
+ indent_up();
+ indent_puts( "if ( yytext[yyl] == '\\n' )" );
+ indent_up();
+ indent_puts( "++yylineno;" );
+ indent_down();
+ indent_down();
+ indent_puts( "}" );
+ indent_down();
+ }
+
+ skelout();
if ( ddebug )
{
indent_puts( "if ( yy_flex_debug )" );
@@ -1367,6 +1385,15 @@ void make_tables()
gen_NUL_trans();
skelout();
+ if ( lex_compat )
+ { /* update yylineno inside of unput() */
+ indent_puts( "if ( c == '\\n' )" );
+ indent_up();
+ indent_puts( "--yylineno;" );
+ indent_down();
+ }
+
+ skelout();
/* Copy remainder of input to output. */