Skip to content

Conversation

@movitto
Copy link

@movitto movitto commented Jun 17, 2020

Right now the following expression will trip up the parser:

$..[(')]')]

The parser will encounter the ')]' inside the static string and use that as the end of the script expression & child-member-component. When it encounters the closing single-quote a lexical error will be thrown.

This patch removes the '?' constraining the character wildcard in the script and filter expression matcher so that we completely parse expressions to the end. It also adds a test for this edge case.

Note: this causes issues with multiple filter expressions such as:

$..[?('expr1')][?('expr2')]

The parser will now pickup the expression as everything between the first '[?(' and the last ')]', in this case the expression will be:

'expr1')][?('expr2'

Which will throw the expression evaluator off.

At the current time it is not aparent how to handle both cases w/ the current BNF based parser.

Right now the following expression will trip up the parser:

  $..[(')]')]

The parser will encounter the ')]' inside the static string
and use that as the end of the script expression &
child-member-component. When it encounters the closing
single-quote a lexical error will be thrown.

This patch removes the '?' constraining the character wildcard
in the script and filter expression matcher so that we completely
parse expressions to the end. It also adds a test for this edge
case.

Note: this causes issues with multiple filter expressions such as:

  $..[?('expr1')][?('expr2')]

The parser will now pickup the expression as everything between
the first '[?(' and the last ')]', in this case the expression
will be:

  'expr1')][?('expr2'

Which will throw the expression evaluator off.

At the current time it is not aparent how to handle both cases
w/ the current BNF based parser.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant