-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C-like: Made all comments greedy #2680
Merged
RunDevelopment
merged 1 commit into
PrismJS:master
from
RunDevelopment:c-like-non-greedy-comment
Dec 30, 2020
Merged
C-like: Made all comments greedy #2680
RunDevelopment
merged 1 commit into
PrismJS:master
from
RunDevelopment:c-like-non-greedy-comment
Dec 30, 2020
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mAAdhaTTah
approved these changes
Dec 30, 2020
@RunDevelopment I'm good to release a new version later this evening. Is there anything else you want to get merged for it? |
Nope. All other PRs need further work and/or offer little immediate benefit to our users. I'll make you the changelog. |
This was referenced Mar 6, 2021
This was referenced Mar 16, 2021
This was referenced Dec 3, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This fixes #2679.
The problem was that multiline comments in C-like weren't greedy. This usually isn't a problem because a non-greedy first grammar rule behaves amlost as if it was greedy with one exception: greedy rematching.
Basically, previously matched tokens have to be overwritten by greedy tokens but non-greedy tokens can't do that. This then results in the token stream seen in #2679:
I also had to make a minor adjustment to Coffeescript because the tests failed. The problem there was that the
delimiter
token was matched beforecomment
which meant that the lookbehind group of the comment pattern didn't accept. This is a general problem with greedy rules and lookbehinds that cannot be fixed without ES2018 lookbehinds (#1708).