Commit graph

2914 commits

Author SHA1 Message Date
Max Brunsfeld
f1e4104d47 Document supertypes and the node-types file
References #542
References #524
Closes #393
2020-02-24 11:12:42 -08:00
Max Brunsfeld
96c060fc6d wasm: Fix typo in Node.typeId 2020-02-21 17:06:07 -08:00
Max Brunsfeld
8addcf7604
Merge pull request #538 from tree-sitter/syntax-highlighting-docs
Syntax highlighting docs
2020-02-21 13:11:53 -08:00
Max Brunsfeld
8d26da7b03 Add highlight subcommand to docs section w/ all subcommands 2020-02-21 13:11:40 -08:00
Max Brunsfeld
a76a232485 Add unit testing docs 2020-02-21 12:58:41 -08:00
Max Brunsfeld
709ddfebe9 docs: Add explanation of syntax highlighting configuration for CLI 2020-02-21 11:39:27 -08:00
Max Brunsfeld
1ce42a04a7 Add docs about injection query properties 2020-02-20 15:34:35 -08:00
Max Brunsfeld
17071267e3 docs: Start work on docs for injection queries 2020-02-20 14:38:37 -08:00
Max Brunsfeld
cf80f094ac docs: Expand local variable highlighting section 2020-02-20 09:35:46 -08:00
Max Brunsfeld
360b188644 cli: Handle 'underline' styling when highlighting w/ HTML output 2020-02-20 09:35:46 -08:00
Max Brunsfeld
92f060303c docs: First draft of highlight query section, start local var section 2020-02-20 09:35:46 -08:00
Max Brunsfeld
2a8860542c Add intro to syntax highlighting docs 2020-02-20 09:35:46 -08:00
Max Brunsfeld
579b8e8d28 Rename files to make room for syntax highlighting section 2020-02-20 09:35:46 -08:00
Max Brunsfeld
33492ca9df query: Add not-eq? predicate in rust & wasm binding 2020-02-19 21:36:30 -08:00
Max Brunsfeld
f67c0526fd
Merge pull request #549 from tree-sitter/query-dot-operator
Add an 'immediate child' operator in queries
2020-02-19 13:24:25 -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
Max Brunsfeld
1d6ea51b63 query: Make * operator only match named nodes 2020-02-18 21:32:52 -08:00
Max Brunsfeld
55edafa946
Merge pull request #548 from alyssaverkade/add-explicit-language-linkage-to-parsers
Add a language linkage declaration to parsers
2020-02-18 21:24:53 -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
Max Brunsfeld
1217f58b8d rust: 0.6.2 2020-02-17 22:37:12 -08:00
Max Brunsfeld
b2e79f6438 rust: In queries, allow set! w/ capture and constant 2020-02-14 20:50:07 -08:00
Max Brunsfeld
56e52c76f9 rust: Add Hash for Point, Range and Node 2020-02-13 16:03:02 -08:00
Max Brunsfeld
ca73cba5f0 Make underline-on-hover work for spans within links
Refs #535
2020-02-12 16:06:50 -08:00
Max Brunsfeld
1f53b7aba8
Merge pull request #536 from kramred/docs/external_link_icon_CC0
Modify styles to show icon for external links
2020-02-12 11:59:29 -08:00
Max Brunsfeld
f4132c90ec
Merge pull request #535 from kramred/docs/github_link
Add hyperlink to github repo in docs; below img of tree
2020-02-12 11:57:36 -08:00
Mark Schmitz
23b88b6ac4 Modify styles to show icon for external links
Icon is CC0, copyright by https://github.com/kramred
2020-02-12 19:40:43 +00:00
Mark Schmitz
3dafb373a8 Add hyperlink to github repo below img of tree
in sidebar, as suggested in https://github.com/tree-sitter/tree-sitter/issues/508
2020-02-12 16:20:03 +00:00
Max Brunsfeld
de8e3ee188 query: Allow multiple captures on a single node 2020-02-11 16:02:32 -08:00
Max Brunsfeld
631710bada Implement Default for Point, Eq for Node 2020-02-11 15:58:35 -08:00
Max Brunsfeld
d8c3f472d2 Fix fallout from ts_language_next_state fix 2020-02-10 12:00:58 -08:00
Max Brunsfeld
5922064b75 node-types: Fix ambiguity warning on rustc 1.41 2020-02-10 10:26:12 -08:00
Max Brunsfeld
096014cb3e Clean up ts_language_next_state 2020-02-07 14:06:14 -08:00
Max Brunsfeld
a1c3de1b99 rust: Add Language::node_kind_is_visible API 2020-01-31 12:04:18 -08:00
Max Brunsfeld
ee7c29346a Small cleanup 2020-01-29 16:48:36 -08:00
Max Brunsfeld
64996976f4 rust: Add Language::id_for_node_kind method 2020-01-29 16:48:08 -08:00
Max Brunsfeld
fcc6c70d5e
Merge pull request #531 from tree-sitter/highlight-carriage-returns
highlight: add built-in support for carriage-return highlight
2020-01-28 16:46:34 -08:00
Max Brunsfeld
e23f518915 highlight: add built-in support for carriage-return highlight 2020-01-28 14:47:21 -08:00
Max Brunsfeld
f049ba350f 0.16.4 2020-01-28 10:09:26 -08:00
Max Brunsfeld
2bc7e457df lib: 0.6.1 2020-01-28 09:27:10 -08:00
Max Brunsfeld
3814babfa8 Update error recovery test to reflect JS grammar changes 2020-01-28 09:16:36 -08:00
Max Brunsfeld
e232ed04d1 Fix lifetimes on QueryCursor methods
Closes #530
2020-01-28 09:14:09 -08:00
Max Brunsfeld
7de36a33eb Remove halt_on_error API 2020-01-27 15:36:09 -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
9ffcb16392 Fix tree-balancing logic
Remove incorrect condition that would prevent balancing of repeating 
structures containing only tokens (nodes w/ no children).

Co-Authored-By: Rob Rix <robrix@github.com>
Co-Authored-By: Patrick Thomson <patrickt@users.noreply.github.com>
2020-01-23 10:26:53 -08:00
Max Brunsfeld
70e2a2c025 Add PHP parser to web playground 2020-01-17 13:30:02 -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
de8877db35 0.16.3 2020-01-16 16:18:25 -08:00