Back to Baml

@b/pkg-grammar

typescript2/pkg-grammar/README.md

0.223.0954 B
Original Source

@b/pkg-grammar

Canonical TextMate grammars for the BAML language — the single source of truth for syntax highlighting.

  • baml.tmLanguage.json — the BAML grammar (source.baml)
  • jinja.tmLanguage.json — the Jinja sub-grammar embedded in prompt blocks (source.baml-jinja)

Editing

Edit the JSON files in this package only. Then propagate to consumers:

sh
pnpm --filter @b/pkg-grammar sync

Consumers

  • app-promptfiddle imports the JSON directly (import('@b/pkg-grammar/baml.tmLanguage.json')) — no local copy.
  • app-vscode-ext keeps a committed mirror under syntaxes/ because VS Code loads the grammar from the physical file named in contributes.grammars[].path and the extension ships bundled (no node_modules in the .vsix). The mirror is regenerated by sync (run automatically on its dev/build) and a pre-commit hook (pnpm --filter @b/pkg-grammar check) fails if it drifts.