Commit graph

1087 commits

Author SHA1 Message Date
Allan Clements
cda634a1c4 feat: add error information in the progress callback
This allows users to bail parsing if an error was *definitely* detected
using the progress callback, as all possible stack versions have a
non-zero error cost.

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2025-01-25 02:47:39 -05:00
Amaan Qureshi
8bb1448a6f feat: add the semantic version to TSLanguage, and expose an API for retrieving it 2025-01-25 01:14:30 -05:00
dependabot[bot]
9003b883f1 build(deps-dev): bump vite from 6.0.7 to 6.0.11 in /lib/binding_web
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 6.0.7 to 6.0.11.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v6.0.11/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-25 00:18:35 -05:00
Amaan Qureshi
e1eb2fdbca refactor(web): break apart the logic for constructing a query 2025-01-23 00:43:27 -05:00
Amaan Qureshi
b5894fac95 feat(web): use custom error type for query errors 2025-01-23 00:43:27 -05:00
Amaan Qureshi
6c3eb760a9 feat: improve PredicateStep types 2025-01-23 00:43:27 -05:00
Amaan Qureshi
a76934dda0 test: update tests 2025-01-23 00:43:27 -05:00
Amaan Qureshi
a18ae03e0b docs(web): update type definitions 2025-01-23 00:43:27 -05:00
Amaan Qureshi
e901716ebd refactor(web)!: deprecate Language.query in favor of new Query 2025-01-23 00:43:27 -05:00
Amaan Qureshi
e874d2d8f8 feat: add a patternIndex field to QueryCapture
This lets users look up the predicates associated with a given
`QueryCapture`, by using the `patternIndex` field and calling
`predicatesForPattern`
2025-01-23 00:43:27 -05:00
Amaan Qureshi
d60c6f163d refactor(web)!: rename pattern to patternIndex in QueryMatch
This aligns with other bindings
2025-01-23 00:43:27 -05:00
Amaan Qureshi
e3ac504e86 refactor(web): move CaptureQuantifier definition 2025-01-23 00:43:27 -05:00
Amaan Qureshi
58662417a6 fix(web): only export public types
This avoids exporting extra unnecessary stuff in the final JS file
2025-01-23 00:43:27 -05:00
Yuri Astrakhan
3e7721e554 chore: a few more minor lints 2025-01-23 00:10:16 -05:00
Amaan Qureshi
79244b5815 fix(web): correct builds for CJS 2025-01-21 12:36:15 -05:00
Amaan Qureshi
f6a943a1ad docs(web): update README and add CONTRIBUTING docs 2025-01-21 12:36:15 -05:00
Amaan Qureshi
0dba35c30f docs(web): update docs 2025-01-21 12:36:15 -05:00
Amaan Qureshi
1f66d156b5 test: update tests 2025-01-21 12:36:15 -05:00
Amaan Qureshi
09cb4c5729 feat(web): document the API 2025-01-21 12:36:15 -05:00
Amaan Qureshi
a4b20c1c56 feat: publish both CJS and ESM files
This way, users can pick whichever one works for their needs
2025-01-21 12:36:15 -05:00
Amaan Qureshi
10e6ecf162 feat: begin autogenerating web-tree-sitter.d.ts 2025-01-21 12:36:15 -05:00
Amaan Qureshi
be7716dfa7 feat(web)!: use the WASM module in the bindings, and not the other way around
Parser is no longer the default export, but you *must* call
`Parser.init()` before doing anything still
2025-01-21 12:36:15 -05:00
Amaan Qureshi
25e6de4a0a docs(web): update process on fetching WASM fiels 2025-01-21 12:36:15 -05:00
Amaan Qureshi
169d7ad57f refactor: rewrite scripts in typescript 2025-01-21 12:36:15 -05:00
Amaan Qureshi
31ceb99603 feat: add and apply eslint config 2025-01-21 12:36:15 -05:00
Amaan Qureshi
2cae67892e feat(web)!: rewrite the library in TypeScript 2025-01-21 12:36:15 -05:00
Amaan Qureshi
07a86b1729 build(web): use files in package.json instead of .npmignore 2025-01-21 12:36:15 -05:00
Amaan Qureshi
6e88672dac chore: cleanup unused code 2025-01-21 01:17:03 -05:00
Amaan Qureshi
c8353a52af fix(lib): don't always clear the tree stack
Only do so if the parser is not resuming balancing
2025-01-21 00:31:34 -05:00
Amaan Qureshi
27bc78698d feat(lib): implement Send + Sync for WasmStore 2025-01-21 00:21:35 -05:00
Amaan Qureshi
9365586cc3 feat: allow parser balancing to be cancellable 2025-01-20 23:52:19 -05:00
Amaan Qureshi
29e6717c31 fix(lib): temporarily allow lint with false positives 2025-01-17 20:41:06 -05:00
Amaan Qureshi
344a88c4fb feat(lib)!: remove ts_node_child_containing_descendant
It was marked deprecated in 0.24
2025-01-12 22:11:30 -05:00
Amaan Qureshi
f941277a9d docs(lib): improve documentation on ts_tree_get_changed_ranges and ts_query_cursor_set_{byte,point}_range 2025-01-12 14:56:22 -05:00
Amaan Qureshi
5de314833f feat(query): structurally verify supertype queries 2025-01-12 13:04:10 -05:00
Amaan Qureshi
26d4b19006 build(rust): bump the lib's MSRV to 1.76 2025-01-12 04:47:59 -05:00
WillLillis
cd6e766365 fix(wasm): allow passing in ERROR in descendantsOfType 2025-01-11 03:00:20 -05:00
Amaan Qureshi
95fd37ecf8 docs: add information about the scoping of cursors 2025-01-11 02:33:48 -05:00
Amaan Qureshi
7953aba070 fix(lib): use inclusive range check for non-empty nodes in next sibling computation 2025-01-10 22:00:33 -05:00
Amaan Qureshi
0195bbf1b4 fix(lib): avoid OOB access when updating alternative steps 2025-01-10 19:41:43 -05:00
Amaan Qureshi
2814c00faa fix(web): correct getExtent
Co-authored-by: Will Lillis <will.lillis24@gmail.com>
2025-01-06 01:55:15 -05:00
Amaan Qureshi
45fa028201 feat(web): add missing API functions
Co-authored-by: Will Lillis <will.lillis24@gmail.com>
2025-01-06 01:55:15 -05:00
Lucas Marçal
aea3a4720a fix(endian): support POSIX mode on Apple platforms 2025-01-06 01:13:04 -05:00
Lucas Marçal
28d5272e71 build(swift): include all source files 2025-01-06 01:13:04 -05:00
WillLillis
767b5486c6 docs: clarify data returned by QueryCaptures during iteration 2025-01-05 03:01:36 -05:00
Amaan Qureshi
ef39298342 feat(wasm): add Supertype API 2025-01-05 00:14:09 -05:00
Riley Bruins
19482834bd feat: add Supertype API
Introduces a new function that takes in a supertype symbol and returns
all associated subtypes. Can be used by query.c to give better errors
for invalid subtypes, as well as downstream applications like the query
LSP to give better diagnostics.
2025-01-05 00:14:09 -05:00
Amaan Qureshi
efc51a596c fix(lib): don't consider unfinished captures definite when the following step is immediate
When collecting captures, we were treating unfinished ones as definite
even if they had pending immediate steps that weren't yet satisfied. Now
we only mark a capture as definite if the pattern is guaranteed and
there are no pending immediate steps to check.
2025-01-04 02:03:41 -05:00
Amaan Qureshi
5f379da544 fix(lib): prevent wildcards from incorrectly marking child patterns as infallible
When a pattern appears under a wildcard parent (like "(_ (expr))"), we
were incorrectly marking it as infallible. The parent_pattern_guaranteed
flag only means the pattern will match after finding the right wildcard
parent, not that any wildcard parent will work.
2025-01-03 23:09:49 -05:00
Amaan Qureshi
a7e6d01144 fix(lib): propagate last_child status to pattern alternatives in queries
Previously, when a pattern was marked as the last child in a query, its
alternatives weren't marked similarly, causing incorrect matching
behavior. Now, the `last_child` status is properly propagated through
all alternatives.
2025-01-03 21:13:29 -05:00