Skip to content

VS Code Syntax Extension for Wyvern

Notifications You must be signed in to change notification settings

zyx-billy/wyvern-syntax

Repository files navigation

wyvern-syntax

A VS Code language extension for the Wyvern programming language.

Features

  • Syntax highlighting
  • Basic autocomplete

Guide for Extension Developers

Requirements

This extension requires nodejs (and npm) to build.

Development Workflow

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.

Macros

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.

Package Extension

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.

About

VS Code Syntax Extension for Wyvern

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published