An extension for VS Code which provides support for the LBNF language.
LBNF is acronym for Labelled BNF, which is the language used in the compiler construction tool BNF Converter.
- Syntax highlighting
- Visual Studio Marketplace: Install from the listing: LBNF — the-wise-monkey
- Open VSX (VSCodium, etc.): Search for "LBNF" in your editor's marketplace, or browse: Open VSX listing (if available)
- Manual: Download the
.vsixfrom Releases and install it:
code --install-extension ./vscode-lbnf-x.y.z.vsix- Open any file with the
.cfextension to get LBNF syntax highlighting. - Example snippet:
EPlus. Exp ::= Exp "+" Exp ;
ENat. Exp ::= Integer ;
token Integer (digit)+ ;
- Install dependencies:
npm install- Open this folder in VS Code and press F5 to launch an Extension Development Host.
Notes:
- Grammar lives in
syntaxes/lbnf.tmLanguage.json. - Language configuration (comments, brackets, auto-closing) is in
language-configuration.json.
Build a .vsix package locally:
npx @vscode/vsce packageThis produces a file like vscode-lbnf-1.0.5.vsix in the repository root.
There are two stores you can publish to.
- Install the CLI:
npm i -g @vscode/vsce- Create a Personal Access Token (PAT) on Azure DevOps with scope "Marketplace (publish)" (see "Publishing tokens" below).
- Sign in once (stores token locally):
vsce login the-wise-monkey- Publish a new version (ensure
versioninpackage.jsonis bumped):
vsce publish- Install the CLI:
npm i -g ovsx- Create an Open VSX token at
https://open-vsx.organd set it as env var (see "Publishing tokens" below):
export OVSX_TOKEN=your-token-here- Publish:
ovsx publishAlternatively, use the npm scripts:
npm run package
npm run publish:vsce
npm run publish:ovsxThis repo includes two workflows that run on pushes to main/master:
.github/workflows/publish-vscode.yml— packages and publishes to the VS Code Marketplace.github/workflows/publish-openvsx.yml— packages and publishes to Open VSX
Both workflows:
- Upload the built
.vsixas a build artifact - Only publish when the
versioninpackage.jsonchanged vs the previous commit
Required repository secrets (Settings → Secrets and variables → Actions):
VSCE_PAT: Azure DevOps PAT with scope "Marketplace (publish)"OVSX_TOKEN: Open VSX personal access token
- Ensure you have access to the publisher
the-wise-monkeyon the Marketplace (owner can invite you). - Create a PAT in Azure DevOps: New Token → User Settings → Personal access tokens → New Token
- Organization: any (or "All accessible organizations")
- Scopes: enable only "Marketplace (Publish)"
- Copy the token value
- Add it to this repo as
VSCE_PATunder GitHub → Settings → Secrets and variables → Actions.
- Sign in at open-vsx.org using GitHub/GitLab.
- Go to profile → Settings → Tokens, create a token with "Publish" permission: Token settings
- Add the token to this repo as
OVSX_TOKENunder GitHub → Settings → Secrets and variables → Actions.
- Fix issue with strings containing a semicolon in rules starting with a keyword
- Fix issue with word
nonemptynot being detected when placed next to another keyword
- Fix issue detecting single line comments after rules starting with a keyword
- Fixed issues detecting categories inside squared brackets
- Fixed issues parsing multiline rules
Added keywords for vscode marketplace
Initial release
