pub struct Parser {
code: String,
_tree: Option<Tree>,
lang: Language,
}
Expand description
A struct that wraps a tree-sitter parser object and source code
Fields§
§code: String
the source code being parsed
_tree: Option<Tree>
the parse tree
lang: Language
the tree-sitter java grammar language
Implementations§
source§impl Parser
impl Parser
sourcepub fn new(source_code: String, lang: Language) -> Result<Self>
pub fn new(source_code: String, lang: Language) -> Result<Self>
Returns a new parser object
source_code
: the source code to be parsedlang
: the tree-sitter grammar to use
sourcepub fn new_script(
source_code: String,
lang: Language
) -> Result<Self, Box<EvalAltResult>>
pub fn new_script( source_code: String, lang: Language ) -> Result<Self, Box<EvalAltResult>>
Macro generated variant of #fn_name that returns EvalAltResult. This allows the function to be used in scripts.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Parser
impl Send for Parser
impl Sync for Parser
impl Unpin for Parser
impl UnwindSafe for Parser
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more