[antlr-interest] Catch all rule and warnings

Hill, Robert rhill03 at eds.com
Wed Dec 13 05:31:56 PST 2006

Maybe this is another case for an island grammer?

I believe Ter put an example somewhere in the Antlr Distribution.



Robert Hill
Information Engineer
Agile Alliance Member
UKIMEA DWP ACU, Hallamshire Business Park, 100 Napier St, Sheffield. S11
email:	rhill03 at eds.com
Office:	+44 114 291 1928
Mobile:	+44 7903 185 516


>-----Original Message-----
>From: antlr-interest-bounces at antlr.org 
>[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Andrei Vereha
>Sent: 13 December 2006 09:36
>To: antlr-interest at antlr.org
>Subject: [antlr-interest] Catch all rule and warnings
>I have a question about warnings.
>I took the "HTML Indexer" from Gramar list section. When I 
>generate the source with antlr, I get 3 warnings. Is a way to 
>avoid these warnings?
>I have have a similar problem to solve:  I need to look for a 
>lot of "custom" tags in a html file + the html content(I can't 
>ignore the HTML content !). If I use this aproach, I will get  
>more and more warnings. This is the only solution?
>In a simple case, (a JSP file), where I need to recognize just 
>the "<%" and "%>" tag, TEXT_BETWEEN_TAGS and TEXT(text outside 
>tags), I made a gramar without warnings, by writing a catch 
>all rule like this:
>JSPSTART:"<%" {this.in_jsp=true };
>JSPEND:"%>" {this.in_jsp=false };
>TEXT options{testLiterals=true} : (~( '<' |  '>' | '%'))+ {
> if(this.in_jsp) $setType(TEXT_BETWEEN_TAGS); };
>In a more complex case, where I need to regonize : <TAG1>, 
><TAG2>, the TEXT rule will be imposible to write.
>Do you have any suggestions?
>Thank you,
> Andrei

More information about the antlr-interest mailing list