Skip to content

Conversation

@FissoreD
Copy link
Contributor

@FissoreD FissoreD commented Feb 20, 2024

Original (matching parens of different color)
image

Fixed
image

Original (nested quotations):
image

Fixed:
image

CC @gares

@Anteru
Copy link
Collaborator

Anteru commented Mar 26, 2024

Good catch. Would you mind adding an example for this? Previously apparently the first parentheses was matched as whitespace.

@Anteru Anteru self-assigned this Mar 26, 2024
@Anteru Anteru added the A-lexing area: changes to individual lexers label Mar 26, 2024
@Anteru Anteru added this to the 2.18.0 milestone Mar 26, 2024
@FissoreD FissoreD changed the title [elpi] matching parens of same color [elpi] matching parens of same color + nested quotations Mar 26, 2024
@gares
Copy link
Contributor

gares commented Mar 27, 2024

Please run CI

(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),
Copy link
Collaborator

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?

Copy link
Contributor Author

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.

@gares
Copy link
Contributor

gares commented Apr 3, 2024

Please run ci

@Anteru Anteru modified the milestones: 2.18.0, 2.19.0 May 4, 2024
@gares
Copy link
Contributor

gares commented Jul 10, 2024

Looks good to me

@Anteru Anteru merged commit b578904 into pygments:master Aug 9, 2024
@gares
Copy link
Contributor

gares commented Aug 20, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-lexing area: changes to individual lexers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants