Handle shorthand syntax in explanations #116
Merged
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.
When performing a performance test on https://github.com/kddnewton/syntax_tree/blob/50f9fc1b815156bdde53f13d4f250d9522f15e64/test/syntax_tree_test.rb I noticed a strange output. The explain syntax indicated that it was missing a bracket when I had only deleted an
end
:The cause was this line:
With the
%w[]
syntax the lexer tokenizes%w[
which (since it doesn't match[
is not counted.This commit corrects that logic by explicitly looking for the last character of these events.