Create a new token source from the given source code which starts at the given offset.
(source: &'src str, mode: Mode, start_offset: TextSize)
| 29 | |
| 30 | /// Create a new token source from the given source code which starts at the given offset. |
| 31 | pub(crate) fn from_source(source: &'src str, mode: Mode, start_offset: TextSize) -> Self { |
| 32 | let lexer = Lexer::new(source, mode, start_offset); |
| 33 | let mut source = TokenSource::new(lexer); |
| 34 | |
| 35 | // Initialize the token source so that the current token is set correctly. |
| 36 | source.do_bump(); |
| 37 | source |
| 38 | } |
| 39 | |
| 40 | /// Returns the kind of the current token. |
| 41 | pub(crate) fn current_kind(&self) -> TokenKind { |