-
Notifications
You must be signed in to change notification settings - Fork 755
[elpi] matching parens of same color + nested quotations #2651
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
Conversation
|
Good catch. Would you mind adding an example for this? Previously apparently the first parentheses was matched as whitespace. |
|
Please run CI |
pygments/lexers/elpi.py
Outdated
| (r"\s", Text.Whitespace), | ||
| (r"(lp:)({})".format("{{"), bygroups(Number, Punctuation), 'elpi-quote-exit'), | ||
| (r"(lp:)((?=[A-Z_]){})".format(constant_re), bygroups(Number, Name.Variable)), | ||
| (r".", Text), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also .+, otherwise you get one match per character (see your output - you want multiple consecutive characters to match?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a good idea! Nonetheless, .+ is overly aggressive, as I don't intend to capture all characters up to the next \n.
I can opt for a more nuanced approach, drawing inspiration from .+ but employing negative lookahead.
|
Please run ci |
|
Looks good to me |
|
Thanks! |
Original (matching parens of different color)

Fixed

Original (nested quotations):

Fixed:

CC @gares