|how to handle lookahead in JLex? email@example.com (1998-10-24)|
|Re: how to handle lookahead in JLex? firstname.lastname@example.org (1998-10-30)|
|Re: how to handle lookahead in JLex? email@example.com (Chris F Clark) (1998-10-30)|
|Re: how to handle lookahead in JLex? firstname.lastname@example.org (Gerwin Klein) (1998-11-01)|
|From:||email@example.com (Jon Willeke)|
|Date:||30 Oct 1998 13:10:04 -0500|
JLex doesn't advertise support for lookahead, but I've found that the
generated lexer stores the next input character as yy_lookahead. This
is adequate for the posted example.
It is not, however, adequate for another case. Consider this line of
h 2 h
The first "h" is an abbreviated form of the "hang" command, which
takes an argument. The second is an abbreviated form of the "halt"
command, which does not. I need two characters of lookahead.
>I'm using JLex to write a lexer for M. I have a case that calls for
>lookahead, which JLex doesn't support. For example, consider this
>line of code:
> write $p($p,",")
>The first "$p" is an abbreviated form of the special function
>"$piece." The second "$p" is an abbreviated form of the special
>variable "$principal." I'd like the lexer to be smart enough to tell
>the difference, and it's easy with lookahead: functions are always
>followed by an open paren.
Jon Willeke <firstname.lastname@example.org>
Return to the
Search the comp.compilers archives again.