Skip to content

Add Cairo syntax highlighting #347

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

Merged

Conversation

cprussin
Copy link
Contributor

This PR adds a really hacky and probably mostly wrong grammar file for Cairo to fix syntax highlighting issues with single-quoted strings.

I created this grammar file by cloning the Rust grammar from https://github.com/shikijs/textmate-grammars-themes/blob/main/packages/tm-grammars/grammars/rust.json. I then updated all references to rust in the various identifiers to cairo instead, and then I removed any references to lifetimes (which is required to ensure the lifetime regex doesn't match before the single-quoted string regex matches) and added a block for handling single-quoted strings (basically just cloning the double-quoted string block and changing the begin and end regex).

I'm not remotely familiar with the textmate grammar syntax so this is almost certainly buggy and incorrect in some ways but it seems to work fine for the code block we have. We'll just have to test it with any new code blocks and fix as needed.

Copy link

vercel bot commented Jun 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
documentation ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 19, 2024 7:00pm

Copy link

vercel bot commented Jun 19, 2024

@cprussin is attempting to deploy a commit to the pyth-web Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@Riateche Riateche left a comment

Choose a reason for hiding this comment

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

Wow, that's very nice!

@cprussin cprussin merged commit a767b14 into pyth-network:main Jun 20, 2024
4 checks passed
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.

2 participants