Commit graph

1028 commits

Author SHA1 Message Date
Andrew Hlynskyi
ffae7d6115 fix: mark helper Rust funcs that receive raw pointers as unsafe 2023-08-20 02:12:51 +03:00
Amaan Qureshi
ac579be788
fix(safety): mark functions that potentially deref a raw pointer as unsafe 2023-08-19 18:59:11 -04:00
Amaan Qureshi
c37dd2458b
Merge pull request #2529 from amaanq/injection-self
feat: add `injection.self` to inject a node with itself
2023-08-19 12:43:10 -04:00
Andrew Hlynskyi
59b8eaf911 rust: pin serde version on 1.0.171 due to serde-rs/serde#2538 2023-08-19 16:15:47 +03:00
Amaan Qureshi
45313e0dfb
feat: add injection.self to inject a node with itself 2023-08-18 18:37:57 -04:00
Amaan Qureshi
ce4a9ef4de
feat: allow specifying an input query-paths argument 2023-08-17 22:21:20 -04:00
Amaan Qureshi
9971e5d5f5
feat: allow specifying an input captures-path argument 2023-08-17 22:20:57 -04:00
Amaan Qureshi
458b5de0fc
feat: add any-of predicate 2023-08-17 22:20:57 -04:00
Amaan Qureshi
8eb92d1c64
feat: add an --apply-all-captures argument to highlight & test 2023-08-17 22:20:57 -04:00
Andrew Hlynskyi
6616d7deeb Change edit dumps format and add indexes for all corpus tests
The new dumped edits format is `edit.<SEED>.<TEST_INDEX>.<SEED_INDEX>.<TEST_NAME>`

To cleanup edits:
- Instead of the standard:
    > rm target/scratch/edit.*

- Use the following shell command:
    > find target/scratch/ -name 'edit.*' -delete
2023-08-18 00:02:21 +03:00
Andrew Hlynskyi
caaa533b8d test: add TREE_SITTER_DUMP_EDITS env var to dump corpus edits
It dumps edits to the `target/scratch` folder in a format like `<SEED>.edit`
2023-08-17 20:55:28 +03:00
Andrew Hlynskyi
0dd85c8452 Add TREE_SITTER_GRAMMAR_DEBUG env var to use debug grammars in tests 2023-08-17 18:16:41 +03:00
Amaan Qureshi
e0434327d0
fix(render): only output SPACE for strings that are just a space 2023-08-16 13:44:44 -04:00
Amaan Qureshi
28b831456e
Merge pull request #2500 from amaanq/dsl-update
feat: improve dsl definitions
2023-08-16 02:58:41 -04:00
Amaan Qureshi
c008005f9a
feat: improve dsl definitions 2023-08-16 02:24:33 -04:00
Amaan Qureshi
ece1060d2c
feat: warn users when using non-static functions that aren't needed for tree-sitter 2023-08-16 01:59:03 -04:00
Andrew Hlynskyi
029899f719 fix: dsl.d.ts - define previous param in rule callbacks 2023-08-15 23:28:54 +03:00
Amaan Qureshi
2d0a3d647b
Merge pull request #2491 from amaanq/sanitize
fix: replace & sanitize more characters
2023-08-13 20:15:20 -04:00
Amaan Qureshi
0b1b0d2fb7
fix: replace & sanitize more characters 2023-08-13 19:29:37 -04:00
Amaan Qureshi
318d4a705a fix: don't add flags if they're not present 2023-08-13 16:28:03 -04:00
Amaan Qureshi
dee98e06e9
Merge pull request #2474 from amaanq/case-insensitive
feat!: support the case-insensitive regex flag
2023-08-11 23:12:15 -04:00
Andrew Hlynskyi
4a007259fc Fix warning from #2454 in more clear way 2023-08-10 03:59:34 +03:00
Brian Strauch
d0afe1ad0a fix: pad hex numbers with zeros when writing colors
This solves a bug where a hex color with a zero can get truncated
2023-08-08 09:04:15 -04:00
Amaan Qureshi
f35752e3ac
feat!: support the case-insensitive regex flag 2023-08-06 23:40:29 -04:00
Amaan Qureshi
96919cae5d
fix(generate): add Vertical Tab and Form Feed to the whitespace class 2023-08-06 20:41:09 -04:00
Andrew Hlynskyi
e024653cb0
Merge pull request #2403 from jakesarjeant/master
feat(cli): add option to select JS runtime other than node
2023-08-03 22:29:22 +03:00
Jake Sarjeant
61b70943b1 feat(cli): add option to select JS runtime other than node 2023-08-03 21:34:47 +03:00
Eddie Hatfield
14aa23b1e1 feat: run highlight tests in subdirectories 2023-08-03 19:11:28 +01:00
Andrew Hlynskyi
485d192880 binding_rust: set_max_start_depth accepts optional to reset limit 2023-08-03 11:45:36 +03:00
Samuel Moelius
7b01d8ee05 Add test_query_max_start_depth_more 2023-08-03 11:45:34 +03:00
Samuel Moelius
41ec8b4166 Partially revert d4d5e29 2023-08-03 11:41:50 +03:00
Andrew Hlynskyi
7816397026 Add compile fail tests for LookaheadIterator 2023-08-03 03:49:57 +03:00
Andrew Hlynskyi
4eb22ed3ae Fix UB for LookaheadIterator 2023-08-03 03:49:57 +03:00
Andrew Hlynskyi
4f28ce4e3b Add async context tests for Node and TreeCursor 2023-08-03 03:03:03 +03:00
Michael Davis
3e499d675a
CLI: Re-use highlight cancellation flag for HTML highlights
The `html` highlight function created its own cancellation flag which
conflicts with the Ctrl-c handler set up in the CLI's `main` block
for `tree-sitter highlight`. We can re-use the cancellation flag from
that block to avoid a panic that happens when using `tree-sitter
highlight -H <file>`

    thread 'main' panicked at 'Error setting Ctrl-C handler: MultipleHandlers', cli/src/util.rs:31:6

