If we have a parenthesized expression that has a start (no left-hand expression), parenthesis is not placed correctly when stringifying the AST.
Example:
const { parse, toString } = require('lucene')
toString(parse('my.prop:value1 AND (NOT _exists_:other.prop OR other.prop:value2)'))
// Result is -> "my.prop:value1 AND NOT (_exists_:other.prop OR other.prop:value2)"
At a glance, the fix should be simple. Check if parenthesized is set when concatenating start and make sure start is not set when adding an opening parenthesis for a parenthesized left-hand.
If we have a
parenthesized
expression that has astart
(no left-hand expression), parenthesis is not placed correctly when stringifying the AST.Example:
At a glance, the fix should be simple. Check if
parenthesized
is set when concatenatingstart
and make surestart
is not set when adding an opening parenthesis for aparenthesized
left-hand.