Struct i_slint_compiler::parser::DefaultParser
source · pub struct DefaultParser<'a> { /* private fields */ }
Implementations§
source§impl<'a> DefaultParser<'a>
impl<'a> DefaultParser<'a>
sourcepub fn new(source: &str, diags: &'a mut BuildDiagnostics) -> Self
pub fn new(source: &str, diags: &'a mut BuildDiagnostics) -> Self
Constructor that create a parser from the source code
sourcepub fn consume_ws(&mut self)
pub fn consume_ws(&mut self)
Consume all the whitespace
Trait Implementations§
source§impl Parser for DefaultParser<'_>
impl Parser for DefaultParser<'_>
source§fn nth(&mut self, n: usize) -> Token
fn nth(&mut self, n: usize) -> Token
Peek the n
th token, not including whitespace and comments
source§fn start_node_impl(
&mut self,
kind: SyntaxKind,
checkpoint: Option<Self::Checkpoint>,
_: NodeToken
)
fn start_node_impl( &mut self, kind: SyntaxKind, checkpoint: Option<Self::Checkpoint>, _: NodeToken )
Can only be called by Self::start_node
source§fn finish_node_impl(&mut self, _: NodeToken)
fn finish_node_impl(&mut self, _: NodeToken)
Can only be called by Node::drop
type Checkpoint = Checkpoint
fn checkpoint(&mut self) -> Self::Checkpoint
source§fn start_node(&mut self, kind: SyntaxKind) -> Node<'_, Self>
fn start_node(&mut self, kind: SyntaxKind) -> Node<'_, Self>
Enter a new node. The node is going to be finished when
The return value of this function is dropped Read more
fn start_node_at( &mut self, checkpoint: Self::Checkpoint, kind: SyntaxKind ) -> Node<'_, Self>
source§fn expect(&mut self, kind: SyntaxKind) -> bool
fn expect(&mut self, kind: SyntaxKind) -> bool
Consume the token if it has the right kind, otherwise report a syntax error.
Returns true if the token was consumed.
source§fn test(&mut self, kind: SyntaxKind) -> bool
fn test(&mut self, kind: SyntaxKind) -> bool
If the token if of this type, consume it and return true, otherwise return false
source§fn until(&mut self, kind: SyntaxKind)
fn until(&mut self, kind: SyntaxKind)
consume everything until reaching a token of this kind