This change also aligns the parameters that `highlight::ansi` and
`highlight::html` take.
2023-08-02 08:56:26 -05:00
Amaan Qureshi
acef7a3cdf chore: add tests 2023-08-02 10:47:28 +01:00
Amaan Qureshi
b8fe5fe21b fix: do not allow eof to advance states if the new state is the same state 2023-08-02 10:47:27 +01:00
Andrew Hlynskyi
a08c61235d Fix, reference by value for Language as everywhere 2023-08-02 00:04:24 +03:00
Daumantas Kavolis
ec90c215ae Add tests for bidirectional cursor 2023-08-02 00:02:33 +03:00
Daumantas Kavolis
1cb378b445 Add rust tests for lookahead iterator 2023-08-02 00:02:33 +03:00
Andrew Hlynskyi
19e665ef79 Add tests for TextProvider 2023-08-01 09:12:45 +03:00
Andrew Hlynskyi
a2f834d846 More error contexts + conv panics to errors with context 2023-07-30 21:16:45 +03:00
Amaan Qureshi
f4e788b28e
feat: warn when unused conflicts are present in a grammar 2023-07-28 00:23:28 -04:00
Amaan Qureshi
b8f7645ae2
Merge pull request #2434 from amaanq/test-update
fix: retain header and divider delimiter lengths when updating tests
2023-07-27 13:40:53 -04:00
Amaan Qureshi
bff5be9360
Merge pull request #2422 from amaanq/query-err-range-bug
fix: take the last range element by default if the query error isn't found
2023-07-27 13:23:45 -04:00
Amaan Qureshi
36c6c8aadf
Merge pull request #2423 from amaanq/nonzero-field-id
feat!: use `Option<NonZeroU16>` for TSFieldIds
2023-07-27 13:04:34 -04:00
Amaan Qureshi
0787c24a14
Merge pull request #2430 from amaanq/negative-assertions
Negative assertions
2023-07-27 12:44:12 -04:00
Amaan Qureshi
137483c7b9
fix: take the last range element by default if the query error isn't found 2023-07-27 12:34:47 -04:00
Amaan Qureshi
99366f3b5d
ci(sparc64): increase timeout time 2023-07-27 12:26:25 -04:00
Amaan Qureshi
192793a6ab
fix: avoid panic if input is empty 2023-07-27 03:37:02 -04:00