Commit graph

36 commits

Author SHA1 Message Date
Douglas Creager
66c30648c2 rust: Extract runtime language detection into separate crate
This patch adds a new `tree-sitter-loader` crate, which holds the CLI's
logic for finding and building local grammar definitions at runtime.
This allows other command-line tools to use this logic too!
2021-06-09 17:42:30 -04:00
Douglas Creager
d2d01e77e3 cli: Use anyhow and thiserror for errors
This patch updates the CLI to use anyhow and thiserror for error
management.  The main feature that our custom `Error` type was providing
was a _list_ of messages, which would allow us to annotate "lower-level"
errors with more contextual information.  This is exactly what's
provided by anyhow's `Context` trait.

(This is setup work for a future PR that will pull the `config` and
`loader` modules out into separate crates; by using `anyhow` we wouldn't
have to deal with a circular dependency between with the new crates.)
2021-06-09 16:17:23 -04:00
hvithrafn
05f79f0f90 Update dependencies; fix breakage 2021-02-26 10:55:20 -07:00
Max Brunsfeld
ba239ce4ab Make query error line numbers consistently display 1-indexed 2020-09-24 15:03:51 -07:00
Max Brunsfeld
518916f221 Return correct path and line in query errors from the CLI 2020-09-24 13:47:27 -07:00
Max Brunsfeld
de2b71d465 Fix query bug when max permutations are exceeded 2020-07-23 16:05:50 -07:00
Max Brunsfeld
1b3a67834b cli: Fix loading of tags query 2020-03-13 16:13:31 -07:00
Max Brunsfeld
feac368a30 Start work on new tree-sitter-tags crate
Co-Authored-By: Patrick Thomson <patrickt@users.noreply.github.com>
2020-03-04 14:27:31 -08:00
Max Brunsfeld
6dbfbaed07 Start work on a system for testing syntax highlighting 2019-12-05 09:45:54 -08:00
Max Brunsfeld
075a552430 Tweak how highlight query paths are specified in package.json 2019-10-17 10:14:05 -07:00
Max Brunsfeld
7c8216c692 highlight: Handle injections correctly, using a separate query cursor 2019-10-14 12:30:22 -07:00
Max Brunsfeld
f4903578f8 Start reimplementing highlight crate with tree queries 2019-10-14 12:30:22 -07:00
Max Brunsfeld
4d63697036 cli: Fix loading of parsers with no tree-sitter section in package.json 2019-08-11 09:21:49 -07:00
Max Brunsfeld
93f7de03e2 cli: Handle multi-parser repos, content-regex property
Prompted by tree-sitter/tree-sitter-typescript#68
2019-08-07 17:41:45 -07:00
Max Brunsfeld
d274e81d0d Overhaul CLI error handling to allow multiple levels of context 2019-05-30 16:52:55 -07:00
Max Brunsfeld
5bb06682d5 Allow dynamically loading grammars w/ no package.json file 2019-05-30 12:05:53 -07:00
Max Brunsfeld
2bd14a8463 Build parsers with debug symbols 2019-04-05 13:04:37 -07:00
Max Brunsfeld
363079bf3e Re-enable HTML language in benchmarks
Made possible by this error recovery performance fix:
4c7d5fe26c
2019-03-03 18:23:01 -08:00
Max Brunsfeld
d2264d597f cli: Add --scope flag to highlight command 2019-02-20 14:38:19 -08:00
Max Brunsfeld
a46515b80f Replace LanguageRegistry trait with a simple callback 2019-02-19 17:07:12 -08:00
Max Brunsfeld
e89b6b2402 Add a highlight subcommand 2019-02-19 12:32:03 -08:00
Max Brunsfeld
57c528b6c5 CLI: Determine language symbol from grammar, not package.json
Fixes #272
Fixes #277
2019-02-13 19:31:26 -08:00
Max Brunsfeld
4dc475b18c cli: Compile C++ external scanners with exceptions disabled 2019-02-06 16:19:08 -08:00
Max Brunsfeld
ccbb8c1cce Add context to error message when opening dynamic libraries 2019-02-06 16:03:50 -08:00
Max Brunsfeld
18085b9eb9 cli: Compile C++ files first when loading parsers 2019-02-06 13:07:03 -08:00
Max Brunsfeld
92a6a69625 cli: Don't error if parser load path contains a non-existent dir 2019-02-06 12:59:19 -08:00
Max Brunsfeld
4cac85fec4 Add benchmark script
* Structure `cli` crate as both a library and an executable, so that
benchmarks can import code from the crate.
* Import macros in the Rust 2018 style.
2019-02-01 15:17:35 -08:00
Max Brunsfeld
cbcc61a8cf Get parse command handling multiple files, add --time, --quiet flags 2019-01-17 17:15:10 -08:00
Max Brunsfeld
e4b9d9dfa9 Fix token conflict detection bugs 2019-01-16 20:57:31 -08:00
Max Brunsfeld
ae07d2d6e4 Build 32-bit executables on 32-bit appveyor builds 2019-01-16 19:22:33 -08:00
Max Brunsfeld
0ee11584a7 Add -xc compiler flag for pure-C external scanners 2019-01-15 16:19:47 -08:00
Max Brunsfeld
0a2d72d956 Determine language name from package.json, not directory 2019-01-15 13:21:48 -08:00
Max Brunsfeld
a8292f4fe9 Load all fixture grammars dynamically
This way the build doesn't take forever any time a single grammar has 
been regenerated.
2019-01-15 13:21:48 -08:00
Max Brunsfeld
fa283dcf27 Use the compiler environment vars computed by the cc config 2019-01-11 14:44:32 -08:00
Max Brunsfeld
e64f7a64a1 Start work on running test corpus tests 2019-01-11 13:31:06 -08:00
Max Brunsfeld
8291d294fb Add test subcommand
Co-Authored-By: Timothy Clem <timothy.clem@gmail.com>
2019-01-07 17:57:27 -08:00