[antlr-interest] Simple ASP-like grammar

Terence Parr parrt at cs.usfca.edu
Wed Nov 30 09:36:36 PST 2005


On Nov 30, 2005, at 1:21 AM, Dimitrios Kolovos wrote:

> I have found a working solution in case someone faces the same  
> issue sometime later. Thanks for your replies!
>
> AnyTextBlock
>    :
>    (
>    '\0' .. '\u00FF'
>    {
>        if (LA(1) == '%' && LA(2) == ']'){
>            break;
>        }
>        else if (LA(1) == '[' && LA(2) == '%'){
>            break;
>        }
>    }
>    )+
>    ;


A quick note: you could put those conditions in a predicate:

( {...}? . )*

or some such.

Ter


More information about the antlr-interest mailing list