ObserverOfTime
60635e0729
fix(generate): add node_modules to quickjs resolver
2025-11-21 19:39:53 -05:00
WillLillis
61c21aa408
refactor(generate)!: include path when available in IO errors
2025-11-14 11:28:00 +01:00
WillLillis
db2d221ae9
fix(generate): remove leftover imports of anyhow
2025-11-14 11:28:00 +01:00
Will Lillis
419a5a7305
fix(generate): don't short-circuit within extend_sorted
2025-11-03 01:22:29 -05:00
WillLillis
b8f52210f9
perf: reduce needless allocations
2025-10-30 18:24:42 +01:00
Christian Clason
6188010f53
build(deps): bump rquickjs to v0.10.0
2025-10-29 18:30:25 -04:00
Will Lillis
87d778a1c6
fix(rust): apply Self usage in struct definition lint
2025-10-24 17:50:28 -04:00
Will Lillis
e344837e35
fix(rust): minor cleanup in generate code
2025-10-24 17:50:28 -04:00
Will Lillis
b3bc7701cd
refactor(generate): make AliasMap use BTreeMap over HashMap
2025-10-12 15:56:30 -04:00
Will Lillis
262f1782cc
fix(generate): ensure deterministic iteration order for symbol aliases
...
while constructing node-types.json
2025-10-12 15:56:30 -04:00
WillLillis
00d172bf9f
fix(generate): correct display of precedence for
...
`--report-states-for-rule`
2025-10-12 15:56:12 -04:00
Will Lillis
ae54350c76
fix(generate): Add missing fields to NodeInfoJson sorting
...
This ensures a deterministic ordering for node-types.json
2025-10-11 14:25:52 -04:00
Amaan Qureshi
5f7806f99e
feat: add option to disable parse state optimizations
2025-09-26 02:40:53 -04:00
WillLillis
a9bce7c18a
fix(generate): return error when generated grammar's state count exceeds
...
the maximum allowed value.
Co-authored-by: Amaan Qureshi <git@amaanq.com>
2025-09-25 22:29:04 -05:00
Amaan Qureshi
ce56465197
test(rust): prefer asserts to panics
2025-09-23 01:19:14 -04:00
Amaan Qureshi
b0cdab85fe
refactor(rust): avoid panics where possible
2025-09-23 01:19:14 -04:00
Amaan Qureshi
c89e40f008
fix(generate): fix builds outside of crate workspace
2025-09-21 02:34:10 -04:00
ObserverOfTime
d13657c40c
refactor(generate): use the logger
...
Co-authored-by: Amaan Qureshi <git@amaanq.com>
2025-09-21 01:53:22 -04:00
Amaan Qureshi
311585d304
refactor!: rename stage flag to emit
2025-09-20 22:35:23 -04:00
Will Lillis
46ea65c89b
refactor: remove url dependency
2025-09-17 04:31:53 -04:00
Will Lillis
6a28a62369
test: add safety checks to ensure langauge version constants are kept in
...
sync
The generate crate defines the `LANGUAGE_VERSION` constant separately
from the TREE_SITTER_LANGUAGE_VERSION definition in `api.h`.
2025-09-17 02:58:31 -04:00
Amaan Qureshi
317e2e74c2
Revert "feat(generate): allow more characters for keywords"
...
This reverts commit 0269357c5a .
2025-09-17 02:19:29 -04:00
Amaan Qureshi
04cfee5664
build(rust): remove unused dependencies
2025-09-16 18:57:06 -04:00
Amaan Qureshi
57c6105897
fix(generate): remove warning message for CJS grammars
2025-09-16 16:42:17 -04:00
Christian Clason
339bad2de4
feat(generate): don't embed tree-sitter CLI version in parser
...
Problem: embedding the CLI version used to generate a parser triggers CI
failures on all grammars for every (patch) release of tree-sitter, even
if there are no actual parser changes.
Solution: do not embed the version; instead rely on whether the update
introduces actual (presumably desirable) changes in the parser to
indicate regeneration is necessary.
2025-09-16 19:21:34 +02:00
Will Lillis
31ff62445b
fix(generate): assert there is a Nfa last state before retrieving it
...
Prevents unsigned subtraction wrapping antics in release builds
2025-09-16 03:51:13 -04:00
bbb651
9593737871
build(generate): remove tree-sitter dependency
...
It was only used to share two constants, and balloons its dependencies.
This also makes `generate_parser_for_grammar` work in wasm.
(Tested in `wasm32-wasip2` in wasmtime with the json grammar,
`wasm32-unknown-unknown` running in the same setup exited successfully
so I'm pretty confident it works as well)
Co-authored-by: Amaan Qureshi <contact@amaanq.com>
2025-09-16 03:48:30 -04:00
Amaan Qureshi
0269357c5a
feat(generate): allow more characters for keywords
2025-09-16 03:01:56 -04:00
Amaan Qureshi
39a67eec61
feat: migrate to ESM
2025-09-16 02:24:11 -04:00
Amaan Qureshi
eedbec8f24
feat: remove the need of an external JS runtime for processing grammars
2025-09-16 02:24:11 -04:00
ObserverOfTime
56325d2a3b
chore: copy license to all packages
2025-09-11 03:12:35 -04:00
Shadaj Laddad
27e5147a5f
feat(generate): place file APIs behind a feature flag
2025-09-07 11:44:09 +03:00
Will Lillis
5fd818babe
fix(generate): use correct state id when adding terminal states to
...
non terminal extras
2025-09-04 04:15:51 -04:00
Will Lillis
310c0b86a7
fix(generate): return error when single state transitions have
...
indirectly recursive cycles.
This can cause infinite loops in the parser near EOF.
Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2025-09-04 00:59:44 -04:00
ObserverOfTime
b57b7213a9
fix(rust): make some methods const
...
Addresses clippy::missing-const-for-fn
2025-08-30 16:47:47 +03:00
Will Lillis
ac171eb280
fix(generate): warn users when extra rule can lead to parser hang
...
When a *named* rule in the extras is able to match the empty string,
parsing can hang in certain situations (i.e. near EOF).
2025-08-29 21:38:41 -04:00
Amaan Qureshi
1152bf4c9d
fix(cli): show rule names for rules with metadata
2025-08-28 13:28:37 -04:00
Will Lillis
e749a97f9f
fix(rust): make String clones more explicit
2025-08-09 16:02:28 -04:00
Will Lillis
3d9f4d1bd3
fix(rust): remove redundant String clones
2025-08-09 16:02:28 -04:00
Pieter Goetschalckx
07b4c8d05d
fix(cli): add reserved type declarations and schema
...
- Use `globalThis` for `reserved` function export
- Add `reserved` field and function to DSL declarations
- Add `reserved` rule to grammar schema
2025-08-02 12:01:41 +03:00
Antonin Delpeuch
8e90799e27
feat(generate): Support for --stage=json/parser/lib
2025-07-26 22:48:00 -04:00
Antonin Delpeuch
d810217e63
refactor: Expose node_types_json without generating C code
2025-07-26 22:48:00 -04:00
Antonin Delpeuch
8676eda663
feat: Only evaluate grammar.js to grammar.json
...
This adds an `--evaluate-only` option to `tree-sitter generate`
so that it only does the evaluation of `grammar.js` to
`src/grammar.json`, without continuing on with the generation of
`src/parser.c` and related files.
It's a follow-up to #4580 .
2025-07-26 22:48:00 -04:00
Daniel Müller
f0165dee92
feat(rust): Add direct links to documentation
...
Make the URL to the documentation of the various crates known so that it
will be easier to click through to it from a crates.io search [0].
[0] https://doc.rust-lang.org/cargo/reference/manifest.html#the-documentation-field
2025-07-22 18:36:08 -04:00
Christian Clason
c18d019db0
Revert "feat(generate): warn about unreachable variables ( #4567 )"
...
This reverts commit 25c601bd2f .
Reason: Too many false positives.
2025-07-22 09:49:26 +02:00
Antonin Delpeuch
25c601bd2f
feat(generate): warn about unreachable variables ( #4567 )
2025-07-21 11:39:18 +02:00
Will Lillis
86b2c939c7
fix(rust): address nightly clippy lint useless_if_let_seq
2025-07-20 21:14:47 -04:00
Will Lillis
0f79c61188
perf(generate): reserve more Vec capacities
2025-07-17 01:51:56 -04:00
Will Lillis
854f527f6e
perf: reorder conditional operands
2025-07-13 19:42:30 +02:00
Will Lillis
c740f244ba
fix(generate): propagate node types error
2025-07-13 19:42:30 +02:00