A VS Code language extension for the Wyvern programming language.
- Syntax highlighting
- Basic autocomplete
This extension requires nodejs (and npm) to build.
Due to a lack of features in the default tmLanguage JSON format used by VS Code, this extension uses a custom build script to generate the resulting tmLanguage JSON file.
- .vscode/ VS Code Tasks (for automating builds)
- src/ Source code
- build_syntax.js Build script
- macros.yaml Macro settings
- tmLanguage.yaml Language Grammar
- syntaxes/ Auto-generated by build script (do not edit)
The source grammar is in src/tmLanguage.yaml
. A YAML file is used instead of JSON so that backslashes (\
) do not have to be escaped when writing strings. This is especially helpful when writing a lot of regular expressions.
Since many rules in the grammar may have overlapping components, the build script allows defining macros that will be replaced before converting the YAML file into JSON.
Macros are defined in the src/macros.yaml
file. During build, src/tmLanguage.yaml
will first be scanned for strings of the form $$key$$
where key
is the name of a macro defined in the macro settings file. Each instance will be replaced with the string mapped to by key
in the macro settings. This step is performed before parsing the grammar YAML file, so the double dollar signs do not need to be escaped.
Additional warnings on macro usage is described in the macro settings file.
Install the Visual Studio Code Extensions tool (vsce
) with npm, and run vsce package
at the repo root to package the repo into an extension. The syntax will always be rebuilt prior to packaging.
To install the unpublished extension locally, run code --install-extension wyvern-syntax-<version>.vsix
.