This repository was archived by the owner on Jul 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 62
Confusion about parsing of "not" operatorΒ #51
Copy link
Copy link
Open
Description
Hi! In the following example I'd expect "not" to be a first-class member of the AST. But it appears to just be concatenated with the operator after it. This would imply I've got to then do string parsing of the operation field if I'm trying to discover "not" use:
> const { statement: [{ where: [where5] }] } = parser('select 1 where processName = \'/bin/sh\' and id not like \'foo\'');
undefined
> where5
{ type: 'expression',
format: 'binary',
variant: 'operation',
operation: 'and',
left:
{ type: 'expression',
format: 'binary',
variant: 'operation',
operation: '=',
left: { type: 'identifier', variant: 'column', name: 'processname' },
right: { type: 'literal', variant: 'text', value: '/bin/sh' } },
right:
{ type: 'expression',
format: 'binary',
variant: 'operation',
operation: 'not like',
right: { type: 'literal', variant: 'text', value: 'foo' },
left: { type: 'identifier', variant: 'column', name: 'id' } } }
Is this intentional? I'd expect the AST to look more like:
...
right:
{ type: 'expression',
format: 'unary',
variant: 'operation',
operation: 'not',
expression:
{ type: 'expression',
format: 'binary',
variant: 'operation',
operation: 'like',
right: { type: 'literal', variant: 'text', value: 'foo' },
left: { type: 'identifier', variant: 'column', name: 'id' } } } }
emilioplatzer
Metadata
Metadata
Assignees
Labels
No labels