5/11/2010 11:37 AM keltezéssel, Terry Ma írta:
> hello, everyone.
>
> I want to parse the statement like following:
>
> any character<#if expression>  any character</#if>  any character
>
> I want to consume any character until find<#if ...>,
> and then consume any character until find next</#if>,
> and so on.
>
> can i use antlr to do this?
> i don't know how to write the grammar to parse the above statement.
>
>
> Terry.
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: 
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
>
>    
Do you mean something like this:

grammar if;


start_rule    : anythingbefore anythinguntilclosingif;

anythingbefore:  ( options {greedy=false;} : . )* '<#if';


anythinguntilclosingif
     :    ( options {greedy=false;} : . )* '</#if>';


Marton


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to