Syntax highlighting
PRQL contains multiple grammar definitions to enable tools to highlight PRQL code. These are all intended to provide as good an experience as the grammar supports. Please raise any shortcomings in a GitHub issue.
The definitions are somewhat scattered around the codebase; this page serves as an index.
-
Lezer — used by CodeMirror editors. The PRQL file is at
prql-lezer/README.me
. -
Handlebars — currently duplicated:
- The book:
book/highlight-prql.js
- The website (outside of the book & playground):
website/themes/prql-theme/static/plugins/highlight/prql.js
- The book:
-
Textmate — used by the VSCode Extension. It’s in the
prql-vscode
repo inprql-vscode/syntaxes/prql.tmLanguage.json
. -
Monarch — used by the Monaco editor, which we use for the Playground. The grammar is at
playground/src/workbench/prql-syntax.js
.
While the pest grammar at
prql-compiler/src/parser/prql.pest
isn’t used for syntax highlighting, it’s the arbiter of truth given it currently
powers the PRQL compiler.