Trait hotspots_parser::Parser
source · 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§
sourcefn ro_container(&self) -> &Container
fn ro_container(&self) -> &Container
Returns a reference to the container.
Provided Methods§
sourcefn add_file(&mut self, f: File) -> Result<(), Error>
fn add_file(&mut self, f: File) -> Result<(), Error>
Will return an error if the file is not compatible with the Parser.
sourcefn files(&self) -> Result<&[File], Error>
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.
sourcefn filter_name(&mut self, s: String)
fn filter_name(&mut self, s: String)
Adds the filter for excluding functions.
sourcefn func_repr(&self, v: Vec<Element>) -> (Vec<Element>, usize)
fn func_repr(&self, v: Vec<Element>) -> (Vec<Element>, usize)
Returns a new vector with the representation names for functions.
sourcefn find_functions(&mut self, pb: &ProgressBar) -> Result<Vec<Element>, Error>
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.