Commit graph

5199 commits

Author SHA1 Message Date
Amaan Qureshi
5032b341a7
fix(lib): set the error cost of children that are terminal error nodes, as they have not been set yet 2024-09-27 16:10:07 -04:00
Amaan Qureshi
b2359e4020 feat!: move generation of grammar files to an init command
The generate subcommand should stick to solely generating a parser and
headers.
2024-09-27 16:06:57 -04:00
Amaan Qureshi
50eaf0b6cd style(lib): add parameter names in declarations that are missing them 2024-09-27 13:38:08 -04:00
Amaan Qureshi
28972f916a fix(lib): silence warnings with -Wpedantic 2024-09-27 12:58:26 -04:00
Amaan Qureshi
0c43988a5e fix(lib): correct descendant-for-range behavior with zero-width tokens 2024-09-27 00:37:13 -04:00
Amaan Qureshi
9ef12624c3 feat(cli): add a no-ranges flag to the parse command 2024-09-26 22:43:01 -04:00
Amaan Qureshi
e04387258b feat(schema): misc improvements 2024-09-24 15:51:26 -04:00
Amaan Qureshi
86d3a5313d fix: disallow empty string literals in rules 2024-09-24 15:36:38 -04:00
Amaan Qureshi
1708a295a8 fix: do not generate spurious files if the grammar path is not the default path 2024-09-24 14:34:52 -04:00
Amaan Qureshi
bc072a52f8 refactor(cli): break out subcommand logic into separate functions
Co-authored-by: buckynbrocko <77247638+buckynbrocko@users.noreply.github.com>
2024-09-24 13:23:49 -04:00
Amaan Qureshi
1f0feb5254 feat: add shell completions 2024-09-24 12:46:38 -04:00
Amaan Qureshi
d3c262a104 fix(test): correctly handle assertions on empty lines
Also fixes assertions for captures spanning on multiple lines.

Co-authored-by: Thomas Vigouroux <thomas.vigouroux@protonmail.com>
2024-09-24 12:36:33 -04:00
Amaan Qureshi
cc4378e751 feat(test): test all queries
Fallback to default testing for all queries present in the parser's
queries directory.

