rizin/subprojects/rizin-shell-parser
2026-06-21 01:09:02 +08:00
..
bindings
corpus librz/core: remove old shell completely (#5004) 2025-03-17 22:26:22 +08:00
src Regenerate shell parser 2026-06-21 01:09:02 +08:00
.gitignore subprojects: regenerate shell grammar with 0.25.3 2025-03-07 09:45:07 +00:00
binding.gyp
Cargo.toml Update tree-sitter to 0.21.0 (#4338) 2024-03-06 20:42:39 +08:00
grammar.js Add ?**, ?**e, ?*** for interactive search of command and settings details (#5062) 2025-07-08 12:06:39 +00:00
meson.build build: Improved meson-build to use rizin as subproject (#4684) 2024-10-29 23:59:42 +08:00
meson_tree_sitter_generate.py Fix build with use_sys_tree_sitter (#2562) 2022-04-28 01:38:03 +08:00
package-lock.json Update tree-sitter to 0.21.0 (#4338) 2024-03-06 20:42:39 +08:00
package.json Update tree-sitter to 0.21.0 (#4338) 2024-03-06 20:42:39 +08:00
README.md Use npx instead in rzshell build insns (#4331) 2024-03-05 22:04:47 +08:00
tree-sitter.json subprojects: regenerate shell grammar with 0.25.3 2025-03-07 09:45:07 +00:00

rizin-shell-parser

This is the parser for rizin shell language. See https://tree-sitter.github.io/tree-sitter/creating-parsers for more info on how to create a parser with tree-sitter.

Sources

  • grammar.js: defines the basic grammar
  • src/scanner.c: external scanner used to scan some tokens that cannot be parsed with the regular js grammar, as that includes only the context-free part of the language.
  • src/parser.c: this file is auto-generated by tree-sitter based on grammar.js
  • corpus/*: list of test files used to ensure the grammar works well

How to update grammar

When you update something in grammar.js or src/scanner.c you have to re-generate the parser. The process works as follows:

  1. Do changes as needed to grammar.js and/or src/scanner.c
  2. Install npm dependencies with: cd subprojects/rizin-shell-parser ; npm install
  3. Re-generate the parser files: npx tree-sitter generate
  4. Check tests still pass: npx tree-sitter test. Use npx tree-sitter parse ./example-file if you want to see the syntax tree of a custom input provided in ./example-file
  5. Commit auto-generated files and modified grammar.js and src/scanner.c into git.