Skip to content

Visual Studio Code extension which provides syntax highlighting for EBNF suitable for Railroad Diagram Generator.

Notifications You must be signed in to change notification settings

VShilenkov/vscode-rrebnf

Repository files navigation

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

About

Visual Studio Code extension which provides syntax highlighting for EBNF suitable for Railroad Diagram Generator.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published