[prog] lex/yacc problem

Jimen Ching jching at flex.com
Wed May 28 09:14:01 EST 2003


On Wed, 28 May 2003, Almut Behrens wrote:
>do you hava a rule somewhere that handles the occurrence of whitespace, e.g.
>
><INITIAL>{WS}  { }
>
>in its most simple case (i.e. to ignore whitespace)?  If not, the lexer
>will pass the string " = " to the parser, instead of "=", as your yacc
>grammar expects.

I have the following two patterns in the lex specification:

WSs			{WS}+

<INITIAL>{NL}		{ cur_lineno++; }
<INITIAL>{WSs}		{ }

Note, these two patterns are at the top of the lexer specification (comes
before all other patterns).

--jc
-- 
Jimen Ching (WH6BRR)      jching at flex.com     wh6brr at uhm.ampr.org


More information about the Programming mailing list