Skip to content
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

Add hlb lexer #332

Merged
merged 3 commits into from Feb 26, 2020
Merged

Add hlb lexer #332

merged 3 commits into from Feb 26, 2020

Conversation

hinshun
Copy link
Sponsor Contributor

@hinshun hinshun commented Feb 14, 2020

Hi @alecthomas, just wanted to experiment with various syntax highlighting libraries for HLB, a language I'm writing using participle.

I noticed that chroma doesn't seem to like the non-capturing group:

{`(\b((?!(scratch|image)\b)[a-zA-Z_][a-zA-Z0-9]*\b))`, ByGroups(NameOther), nil},

chroma-hlb

The equivalent from pygments:

(u'(\\b((?!(scratch|image)\\b)[a-zA-Z_][a-zA-Z0-9]*\\b))', bygroups(Name.Variable)),

pygments-hlb

I also included a pygments2chroma.hlb that allowed me to containerize the workflow to convert my pygments lexer, happy to exclude it.

@alecthomas
Copy link
Owner

Thanks! Try using chroma --trace to debug which rules are matching.

@hinshun
Copy link
Sponsor Contributor Author

hinshun commented Feb 17, 2020

I looked at haxe's example of using non-capturing group and updated my lexer to work for both pygments and chroma.

chroma-hlb

@alecthomas
Copy link
Owner

Nice! Can you add a test please? Instructions are in the lexers directory.

@hinshun hinshun marked this pull request as ready for review February 18, 2020 21:51
@alecthomas alecthomas merged commit e5d9650 into alecthomas:master Feb 26, 2020
@alecthomas
Copy link
Owner

Thanks!

mrsdizzie pushed a commit to mrsdizzie/chroma that referenced this pull request Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants