I'm using ANLTR4 in java and I could parse a WKT polygon string like this
polygon((20 30, 30 40, 50 60, 20 30))
with this Lexer:
POLYGON: ('polygon'|'POLYGON')'(('[0-9:,-.eTZ" ]+'))';
because the numbers inside polygon(( )) can be datetime or float then it contains some characters.
However, I couldn't parse a polygon with inner polygon like this
polygon((20 30, 30 40, 50 60, 20 30), (20 30, 30 40, 50 60, 20 30), (20 30, 30 40, 50 60, 20 30))
when I tried to add () in Lexer, e.g:
POLYGON: ('polygon'|'POLYGON')'(('[0-9:,-.eTZ" \(\)]+'))';
Java throws exception, cannot find ")" with .
What can I do to make ANTLR4 can parse polygon((), (), (), ...)?