docs: various fixes
Closes https://github.com/tree-sitter/tree-sitter/issues/1317. Closes https://github.com/tree-sitter/tree-sitter/issues/1752. Closes https://github.com/tree-sitter/tree-sitter/issues/2439. Co-authored-by: Simon Hengel <sol@typeful.net> Co-authored-by: Akash Yadav <itsaky01@gmail.com> Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com> Co-authored-by: Laytan Laats <laytanlaats@hotmail.com>
This commit is contained in:
parent
ea7f6e1fa3
commit
df1fe842eb
15 changed files with 21 additions and 20 deletions
|
|
@ -1,11 +1,7 @@
|
|||
# tree-sitter
|
||||
|
||||
[![CICD badge]][CICD]
|
||||
[](https://zenodo.org/badge/latestdoi/14164618)
|
||||
|
||||
[CICD badge]: https://github.com/tree-sitter/tree-sitter/actions/workflows/CICD.yml/badge.svg
|
||||
[CICD]: https://github.com/tree-sitter/tree-sitter/actions/workflows/CICD.yml
|
||||
|
||||
Tree-sitter is a parser generator tool and an incremental parsing library. It can build a concrete syntax tree for a source file and efficiently update the syntax tree as the source file is edited. Tree-sitter aims to be:
|
||||
|
||||
- **General** enough to parse any programming language
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ impl<'a> ParseItemSetBuilder<'a> {
|
|||
}
|
||||
|
||||
// The FIRST set of a non-terminal `i` is the union of the following sets:
|
||||
// * the set of all terminals that appear at the beginings of i's productions
|
||||
// * the set of all terminals that appear at the beginnings of i's productions
|
||||
// * the FIRST sets of all the non-terminals that appear at the beginnings
|
||||
// of i's productions
|
||||
//
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use tree_sitter::Parser;
|
|||
// The `sanitizing` cfg is required to don't run tests under specific sunitizer
|
||||
// because they don't work well with subprocesses _(it's an assumption)_.
|
||||
//
|
||||
// Bellow are two alternative examples of how to disable tests for some arches
|
||||
// Below are two alternative examples of how to disable tests for some arches
|
||||
// if a way with excluding the whole mod from compilation wouldn't work well.
|
||||
//
|
||||
// XXX: Also may be it makes sense to keep such tests as ignored by default
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ fn test_tree_edit() {
|
|||
}
|
||||
|
||||
// edit starting in the tree's padding but extending into its content:
|
||||
// shrink the content to compenstate for the expanded padding.
|
||||
// shrink the content to compensate for the expanded padding.
|
||||
{
|
||||
let mut tree = tree.clone();
|
||||
tree.edit(&InputEdit {
|
||||
|
|
|
|||
|
|
@ -20,14 +20,16 @@ There are currently bindings that allow Tree-sitter to be used from the followin
|
|||
* [Guile](https://github.com/Z572/guile-ts)
|
||||
* [Haskell](https://github.com/tree-sitter/haskell-tree-sitter)
|
||||
* [Java](https://github.com/serenadeai/java-tree-sitter)
|
||||
* [Java (Android)](https://github.com/AndroidIDEOfficial/android-tree-sitter)
|
||||
* [JavaScript (Node.js)](https://github.com/tree-sitter/node-tree-sitter)
|
||||
* [JavaScript (Wasm)](https://github.com/tree-sitter/tree-sitter/tree/master/lib/binding_web)
|
||||
* [Kotlin](https://github.com/oxisto/kotlintree)
|
||||
* [Lua](https://github.com/euclidianAce/ltreesitter)
|
||||
* [OCaml](https://github.com/returntocorp/ocaml-tree-sitter-core)
|
||||
* [Odin](https://github.com/laytan/odin-tree-sitter)
|
||||
* [Perl](https://metacpan.org/pod/Text::Treesitter)
|
||||
* [Python](https://github.com/tree-sitter/py-tree-sitter)
|
||||
* [Ruby](https://github.com/tree-sitter/ruby-tree-sitter)
|
||||
* [Ruby](https://github.com/Faveod/ruby-tree-sitter)
|
||||
* [Ruby](https://github.com/calicoday/ruby-tree-sitter-ffi)
|
||||
* [Rust](https://github.com/tree-sitter/tree-sitter/tree/master/lib/binding_rust)
|
||||
* [Swift](https://github.com/ChimeHQ/SwiftTreeSitter)
|
||||
|
|
@ -94,7 +96,8 @@ There are currently bindings that allow Tree-sitter to be used from the followin
|
|||
* [LLVM MachineIR](https://github.com/Flakebi/tree-sitter-llvm-mir)
|
||||
* [LLVM MLIR](https://github.com/artagnon/tree-sitter-mlir)
|
||||
* [LLVM TableGen](https://github.com/Flakebi/tree-sitter-tablegen)
|
||||
* [Lua](https://github.com/Azganoth/tree-sitter-lua)
|
||||
* [Lua](https://github.com/MunifTanjim/tree-sitter-lua)
|
||||
* [Magik](https://github.com/krn-robin/tree-sitter-magik)
|
||||
* [Make](https://github.com/alemuller/tree-sitter-make)
|
||||
* [Markdown](https://github.com/ikatyang/tree-sitter-markdown)
|
||||
* [Markdown](https://github.com/MDeiml/tree-sitter-markdown)
|
||||
|
|
@ -106,6 +109,7 @@ There are currently bindings that allow Tree-sitter to be used from the followin
|
|||
* [Noir](https://github.com/hhamud/tree-sitter-noir)
|
||||
* [Objective-C](https://github.com/jiyee/tree-sitter-objc)
|
||||
* [OCaml](https://github.com/tree-sitter/tree-sitter-ocaml)
|
||||
* [Odin](https://github.com/amaanq/tree-sitter-odin)
|
||||
* [Org](https://github.com/milisims/tree-sitter-org)
|
||||
* [P4](https://github.com/ace-design/tree-sitter-p4)
|
||||
* [Pascal](https://github.com/Isopod/tree-sitter-pascal)
|
||||
|
|
@ -142,6 +146,7 @@ There are currently bindings that allow Tree-sitter to be used from the followin
|
|||
* [SQL - PostgreSQL](https://github.com/m-novikov/tree-sitter-sql)
|
||||
* [SQL - SQLite](https://github.com/dhcmrlchtdj/tree-sitter-sqlite)
|
||||
* [SSH](https://github.com/metio/tree-sitter-ssh-client-config)
|
||||
* [Supercollider](https://github.com/madskjeldgaard/tree-sitter-supercollider)
|
||||
* [Svelte](https://github.com/Himujjal/tree-sitter-svelte)
|
||||
* [Swift](https://github.com/alex-pinkus/tree-sitter-swift)
|
||||
* [SystemRDL](https://github.com/SystemRDL/tree-sitter-systemrdl)
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ TSTree *ts_parser_parse(
|
|||
);
|
||||
```
|
||||
|
||||
The `TSInput` structure lets you to provide your own function for reading a chunk of text at a given byte offset and row/column position. The function can return text encoded in either UTF8 or UTF16. This interface allows you to efficiently parse text that is stored in your own data structure.
|
||||
The `TSInput` structure lets you provide your own function for reading a chunk of text at a given byte offset and row/column position. The function can return text encoded in either UTF8 or UTF16. This interface allows you to efficiently parse text that is stored in your own data structure.
|
||||
|
||||
```c
|
||||
typedef struct {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ permalink: creating-parsers
|
|||
|
||||
# Creating parsers
|
||||
|
||||
Developing Tree-sitter grammars can have a difficult learning curve, but once you get the hang of it, it can be fun and even zen-like. This document will help get you to get started and to develop a useful mental model.
|
||||
Developing Tree-sitter grammars can have a difficult learning curve, but once you get the hang of it, it can be fun and even zen-like. This document will help you to get started and to develop a useful mental model.
|
||||
|
||||
## Getting Started
|
||||
|
||||
|
|
|
|||
|
|
@ -824,7 +824,7 @@ extern "C" {
|
|||
pub fn ts_wasm_store_language_count(arg1: *const TSWasmStore) -> usize;
|
||||
}
|
||||
extern "C" {
|
||||
#[doc = " Check if the language came from a Wasm module. If so, then in order to use\n this langauge with a Parser, that parser must have a Wasm store assigned."]
|
||||
#[doc = " Check if the language came from a Wasm module. If so, then in order to use\n this language with a Parser, that parser must have a Wasm store assigned."]
|
||||
pub fn ts_language_is_wasm(arg1: *const TSLanguage) -> bool;
|
||||
}
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -1208,7 +1208,7 @@ size_t ts_wasm_store_language_count(const TSWasmStore *);
|
|||
|
||||
/**
|
||||
* Check if the language came from a Wasm module. If so, then in order to use
|
||||
* this langauge with a Parser, that parser must have a Wasm store assigned.
|
||||
* this language with a Parser, that parser must have a Wasm store assigned.
|
||||
*/
|
||||
bool ts_language_is_wasm(const TSLanguage *);
|
||||
|
||||
|
|
|
|||
|
|
@ -1768,7 +1768,7 @@ static unsigned ts_parser__condense_stack(TSParser *self) {
|
|||
}
|
||||
}
|
||||
|
||||
// Enfore a hard upper bound on the number of stack versions by
|
||||
// Enforce a hard upper bound on the number of stack versions by
|
||||
// discarding the least promising versions.
|
||||
while (ts_stack_version_count(self->stack) > MAX_VERSION_COUNT) {
|
||||
ts_stack_remove_version(self->stack, MAX_VERSION_COUNT);
|
||||
|
|
|
|||
|
|
@ -3849,7 +3849,7 @@ static inline bool ts_query_cursor__advance(
|
|||
continue;
|
||||
}
|
||||
|
||||
// Enfore the longest-match criteria. When a query pattern contains optional or
|
||||
// Enforce the longest-match criteria. When a query pattern contains optional or
|
||||
// repeated nodes, this is necessary to avoid multiple redundant states, where
|
||||
// one state has a strict subset of another state's captures.
|
||||
bool did_remove = false;
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@
|
|||
* https://docs.wasmtime.dev/api/wasmtime/struct.Config.html#method.async_support
|
||||
*
|
||||
* All WebAssembly executes synchronously, but an async support enables the Wasm code
|
||||
* be executed on a seperate stack, so it can be paused and resumed. There are three
|
||||
* be executed on a separate stack, so it can be paused and resumed. There are three
|
||||
* mechanisms for yielding control from wasm to the caller: fuel, epochs, and async host functions.
|
||||
*
|
||||
* When WebAssembly is executed, a #wasmtime_call_future_t is returned. This struct represents the
|
||||
* state of the execution and each call to #wasmtime_call_future_poll will execute the WebAssembly
|
||||
* code on a seperate stack until the function returns or yields control back to the caller.
|
||||
* code on a separate stack until the function returns or yields control back to the caller.
|
||||
*
|
||||
* It's expected these futures are pulled in a loop until completed, at which point the future
|
||||
* should be deleted. Functions that return a #wasmtime_call_future_t are special in that all
|
||||
|
|
|
|||
|
|
@ -337,7 +337,7 @@ WASM_API_EXTERN wasmtime_error_t* wasmtime_config_cache_config_load(wasm_config_
|
|||
*
|
||||
* This option defaults to the native host. Calling this method will
|
||||
* additionally disable inference of the native features of the host (e.g.
|
||||
* detection of SSE4.2 on x86_64 hosts). Native features can be reenabled with
|
||||
* detection of SSE4.2 on x86_64 hosts). Native features can be re-enabled with
|
||||
* the `cranelift_flag_{set,enable}` properties.
|
||||
*
|
||||
* For more information see the Rust documentation at
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@ WASM_API_EXTERN bool wasmtime_linker_get(
|
|||
);
|
||||
|
||||
/**
|
||||
* \brief Preform all the checks for instantiating `module` with the linker,
|
||||
* \brief Perform all the checks for instantiating `module` with the linker,
|
||||
* except that instantiation doesn't actually finish.
|
||||
*
|
||||
* \param linker the linker used to instantiate the provided module.
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ typedef struct wasmtime_store wasmtime_store_t;
|
|||
* \brief An interior pointer into a #wasmtime_store_t which is used as
|
||||
* "context" for many functions.
|
||||
*
|
||||
* This context pointer is used pervasively throught Wasmtime's API. This can be
|
||||
* This context pointer is used pervasively throughout Wasmtime's API. This can be
|
||||
* acquired from #wasmtime_store_context or #wasmtime_caller_context. The
|
||||
* context pointer for a store is the same for the entire lifetime of a store,
|
||||
* so it can safely be stored adjacent to a #wasmtime_store_t itself.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue