mesquite_powershell 0.2.0

The PowerShell grammar for Mesquite (pure-Rust tree-sitter), from tree-sitter-powershell 0.26.3
Documentation
# Mesquite

Mesquite is a pure, safe Rust port of [tree-sitter](https://github.com/tree-sitter/tree-sitter)
0.25.10 and 58 grammars.

- **Pure Rust.** No C sources, build scripts or C compiler. The only external
  dependencies are `regex` and `streaming-iterator`.
- **Safe.** Every crate has `#![forbid(unsafe_code)]`.
- **Drop-in names.** The runtime's library is `tree_sitter` and follows tree-sitter's
  Rust API. Each grammar crate's library and constants are named like the upstream
  crate's (`tree_sitter_rust::LANGUAGE`), so most code that uses tree-sitter only needs
  its `Cargo.toml` changed.
- **Same results as C.** Trees, incremental reparses, query results and progress
  callbacks match the C library's, apart from a few [C bugs it fixes]docs/api-differences.md#fixes.

## Languages

Astro, Bash, C, C#, C++, CMake, CSS, CUDA, Dart, Diff, Elixir, Elm, Embedded templates
(ERB, EJS), Erlang, F#, Fortran, GLSL, Go, GraphQL, Haskell, HCL, HTML, Java, JavaScript,
JSDoc, JSON, Julia, Kotlin, Lua, Make, Markdown, Objective-C, OCaml, Odin, Perl, PHP,
PowerShell, Protocol Buffers, Python, R, Ruby, Rust, Scala, Solidity, SQL, Svelte, Swift,
TOML, TypeScript and TSX, Verilog, XML and DTD, YAML, Zig.

The crates, their upstream versions and their constants are listed in
[docs/grammars.md](docs/grammars.md).

## Speed

Parse time relative to C tree-sitter 0.25.10 with the same grammars (below 1 is faster),
with C built by GCC 13.4 or Clang 21.1.

| Inputs | GCC 13.4 | Clang 21.1 |
|---|---:|---:|
| All 58 grammars (geometric mean) | 0.71 | 0.72 |
| C (Linux kernel) | 0.62 | 0.68 |
| C++ | 0.72 | 0.73 |
| Rust | 0.68 | 0.71 |
| Python | 0.71 | 0.75 |
| TypeScript | 0.71 | 0.75 |
| JavaScript | 0.72 | 0.75 |
| Go | 0.66 | 0.80 |
| Java | 0.66 | 0.79 |

Mesquite is faster on 57 of the 58 grammars. Its large grammar tables are read in place
from the binary, as C reads its static arrays, so a grammar's first use takes at most 0.1
ms. Every grammar, memory, binary size, reparsing, the machine, the method and how to
compare on your own files are in [docs/speed.md](docs/speed.md).

## Installation

Add the runtime and a grammar crate for each language you parse:

```toml
[dependencies]
mesquite = "0.26.0"
mesquite_rust = "0.2.0"
```

The library names are `tree_sitter` and `tree_sitter_rust`, so `use tree_sitter::...`
lines stay as they are. To keep upstream's dependency names as well, rename the packages:

```toml
[dependencies]
tree-sitter = { package = "mesquite", version = "0.26.0" }
tree-sitter-rust = { package = "mesquite_rust", version = "0.2.0" }
```

Mesquite 0.26 still follows tree-sitter 0.25.10. Its version moved past 0.25 when the
grammar crates' tables changed, so it needs the 0.2 grammar crates. The crates use the
2024 edition and need Rust 1.89 or later.

## Usage

```rust
use tree_sitter::{Parser, Query, QueryCursor, StreamingIterator};

let mut parser = Parser::new();
parser
    .set_language(&tree_sitter_rust::LANGUAGE.into())
    .expect("Error loading Rust grammar");
let source = "fn main() {}";
let tree = parser.parse(source, None).unwrap();
assert_eq!(
    tree.root_node().to_sexp(),
    "(source_file (function_item name: (identifier) parameters: (parameters) body: (block)))"
);

let query = Query::new(
    &tree_sitter_rust::LANGUAGE.into(),
    "(function_item name: (identifier) @name)",
)
.unwrap();
let mut cursor = QueryCursor::new();
let mut matches = cursor.matches(&query, tree.root_node(), source.as_bytes());
while let Some(found) = matches.next() {
    for capture in found.captures.iter() {
        println!("{}", capture.node.utf8_text(source.as_bytes()).unwrap());
    }
}
```

## Documentation

- [Grammars]docs/grammars.md: every grammar crate, its upstream crate and constants,
  and the repository layout.
- [Differences]docs/api-differences.md from tree-sitter 0.25.10: chiefly the missing C
  API and WebAssembly support, a `Parser` that is `Send` but not `Sync`, and the C bugs
  the port fixes.
- [Speed]docs/speed.md: the full comparison with C.

## Tests

```sh
cargo test --workspace
```

## License

MIT, like tree-sitter and most of the grammars. Four grammars are Apache-2.0 (Astro,
Elixir, Erlang and HCL). The copyright notices are in [NOTICE](NOTICE), and the license
texts in [LICENSE](LICENSE), `runtime/LICENSE`, `tables/LICENSE` and
`grammars/<key>/LICENSE`.