【发布时间】:2018-01-25 11:54:37
【问题描述】:
我有一个如下所示的解析器规则
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: ')';
这正确匹配字符串list(srcVm) of flows where typeTag ="TAG_SRC_IP_VM" until timestamp
但是当我尝试解析具有多个匹配括号的字符串时,它无法正确解析,例如 list(srcVm) of flows where (typeTag ="TAG_SRC_IP_VM") until timestamp
有人可以告诉我如何修改上述规则以匹配一个字符串,该字符串在nested_query 规则下具有多个匹配的大括号,如下所示
nested_query:1
|
---------------------------------------------------------
list ( nested_query:3 ) of flows where ( nested_query:4) until timestamp
| |
srcVM (typeTag ="TAG_SRC_IP_VM")
【问题讨论】:
-
您能否提供更多信息。 LPARAN/RPARAN/nested_query_op/...的定义是什么?
-
更新了问题。我错过了那些规则。感谢您指出这一点。