I am trying to use antlr to parse a log file. Since I'm only interested in the partial part of the log, I only want to write a partial parser to process the important part.
for example: I want to analyze a segment:
[ 123 begin ]
So I wrote a grammar:
log : '[' INT 'begin' ']' ; INT : '0'..'9'+ ; NEWLINE : '\r'? '\n' ; WS : (' '|'\t')+ {skip();} ;
But the segment may appear in the middle of the line, for example:
111 [ 123 begin ] 222
According to the discussion: What happened to the simple ANTLR grammar? I know why my grammar cannot handle the above statement.
I want to know if there is a way to force antlr to ignore any error and continue to process the remaining text?
Thanks for any advice! Leon
source share