Commit graph

229 commits

Author SHA1 Message Date
bglgwyng
096a844cda fix: handle empty node kind strings in node-types compatibility test 2025-11-20 14:40:07 +09:00
bglgwyng
6dcc1edff2 test: add parser and node-types.json compatibility tests for multiple grammars 2025-11-20 12:37:37 +09:00
bglgwyng
80b5bce27a fix: fix return value of get_node_types 2025-11-20 11:58:42 +09:00
bglgwyng
f1f11bde00 Merge branch 'master' into include-symbol_id-in-node-types-json 2025-11-19 21:53:39 +09:00
bglgwyng
48b2440b1e refactor: remove unused imports from generate module 2025-11-19 21:51:22 +09:00
bglgwyng
98acc93411 fix: pass unique_aliases to assign symbol_ids for aliases 2025-11-19 21:48:08 +09:00
Will Lillis
877782a8a4 fix(docs): update cli docs to reflect changes to various subcommand
arguments
2025-11-19 04:30:01 -05:00
Antonin Delpeuch
0e1f715ef1 Move PathsJSON method, reformat 2025-11-19 03:57:13 -05:00
Antonin Delpeuch
f3012a999d feat(bindings): expose the queries dynamically
Available in the Rust, Python, and Node bindings

Co-authored-by: ObserverOfTime <chronobserver@disroot.org>
2025-11-19 03:57:13 -05:00
bglgwyng
f4472c0140 refactor: change unique_aliases to store tuples with numeric symbol IDs 2025-11-19 13:19:47 +09:00
bglgwyng
9f3677dc10 refactor: remove unused alias ID generation code 2025-11-19 13:03:00 +09:00
bglgwyng
a496b8af43 refactor: change symbol_ids to store multiple IDs per node type 2025-11-18 22:57:07 +09:00
Valeriy Kosikhin
57e3a7b2ca fix(loader): set correct runtime host for cc while cross-compiling
Pass the BUILD_TARGET variable from the build environment as 'host' for
the cc crate. Otherwise, when cross-compiled, cc will keep looking for a
cross-compiler instead of the native one on the target system.

