grammar WhereableClause
rule expression disjunction end rule disjunction conjunction opt:( _sp? 'or'i _sp? conjunction )* <Disjunction> end rule conjunction term opt:( _sp? 'and'i _sp? term )* <Conjunction> end rule term condition / condition_between / condition_in / '(' _sp? expression _sp? ')' <NestedExpression> end rule condition column _sp? operator _sp? literal <Condition> end rule condition_between column _sp 'between'i _sp left:literal _sp 'and'i _sp right:literal <ConditionBetween> end rule condition_in column _sp 'in'i _sp? '(' _sp? literal _sp? opt:( ',' _sp? literal _sp? )* ')' <ConditionIn> end rule _sp [\s]+ end rule column [a-zA-Z0-9_]+ <Column> end rule operator ( 'eq'i &_sp / 'ne'i &_sp / 'gte'i &_sp / 'gt'i &_sp / 'lte'i &_sp / 'lt'i &_sp / '=' / '!=' / '<>' / '>=' / '>' / '<=' / '<' ) <Operator> end rule literal ( '"' ( '\"' / [^"] )+ '"' / "'" ( "''" / "\\'" / [^'] )+ "'" / [^\s,)]+ ) <Literal> end
end