Open ruuda opened 7 years ago
Hello,
Here is what I managed to get after playing a little with syntax highlighting in VS Code:
What do you think?
That is awesome!
I apologise for not keeping this issue up to date, the parser has been replaced since I opened this issue. The lexer is still in src/lexer.rs
(now permalink), but the simlicity of the token stream is probably clouded by the code. I should write some docs about it. Apart from the Rust parser, there is a Bison grammar in etc/pris.y
that should match the Rust implementation. The tokens defined at the top there, together with the literals, are all existing tokens, and that should be sufficient for syntax highlighting.
If you like to contribute VS Code highlighting support here (even an incomplete version would be nice, at the moment we have nothing), we can put the required files in etc/vscode
in the repository. If I understand correctly, a VS Code highlighting extension includes a language-configuration.json
file, and then a metadata file for the extension?
It would be nice to have syntax highlighting for Pris source files.
Syntax details
A good starting point is the Bison grammar in
etc/pris.y
. The Pris parser uses a different implementation (insrc/lexer.rs
andsrc/parser.rs
), but the two should be in sync. The Bison file is used to check that the grammar remains sensible. The tokens defined at the top, together with the string literals (for keywords and suffixes) are all the tokens, and those should be sufficient for syntax highlighting.Formats
I will take care of Vim and Kate myself when I find the time. (Vim is my editor of choice, and Pandoc — which powers my blog — uses
highlighting-kate
.)