More specialized Node subclasses
sad-spirit opened this issue · comments
There were quite a lot corners cut when implementing Parser
, so it ended up generating fewer subclasses of Node
than reasonable.
The most obvious example is OperatorExpression
class that accepts any string as an operator and any Expression
s as operands. Fixing this will require at least implementing
- a
QualifiedOperator
node that will representoperator(namespace.###)
construct - an
IsExpression
node representingfoo IS [NOT] SOMETHING
, obviously it will have only left argument - an
IsDistinctExpression
node forfoo IS [NOT] DISTINCT FROM bar
- a
NotExpression
node for 'NOT something`, with only right argument - an
OverlapsExpression
node allowing onlyRowExpression
s as arguments - an
AtTimeZoneExpression
with only left argument
after that OperatorExpression
may be changed to check that its operator is either a Token
of applicable type or an instance of QualifiedOperator
Also move associativity and precedence constants from SqlBuilderWalker
to ScalarExpression
(and SetOpSelect
), define getAssociativity()
and getPrecedence()
in ScalarExpression
and implement in relevant nodes.
This will prevent errors when new nodes are added to support new syntax, see e.g. commit 1c9036b