Function tree_sitter::ffi::ts_query_new

source ·
pub unsafe extern "C" fn ts_query_new(
    language: *const TSLanguage,
    source: *const c_char,
    source_len: u32,
    error_offset: *mut u32,
    error_type: *mut TSQueryError
) -> *mut TSQuery
Expand description

Create a new query from a string containing one or more S-expression patterns. The query is associated with a particular language, and can only be run on syntax nodes parsed with that language.

If all of the given patterns are valid, this returns a TSQuery. If a pattern is invalid, this returns NULL, and provides two pieces of information about the problem:

  1. The byte offset of the error is written to the error_offset parameter.
  2. The type of error is written to the error_type parameter.