pub struct Parser { /* private fields */ }Expand description
A stateful object that this is used to produce a Tree based on some
source code.
Implementations§
Source§impl Parser
impl Parser
Sourcepub fn set_grammar(
&mut self,
grammar: Grammar,
) -> Result<(), IncompatibleGrammarError>
pub fn set_grammar( &mut self, grammar: Grammar, ) -> Result<(), IncompatibleGrammarError>
Set the language that the parser should use for parsing.
pub fn set_timeout(&mut self, duration: Duration)
Sourcepub fn set_included_ranges(
&mut self,
ranges: &[Range],
) -> Result<(), InvalidRangesError>
pub fn set_included_ranges( &mut self, ranges: &[Range], ) -> Result<(), InvalidRangesError>
Set the ranges of text that the parser should include when parsing. By default, the parser will always include entire documents. This function allows you to parse only a portion of a document but still return a syntax tree whose ranges match up with the document as a whole. You can also pass multiple disjoint ranges.
ranges must be non-overlapping and sorted.
pub fn parse<I: Input>( &mut self, input: impl IntoInput<Input = I>, old_tree: Option<&Tree>, ) -> Option<Tree>
Trait Implementations§
impl Send for Parser
impl Sync for Parser
Auto Trait Implementations§
impl Freeze for Parser
impl RefUnwindSafe for Parser
impl Unpin for Parser
impl UnsafeUnpin 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