[antlr-interest] newbie grammar questions

Terence Parr parrt at jguru.com
Thu Jan 17 10:43:45 PST 2002


On Wednesday, January 16, 2002, at 12:32  PM, tblanchard2 wrote:
> My case in particular is with JSP pages.  They are a bunch of HTML
> stuff with a few tags that look like <% javaCode %>.
>
> There's a simple case.
>
> If I make a rule like
>
> scriptlet : "<%" stuff "%>" ;
>
> the whole file might be
>
> file : ( (stuff)? (scriptlet) (stuff)? | (stuff) ) !EOF ;
>
> maybe?

That approach should work with the only wrinkle being that stuff is 
probably a token that is "anything but <%...%>".  I swear there is an 
example somewhere where I do this "match CTEXT" properly.  Hmm....

Ter
--
Chief Scientist & Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list