For a given query <QUERY>.scm, the test files are searched in
test/<QUERY>/*

Also mimic the output of other test-running subcommands when testing
queries.

Co-authored-by: Thomas Vigouroux <thomas.vigouroux@protonmail.com>
2024-09-24 12:36:33 -04:00
dependabot[bot]
b695568516 build(deps): bump the cargo group with 3 updates
Bumps the cargo group with 3 updates: [cc](https://github.com/rust-lang/cc-rs), [clap](https://github.com/clap-rs/clap) and [thiserror](https://github.com/dtolnay/thiserror).


Updates `cc` from 1.1.20 to 1.1.21
- [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.1.20...cc-v1.1.21)

Updates `clap` from 4.5.17 to 4.5.18
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.17...clap_complete-v4.5.18)

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

---
updated-dependencies:
- dependency-name: cc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-24 11:28:20 -04:00
Amaan Qureshi
52f696096d feat: provide a rebuild flag to force rebuild parsers 2024-09-24 11:27:59 -04:00
Samuel Tardieu
1aa28e04ee style(tests): do not use .as_bytes().len() on strings 2024-09-22 20:27:38 -04:00
Amaan Qureshi
c1f8a8a728 chore: remove compile_flags.txt 2024-09-22 20:26:51 -04:00
Amaan Qureshi
83d41542f8 feat: add eslint configuration package 2024-09-22 20:26:04 -04:00
Will Lillis
99dbbbcbe9
fix(fuzz): skip tests marked with :skip & don't report errors on tests marked with :error 2024-09-22 03:46:52 -04:00
Amaan Qureshi
4934a16173 feat: add root field in node-types.json 2024-09-22 01:48:03 -04:00
Amaan Qureshi
6f050f0da5 fix: properly handle utf8 code points for highlight and tag assertions 2024-09-22 01:03:59 -04:00
Joel Spadin
755e49e212 fix(wasm): use / paths for workdir
Reimplemented the fix from #2183 to fix building WASM files with Docker
on Windows again. The --workdir argument gives a path inside the Docker
container, so it must use forward slashes regardless of the default path
separator on the host OS.
2024-09-22 00:50:33 -04:00
Firas al-Khalil
4f0d463d49
build(make): support darwin cross-compile 2024-09-17 11:01:54 +03:00
Amaan Qureshi
0a85744eba fix(lib): peek at the next sibling when iterating to find the child that contains a given descendant
This issue shows up when we have a zero-width token that is the target
descendant node, previously the previous sibling would be returned as
the child that contains the descendant, which is incorrect.
2024-09-17 04:37:43 +02:00
PanGan21
1a6af3fafe fix(docs): fix highlight readme example using compatible versions 2024-09-17 04:34:19 +02:00
dependabot[bot]
c6faeb948e build(deps): bump the cargo group across 1 directory with 11 updates
Bumps the cargo group with 10 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.86` | `1.0.89` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.1.14` | `1.1.19` |
| [clap](https://github.com/clap-rs/clap) | `4.5.16` | `4.5.17` |
| [filetime](https://github.com/alexcrichton/filetime) | `0.2.24` | `0.2.25` |
| [indexmap](https://github.com/indexmap-rs/indexmap) | `2.4.0` | `2.5.0` |
| [pretty_assertions](https://github.com/rust-pretty-assertions/rust-pretty-assertions) | `1.4.0` | `1.4.1` |
| [serde](https://github.com/serde-rs/serde) | `1.0.209` | `1.0.210` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.127` | `1.0.128` |
| [webbrowser](https://github.com/amodm/webbrowser-rs) | `1.0.1` | `1.0.2` |
| [bindgen](https://github.com/rust-lang/rust-bindgen) | `0.69.4` | `0.70.1` |



Updates `anyhow` from 1.0.86 to 1.0.89
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.86...1.0.89)

Updates `cc` from 1.1.14 to 1.1.19
- [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.1.14...cc-v1.1.19)

Updates `clap` from 4.5.16 to 4.5.17
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.16...clap_complete-v4.5.17)

Updates `filetime` from 0.2.24 to 0.2.25
- [Commits](https://github.com/alexcrichton/filetime/compare/0.2.24...0.2.25)

Updates `indexmap` from 2.4.0 to 2.5.0
- [Changelog](https://github.com/indexmap-rs/indexmap/blob/master/RELEASES.md)
- [Commits](https://github.com/indexmap-rs/indexmap/compare/2.4.0...2.5.0)

Updates `pretty_assertions` from 1.4.0 to 1.4.1
- [Release notes](https://github.com/rust-pretty-assertions/rust-pretty-assertions/releases)
- [Changelog](https://github.com/rust-pretty-assertions/rust-pretty-assertions/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-pretty-assertions/rust-pretty-assertions/compare/v1.4.0...v1.4.1)

Updates `serde` from 1.0.209 to 1.0.210
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.209...v1.0.210)

Updates `serde_derive` from 1.0.209 to 1.0.210
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.209...v1.0.210)

Updates `serde_json` from 1.0.127 to 1.0.128
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/1.0.127...1.0.128)

Updates `webbrowser` from 1.0.1 to 1.0.2
- [Release notes](https://github.com/amodm/webbrowser-rs/releases)
- [Changelog](https://github.com/amodm/webbrowser-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/amodm/webbrowser-rs/compare/v1.0.1...v1.0.2)

Updates `bindgen` from 0.69.4 to 0.70.1
- [Release notes](https://github.com/rust-lang/rust-bindgen/releases)
- [Changelog](https://github.com/rust-lang/rust-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/rust-bindgen/compare/v0.69.4...v0.70.1)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: cc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: filetime
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: indexmap
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo
- dependency-name: pretty_assertions
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: serde_derive
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: webbrowser
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: bindgen
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-17 04:13:53 +02:00
ObserverOfTime
6e19fccf39 chore(bindings): update rust lib docs 2024-09-17 03:40:48 +02:00
Dave Abrahams
112acd5b93
fix(generate): remove excludes in Package.swift 2024-09-16 21:40:21 -04:00
Hanlu
ff813a311b
fix: correct comment quote 2024-09-16 21:39:49 -04:00
Will Lillis
b0e8e50a19
fix(cli): remove duplicate short options from fuzz command (#3635)
- Remove short option from fuzz command edits option
- Remove short option from fuzz command iterations option
2024-09-15 11:04:12 +03:00
Amaan Qureshi
7e3f572655 feat: add field_name_for_named_child 2024-09-09 11:05:29 -04:00
Amaan Qureshi
8667e3ea0c fix(binding_web): remove nonexistent function definition 2024-09-08 16:57:20 -04:00
Amaan Qureshi
d8ab779df4 fix(generate): do not generate large character sets for unused variables 2024-09-08 15:42:18 -04:00
Amaan Qureshi
cbd3bb5b9a feat!: remove the build-wasm subcommand
`build --wasm` should be used instead
2024-09-08 13:41:26 -04:00
Amaan Qureshi
10e474f488 feat!: remove filter flag from commands in favor of include and exclude 2024-09-07 20:53:04 -04:00
Amaan Qureshi
5e46fef0d7 chore: clippy lints 2024-09-07 20:31:20 -04:00
Amaan Qureshi
9301d38b77 feat!: remove C++ support for external scanners 2024-09-07 20:14:36 -04:00
Jinser Kafka
fd190f1d9d fix(cli): keep skipped tests unchanged in the test/corpus 2024-09-07 18:55:49 -04:00
ObserverOfTime
26c1202058 build(lib): build using cmake 2024-09-07 18:38:05 -04:00
Amaan Qureshi
fcbd67b3fa fix(binding_web): correct edit signature 2024-09-07 17:53:18 -04:00
Amaan Qureshi
4d3d1f0df2 fix(generate): add tree-sitter to the dev-dependencies of the Cargo.toml 2024-09-07 17:46:09 -04:00
Amaan Qureshi
9b398c2b84 fix(lib): backtrack to the last relevant iterator if no child was found 2024-09-05 18:01:29 -04:00
Liam Rosenfeld
d60789afdc
feat(language): derive Clone and Copy on LanguageFn
Allows a LanguageFn to be passed around and create multiple languages since Language::new consumes a LanguageFn

LanguageFn just wraps a function pointer, which already conforms to Copy so this is a simple addition.
2024-09-02 21:12:17 -04:00
Amaan Qureshi
f48c210dbd ci: add backport workflow 2024-09-01 15:18:43 -04:00
Amaan Qureshi
272ebf77b9 fix(test): retain attributes when running test -u 2024-09-01 06:18:55 -04:00
Amaan Qureshi
0a486d508f fix(test): exit with an error if a test marked with :error has no error 2024-09-01 06:18:55 -04:00
Amaan Qureshi
ee06325f67 fix(lib): correct extra node creation from non-zero root-alias cursors 2024-08-31 23:58:19 -04:00
Amaan Qureshi
4387e44b98 fix(rust): add missing TSNode functions 2024-08-31 23:06:26 -04:00
Amaan Qureshi
53cc93c267 fix(generate): disallow inline variables referencing themselves
This fixes an infinite loop bug
2024-08-31 16:57:23 -04:00
Amaan Qureshi
3f424c0121 feat: add an API to time out query executions
Currently, if a predicate is hard to match on the Rust side, a sizable
query against a very large file can take forever, and ends up hanging.
This commit adds an API function `ts_query_cursor_set_timeout_micros` to
limit how long query execution is allowed to take, thereby negating the
chance of a hang to occur.
2024-08-31 14:33:28 -04:00