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
Mark Schmitz
b1c7768cc2
Output also HTML_FOOTER with highlight --html ( #550 )
...
* Output also HTML_FOOTER with highlight --html
* move html footer output after end of for loop, as only one closing tag
is needed
2020-03-02 15:04:15 -08:00
Max Brunsfeld
ee46218a73
Fix incremental parsing problem with non-terminal extras
...
Also add PHP grammar as a fixture to test against.
2020-03-02 14:17:12 -08:00
Max Brunsfeld
6cb8d24de2
Merge pull request #542 from SKalt/issue-524-document-supertypes-in-grammar-schema
...
feat(cli): documented optional supertypes string[] in grammar schema
2020-02-24 16:14:49 -08:00
Steven Kalt
d82ee739e9
Update cli/src/generate/grammar-schema.json
...
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@github.com>
2020-02-24 18:13:38 -05:00
Max Brunsfeld
709ddfebe9
docs: Add explanation of syntax highlighting configuration for CLI
2020-02-21 11:39:27 -08:00
Max Brunsfeld
360b188644
cli: Handle 'underline' styling when highlighting w/ HTML output
2020-02-20 09:35:46 -08:00
Max Brunsfeld
570b83e2b2
query: Add immediate child operator
2020-02-19 11:47:52 -08:00
Max Brunsfeld
950a89a525
query: Differentiate between wildcard '*' and named wildcard '(*)'
2020-02-19 09:42:29 -08:00
Alyssa Verkade
0e689657b7
Add a language linkage declaration to parsers
...
Previously, in order to compile a `tree-sitter` grammar that contained
c++ source in the parser (ie the `scanner.cc` file), you would have to
compile the `parser.c` file separately from the c++ files. For example,
in rust this would result in a `build.rs` close to the following:
```
extern crate cc;
fn main() {
let dir: PathBuf = ["tree-sitter-ruby", "src"].iter().collect();
cc::Build::new()
.include(&dir)
.cpp(true)
.file(dir.join("scanner.cc"))
// NOTE: must have a name that differs from the c static lib
.compile("tree-sitter-ruby-scanner");
cc::Build::new()
.include(&dir)
.file(dir.join("parser.c"))
// NOTE: must have a name that differs from the c++ static lib
.compile("tree-sitter-ruby-parser");
}
```
This was necessary at the time for the following grammars: `ruby`,
`php`, `python`, `embedded-template`, `html`, `cpp`, `ocaml`,
`bash`, `agda`, and `haskell`.
To solve this, we specify an `extern "C"` language linkage declaration
to the functions that must be linked against to compile a parser with the
scanner, making parsers linkable against c++ source.
On all major compilers (gcc, clang, and msvc) this should be the only
change needed due to the combination of clang and gcc both supporting
designated initialization for years and msvc 2019 adopting designated
initializers as a part of the C++20 conformance push.
Subsequently, for rust projects, the necessary `build.rs` would become
(which also brings these parsers into sync with the current docs):
```
extern crate cc;
fn main() {
let dir: PathBuf = ["tree-sitter-ruby", "src"].iter().collect();
cc::Build::new()
.include(&dir)
.cpp(true)
.file(dir.join("scanner.cc"))
.file(dir.join("parser.c"))
.compile("tree-sitter-ruby");
}
```
2020-02-18 19:46:59 -08:00
Steven Kalt
c5ca259d09
feat(cli): documented optional supertypes Array<string> in grammar-schema.json
2020-02-15 11:23:14 -05:00
Max Brunsfeld
de8e3ee188
query: Allow multiple captures on a single node
2020-02-11 16:02:32 -08:00
Max Brunsfeld
5922064b75
node-types: Fix ambiguity warning on rustc 1.41
2020-02-10 10:26:12 -08:00
Max Brunsfeld
e23f518915
highlight: add built-in support for carriage-return highlight
2020-01-28 14:47:21 -08:00
Max Brunsfeld
d06407aca2
Update highlight test for JSDoc grammar changes
2020-01-27 13:08:30 -08:00
Max Brunsfeld
3f109a3cb5
highlight: Fix logic for handling empty injections with no highlights
2020-01-27 12:32:37 -08:00
Max Brunsfeld
8dd68c360a
Fix logic for generating unique symbol map
...
Previously, this didn't correctly handle the case where *multiple*
symbols were all simply-aliased to the same *other* symbol.
Refs #500
2020-01-27 12:06:48 -08:00
Max Brunsfeld
9f63139a10
Fix error when set_included_ranges is called with an invalid range list
2020-01-17 10:31:28 -08:00
Max Brunsfeld
7421836ee4
Improve cli error message on invalid glob
2020-01-16 16:17:33 -08:00
Max Brunsfeld
9d460e6d01
Merge pull request #525 from SKalt/add-field-rule-to-grammar-json-schema
...
added field-rule to grammar-schema.json
2020-01-16 16:06:48 -08:00
Max Brunsfeld
9dfd03e79a
highlight: Sipmlify injection API w/ new injection.combined property
2020-01-16 12:43:31 -08:00
Max Brunsfeld
f3747863df
Add ts_query_disable_pattern API
2020-01-15 17:08:55 -08:00
Max Brunsfeld
58617cfa0c
Improve output format for query subcommand
2020-01-15 17:08:31 -08:00
Steven Kalt
619d7cd65a
added field-rule to grammar-schema.json
2020-01-12 19:40:21 -05:00
Steven Kalt
e69430ae7d
removed duplicate key ( #521 )
...
The key "required" was duplicated on "symbol-rule". I removed the more permissive copy.
2020-01-09 17:34:07 -08:00
Max Brunsfeld
9a73277389
web-ui: Load static files from disk if TREE_SITTER_BASE_DIR var is set
2019-12-19 11:23:14 -08:00
Max Brunsfeld
f53e7377dc
Allow highlight to command to take glob patterns
2019-12-17 15:49:05 -08:00
Max Brunsfeld
f0e4d630d5
Reliably avoid duplicate subtypes in node-types.json
2019-12-17 14:55:51 -08:00
Max Brunsfeld
3ac047679c
Fix children.required when multiple nodes are aliased as the same
2019-12-16 12:39:57 -08:00
Max Brunsfeld
7c711c5537
Move the private functions in node_types.rs to the end of the file
2019-12-16 12:38:40 -08:00
Max Brunsfeld
5edf97bca9
Remove accidentally-commited garbage line in arg parsing config
2019-12-16 11:59:26 -08:00
Max Brunsfeld
9a0cfa2376
Fix 'required' field when rules with diff fields are aliased to look the same
2019-12-12 11:26:58 -08:00
Max Brunsfeld
fc19312913
Fix node-types bugs involving aliases and external tokens
2019-12-12 10:06:18 -08:00
Max Brunsfeld
1b5ae380ce
Don't attempt to extract keywords that don't entirely match word token ( #505 )
2019-12-11 17:18:15 -08:00
Max Brunsfeld
c2e253a4c8
Update unit test to reflect javascript query change
2019-12-10 13:24:36 -08:00
Max Brunsfeld
a5a9000e29
generate: Ensure that field_map_slices array is long enough
2019-12-09 11:46:32 -08:00
Steven Kalt
09fb24c03d
add encoding to web_ui.html ( #504 )
...
addressing #503 .
2019-12-06 19:28:08 -08:00
Max Brunsfeld
0cb2ef1082
Fix code paths that still conflated null characters with EOF
2019-12-06 15:29:03 -08:00
Max Brunsfeld
d426f46087
Add unit test for symbols respecting simple aliases
2019-12-06 12:47:27 -08:00
Max Brunsfeld
7032dae4f6
Include alias symbols in unique symbol map
2019-12-06 12:11:09 -08:00
Max Brunsfeld
bea6e0e28b
cli: Generate parseres with the new ABI by default
2019-12-06 11:51:55 -08:00
Max Brunsfeld
bd49fbab12
cli: Allow globs and exclusions (via '!' prefix) as args to parse
2019-12-06 11:41:21 -08:00
Max Brunsfeld
56c620c005
Store a mapping to ensure no two symbols map to the same metadata
2019-12-05 17:21:46 -08:00
Max Brunsfeld
d6c7b243a7
Merge pull request #499 from tree-sitter/highlight-test
...
Add a system for testing syntax highlighting queries
2019-12-05 15:55:24 -08:00
Max Brunsfeld
4b9feccd13
Run syntax highlighting tests as part of the main test command
...
Also, allow `corpus` to be in the `test/corpus` directory, and expect
highlighting tests to be in the `test/highlight` directory.
2019-12-05 15:28:16 -08:00
Max Brunsfeld
6dbfbaed07
Start work on a system for testing syntax highlighting
2019-12-05 09:45:54 -08:00
Max Brunsfeld
c957a5b8e7
Add test for handling of too many states in query captures
2019-11-22 11:54:32 -08:00
Max Brunsfeld
5a979d1457
node-types: Add test for field merging with aliases
...
Co-Authored-By: Timothy Clem <timothy.clem@gmail.com>
2019-11-19 14:31:56 -08:00
Max Brunsfeld
1d63434664
Refactor node-type merging
2019-11-19 11:57:21 -08:00
Max Brunsfeld
5489bc4dc5
Fix small issues with merging node types
...
* Merge the `required` field with an 'and', not an 'or'
* Merge field info in addition to children info
2019-11-19 11:55:21 -08:00
Timothy Clem
e2325102d1
No printing
2019-11-19 09:03:35 -08:00
Timothy Clem
c346ce4a5e
Try not to loose existing children
2019-11-18 14:48:24 -08:00
Timothy Clem
5c72642634
A test demonstrating the issue with named aliases
2019-11-18 14:47:48 -08:00
Max Brunsfeld
660efd8c0f
Fix handling of token rules directly inside of alias, prec, or field.
...
Fixes #483
2019-11-15 10:53:17 -08:00
Max Brunsfeld
d45b98c7d9
node-types - Fix duplicate when a terminal is aliased with the same name as a non-terminal
2019-11-14 09:31:25 -08:00
Max Brunsfeld
5767bbc806
Avoid generating C char literals with control characters
...
Fixes #487
2019-11-13 10:54:34 -08:00
Max Brunsfeld
a2bbc7391b
node-types: Fix handling of simple aliased inlined rules
2019-11-13 10:38:47 -08:00
Max Brunsfeld
1909ae2cee
binding_rust: Improve node children APIs
...
Closes #480
2019-11-08 14:20:10 -08:00
Max Brunsfeld
39ceff1908
Restore json corpus tests, which accidentally weren't running
2019-10-31 14:32:50 -07:00
Max Brunsfeld
d765332c61
Don't rely on new eof ABI in parsers unless --next-abi is passed
2019-10-31 14:32:50 -07:00
Max Brunsfeld
d3b7caa565
Add a TSLexer.eof() API, use it in generated parsers
2019-10-31 14:11:52 -07:00
Max Brunsfeld
a62b7a70f3
Lexer: track EOF state without relying on null character as lookahead
2019-10-31 14:11:52 -07:00
Max Brunsfeld
0cceca7b4e
Rename extra_tokens -> extra_symbols
2019-10-21 17:26:01 -07:00
Max Brunsfeld
fcaabea0cf
Allow non-terminal extras
2019-10-21 16:08:59 -07:00
Max Brunsfeld
49c632ae90
Fix error in test command when queries folder does not exist
...
Fixes #468
2019-10-21 09:22:24 -07:00
Max Brunsfeld
e14e285a10
cli: Check queries when running tree-sitter test
2019-10-18 14:44:16 -07:00
Max Brunsfeld
64c6cf4473
Implicitly reset parser's state if language is changed after a timeout
2019-10-18 11:28:59 -07:00
Max Brunsfeld
084406148b
Tweak highlight name matching semantics, add doc comments
2019-10-17 12:03:34 -07:00
Max Brunsfeld
b79295e1a0
🔥 Everything related to property sheets
2019-10-17 11:00:31 -07:00
Max Brunsfeld
075a552430
Tweak how highlight query paths are specified in package.json
2019-10-17 10:14:05 -07:00
Max Brunsfeld
fa43ce01a6
Allow queries to capture ERROR nodes
2019-10-16 11:54:32 -07:00
Max Brunsfeld
060e00463d
Implement include-children directive in injection queries
2019-10-14 17:38:42 -07:00
Max Brunsfeld
b3809274f0
Load highlight queries correctly in highlight unit tests
2019-10-14 17:24:16 -07:00
Max Brunsfeld
7c8216c692
highlight: Handle injections correctly, using a separate query cursor
2019-10-14 12:30:22 -07:00
Max Brunsfeld
324c259cbb
rust: Create readable messages for query syntax errors
2019-10-14 12:30:22 -07:00
Max Brunsfeld
4c17af3ecd
Allow queries with no patterns
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
dc7997fdbb
node-types: Rework the approach to computing multiple and required
2019-10-11 13:59:02 -07:00
Max Brunsfeld
02b6397aa3
Add test for advancing query cursor after has already finished
2019-10-03 12:55:10 -07:00
Max Brunsfeld
9872a083b7
rust: Change QueryCursor::captures to expose the full match
2019-10-03 12:45:58 -07:00
Ika
f191858bae
fix: handle UNEXPECTED node
2019-10-03 21:24:17 +08:00
Max Brunsfeld
fb7a5369fe
Fix regression in node-types for rules with simple aliases
2019-10-02 14:11:21 -07:00
Max Brunsfeld
754cfd42bf
Respect nodes' aliases when generating node types
...
Fixes #455
2019-10-02 13:59:00 -07:00
Max Brunsfeld
27149902f8
Handle is?, is-not?, and set! predicate functions in queries
2019-09-25 10:21:20 -07:00
Max Brunsfeld
b15e90bd26
Handle set! predicate function in queries
2019-09-24 11:54:24 -07:00
Max Brunsfeld
ff9a2c1f53
Make queries work in languages with simple aliases
2019-09-24 11:54:24 -07:00
Max Brunsfeld
070f11b8bf
Use ptr::NonNull in Rust bindings
2019-09-23 17:00:52 -07:00
Max Brunsfeld
598e4e4cf4
Add a unit test to verify captures are sorted by start and end position
2019-09-20 10:12:45 -07:00
Max Brunsfeld
c9f46b8242
Fix false negative in token conflict detection
...
Co-Authored-By: Timothy Clem <timothy.clem@gmail.com>
2019-09-19 11:50:38 -07:00
Max Brunsfeld
a6b6a681ec
Fix a bug that prevented early termination of query matches
2019-09-18 16:13:10 -07:00
Max Brunsfeld
d9b8bae629
rust: Include pattern indices when iterating query captures
2019-09-18 14:22:55 -07:00
Max Brunsfeld
186b08381c
Terminate failed query matches before descending whenever possible
...
When iterating over captures, this prevents reasonable queries from
forcing the tree cursor to buffer matches unnecessarily.
2019-09-18 11:37:49 -07:00
Max Brunsfeld
374a7ac81e
Ensure that duplicate captures are ordered by pattern index
2019-09-17 16:27:16 -07:00
Max Brunsfeld
82955759c0
Add an API for getting a pattern's start offset in the source code
2019-09-17 16:19:58 -07:00
Max Brunsfeld
2d1ca8bc9f
Fix match return order fom ts_query_cursor_next_match
2019-09-17 14:52:27 -07:00
Max Brunsfeld
7793bf2a5a
Clean up query code
2019-09-16 11:33:22 -07:00
Max Brunsfeld
d4d554b2ae
Add wasm bindings for predicates
2019-09-16 10:25:44 -07:00
Max Brunsfeld
096126d039
Allow predicates in queries, to match on nodes' text
2019-09-15 22:06:51 -07:00
Max Brunsfeld
0d913dec65
Fix layout issues in web-ui
2019-09-13 15:19:31 -07:00
Max Brunsfeld
86205b9e6d
Fix infinite loop on unterminated string in query
2019-09-13 15:19:21 -07:00
Max Brunsfeld
a1fec71b19
Tweak QueryCursor to allow iterating either matches or captures
...
For syntax highlighting, we want to iterate over all of the captures in
order, and don't care about grouping the captures by pattern.
2019-09-13 15:19:04 -07:00
Max Brunsfeld
f08767c482
Add tree query editor to web UI and playground
2019-09-12 14:07:17 -07:00
Max Brunsfeld
49ce2fddb9
Add wasm binding for running tree queries in a limited range
2019-09-12 12:14:04 -07:00
Max Brunsfeld
67dcbc3e73
Detect error when a prefix of a valid node name is used in a query
2019-09-11 21:23:46 -07:00
Max Brunsfeld
c71de5bd81
Tweak query interface
...
* Rename TSQueryContext -> TSQueryCursor
* Remove the permanent association between the cursor and its query. The
cursor can now be used again for a different query.
2019-09-11 17:33:48 -07:00
Max Brunsfeld
c8c75782e3
Allow tree queries to execute within a limited range
2019-09-11 16:49:29 -07:00
Max Brunsfeld
beb5eec7d9
Fix handling of single-node patterns in tree queries
2019-09-11 15:22:32 -07:00
Max Brunsfeld
ad3f21b0e5
Add simple CLI command for running tree queries
2019-09-11 15:12:45 -07:00
Max Brunsfeld
d674bc139a
Fix more bugs in binary search used in tree queries
...
This binary search implementation differs from Rust's
`slice::binary_search_by` method in how they deal with ties.
In Rust's implementation:
> If there are multiple matches, then any one of the matches
> could be returned.
This implementation needs to return the index of the *first* match.
2019-09-11 14:45:14 -07:00
Max Brunsfeld
33f89522f6
Allow lisp-style comments in tree queries
2019-09-11 12:16:05 -07:00
Max Brunsfeld
4fa0b02d67
Fix management of capture lists in query execution
2019-09-11 12:06:38 -07:00
Max Brunsfeld
60467ae701
Fix bugs in binary search used in tree queries
2019-09-10 22:30:27 -07:00
Max Brunsfeld
fe7c74e7aa
Start work on an API for querying trees
2019-09-10 20:53:57 -07:00
Ika
d88dae7a3e
feat(cli): support snapshot testing with --update flag
...
This PR adds an `--update` flag to the `tree-sitter test` command, which adds the ability to replace the _expected_ output in the corpus.txt with the _actual_ output produced by the parser, that is, we can now simply use this `--update` flag to write all the corresponding parser output back to the corpus.txt, and we just need to check the output without typing its actual sexp.
- use the same output format as `tree-sitter parse`, except there won't be any position information printed.
- the corpus.txt won't be touched if there's no difference between the _expected_ output and the _actual_ output in that file.
- if there're differences between _expected_ and _actual_, _expected_ will be replaced by _actual_ and the whole file will be reformatted, i.e., all the output sexp will be formatted just like the output from `tree-sitter parse` and all the delimiters `===`/`---` will be normalized as 80-column long.
- this flag also works with `--filter` flag.
2019-09-06 10:57:59 +08:00
Ika
9770a0c9f6
Merge branch 'master' of https://github.com/tree-sitter/tree-sitter into feat/snapshot-testing
2019-09-06 10:44:32 +08:00
Ika
807fdf3ef0
Revert "feat(cli): support snapshot testing with --update flag"
...
This reverts commit 1b033fdfa4 .
2019-09-06 10:42:37 +08:00
Max Brunsfeld
a8dedbee0d
In test command, use the longest line of dashes as the test divider
2019-09-05 09:59:59 -07:00
Max Brunsfeld
62538ed410
highlight iterator: Return byte offset ranges instead of string slices
...
Refs #443
2019-09-04 17:29:31 -07:00
Max Brunsfeld
30e73505e1
Fix handling of extra tokens in ts_tree_cursor_current_field_id
2019-09-04 09:04:31 -07:00
Ika
1b033fdfa4
feat(cli): support snapshot testing with --update flag
...
This PR adds an `--update` flag to the `tree-sitter test` command, which adds the ability to replace the _expected_ output in the corpus.txt with the _actual_ output produced by the parser, that is, we can now simply use this `--update` flag to write all the corresponding parser output back to the corpus.txt, and we just need to check the output without typing its actual sexp.
- use the same output format as `tree-sitter parse`, except there won't be any position information printed.
- the corpus.txt won't be touched if there's no difference between the _expected_ output and the _actual_ output in that file.
- if there're differences between _expected_ and _actual_, only the test case that is different will be replaced, the rest test cases will stay as-is. (All the delimiters `===`/`---` will be normalized as 80-column long, though.)
- this flag also works with `--filter` flag.
2019-09-01 23:52:39 +08:00
Ika
4b0489e2f3
fix: allow lowercase unicode escape ( #440 )
2019-08-31 23:30:33 -07:00
Max Brunsfeld
69ab405325
In next ABI, group symbols by action in small parse state table
...
This is a more compact representation because in most states, many
symbols share the same actions.
2019-08-30 20:29:55 -07:00
Max Brunsfeld
8037607583
Only generate the new parse table format if --next-abi flag is used
2019-08-29 17:37:33 -07:00
Max Brunsfeld
aeb2f895b4
Add --report-states flag for reporting state counts for each rule
2019-08-29 17:36:39 -07:00
Max Brunsfeld
82ff542d3b
Appease MSVC by avoiding empty arrays
2019-08-29 17:31:44 -07:00
Max Brunsfeld
09a2755399
Store parse states with few lookahead symbols in a more compact way
2019-08-29 15:52:23 -07:00
Max Brunsfeld
48a883c1d4
Move external token state id computation out of render module
2019-08-29 15:48:22 -07:00
Max Brunsfeld
759c1d6e65
Reorder parse states by descending symbol count
2019-08-29 15:28:29 -07:00
Max Brunsfeld
2430733ee8
Avoid iterating hashmaps in places where order matters
2019-08-29 15:26:05 -07:00
Max Brunsfeld
f371507d39
Move TokenSet to rules module
2019-08-29 15:25:45 -07:00
Max Brunsfeld
0955c5b3d7
Handle named nodes aliased as anonymous nodes
...
Fixes #401
2019-08-29 14:28:44 -07:00
Max Brunsfeld
b3ab2e07a2
binding_rust: Generalize the interface to callback-based parse methods
...
Fixes #386
2019-08-29 10:39:51 -07:00
Max Brunsfeld
09b46b87dd
Remove unnecessary blank lines from parse command output on error
2019-08-28 15:29:44 -07:00
Tuấn-Anh Nguyễn
d96ba09391
Make Tree::changed_ranges return an Iterator instead of a Vec ( #437 )
...
* Make Tree::changed_ranges return an Iterator instead of a Vec
* Remove CBufferIter.free parameter
2019-08-26 19:36:16 -07:00
Max Brunsfeld
d5b5d473ab
Add missing comparisons to property item hash & equality impls
...
Fixes the inconsistent failurs of property sheet unit tests
2019-08-26 09:31:48 -07:00
Max Brunsfeld
8e3ff6376f
Upgrade rand, dirs
2019-08-19 17:31:35 -07:00
Rob Donnelly
9ba5f25594
Ignore hidden files in grammar test directories ( #430 )
...
This fixes "stream did not contain valid UTF-8" error due to
`tree-sitter test` attempting to Vim's parse hidden binary swap files.
2019-08-19 09:03:12 -07:00
Max Brunsfeld
5e04daf483
Avoid non-deterministic set iteration order when handling conflicts
2019-08-13 15:57:42 -07:00
Max Brunsfeld
56ce4e5d50
Upgrade rsass, remove hashbrown
2019-08-13 10:08:58 -07:00
Max Brunsfeld
5f369a5870
Fix another empty array literal for MSVC compatibility
2019-08-12 15:13:41 -07:00
Max Brunsfeld
13c0aa7dbb
Avoid empty initializer list for ts_alias_sequences
...
Fixes a bug introduced in 68b089b41e
2019-08-12 14:11:40 -07:00
Max Brunsfeld
68b089b41e
cli: Fix generation of parsers with fields but no aliases
...
Fixes #419
2019-08-11 09:22:30 -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
0dff46865c
web-ui: Fix content-type of library wasm
2019-08-10 13:00:55 -07:00
Max Brunsfeld
d78204b713
cli: Don't regenerate index.js if it already exists
2019-08-08 15:02:36 -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
0afbc31789
Automatically skip BOM characters at beginnings of files
...
Refs tree-sitter/tree-sitter-python#48
2019-08-02 12:03:04 -07:00
Max Brunsfeld
9e1649d9f8
node-types: Fix children descriptors' multiple and required properties
2019-07-30 12:07:11 -07:00
Max Brunsfeld
a21d355ade
Fix handling of potentially overlapping selectors in property sheets
2019-07-22 16:17:10 -07:00
Max Brunsfeld
f4740a1beb
Make properties generation aware of which nodes are leaves
2019-07-22 09:30:05 -07:00
Max Brunsfeld
0a3f2131c8
Move state splitting algorithm into its own file
2019-07-19 12:39:52 -07:00
Max Brunsfeld
f85ce2fbfa
Remove state-ids-to-log flag
2019-07-18 16:06:13 -07:00
Max Brunsfeld
ea515b6967
Fix ts_node_string behavior for anonymous leaf nodes
...
Refs tree-sitter/py-tree-sitter#8
2019-07-18 12:39:15 -07:00
Max Brunsfeld
f505613af3
Fix bug introduced when optimizing property sheet JSON files
2019-07-17 17:00:25 -07:00
Max Brunsfeld
f64ee1eb75
Fix incorrect handling of field names in property sheets
2019-07-17 14:28:44 -07:00
Max Brunsfeld
7cd1d77c08
Loosen assertion in timeout unit test to avoid spurious CI failures
2019-07-17 14:28:44 -07:00
Max Brunsfeld
def1e1e91a
Reduce bloat in generated property sheet JSON files
2019-07-17 14:28:44 -07:00
Max Brunsfeld
d84e6fafdd
Merge pull request #375 from mkrupcale/wasm-docker-selinux
...
Use Z option for docker-run volume mount
2019-07-16 15:10:42 -07:00
Max Brunsfeld
bd466febb4
highlight: Fix panic when cancelled before parsing a nested document
2019-07-16 14:34:24 -07:00
Max Brunsfeld
c90a532d8f
Update tests to reflect javascript grammar changes
2019-07-10 14:30:43 -05:00
Paul Young
98d98ca171
Set NODEJS_CATCH_EXIT=0 when invoking emcc
2019-07-10 13:41:16 +01:00
Max Brunsfeld
a9ca6ff73c
Fix non-deterministic ordering of lex states
2019-07-03 16:34:06 -07:00
Matthew Krupcale
71d96e813f
Use Z option for docker-run volume mount
...
This is necessary on systems with SELinux to prevent file permission/access errors when building WASM output
* cli/src/wasm.rs: Use Z volume mount option for docker-run
* script/build-wasm: Likewise.
2019-06-29 15:49:25 -04:00
Max Brunsfeld
223a656fc8
Fix another bug in lex state merging
...
Reuse more logic for lex and parse state merging algorithms
2019-06-21 13:12:09 -07:00
Max Brunsfeld
dfd012d13d
Merge pull request #367 from tree-sitter/node-type-children
...
Include info about children w/o fields in node-types.json
2019-06-20 14:06:27 -07:00
Max Brunsfeld
70dc79b412
Merge lex states more liberally
2019-06-20 14:05:15 -07:00
Max Brunsfeld
fe6a69a626
Sort lex states
2019-06-20 13:01:28 -07:00
Max Brunsfeld
ead37c29c6
Tighten timeouts in parse timeout tests
2019-06-20 09:57:38 -07:00
Max Brunsfeld
5b38ff5f78
Loosen lex state equality check to catch some spurious duplicates
2019-06-20 09:57:38 -07:00
Max Brunsfeld
e4873191d6
Refactor generated lex function to use fewer instructions per state
2019-06-20 09:57:38 -07:00
Max Brunsfeld
28011b1e60
Add ts_node_is_extra API
2019-06-19 15:58:29 -07:00
Max Brunsfeld
0ad4e147e2
Dedup types in children property of node-types
2019-06-19 15:35:53 -07:00
Max Brunsfeld
ee1d4d6b2c
Fix handling of inlined rules in node-types generation
2019-06-19 15:30:48 -07:00
Max Brunsfeld
0a2b183bd0
Add a unit test for the children property in node-types
2019-06-17 13:24:13 -07:00
Max Brunsfeld
381cb09c64
Include info about children w/o fields in node-types.json
2019-06-17 11:35:06 -07:00
Max Brunsfeld
80b785daee
Improve behavior of node descendant queries with single positions
2019-06-13 10:53:59 -07:00
Max Brunsfeld
a1682eb81c
Handle injection-includes-children in highlighting property sheets
2019-06-11 16:59:33 -07:00
Max Brunsfeld
4d4e4f3909
Fix problems with build-wasm command
...
* Check that docker is on the PATH before trying to run it
* Don't try to use id(1) if using docker on windows
* Add error message if neither emcc nor docker are available
Fixes #358
2019-06-10 11:40:36 -07:00
Max Brunsfeld
f7d25a5934
Fix missed opportunities to merge parse states
2019-06-06 15:29:22 -07:00
Max Brunsfeld
fa68ef4cea
Make git sha optional at build time
...
Fixes #352
2019-06-06 13:12:53 -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
f5163126c8
generate-fixtures-wasm: handle language repos w/ multiple grammars
...
Refs tree-sitter/tree-sitter-typescript#68
2019-05-30 12:34:03 -07:00
Max Brunsfeld
5bb06682d5
Allow dynamically loading grammars w/ no package.json file
2019-05-30 12:05:53 -07:00
Max Brunsfeld
23c6d78674
Fix presentation of missing nodes in parse command
2019-05-15 16:25:53 -07:00
Max Brunsfeld
9674df0c54
Avoid introducing certain auxiliary repeat rules in hidden rules
2019-05-15 12:36:54 -07:00
Max Brunsfeld
a008ce63e6
Don't include wasm library in the CLI binary on windows
2019-05-14 15:51:12 -07:00
Max Brunsfeld
ad43b211f4
Allow building the wasm libs with native emscripten instead of docker
...
And build them on the mac CI as well as the linux CI
2019-05-14 14:02:22 -07:00
Max Brunsfeld
a1ed12f4f4
Start work on web UI command
2019-05-13 21:51:17 -07:00
Max Brunsfeld
7bc7306afb
Add a unit test for local variable tracking in syntax highlighting
2019-05-10 14:38:43 -07:00
Max Brunsfeld
958ab27efb
Update JS highlighting unit test
2019-05-10 10:32:31 -07:00
Max Brunsfeld
b25af0f05f
Fix property state merging bug
2019-05-09 20:34:34 -07:00
Max Brunsfeld
a7d02e7276
Add support for highlight properties that track local variables
2019-05-09 20:34:34 -07:00
Max Brunsfeld
d78ac581f3
Rename scope -> highlight in highlighting property sheets
...
We need to use the word `scope` for a different purpose: tracking local
scopes.
2019-05-09 09:42:40 -07:00
Max Brunsfeld
572f290ec0
Fix highlighting in the presence of node fields
2019-05-07 11:17:34 -07:00
Max Brunsfeld
a6a50a6320
Avoid some bloat in wasm build
2019-05-01 12:44:58 -07:00
Max Brunsfeld
7d1aa10f73
Update generated binding.cc to use newer NAN APIs
2019-04-30 17:23:36 -07:00
Max Brunsfeld
8315a6277b
Increase memory limit for language wasm files
2019-04-27 17:54:00 -07:00
Max Brunsfeld
66e006105c
Build and test wasm on CI
2019-04-26 14:38:13 -07:00
Max Brunsfeld
58e1a0fee7
In node range queries, treat the end coordinate as exclusive
2019-04-26 13:36:28 -07:00
Max Brunsfeld
1fc0525940
Start work on a WASM binding
2019-04-25 17:27:39 -07:00
Ervin Oro
e5584f82d3
Add test to verify regex unicode codepoints work
2019-04-09 21:55:49 +03:00
Ervin Oro
8c845f29e0
Allow hex characters in unicode code points
2019-04-09 20:37:36 +03:00
Max Brunsfeld
701d63dab7
Add --edit flag to parse command
2019-04-08 09:21:03 -07:00
Max Brunsfeld
2bd14a8463
Build parsers with debug symbols
2019-04-05 13:04:37 -07:00
Max Brunsfeld
a1eee4a193
Catch missing precedence values in JS
...
Fixes #305
2019-04-05 13:04:12 -07:00
Max Brunsfeld
df76aef067
CLI: In lex function, merge branches with the same body
2019-04-04 16:02:50 -07:00
Max Brunsfeld
6490b1e4f2
Fix non-deterministic conflict message order
2019-03-29 17:36:19 -07:00
Max Brunsfeld
a133afe9ac
Clean up ParseItem::cmp
2019-03-29 12:49:51 -07:00
Max Brunsfeld
9bdac0e693
CLI: Account for field names when comparing parse items
2019-03-29 12:13:24 -07:00
Max Brunsfeld
09b902f6a0
cli: require node-types.json in generated index.js files
2019-03-29 09:07:32 -07:00
Max Brunsfeld
eb96dd6ddb
node types: Preserve all supertypes in field type lists
2019-03-27 16:32:02 -07:00
Max Brunsfeld
451478c620
Include tokens in node-types.json
2019-03-26 16:57:55 -07:00
Max Brunsfeld
e9afdd72b4
node-types: Fix incorrect named value for subclasses
2019-03-26 15:27:07 -07:00
Max Brunsfeld
af09e65efc
Move node types code to its own module
2019-03-26 14:42:32 -07:00
Max Brunsfeld
6c65d74810
Restructure node-types.json output
2019-03-26 13:43:10 -07:00
Max Brunsfeld
5035e194ff
Merge branch 'master' into node-fields
2019-03-26 11:58:21 -07:00
Max Brunsfeld
b79bd8693b
Start work on handling node supertypes
2019-03-26 11:51:02 -07:00
Max Brunsfeld
82358d3f2f
Merge pull request #307 from tree-sitter/pointer-sized-cancellation-flag
...
Make the cancellation flag a size_t, not a uint32_t
2019-03-22 12:30:39 -07:00
Max Brunsfeld
5a59f19b69
Use explicit syntax for functions with no parameters
2019-03-21 16:06:06 -07:00
Max Brunsfeld
0ccb910922
Use a size_t instead of a uint32_t for cancellation flag
2019-03-21 11:26:05 -07:00
Max Brunsfeld
2fd9ffa8e5
Add --cancel flag to parse command to allow command-line testing
2019-03-21 10:56:32 -07:00
Max Brunsfeld
3340168097
Fix backwards logic for cancellation flag
2019-03-20 17:02:07 -07:00
Max Brunsfeld
8941dc1dda
Add cancellation flag parameter to highlight API
2019-03-18 09:52:02 -07:00
Max Brunsfeld
0ae304f582
Lib: Rework the API for cancelling a parse
...
Also, use beta on CI until atomic::AtomicU32 lands in stable.
2019-03-18 09:51:21 -07:00
Jacob Mitchell
15b096d695
Extract graph log validation into a specialized test
2019-03-14 22:21:19 -07:00
Jacob Mitchell
c8d040ca26
Use 1-indexed rows in CLI and log output ( resolves #287 )
2019-03-14 22:21:19 -07:00
Max Brunsfeld
1aaad66a03
Merge pull request #301 from tree-sitter/clock-based-timeouts
...
Replace operation limit API with a clock-based timeout API
2019-03-14 16:50:44 -07:00
Max Brunsfeld
9ae594a507
Be more loose with timeout unit test assertions
2019-03-14 15:53:45 -07:00
Max Brunsfeld
006a931ab8
Tests: Prevent array reallocations during ts_stack_print_dot_graph
...
When debugging a test with 'script/test -D', the DOT-graph generation
code was sometimes causing reallocations that were not captured by the
allocation tracker, because we explicitly disable allocation-tracking
for that method in order to reduce noise when debugging memory leaks.
By growing the relevant array *prior* to turning off allocation
tracking, we can ensure that it is not reallocated within that function,
avoiding false positive memory leak errors.
Fixes #302
2019-03-14 13:59:12 -07:00
Max Brunsfeld
88e3907cc0
Use QueryPerformanceFrequency as clock on windows
2019-03-14 13:42:31 -07:00
Max Brunsfeld
e30e827c5f
CLI: Add timeout flag to parse command
2019-03-14 11:52:50 -07:00
Max Brunsfeld
cddb3e416d
Replace operation limit API with a clock-based timeout API
2019-03-14 11:13:38 -07:00
Max Brunsfeld
abcac40f2d
cli: Add a --time flag to highlight subcommand
2019-03-13 15:52:29 -07:00
Max Brunsfeld
083e813218
Highlight: fix handling of root node injections like in ERB, EJS
2019-03-13 15:51:50 -07:00
Max Brunsfeld
b89348e7fe
Merge branch 'master' into c-highlight
2019-03-12 15:27:12 -07:00
Max Brunsfeld
2de54c101e
cli: put a newline character at the end of grammar.json files
2019-03-12 11:54:31 -07:00
Max Brunsfeld
d19c875134
cli: ⬆️ rsass
2019-03-12 11:50:16 -07:00
Max Brunsfeld
98e4fd22ef
Start work on a C API for syntax highlighting
2019-03-08 13:13:02 -08:00
Max Brunsfeld
f52271352b
Merge branch 'master' into node-fields
2019-03-05 08:08:05 -08:00
Max Brunsfeld
a20fc3c111
Remove unnecessary character escape processing for regexes
...
Fixes #289
2019-03-04 10:10:04 -08:00
Max Brunsfeld
08ac66a656
Don't generate prop sheets when a specific grammar path is passed
2019-03-03 18:53:24 -08: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
1bad6dc41e
Add ~/.tree-sitter/config.json file, init-config command
...
Right now this is just used for two things:
* Specifying folders for locarting parsers to use with `tree-sitter
parse` and `tree-sitter highlight`
* Specifying colors to use for `tree-sitter-highlight`
2019-02-25 12:33:24 -08:00
Max Brunsfeld
858b4ba8ac
cli: Fix handling of import chains in property sheets
2019-02-22 16:15:36 -08:00
Max Brunsfeld
14b7af3436
highlight: Fix HTML rendering of empty lines
2019-02-22 11:48:29 -08:00
Max Brunsfeld
e239aa8229
highlight: don't include scope in ScopeEnd events
...
When there are embedded documents, multiple scopes can start or
end at the same position. Previously, there was no guarantee that
the ScopeEnd events would always occur in the reverse order of the
ScopeStart events. The easiest way to avoid exposing inconsistency
is to not surface the scopes being ended.
2019-02-20 16:45:51 -08:00
Max Brunsfeld
d2264d597f
cli: Add --scope flag to highlight command
2019-02-20 14:38:19 -08:00
Max Brunsfeld
2ee5cbbc1d
highlight: take callback parameters by value
2019-02-20 10:27:08 -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
0dd15e2b02
Ensure deterministic order of values in property sheet JSON files
2019-02-19 10:40:34 -08:00
Max Brunsfeld
9185f6c168
Clarify parse command error message when failing to read source file
2019-02-19 10:40:27 -08:00
Max Brunsfeld
4db132ff94
In property sheets, avoid converting numeric values to strings
2019-02-15 20:48:36 -08:00
Max Brunsfeld
405c200786
Merge branch 'master' into node-fields
2019-02-14 16:27:22 -08:00
Max Brunsfeld
5debf3cbcc
cli: Create src directory before writing grammar.json
...
Fixes #278
2019-02-14 10:57:33 -08:00
Max Brunsfeld
4f069fbe3b
Merge branch 'master' into node-fields
2019-02-14 09:35:47 -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
9f3134dace
Allow fields to be used in property sheets
2019-02-13 19:14:33 -08:00
Max Brunsfeld
65d1ce8593
lib: Include fields in ts_node_string output
...
This allows you to assert about fields in tests. But if your test
s-expression does *not* include fields, the fields will be stripped from
the regexp before comparison.
2019-02-13 09:47:21 -08:00
Max Brunsfeld
9f608435ee
Fix errors in when languages have no fields
2019-02-12 17:20:12 -08:00
Max Brunsfeld
56309a1c28
Generate node-fields.json file
2019-02-12 11:06:18 -08:00
Max Brunsfeld
b7e38ccc96
Allow using fields in inlined rules
2019-02-08 17:12:08 -08:00
Max Brunsfeld
eb1e7af5ec
Normalize rule argument to field function
2019-02-08 17:11:58 -08:00
Max Brunsfeld
e579e09569
Ensure interpretations are in a predictable order in conflict messages
2019-02-08 17:11:44 -08:00
Max Brunsfeld
a7206b1b8b
Add some assertions to node field test
2019-02-08 16:25:27 -08:00
Max Brunsfeld
79d90f0d3e
Restore naming of alias sequence lengths
...
Fields aren't stored in sequences now, so the max length
is back to being just for aliases.
2019-02-08 16:14:18 -08:00
Max Brunsfeld
d8a2c0dda2
Use a separate type for storing field map headers
2019-02-08 16:06:29 -08:00
Max Brunsfeld
51a9f14f7d
Ensure symbols are written in a predictable order in conflict messages
2019-02-08 15:16:56 -08:00
Max Brunsfeld
1d1674811c
Fully implement ts_node_child_by_field_id
2019-02-08 15:16:56 -08:00
Max Brunsfeld
18a13b457d
Get basic field API working
2019-02-08 15:16:56 -08:00
Max Brunsfeld
108ca989ea
Start work on including child refs in generated parsers
2019-02-08 15:16:56 -08:00
Max Brunsfeld
bf4e1304f8
Start work on new ref API, for giving names to nodes' children
...
Co-Authored-By: Ayman Nadeem <aymannadeem@gmail.com>
2019-02-08 15:16:56 -08:00
Max Brunsfeld
dac13af206
cli: Always write parser.h in generate command
2019-02-08 15:16:38 -08:00
Max Brunsfeld
acd30d4693
Write grammar.json file when generating based on grammar.js
2019-02-08 15:15:47 -08:00
Max Brunsfeld
4dc475b18c
cli: Compile C++ external scanners with exceptions disabled
2019-02-06 16:19:08 -08:00
Max Brunsfeld
9b8bf8dfe2
cli: Compute fragile tokens *after* merging compatibile parse states
...
Previously, we failed to mark as fragile some tokens that *should* be
fragile because of tokens that were introduced during parse state
merging.
2019-02-06 16:18:49 -08:00
Max Brunsfeld
af694b4c13
cli: Fix exit code of parse subcommand
2019-02-06 16:17:35 -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
4badd7cc40
Disable compiler optimizations for lex functions in more cases
...
* Reduce the lexer state count threshold from 500 to 300
* Disable optimizations on clang and gcc in addition to MSVC
Optimizations in these source files don't seem to make any impact on
parsing performance, but they slow down compile time substantially.
2019-02-06 11:50:37 -08:00
Max Brunsfeld
db8de605e6
Merge pull request #270 from vmg/vmg/fixes
...
Bytes/C Fixes
2019-02-06 10:41:41 -08:00
Max Brunsfeld
5c925b3868
cli: Check that extra rules aren't passed to functions like 'optional'
...
Fixes #247
2019-02-06 09:31:32 -08:00
Vicent Marti
a8cc082ce2
binding: Make walk_with_properties take an &[u8]
2019-02-06 10:10:55 +01:00
Max Brunsfeld
d7bc61cada
Include parser header content in library crate
2019-02-05 11:59:34 -08:00
Max Brunsfeld
50281637d7
binding: Make parse methods more convenient
...
* Rename parse_str to parse and make it polymorphic.
* Rename parse_utf8 to parse_with, since it is now the callback-based
version of parse
* Add a parse_utf16 method analogous to parse
* Rename existing parse_utf16 method to parse_utf16_with
This brings in the changes from tree-sitter/rust-tree-sitter#5
2019-02-05 10:59:33 -08:00
Max Brunsfeld
efe79889be
Port node tests
2019-02-04 20:42:56 -08:00
Max Brunsfeld
9a8cf39277
Add incremental parsing unit tests
2019-02-04 16:43:21 -08:00
Max Brunsfeld
4a98f0b87e
Port unit test for missing tokens and included ranges
2019-02-04 14:44:06 -08:00
Max Brunsfeld
e62a8a2302
Port more parser unit tests
2019-02-04 10:38:44 -08:00
Max Brunsfeld
59f7511b1c
Fix test command's exit code
2019-02-04 09:12:25 -08:00
Max Brunsfeld
6b8483c53c
Start work on porting included range unit tests
2019-02-02 22:57:04 -08:00
Max Brunsfeld
d465850aba
Add unit tests for ts_tree_get_changed_ranges
2019-02-02 14:00:11 -08:00
Max Brunsfeld
f263a4fbe3
Separate walk_with_properties tests from parser tests
2019-02-01 21:20:27 -08:00
Max Brunsfeld
e143710f4a
Move properties module out of generate
2019-02-01 19:57:00 -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
e26cbb62a5
Add Tree::edit unit tests
2019-01-31 08:15:30 -08:00
Max Brunsfeld
f6d014f3f4
Write tree_sitter/parser.h file in generate command
2019-01-28 14:23:41 -08:00
Max Brunsfeld
6d8ef48dad
Make test subcommand exit 1 if tests fail
2019-01-27 09:53:49 -08:00
Max Brunsfeld
5927e104c2
Check tree consistency in randomized tests
2019-01-26 22:22:29 -08:00
Max Brunsfeld
af83e8034e
Move test helpers into their own folder
2019-01-25 16:40:26 -08:00
Max Brunsfeld
5a12fbd927
Verify changed ranges in randomized tests
2019-01-25 15:20:34 -08:00
Max Brunsfeld
233d616ebf
Add random mutation tests
2019-01-25 12:05:21 -08:00
Max Brunsfeld
e305012b31
Loosen keyword identification criteria slightly
2019-01-21 15:33:43 -08:00
Max Brunsfeld
196339aaa9
Assert no memory leaks by stubbing malloc/free in the test suite
2019-01-21 14:22:35 -08:00
Max Brunsfeld
6105bf9909
Include error recovery examples in test suite
2019-01-20 16:58:49 -08:00
Max Brunsfeld
f6cdd5e3d4
Loosen criteria for identifying conflict-free tokens for error recovery
2019-01-20 16:58:31 -08:00
Max Brunsfeld
ff41f05a20
Fix computation of following tokens
2019-01-18 15:16:20 -08:00
Max Brunsfeld
31bdf5eb97
Fix handling of JavaScript errors
...
Refs #258
2019-01-18 09:40:09 -08:00
Max Brunsfeld
ed195de8b6
rustfmt
2019-01-17 17:16:04 -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
c204b5e728
Print help/version info when run w/ no subcommand
2019-01-17 15:17:36 -08:00
Max Brunsfeld
c27f776d41
Fix word token index issue in a different way
...
Refs https://github.com/tree-sitter/tree-sitter/issues/258
2019-01-17 13:18:59 -08:00
Max Brunsfeld
8f4096e5cb
Give more informative error messages when failing to write files
2019-01-17 12:52:05 -08:00
Max Brunsfeld
bb5dedfb1e
Fix another token conflict detection bug
2019-01-17 12:44:35 -08:00
Max Brunsfeld
9f7079c9c5
Ensure that the word token has a low numerical index
...
Fixes https://github.com/tree-sitter/tree-sitter/issues/258
2019-01-17 12:44:14 -08:00
Max Brunsfeld
3d11388cd1
Fix test subcommand bugs
...
* Log session was dropped before the parser
* Whitespace between close parens was not stripped
2019-01-17 12:40:21 -08:00
Max Brunsfeld
d52a11fd03
Avoid using a string literal to pass grammar path to JS
...
Backslashes in windows path were getting interpeted as escape characters.
2019-01-17 10:09:03 -08:00
Max Brunsfeld
d903371709
Remove noisy logging
2019-01-17 10:07:58 -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
a0a3903f76
Generate binding.gyp, binding.cc, and index.js
2019-01-16 13:53:01 -08:00
Max Brunsfeld
ef735eb942
Upload binary artifacts from CI builds
2019-01-16 10:12:43 -08:00
Max Brunsfeld
d23a03bdf1
Represent ParseItemSet as a sorted Vec, not a BTreeMap
2019-01-15 16:37:54 -08:00
Max Brunsfeld
0ee11584a7
Add -xc compiler flag for pure-C external scanners
2019-01-15 16:19:47 -08:00
Max Brunsfeld
ceff3936ef
Unify logic for handling tokens that match separators into one place
2019-01-15 16:10:52 -08:00
Max Brunsfeld
522021b107
Fix NFA generation w/ nested groups
2019-01-15 15:57:29 -08:00
Max Brunsfeld
d8ab36b2a5
Fix bugs in handling tokens that overlap with separators
2019-01-15 13:21:48 -08:00
Max Brunsfeld
b799b46f79
Handle repetition range operators with commas in regexes
2019-01-15 13:21:48 -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
5c3c1dd0bd
Get logging flags working properly with test script
2019-01-15 13:21:48 -08:00
Max Brunsfeld
19b2addcc4
Fix bug in symbol enum code generation
2019-01-14 14:08:07 -08:00
Max Brunsfeld
def5884b59
Allow passing grammar JS or JSON path to generate command
2019-01-14 14:07:42 -08:00
Max Brunsfeld
e2717a6ad1
Preprocess regexes to allow non-standard escape sequences
...
Also allow unescaped curly braces to match literal curly braces when
they don't form a valid repetition operator.
2019-01-14 14:05:19 -08:00
Max Brunsfeld
2e009f7177
Avoid writing empty initializer list for alias sequences
2019-01-12 21:57:34 -08:00
Max Brunsfeld
545e840a08
Remove stray single quotes in symbol name strings
2019-01-12 21:42:31 -08:00
Max Brunsfeld
6f242fda0c
Fix edge case in flatten rule
2019-01-11 17:43:42 -08:00
Max Brunsfeld
c76a155174
Fix escaping of characters in C strings
2019-01-11 17:43:27 -08:00
Max Brunsfeld
1468b349b5
Ensure 'src' directory exists before writing src/parser.c
2019-01-11 17:39:16 -08:00
Max Brunsfeld
6592fdd24c
Fix parser generation error messages
2019-01-11 17:26:45 -08:00
Max Brunsfeld
88f1c4af8e
Ensure the .tree-sitter directory exists
2019-01-11 14:56:33 -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
0d85a1ef53
Exclude final newlines from inputs when parsing corpus files
2019-01-11 09:48:45 -08:00
Max Brunsfeld
cffe80bfad
Fix tie-breaking via cascade ordering in property sheets
2019-01-11 09:48:19 -08:00
Max Brunsfeld
272046a250
Reorganize tests - move them all into the CLI crate
2019-01-10 17:11:57 -08:00
Max Brunsfeld
ae6dbb945b
Avoid using unix-specific methods on windows
2019-01-10 16:11:19 -08:00
Max Brunsfeld
38417fc8a1
Port over remaining tests about property sheet generation
2019-01-10 15:17:38 -08:00
Max Brunsfeld
1dfbe495ed
Get property sheet compilation working
2019-01-10 13:12:16 -08:00
Max Brunsfeld
6bd550ca87
Start work on property sheet compilation
2019-01-09 18:10:32 -08:00
Max Brunsfeld
c0fad8b3c4
Write parser.c in generate command
2019-01-09 14:43:49 -08:00
Max Brunsfeld
2e8b2ab8fb
Give strings more implicit precedence than immediate tokens
2019-01-09 09:59:46 -08:00
Max Brunsfeld
6972a8e3e8
Add logging when deciding not to merge parse states
2019-01-09 09:58:45 -08:00
Max Brunsfeld
98807d2053
Add debug and debug-graph flags to parse and test commands
2019-01-08 21:03:51 -08:00
Max Brunsfeld
6c4d00aad5
Print diffs when tests fail
2019-01-07 22:01:40 -08:00
Max Brunsfeld
20fcffb393
Add parse subcommand
...
Co-Authored-By: Timothy Clem <timothy.clem@gmail.com>
2019-01-07 17:57:36 -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
Max Brunsfeld
f059557a9d
Move parser generation code in to 'generate' module within CLI crate
2019-01-07 10:23:01 -08:00
Max Brunsfeld
4e29fe69df
Reduce lex table size by merging compatible entry point states
2019-01-07 09:59:04 -08:00
Max Brunsfeld
001f8c8f55
Rename LookaheadSet -> TokenSet
...
Also, replace non-standard `with` method with a `FromIterator`
implementation.
2019-01-07 08:39:47 -08:00
Max Brunsfeld
47607cecf4
Reorganize repo, add rust CLI and binding code,
2019-01-04 17:31:49 -08:00
Max Brunsfeld
5b0e12ea33
Move code into cli directory
2019-01-04 16:50:52 -08:00