Commit graph

23 commits

Author SHA1 Message Date
Max Brunsfeld
9b485924d6 Fix invalid parse stack recursive merging with mismatched error cost
Allowing this invalid merge caused an invariant to be violated
later on during parsing, when handling a later error.

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
Co-authored-by: Marshall <marshall@zed.dev>
2024-02-26 20:16:21 -05:00
dundargoc
ce191e02c5 fix: use correct printf specifiers 2024-02-08 22:46:43 +01:00
dundargoc
ff367ebf4c build: enable -pedantic
Co-authored-by: Patrick Thomson <patrickt@github.com>
2024-02-08 16:12:54 +01:00
Max Brunsfeld
9564e1706d Fix error recovery regression due to stack node_count change 2023-08-17 17:21:31 -07:00
Amaan Qureshi
05a4f9f3e3
Merge pull request #1411 from aminya/c-warnings
Fix compiling C library with Clang on Windows
2023-08-03 13:39:52 -04:00
Amaan Qureshi
13f6ec2b0c
fix: rename shadowed variables from -Wshadow warnings and apply some useful clang-tidy warnings 2023-07-19 18:12:26 -04:00
Matt
8751fa0853
Add explicit casting for array capacities 2022-09-21 15:52:44 -04:00
Max Brunsfeld
254edb0ec8 Include captured summary information in stack debug graphs 2022-07-07 17:53:54 -07:00
Max Brunsfeld
3ac36b0cbe Handle backslashes in token names when printing DOT debug graphs 2022-06-25 17:13:11 -07:00
Max Brunsfeld
0bdd9b640c Store the lookahead subtree of paused stack versions, not just the lookahead symbol 2022-02-22 09:45:26 -08:00
Amin Yahyaabadi
94ffcdadf3 Mark stack__iter as static
Fixes
```
warning: In file included from src\lib.c:14:
warning: src/./stack.c:311:9: warning: static function 'ts_stack__add_slice' is used in an inline function with external linkage [-Wstatic-in-inline]
warning:         ts_stack__add_slice(
warning:         ^
warning: src/./stack.c:274:1: note: use 'static' to give inline function 'stack__iter' internal linkage
warning: inline StackSliceArray stack__iter(Stack *self, StackVersion version,
warning: ^
warning: static
warning: src/./stack.c:15:16: note: expanded from macro 'inline'
warning: #define inline __forceinline
warning:                ^
warning: src/./stack.c:258:13: note: 'ts_stack__add_slice' declared here
warning: static void ts_stack__add_slice(Stack *self, StackVersion original_version,
warning:             ^
warning: 1 warning generated.
    Finished dev [unoptimized + debuginfo] target(s) in 2.01s
```
2022-01-21 22:39:38 -08:00
Max Brunsfeld
584b55df8d Delete unused code, tweak whitespace 2022-01-19 16:54:57 -08:00
Max Brunsfeld
622359b400 Simplify allocation-recording in test suite using new ts_set_allocator API 2021-12-30 16:09:07 -08:00
Claudi Lleyda Moltó
8e4509e47b
Fix: cast pointers to void * when printing
To avoid undefined behaviour, pointers should be cast to `void *` when
printed with `%p`.
2021-05-21 12:36:58 +02:00
Max Brunsfeld
d533d1f076 Allocate parent nodes together with their child array 2020-10-23 12:15:44 -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
Patrick Thomson
39bfcdf595 Fix build with MinGW tooling. (#514)
Courtesy of @Eli-Zaretskii, these fixes should unblock people from
building tree-sitter with MinGW.

I don't think this is an unreasonable maintenance burden, especially
given the Emacs project's interest in using tree-sitter, but
@maxbrunsfeld gets the final call.
2020-01-06 09:21:40 -08:00
Max Brunsfeld
bc5e71bcc2 Fix handling of zero-width external tokens at beginning of document
Fixes #316
2019-04-08 15:01:52 -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
006a931ab8 Tests: Prevent array reallocations during ts_stack_print_dot_graph
When debugging a test with 'script/test -D', the DOT-graph generation
code was sometimes causing reallocations that were not captured by the
allocation tracker, because we explicitly disable allocation-tracking
for that method in order to reduce noise when debugging memory leaks.

By growing the relevant array *prior* to turning off allocation
tracking, we can ensure that it is not reallocated within that function,
avoiding false positive memory leak errors.

Fixes #302
2019-03-14 13:59:12 -07: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