Re: [Flex-help] Using empty string as pattern
flex is a tool for generating scanners
Brought to you by:
wlestes
From: Erik S. <man...@gm...> - 2006-08-24 06:48:00
|
On Wednesday 16 August 2006 10:36, Edsko de Vries wrote: > On Wed, Aug 16, 2006 at 09:13:29AM +0200, Erik Sandberg wrote: > > Hi, > > > > I'd like to use the empty string as a pattern in flex. I have tried a > You could do something like > > <newarg>(.|\n) yyless(0); pop the stack; return a token; Thanks! Something similar solves my problem: When the lexer encounters a function of arity 2, it expands it to three tokens using your technique: FUNCTION EXPECT_ARG EXPECT_ARG Then bison's rule for argument list looks like arg_list: /*empty*/ | EXPECT_ARG arg_list argument; That way, I can create functions of any arity, without argument separators. Thanks for your help! -- Erik |