An incremental parsing system for programming tools https://tree-sitter.github.io
Find a file
Douglas Creager a29c8d9264 Move allocation tracking into lib crate
We have several test cases defined in the `cli` crate that depend on the
`lib` crate's `allocation-tracking` feature.  The implementation of the
actual allocation tracker used to live in the `cli` crate, close to the
test cases that use it.  The `allocation-tracking` feature in the `lib`
crate was just used to tell the tree-sitter implementation to expect
that the allocation tracker exists, and to use it.

That pattern meant that we had a circular dependency: `cli` depends on
`lib`, but `lib` required some code that was implemented in `cli`.
That, in turn, caused linker errors — but only when compiling in certain
configurations! [1]

This patch moves all of the allocation tracking implementation into the
`lib` crate, gated on the existing `allocation-tracking` feature, which
fixes the circular dependency.

Note that this patch does **not** fix the fact that feature unification
causes the `lib` crate to be built with the `allocation-tracking`
feature enabled, even though it's not a default.  Fixing that depends on
the forthcoming version 2 feature resolver [2], or using the `dev_dep`
workaround [3] in the meantime.

[1] https://github.com/tree-sitter/tree-sitter/issues/919
[2] https://doc.rust-lang.org/nightly/cargo/reference/features.html#feature-resolver-version-2
[3] https://github.com/tree-sitter/tree-sitter/issues/919#issuecomment-777107086
2021-02-23 09:16:37 -05:00
.github/workflows Don't rely on bash 4.0 to lowercase platform name on CI 2021-02-11 17:08:14 -08:00
cli Move allocation tracking into lib crate 2021-02-23 09:16:37 -05:00
docs Update Elm link 2021-02-01 02:32:16 +01:00
highlight highlight: Make README snippets compile 2020-11-24 12:35:38 +01:00
lib Move allocation tracking into lib crate 2021-02-23 09:16:37 -05:00
script Merge pull request #906 from tree-sitter/unicode-property-escapes 2021-02-17 16:14:42 -08:00
tags tags: fix compilation on aarch64 2020-11-13 19:01:57 +06:00
test Expand tests for unicode property escapes 2021-02-17 13:29:30 -08:00
.appveyor.yml Restore the appveyor config file 2021-02-05 11:09:37 -08:00
.gitattributes lib: remove utf8proc dependency (#436) 2019-10-14 11:18:39 -07:00
.gitignore Start work on restructuring query implementation to deal w/ optionals and repeats better 2020-05-07 12:41:25 -07:00
Cargo.lock Move allocation tracking into lib crate 2021-02-23 09:16:37 -05:00
Cargo.toml Move code into cli directory 2019-01-04 16:50:52 -08:00
CONTRIBUTING.md Tweak readmes 2020-05-12 16:16:48 -07:00
LICENSE Add boilerplate 2018-05-17 14:46:29 -07:00
Makefile Fix compilation warnings (#635) 2020-06-03 12:19:57 -07:00
README.md Put GH actions badge in the README 2021-02-05 12:22:46 -08:00
tree-sitter.pc.in Add a simple Makefile-based build system. 2020-04-21 23:49:19 -04:00

tree-sitter

Build Status Build status

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
  • Fast enough to parse on every keystroke in a text editor
  • Robust enough to provide useful results even in the presence of syntax errors
  • Dependency-free so that the runtime library (which is written in pure C) can be embedded in any application