help-flex
[Top][All Lists]
Advanced

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

yy_more_len: flex 2.4.25


From: Bojan Smojver
Subject: yy_more_len: flex 2.4.25
Date: 18 Dec 2002 09:15:30 +1100

When using yylineno option with the reentrant scanner, the generated
scanner file includes this code:

------------------------------------------
#ifdef YY_USE_LINENO
  if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act]
  {
     int yyl;
       for ( yyl = yy_more_len; yyl < yyleng; ++yyl )
         if ( yytext[yyl] == '\n' )
         ++yylineno;
  }
#endif
-----------------------------------------

This causes gcc to complain:

scanner.c: In function `spin_lex':
scanner.c:1450: `yy_more_len' undeclared (first use in this function)
scanner.c:1450: (Each undeclared identifier is reported only once
scanner.c:1450: for each function it appears in.)

I think this code should be:

-----------------------------------------
#ifdef YY_USE_LINENO
  if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act]
  {
     int yyl;
       for ( yyl = YY_G(yy_more_len); yyl < yyleng; ++yyl )
         if ( yytext[yyl] == '\n' )
         ++yylineno;
  }
#endif
-----------------------------------------

When I changed the generated scanner to use YY_G(yy_more_len), gcc quite
happily compiled and linked my scanner. The scanner also worked OK as
far as yylineno is concerned.

-- 
Bojan




reply via email to

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