[antlr-interest] how to match '.' ?

John B. Brodie jbb at acm.org
Sat Dec 16 07:49:09 PST 2006


>Hi there,

Hi!

>i have the following rules:
>
>test	:	STRING ' ' PUNKTUATION ' ' STRING;
>
>PUNKTUATION
>	:	 '.'|','|'!'|'?'|':'|'\\'|'/'|'$'|';'|'"'|')'|'(';
>
>STRING	:	('a'..'z'|'A'..'Z'|'0'..'9'|'\.'|'-')+;
>
>
>
>this matches=20
>'hallo ( test', 'hallo ? test', 'hallo : test', etc ..
>
>but noch anything like=20
>'hallo . test' (or !,\,/," instead of . )=20

a grammar file containing just those 3 rules above works just fine for me.

maybe post the smallest *complete* example of your problem?

   -jbb


More information about the antlr-interest mailing list