diff --git a/cli/src/tests/node_test.rs b/cli/src/tests/node_test.rs index d4a5a3f9..7e652cd5 100644 --- a/cli/src/tests/node_test.rs +++ b/cli/src/tests/node_test.rs @@ -739,7 +739,7 @@ fn test_node_numeric_symbols_respect_simple_aliases() { let root = tree.root_node(); assert_eq!( root.to_sexp(), - "(program (binary left: (unary (identifier)) right: (identifier)))", + "(program (binary left: (unary operand: (identifier)) right: (identifier)))", ); let binary_node = root.child(0).unwrap(); diff --git a/cli/src/tests/query_test.rs b/cli/src/tests/query_test.rs index 082686ac..02f222bb 100644 --- a/cli/src/tests/query_test.rs +++ b/cli/src/tests/query_test.rs @@ -1507,7 +1507,7 @@ fn test_query_matches_with_supertypes() { value: (expression) @kw_arg) (assignment - left: (left_hand_side (identifier) @var_def)) + left: (identifier) @var_def) (primary_expression/identifier) @var_ref "#, diff --git a/docs/index.md b/docs/index.md index d9410cc2..eca3f1a9 100644 --- a/docs/index.md +++ b/docs/index.md @@ -62,6 +62,7 @@ Parsers for these languages are in development: * [Julia](https://github.com/tree-sitter/tree-sitter-julia) * [Nix](https://github.com/cstrahan/tree-sitter-nix) * [Scala](https://github.com/tree-sitter/tree-sitter-scala) +* [SPARQL](https://github.com/BonaBeavis/tree-sitter-sparql) * [Swift](https://github.com/tree-sitter/tree-sitter-swift) ### Talks on Tree-sitter diff --git a/highlight/README.md b/highlight/README.md index ae462f9d..07edc421 100644 --- a/highlight/README.md +++ b/highlight/README.md @@ -17,7 +17,7 @@ extern "C" tree_sitter_javascript(); Define the list of highlight names that you will recognize: ```rust -let highlight_names = [ +let highlight_names : Vec = [ "attribute", "constant", "function.builtin", @@ -93,14 +93,14 @@ let highlights = highlighter.highlight( ).unwrap(); for event in highlights { - match event? { + match event.unwrap() { HighlightEvent::Source {start, end} => { eprintln!("source: {}-{}", start, end); }, - HighlightEvent::HighlightStart(s) { + HighlightEvent::HighlightStart(s) => { eprintln!("highlight style started: {:?}", s); }, - HighlightEvent::HighlightEnd { + HighlightEvent::HighlightEnd => { eprintln!("highlight style ended"); }, } diff --git a/tags/src/c_lib.rs b/tags/src/c_lib.rs index 85de1ff6..8f689a9a 100644 --- a/tags/src/c_lib.rs +++ b/tags/src/c_lib.rs @@ -1,6 +1,7 @@ use super::{Error, TagsConfiguration, TagsContext}; use std::collections::HashMap; use std::ffi::CStr; +use std::os::raw::c_char; use std::process::abort; use std::sync::atomic::AtomicUsize; use std::{fmt, slice, str}; @@ -73,7 +74,7 @@ pub extern "C" fn ts_tagger_delete(this: *mut TSTagger) { #[no_mangle] pub extern "C" fn ts_tagger_add_language( this: *mut TSTagger, - scope_name: *const i8, + scope_name: *const c_char, language: Language, tags_query: *const u8, locals_query: *const u8, @@ -109,7 +110,7 @@ pub extern "C" fn ts_tagger_add_language( #[no_mangle] pub extern "C" fn ts_tagger_tag( this: *mut TSTagger, - scope_name: *const i8, + scope_name: *const c_char, source_code: *const u8, source_code_len: u32, output: *mut TSTagsBuffer, @@ -234,7 +235,7 @@ pub extern "C" fn ts_tags_buffer_found_parse_error(this: *const TSTagsBuffer) -> #[no_mangle] pub extern "C" fn ts_tagger_syntax_kinds_for_scope_name( this: *mut TSTagger, - scope_name: *const i8, + scope_name: *const c_char, len: *mut u32, ) -> *const *const i8 { let tagger = unwrap_mut_ptr(this); diff --git a/tags/src/lib.rs b/tags/src/lib.rs index 12db90cb..89809052 100644 --- a/tags/src/lib.rs +++ b/tags/src/lib.rs @@ -5,6 +5,7 @@ use regex::Regex; use std::collections::HashMap; use std::ffi::{CStr, CString}; use std::ops::Range; +use std::os::raw::c_char; use std::sync::atomic::{AtomicUsize, Ordering}; use std::{char, fmt, mem, str}; use tree_sitter::{ @@ -230,8 +231,9 @@ impl TagsConfiguration { pub fn syntax_type_name(&self, id: u32) -> &str { unsafe { - let cstr = CStr::from_ptr(self.syntax_type_names[id as usize].as_ptr() as *const i8) - .to_bytes(); + let cstr = + CStr::from_ptr(self.syntax_type_names[id as usize].as_ptr() as *const c_char) + .to_bytes(); str::from_utf8(cstr).expect("syntax type name was not valid utf-8") } }