[antlr-interest] Re: Lexer help
odzsoi
odzsoi at yahoo.com
Thu Apr 10 00:25:43 PDT 2003
So, the solution was to replace TEXT to
TEXT : ~('$') // First letter is not a dollar
( ~('$') // Not dollar
| '$'! '$' // Or two dollars
)*;
This way there is no conflict.
--- In antlr-interest at yahoogroups.com, "odzsoi" <odzsoi at y...> wrote:
> Hi,
>
> I would need your help to create a lexer for a simple templating language that would
> eat up everything that is not between two dollars ($), but replaces two dollars to a
> single dollar.
>
> For example:
> blabla$something$$$blabla$something2$bla$$bla
>
> should be lexed as (blabla) (something) ($blabla) (something2) (bla$bla).
>
> My lexer grammar is:
> TEXT : ( ~('$') // Not dollar
> | '$'! '$' // Or two dollars
> )+ ;
>
> DOLLAR : '$' ;
>
> AntLR says:
>
> warning: lexical nondeterminism between rules TEXT and DOLLAR upon
> template.g: k==1:'$'
> template.g: k==2:<end-of-token>
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list