Signed-off-by: Valeriy Kosikhin <vkosikhin@gmail.com>
2025-11-17 18:19:34 +01:00
WillLillis
61c21aa408 refactor(generate)!: include path when available in IO errors 2025-11-14 11:28:00 +01:00
WillLillis
7eb23d9f3c refactor(config)!: transition from anyhow to thiserror 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
WillLillis
67cb3cb881 refactor(loader)!: transition from anyhow to thiserror 2025-11-14 11:28:00 +01:00
Will Lillis
7657cc9d35 fix(dsl): add ReservedRule to Rule type definition 2025-11-12 07:27:05 +01:00
bglgwyng
0ad40ec263 refactor: extract symbol ID generation into dedicated module 2025-11-09 18:58:27 +09:00
bglgwyng
e029188319 test: update node type tests to use actual symbol IDs 2025-11-09 17:29:30 +09:00
bglgwyng
ff4c91a614 fix: fix grammar conflicts in test cases for parsing table generation 2025-11-09 17:14:00 +09:00
bglgwyng
ab9b098aad refactor: extract grammar introspection into separate module 2025-11-09 16:19:49 +09:00
bglgwyng
04420e4b51 refactor: remove unused JSONOutput and GeneratedParser structs 2025-11-07 17:29:25 +09:00
bglgwyng
21c9f9ae4f refactor: change symbol_ids to store both string and numeric IDs
- Modified symbol_ids HashMap to store tuples of (String, u16) instead of just String
- Updated symbol ID generation to assign numeric IDs sequentially (0 for end symbol, then 1, 2, 3...)
- Changed all symbol_ids access patterns throughout codebase to use tuple destructuring (.0 for string, .1 for numeric)
- Updated node_types.json to use numeric u16 symbol_id instead of String
2025-11-07 17:29:05 +09:00
Will Lillis
361287fb56 fix(cli)!: deprecate --build flag for generate command 2025-11-07 08:51:24 +01:00
bglgwyng
8238c36f5f style: format 2025-11-07 16:47:08 +09:00
bglgwyng
4519e2b8cc feat: add symbol_id field to node type JSON output
- Added symbol_id as optional field in NodeTypeJSON struct for tracking grammar symbols
- Threaded symbol_ids HashMap through generate_node_types_json function to populate symbol IDs
- Updated all test assertions to include symbol_id: None for backward compatibility
2025-11-07 16:46:52 +09:00
bglgwyng
b7d85668fe refactor: extract grammar introspection into separate function
- Consolidated grammar processing logic into new `introspect_grammar` function
- Removed intermediate `GeneratedParser` and `JSONOutput` structs in favor of direct `GrammarIntrospection` struct
- Simplified code generation flow by separating grammar analysis from code rendering
2025-11-07 16:17:28 +09:00
bglgwyng
3b8a653167 refactor: extract symbol ID generation and helper functions
- Moved symbol ID generation logic out of renderer initialization into standalone function
- Extracted sanitize_identifier and metadata_for_symbol as reusable helper functions
- Symbol IDs now computed before rendering and passed to renderer constructor
2025-11-07 11:57:39 +09:00
Will Lillis
419a5a7305 fix(generate): don't short-circuit within extend_sorted 2025-11-03 01:22:29 -05:00
Will Lillis
c7b5f89392 feat(xtask): generate JSON schema for cli TestSummary 2025-11-02 21:08:55 -05:00
Will Lillis
d546e28abf fix(cli): mark report_states_for_rule and json/json_summary flags
for `generate` command as conflicting
2025-11-02 21:08:55 -05:00
WillLillis
86e2fd2337 fix(cli): correct behavior of parse --stat and --json-summary flags 2025-11-02 21:08:55 -05:00
WillLillis
ff255a2354 test: add coverage for new test aggregation method 2025-11-02 21:08:55 -05:00
WillLillis
fe67521b3d refactor(cli)!: deprecate json flags in favor of json-summary 2025-11-02 21:08:55 -05:00
WillLillis
f02d7e7e33 feat(test): display test results in JSON format 2025-11-02 21:08:55 -05:00
WillLillis
6a8676f335 refactor(test): generalize printing of test diff keys and diffs 2025-11-02 21:08:55 -05:00
WillLillis
944386d25f refactor(test): clean up test filtering logic
Also, only update the expected output of a case when it is skipped if
the `update` flag has been passed
2025-11-02 21:08:55 -05:00
Will Lillis
097c2d4f05 fix(cli): remove --emit=lib generate option
This also replaces the `--emit` option with an `--no-parser` flag. The
default value is false, meaning a parser is still generated by default.
2025-11-02 10:26:28 +01:00
WillLillis
b8f52210f9 perf: reduce needless allocations 2025-10-30 18:24:42 +01:00
WillLillis
ecc787e221 fix(test): correct language typo in test name 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
WillLillis
a2f2b16acb fix(xtask): require version argument for bump-version command 2025-10-24 18:13:59 -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
dependabot[bot]
da5926d6f5 build(deps): bump the cargo group across 1 directory with 4 updates
Bumps the cargo group with 4 updates in the / directory: [anstyle](https://github.com/rust-cli/anstyle), [cc](https://github.com/rust-lang/cc-rs), [thiserror](https://github.com/dtolnay/thiserror) and [widestring](https://github.com/VoidStarKat/widestring-rs).


Updates `anstyle` from 1.0.11 to 1.0.13
- [Commits](https://github.com/rust-cli/anstyle/compare/v1.0.11...v1.0.13)

Updates `cc` from 1.2.39 to 1.2.41
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.2.39...cc-v1.2.41)

Updates `thiserror` from 2.0.16 to 2.0.17
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/2.0.16...2.0.17)

Updates `widestring` from 1.2.0 to 1.2.1
- [Release notes](https://github.com/VoidStarKat/widestring-rs/releases)
- [Changelog](https://github.com/VoidStarKat/widestring-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/VoidStarKat/widestring-rs/compare/v1.2.0...v1.2.1)

---
updated-dependencies:
- dependency-name: anstyle
  dependency-version: 1.0.13
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: cc
  dependency-version: 1.2.41
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: thiserror
  dependency-version: 2.0.17
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: widestring
  dependency-version: 1.2.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-14 11:00:03 +02: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