[antlr-interest] Trouble with grammar

Alex Shneyderman a.shneyderman at gmail.com
Wed May 9 09:56:54 PDT 2007


I am testing out ANTLR3 and ran into a problem I do not understand;

here is a simple grammar:
grammar GSP;

gspTag
:
     '<' NS ':' TAG '>' TEXT '</' NS ':' TAG '>'
;

TEXT: (~'<')+;
NS:  (~':')+ ;
TAG: ('a'..'z'|'A'..'Z')+;

WS: (' '|'\t'|'\r'|'\n')+ {skip();} ;

On this input:

<g:test>adfas</g:test>

recognizer gives me the following messages:

line 1:0 mismatched input '<g' expecting '<'
line 1:2 mismatched input ':test>adfas' expecting ':'

anyone knows what is wrong here.


More information about the antlr-interest mailing list