intitni / SwiftTreeSitter

Swift API for the tree-sitter incremental parsing system

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status License Platforms Documentation

SwiftTreeSitter

Swift API for the tree-sitter incremental parsing system.

  • Close to full coverage of the C API
  • Swift/Foundation types where possible
  • Standard query result mapping for highlights and injections
  • Query predicate support via ResolvingQueryCursor

SwiftTreeSitter is fairly low-level. If you are looking a higher-level system for syntax highlighting and other syntactic operations, you might want to have a look at Neon.

πŸ“– Documentation is available in DocC format.

Integration

dependencies: [
    .package(url: "https://github.com/ChimeHQ/SwiftTreeSitter")
]

TreeSitterDocument

This is an experimental target that ties together a lot of the tree-sitter highlighting concepts into one easier-to-use library. It is currently experimental.

Language Parsers

Tree-sitter language parsers are separate projects, and you'll probably need at least one. More details are available in the documentation. How they can be installed an incorporated varies. Since you're here, you might find SPM the most convenient.

Parser Make SPM Official Repo
Bash βœ… βœ…
C βœ… βœ…
C++ βœ… βœ…
C# βœ… βœ…
Clojure βœ…
CMake
Comment
CSS βœ… βœ…
D
Dart
Dockerfile βœ… βœ… βœ…
Diff βœ… βœ…
Elixir βœ… βœ… βœ…
Elm βœ… βœ…
Erlang
Fish
Fortran
gitattributes
gitignore
Go βœ… βœ… βœ…
GoMod βœ… βœ… βœ…
GoWork βœ…
graphql
Hack
Haskell βœ… βœ…
HCL βœ… βœ…
HTML βœ… βœ…
Java βœ… βœ… βœ…
Javascript βœ… βœ…
JSON βœ… βœ… βœ…
Json5
JSDoc βœ… βœ…
Julia βœ… βœ…
Kotlin βœ…
Latex βœ… βœ…
LLVM
Lua βœ… βœ…
Make
Markdown βœ… βœ…
Markdown βœ…
OCaml βœ… βœ…
Pascal
Perl βœ… βœ…
PHP βœ… βœ… βœ…
PowerShell
Python βœ… βœ…
R
Racket
Regex
Ruby βœ… βœ… βœ…
Rust βœ… βœ…
Scala βœ… βœ…
Scheme
Scss
SQL βœ… βœ…
Sqlite
SSH βœ… βœ…
Swift βœ… βœ… βœ…
TOML βœ…
Tree-sitter query language βœ… βœ…
Typescript βœ… βœ…
Verilog βœ… βœ…
Vue
YAML βœ…
Zig βœ… βœ… βœ…

Contributing and Collaboration

I'd love to hear from you! Get in touch via an issue or pull request.

I prefer collaboration, and would love to find ways to work together if you have a similar project.

I prefer indentation with tabs for improved accessibility. But, I'd rather you use the system you want and make a PR than hesitate because of whitespace.

By participating in this project you agree to abide by the Contributor Code of Conduct.

About

Swift API for the tree-sitter incremental parsing system

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Swift 99.7%Language:Scheme 0.3%