pub trait Parser {
    // Required methods
    fn container(&mut self) -> &mut Container;
    fn ro_container(&self) -> &Container;
    fn supported(&self, f: &File) -> bool;
    fn language(&self) -> Language;
    fn query(&self) -> &Query;

    // Provided methods
    fn add_file(&mut self, f: File) -> Result<(), Error> { ... }
    fn files(&self) -> Result<&[File], Error> { ... }
    fn filter_name(&mut self, s: String) { ... }
    fn filter(&self, p: &str) -> bool { ... }
    fn func_repr(&self, v: Vec<Element>) -> (Vec<Element>, usize) { ... }
    fn find_functions(
        &mut self,
        pb: &ProgressBar
    ) -> Result<Vec<Element>, Error> { ... }
}
Expand description

Parser provides the functionalities necessary for finding tree-sitter Nodes from a list of given files.

Required Methods§

source

fn container(&mut self) -> &mut Container

Returns a mutable reference to the container.

source

fn ro_container(&self) -> &Container

Returns a reference to the container.

source

fn supported(&self, f: &File) -> bool

Returns true if the file is compatible with the Parser.

source

fn language(&self) -> Language

Returns a tree-sitter language.

source

fn query(&self) -> &Query

Returns a tree-sitter Query object for the Parser’s language.

Provided Methods§

source

fn add_file(&mut self, f: File) -> Result<(), Error>

Will return an error if the file is not compatible with the Parser.

source

fn files(&self) -> Result<&[File], Error>

Returns a mutable reference to the given files. It returns and error if the file can’t be read.

source

fn filter_name(&mut self, s: String)

Adds the filter for excluding functions.

source

fn filter(&self, p: &str) -> bool

Applies the filter on function names.

source

fn func_repr(&self, v: Vec<Element>) -> (Vec<Element>, usize)

Returns a new vector with the representation names for functions.

source

fn find_functions(&mut self, pb: &ProgressBar) -> Result<Vec<Element>, Error>

Returns all the functions in all files. It returns and error if the file can’t be read, or the language parser can’t parse the contents.

Implementors§