Max Brunsfeld
a40045a419
When editing, properly invalidate trees that depend on get_column
2021-03-11 14:46:13 -08:00
Max Brunsfeld
774ae5e3d5
In parse tables, store production ids as 16 bits
...
Also remove the use of bitfields from the parse table format.
In all cases, bitfields were not necessary to achieve the
current binary sizes. Avoiding them makes the binaries more
portable.
There was no way to make this change backward-compatible,
so we have finally dropped support for parsers generated
with an earlier version of Tree-sitter.
At some point, when Atom adopts this version of Tree-sitter,
this change will affect Atom users who have installed packages
using third-party Tree-sitter parsers. The packages will need
to be updated to use a regenerated version of the parsers.
2021-02-25 16:12:31 -08:00
Andrew Hlynskyi
6448053efa
parser.c - added backslash escaping in LOG_LOOKAHEAD to make it clear in case of \n
2021-02-08 13:33:54 +02:00
Andrew Hlynskyi
51f8b16bb0
parser.c - make LOG_LOKAHEAD simpler according to disscussion in PR #917
2021-02-08 13:32:15 +02:00
Andrew Hlynskyi
f92ad04824
parser.c - added LOG_LOOKAHEAD macro to escape \n in logging
2021-02-08 06:23:55 +02:00
Max Brunsfeld
908b102786
Add more doc comments in the C lib
2020-10-23 12:15:44 -07:00
Max Brunsfeld
d533d1f076
Allocate parent nodes together with their child array
2020-10-23 12:15:44 -07:00
Hansraj Das
000455ee79
Multiple typo fixes
...
* This is a patch from neovim PR: https://github.com/neovim/neovim/pull/13063
2020-10-11 13:02:40 +05:30
Björn Linse
04eacc44ef
avoid warnings for implicit fallthrough in switch statements
2020-08-26 10:04:08 +02:00
Max Brunsfeld
81bbdf19f4
Fix handling of non-terminal extras that share non-extra rules
...
Fixes #701
2020-07-29 09:50:13 -07:00
Max Brunsfeld
253f23c3d4
Fix error when parse error occurs after non-terminal extra
2020-07-28 13:33:13 -07:00
Max Brunsfeld
0bf2450b4a
Always enforce stack version limit during reductions
...
Fixes #669
2020-07-06 15:58:33 -07:00
Max Brunsfeld
0e5ff14976
Requery the parse table when breaking down the parse stack on invalid lookahead ( #636 )
...
* Requery parse table after breaking down parse stack due to invalid lookahead
* Include Ruby parser in randomized test suite
Ruby and PHP are our only two languages that use non-terminal extras.
Adding Ruby uncovered some bugs.
* Print edited source code when running parse --edit w/ debug flag
* Recompute lookahead when breaking down stack on invalid lookahead
* Fix stack summary leak when there are two discontinuities on a stack version
2020-06-04 13:40:04 -07:00
Thomas Vigouroux
81d533d2d1
Fix compilation warnings ( #635 )
...
* lib: fix compilation warnings
* ci: add CFLAGS
2020-06-03 12:19:57 -07:00
Riccardo Schirone
780e9cecc9
Do not use multiple unnamed structs inside of unions
2020-04-29 20:42:45 +02:00
Max Brunsfeld
7f4828254f
Fix criteria for detecting when an aborted parse is resuming
2020-03-09 11:30:08 -07:00
Max Brunsfeld
31f3e866cf
📝 Add comment for non-terminal extra edge case
2020-03-02 14:21:03 -08:00
Max Brunsfeld
ee46218a73
Fix incremental parsing problem with non-terminal extras
...
Also add PHP grammar as a fixture to test against.
2020-03-02 14:17:12 -08:00
Max Brunsfeld
d8c3f472d2
Fix fallout from ts_language_next_state fix
2020-02-10 12:00:58 -08:00
Max Brunsfeld
7de36a33eb
Remove halt_on_error API
2020-01-27 15:36:09 -08:00
Max Brunsfeld
9f63139a10
Fix error when set_included_ranges is called with an invalid range list
2020-01-17 10:31:28 -08:00
Max Brunsfeld
0cb2ef1082
Fix code paths that still conflated null characters with EOF
2019-12-06 15:29:03 -08:00
Max Brunsfeld
fcaabea0cf
Allow non-terminal extras
2019-10-21 16:08:59 -07:00
Max Brunsfeld
64c6cf4473
Implicitly reset parser's state if language is changed after a timeout
2019-10-18 11:28:59 -07:00
Max Brunsfeld
aace0970d8
Tweak formatting, add comments
2019-08-19 17:31:35 -07:00
Max Brunsfeld
ef87ed6130
Check once for cancellation at the beginning of a parse
2019-08-19 17:31:35 -07:00
Max Brunsfeld
64fc944202
Fix missing criteria for leaf node reuse
2019-06-20 15:02:20 -07:00
Max Brunsfeld
0e046fc6c0
Fix bug when the assert macro is disabled
...
Fixes #364
2019-06-14 14:23:38 -07:00
Patrick Thomson
6e2a60629c
Make ts_tree_delete and ts_parser_delete NULL-safe.
...
Historically, `free(3)`-style functions have been NULL-safe, to make
resource handling functions more robust. This doesn't seem to be the
case with tree-sitter's `ts_tree_delete` and `ts_parser_delete` C
functions, which immediately dereference the passed pointer. This
leads to complexity in client libraries that have to ensure that trees
and parsers are cleaned up correctly.
This patch adds NULL checks to `parse_delete` and `tree_delete`. They
should have negligable performance impacts, since null checks are fast.
I didn't change the internal _delete functions, as arguably those
being NULL-unsafe is a feature, not a bug.
2019-05-30 11:47:56 -04:00
Max Brunsfeld
5035e194ff
Merge branch 'master' into node-fields
2019-03-26 11:58:21 -07:00
Max Brunsfeld
82358d3f2f
Merge pull request #307 from tree-sitter/pointer-sized-cancellation-flag
...
Make the cancellation flag a size_t, not a uint32_t
2019-03-22 12:30:39 -07:00
Max Brunsfeld
5a59f19b69
Use explicit syntax for functions with no parameters
2019-03-21 16:06:06 -07:00
Max Brunsfeld
74d154c706
Use CLOCK_MONOTONIC on platforms that support it
...
This way, timeouts will apply even if the current process
is starved for CPU.
2019-03-21 14:13:42 -07:00
Max Brunsfeld
0ccb910922
Use a size_t instead of a uint32_t for cancellation flag
2019-03-21 11:26:05 -07:00
Max Brunsfeld
3340168097
Fix backwards logic for cancellation flag
2019-03-20 17:02:07 -07:00
Max Brunsfeld
0ae304f582
Lib: Rework the API for cancelling a parse
...
Also, use beta on CI until atomic::AtomicU32 lands in stable.
2019-03-18 09:51:21 -07:00
Jacob Mitchell
c8d040ca26
Use 1-indexed rows in CLI and log output ( resolves #287 )
2019-03-14 22:21:19 -07:00
Max Brunsfeld
59fd8528d4
Avoid division rounding errors w/ clock counts
2019-03-14 15:53:45 -07:00
Max Brunsfeld
88e3907cc0
Use QueryPerformanceFrequency as clock on windows
2019-03-14 13:42:31 -07:00
Max Brunsfeld
430f8874ea
Lib: reduce frequency of clock calls during parsing
2019-03-14 11:52:25 -07:00
Max Brunsfeld
cddb3e416d
Replace operation limit API with a clock-based timeout API
2019-03-14 11:13:38 -07:00
Max Brunsfeld
56309a1c28
Generate node-fields.json file
2019-02-12 11:06:18 -08:00
Max Brunsfeld
1d1674811c
Fully implement ts_node_child_by_field_id
2019-02-08 15:16:56 -08:00
Max Brunsfeld
18a13b457d
Get basic field API working
2019-02-08 15:16:56 -08:00
Max Brunsfeld
213ccfd3a4
Update trees' metadata bits when setting symbol back to word token
2019-01-29 15:30:13 -08:00
Max Brunsfeld
233d616ebf
Add random mutation tests
2019-01-25 12:05:21 -08:00
Max Brunsfeld
0f2347b318
Just call the C lib 'the library' everywhere, don't call it a 'runtime'
2019-01-10 15:22:39 -08:00
Max Brunsfeld
98807d2053
Add debug and debug-graph flags to parse and test commands
2019-01-08 21:03:51 -08:00
Max Brunsfeld
dd416b0955
Update include paths to not reference 'runtime' directory
2019-01-04 17:33:34 -08:00
Max Brunsfeld
47607cecf4
Reorganize repo, add rust CLI and binding code,
2019-01-04 17:31:49 -08:00