cairo_lang_parser::types

Trait TokenStream

Source
pub trait TokenStream {
    // Required methods
    fn get_start_offset(&self) -> Option<TextOffset>;
    fn as_str(&self) -> &str;
}
Expand description

Used to run Cairo language parser over a custom source of tokens not produced by the lexer.

Required Methods§

Source

fn get_start_offset(&self) -> Option<TextOffset>

Returns the starting TextOffset of the token stream, if there is at least a single token.

This property is used as offset of a root cairo_lang_syntax::node::SyntaxNode produced when parsing this stream.

Source

fn as_str(&self) -> &str

Returns all tokens string content as a slice.

Implementors§