[antlr-interest] disable warnings in v3?

Kay Roepke kroepke at classdump.org
Mon Jan 8 20:02:51 PST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Fabian!

On 9. Jan 2007, at 1:35 , fhaupt at informatik.uni-wuerzburg.de wrote:

> There is a keyword <verbatim> </verbatim> in twiki in between which  
> nothing should be interpreted.
>
> So I tried to use the rule:
>
> verbatim: '<verbatim>' .* '</verbatim>'
> however, now antlr complains a lot about ambiguity there. I see the  
> point, that .* matches everything even my tags somewhere
> else, but in here that doesn't matter.
>
> Is there a way to temporarily disable every matching besides the
> '</verbatim>'- endtag? Or to disable the warnings at least?

Indeed there is:

Assuming you are using v3, change that rule to

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

ANTLR matches greedily by default, so the ambiguities reported are  
between the .* loop
and the characters of the '</verbatim>' string.

That should do the trick, the same thing is normally done for  
comments :)

HTH,
- -k
- --
Kay Röpke
http://classdump.org/




-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)

iD8DBQFFoxPwfhv+DUzSptARAnZ5AJwJR5fTinxAoh2kn2mIIvepPSXHRgCfdfvT
J6oAI+2snIbQM+KI62N6/3c=
=IRXX
-----END PGP SIGNATURE-----


More information about the antlr-interest mailing list