First of all, i am new to ANTLR. What i am asking may be trivial for the rest of you guys, but i need your help.
I want to match all the qualified names within a stream, and ignore the rest of the characters from the stream.
I tried the following:
findAllQualifiedNames
: qualifiedName+
;
qualifiedName
: IDENTIFIER
('.' IDENTIFIER)*
;
IDENTIFIER
: ('_'
| '$'
| ('a'..'z' | 'A'..'Z'))
('a'..'z' | 'A'..'Z' | '0'..'9' | '_' | '$')*
;
AnyOtherChar
: .
{$channel=HIDDEN;}
;
But it doesn't work the way i expected: for the input a.b.c;d.e.f;
, it matches only a.b.c
as a qualified name. And i get the error:
No viable alternative at ;
EDIT:
For the grammar above, i tried the following input: a.b.c; d.e.f; .. {x.y;}
I expected to match a.b.c, d.e.f
and x.y
, but i get the following: