-
Notifications
You must be signed in to change notification settings - Fork 33
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
Syntax highlighting for ucode #178
Comments
And in nano, of course, included in OpenWrt! |
A pull request for introducing ucode in Chroma has been created. |
I added a pull request to include syntax highlighting in OpenWrt's nano package: |
@eric-j-ason - I suggest to use the nano highlighting I submitted in the other PR as authoritative source for the supported syntax keywords. See also https://github.com/jow-/ucode/blob/master/lexer.c#L47 There's some special cases like Another complication is that ucode may run in template mode where by default the file source is uninterpreted plain text and actual ucode logic only appears in |
Yes, good idea. Those lines in
Oh, I see. Does it work the same in JavaScript, or is it different? In what I did for Chroma, I just took JavaScript as the starting point, and adjusted the list of keywords. I'm afraid I don't know how to do anything more complicated in Chroma or any other highlighter.
Yes, also this I didn't know how to do, so I had to leave it out. It's nice that you did it for nano. I haven't quite figured out how highlighting works on GitHub. Perhaps they use a complete parser, enabling additional features such as getting the definition of a variable by clicking it. This is what they say: "We use Linguist to perform language detection and to select third-party grammars for syntax highlighting. You can find out which keywords are valid in the languages YAML file." |
I have noticed that these highlighting rules assume that the file is a template, and breaks on a pure ucode file. |
I'd like to get support for ucode in syntax highlighters such as Chroma (which is used by Gitea) and Pygments, perhaps by starting with their Javascript definitions and modifying them. Is there a specification of what keywords and other token types exist in ucode?
For reference:
The text was updated successfully, but these errors were encountered: