The grammar reads every statement of OpenQASM 3.1 (declarations of every type, gates, subroutines and externs, modifiers and gphase, control flow, timing, calibrations kept as text with their braces matched, pragmas and annotations) and OpenQASM 2's qreg, creg, opaque, measure q -> c and if(c==1). The parser is generated at ABI 14 with the pinned command line (0.26.13) and committed; regenerating it reproduces it byte for byte. Queries for highlighting, scopes and folds; 17 corpus tests checked tree for tree, and the highlighting checked by 15 assertions. script/check-programs.mjs parses every program in the repository's conformance material and examples (the tracked .qasm files, the Studio's worked examples, the language service's samples, the programs in the command line's README and smoke script): 25 of 25 parse with no error, and a broken program is refused, so a clean result means something. Co-Authored-By: Claude Opus 5.5 <[email protected]>
20 lines
697 B
JSON
20 lines
697 B
JSON
{
|
|
"name": "tree-sitter-openqasm",
|
|
"version": "0.1.0",
|
|
"description": "OpenQASM 3, and the OpenQASM 2 forms in common use, for tree-sitter: the grammar, its generated parser, and highlighting and scope queries",
|
|
"license": "Apache-2.0",
|
|
"private": true,
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "https://git.transaction.science/Transaction-Science/open-standards",
|
|
"directory": "wai/tools/tree-sitter-openqasm"
|
|
},
|
|
"files": ["grammar.js", "tree-sitter.json", "src", "queries"],
|
|
"scripts": {
|
|
"generate": "tree-sitter generate --abi 14",
|
|
"test": "tree-sitter test && node script/check-programs.mjs"
|
|
},
|
|
"devDependencies": {
|
|
"tree-sitter-cli": "0.26.13"
|
|
}
|
|
}
|