Skip to main content

TokenStreamPattern

Trait TokenStreamPattern 

Source
pub trait TokenStreamPattern {
    // Required methods
    fn process_token(
        &mut self,
        p: &mut Parser,
        offset: i32,
        top_level: bool,
    ) -> bool;
    fn result(&self) -> i32;

    // Provided methods
    fn is_top_level(
        &self,
        open_angle_brackets: i32,
        open_brackets: i32,
        open_braces: i32,
        open_parentheses: i32,
    ) -> bool { ... }
    fn handle_unmatched_closing(&mut self, _token: SyntaxKind) -> bool { ... }
}
Expand description

TokenStreamPattern, with AbstractTokenStreamPattern’s defaults.

Required Methods§

Source

fn process_token( &mut self, p: &mut Parser, offset: i32, top_level: bool, ) -> bool

Called on each token; true stops.

Source

fn result(&self) -> i32

The offset where the pattern matched, -1 if none.

Provided Methods§

Source

fn is_top_level( &self, open_angle_brackets: i32, open_brackets: i32, open_braces: i32, open_parentheses: i32, ) -> bool

Source

fn handle_unmatched_closing(&mut self, _token: SyntaxKind) -> bool

Called on unmatched ); true asks to stop (ignored by the caller upstream).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§