This VSCode extension provides Extended Backus–Naur Form syntax highlighting.
Grammar is taken from Railroad Diagram Generator
- Provides syntax highlighting for files with extension '.ebnf'
- Colours maybe customized by adopting
settings.json
Screenshot above was taken with using the following theme customization:
{
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "entity.name.declaration.ebnf",
"settings": {
"foreground": "#ff9404",
"fontStyle": "bold"
}
},
{
"scope": "entity.name.ebnf",
"settings": {
"foreground": "#4ea5b6",
}
},
{
"scope": "keyword.operator.new.ebnf",
"settings": {
"foreground": "#3875d7",
}
},
{
"scope": "keyword.operator.alternative.ebnf",
"settings": {
"foreground": "#b4e4fd",
}
},
{
"scope": "keyword.operator.quantifier.ebnf",
"settings": {
"foreground": "#c0a0f3",
"fontStyle": "bold"
}
},
{
"scope": "keyword.operator.difference.ebnf",
"settings": {
"foreground": "#7cbdf1",
}
},
]
}
}
- Provides diagnostics
- Used but undefined tokens
- Redefined tokens
- It is required to split every rule with blank line
- requires HyperScopes extension installed
- No settings provided
- Grammar doesn't recognize links
- Used non standard token classes
- HyperScopes extension works not perfectly and provides not reliable output (hscopes/issues/2). Diagnostics features may require another approach for implementation.
- include guard support (
ifndef
define
endif
) - tests
- support for preprocessor directive
#include
- experimental diagnostics implementation
- initial release with more or less stable tokenization