Enable 'greedy' regex to capture entire script/filter expression #142
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.