cairo_lang_parser/
types.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
use cairo_lang_filesystem::span::TextOffset;

/// Used to run Cairo language parser over a custom source of tokens not produced by the lexer.
pub trait TokenStream {
    /// 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.
    fn get_start_offset(&self) -> Option<TextOffset>;

    /// Returns all tokens string content as a slice.
    fn as_str(&self) -> &str;
}