Antlr parsing rule to parse string with matching braces

56 views
Skip to first unread message

subhara...@gmail.com

unread,
Jan 25, 2018, 9:04:53 AM1/25/18
to antlr-discussion
Crossposting from stackoverflow

I have a parser rule which looks like below

nested_query: ~(LPARAN | RPARAN)+? LPARAN nested_query RPARAN ~(LPARAN | RPARAN)+?
   
| nested_query nested_query_op LPARAN nested_query RPARAN
   
| ~(LPARAN | RPARAN)+?
   
;
nested_query_op
: binary_in | binary_not_in ;
binary_in
: 'in';
binary_not_in
: 'not' 'in';
LPARAN
: '(';
RPARAN
: ')';

This correctly matches the string list(srcVm) of flows where typeTag ="TAG_SRC_IP_VM" until timestamp

But when I try to parse a string having more than one matching brackets it does not get properly parsed for example list(srcVm) of flows where (typeTag ="TAG_SRC_IP_VM") until timestamp


Can someone let me know how can I modify the above rule to match a string with more than one matching braces under nested_query rule?


Reply all
Reply to author
Forward
0 new messages