Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>EBNF HighLightingNew to Visual Studio Code? Get it now.
EBNF HighLighting

EBNF HighLighting

VShilenkov

|
282 installs
| (0) | Free
EBNF HighLighting RRDG grammar
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

vscode-rrebnf

This VSCode extension provides Extended Backus–Naur Form syntax highlighting.

Grammar is taken from Railroad Diagram Generator

Features

  • Provides syntax highlighting for files with extension '.ebnf'

RR EBNF Grammar

  • 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

undefined

  • Redefined tokens

redefined

Requirements

  • It is required to split every rule with blank line
  • requires HyperScopes extension installed

Extension Settings

  • No settings provided

Known Issues

  • 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.

Release Notes

0.0.4

  • include guard support (ifndef define endif)
  • tests

0.0.3

  • support for preprocessor directive #include

0.0.2

  • experimental diagnostics implementation

0.0.1

  • initial release with more or less stable tokenization

Links which were useful during development

  • syntax: ONIG_SYNTAX_ONIGURUMA (default syntax)
  • rubular
  • A guide to writing a language grammar (TextMate) in Atom
  • Writing a TextMate Grammar: Some Lessons Learned
  • Notes on how to create a Language Grammar and Custom Theme for a Textmate Bundle
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft