Reset result_symbol field of lexer in wasm memory in between invocations#4218
Merged
maxbrunsfeld merged 1 commit intomasterfrom Feb 18, 2025
Merged
Reset result_symbol field of lexer in wasm memory in between invocations#4218maxbrunsfeld merged 1 commit intomasterfrom
result_symbol field of lexer in wasm memory in between invocations#4218maxbrunsfeld merged 1 commit intomasterfrom
Conversation
401c059 to
053203b
Compare
|
Successfully created backport PR for |
|
Git push to origin failed for release-0.24 with exitcode 1 |
|
Successfully created backport PR for |
|
Git push to origin failed for release-0.25 with exitcode 1 |
maxbrunsfeld
added a commit
to zed-industries/zed
that referenced
this pull request
Feb 18, 2025
…25054) Closes #24742 Closes #24632 This PR bumps Tree-sitter to bring in bug fixes: * tree-sitter/tree-sitter#4218 * tree-sitter/tree-sitter#4213 * tree-sitter/tree-sitter#4210 I've also bumped Wasmtime and wit-bindgen, since the new Tree-sitter uses a newer wasmtime. Release Notes: - Fixed a parsing bug that caused memory leaks and crashes when using the Ansible extension --------- Co-authored-by: Anthony <anthony@zed.dev> Co-authored-by: Anthony Eid <hello@anthonyeid.me>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Normally, the external scanners are expected to assign to the
result_symbolfield of theTSLexerbefore returning true. But if they don't assign it, it is initialized with a default value of zero (the first external token, whatever that is).Currently, the tree-sitter-yaml external scanner (and possibly others) rely on this zero value, and sometimes return true without writing to it.
Problem
When running external scanners loaded from WASM, we did not reset
result_symbolin between invocations of the lexer, so lexer'sresult_symbolvalue would depend on what was returned from the previous call.This PR fixes that.