Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

Add set text analyser for Mason lexer #12

Merged
merged 1 commit into from Nov 6, 2020
Merged

Conversation

gandarez
Copy link
Member

@gandarez gandarez commented Nov 5, 2020

This PR ports pygments Mason text analysis to chroma/go. Original code can be found at: https://github.com/pygments/pygments/blob/master/pygments/lexers/templates.py#L566

The regex for unnamed blocks seems to be wrong defined in Pygments. According to the official documentation a class block must be ended by a </%class> and not by </%class%>.

Example here:
https://metacpan.org/pod/distribution/Mason/lib/Mason/Manual/Intro.pod#Email-generator-(from-script)

Fixes: wakatime/wakatime-cli#88

@gandarez gandarez added the enhancement New feature or request label Nov 5, 2020
@@ -0,0 +1 @@
<& /path/to/comp.mi, name=>value &>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As re.DOTALL is used in the python version, can we add a test case, where this is split across multiple lines?

Suggested change
<& /path/to/comp.mi, name=>value &>
<& /path/to/comp.mi,
name=>value &>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Already changed mason_calling_component.m to support it.

Copy link

@dron22 dron22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All in all great catch with the pygments issue. 💪 I would've missed this. You could open an issue/pr on the pygments repository.

@gandarez
Copy link
Member Author

gandarez commented Nov 6, 2020

PR opened to the maintainers.

@gandarez gandarez merged commit 725daa5 into master Nov 6, 2020
@gandarez gandarez deleted the mason-lexer-text-analysis branch November 6, 2020 21:43
dron22 pushed a commit that referenced this pull request Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Chroma] Add text analyzer for Mason, Objective-C and Octave
2 participants