morgana_core/syntax/source/mod.rs
1pub mod file;
2pub mod range;
3pub mod string;
4
5pub trait Source: std::fmt::Debug {
6 /// Get the filename of the source, or None if the source has no filename
7 fn filename(&self) -> Option<String>;
8
9 /// Consume and get the next character in the content of the source. Return `None` if no
10 /// character can be read.
11 fn eat(&mut self) -> Option<char>;
12
13 /// Get the current position in the source
14 fn pos(&self) -> self::range::Pos;
15
16 /// Peek the next character in the source
17 fn peek(&self) -> Option<char>;
18}