implydata/plywood

Question about supporting escape in string parsing rule

0ctopus13prime opened this issue · 0 comments

Hi! expert!

I currently using plywood library to mediate query to druid broker.
Yesterday I met expression parse error, so I digged deeper inside plywood and I found below.

String "String"
= "'" chars:NotSQuote "'" _ { return chars; }
/ "'" chars:NotSQuote { error("Unmatched single quote"); }
/ '"' chars:NotDQuote '"' _ { return chars; }
/ '"' chars:NotDQuote { error("Unmatched double quote"); }

In my case construct plywood string expression using query from client like below.

const expressionStr = `$dim.in(['${val1}', '${val2}'])`

and one of the parameters was 'banana",
plywood expression would be $dim.in([''banana"']) or $dim.in(["'banana""]).
Unfortunately, neither of these was accepted.

By parsing rule, single quote string's last character must match. Either 'some' or "some".
For now I avoided this by directly using plywood.LiteralExpression, so no more exceptions thrown.

So, I wonder any plans to support escape rule.

Thanks
Best regard.