cairo_lang_parser/types.rs
1use cairo_lang_filesystem::span::TextOffset;
2
3/// Used to run Cairo language parser over a custom source of tokens not produced by the lexer.
4pub trait TokenStream {
5 /// Returns the starting [`TextOffset`] of the token stream, if there is at least a single
6 /// token.
7 ///
8 /// This property is used as offset of a root [cairo_lang_syntax::node::SyntaxNode] produced
9 /// when parsing this stream.
10 fn get_start_offset(&self) -> Option<TextOffset>;
11
12 /// Returns all tokens string content as a slice.
13 fn as_str(&self) -> &str;
14}