我实际上只是在提取一部分T-SQL语法(https://github.com/antlr/grammars-v4)。具体来说,处理WHERE
子句的部分减去任何子查询逻辑。不幸的是,
expression
: primitive_expression
| function_call
| expression COLLATE id
| case_expression
| full_column_name
| bracket_expression
| unary_operator_expression
| expression op=(ASTERSIK | SLASH_F | P_SIGN) expression
| expression op=(PLUS | HYPHEN | AMPERSAND | CARET | PIPE | (PIPE PIPE)) expression
| expression comparison_operator expression
| expression assignment_operator expression
| over_clause
;
本身是左递归的。我不确定为什么会出现错误,而整个项目却没有。