diff options
| author | Tolmachev Igor <me@igorek.dev> | 2026-05-08 17:05:01 +0300 |
|---|---|---|
| committer | Tolmachev Igor <me@igorek.dev> | 2026-05-08 18:22:09 +0300 |
| commit | 323ddffe325a4bffec89447c75cc27a81315abc1 (patch) | |
| tree | 1391ea326e73a6bfff2f244cddb967593b382ee9 /compiler/src/lexer/mod.rs | |
| parent | 58b937521f3e459089c0d475551bf9a49f930657 (diff) | |
| download | crisp-323ddffe325a4bffec89447c75cc27a81315abc1.tar.gz crisp-323ddffe325a4bffec89447c75cc27a81315abc1.zip | |
Split Spanned<T> from Span and expose fields
Spanned<T> wraps a value with a Span.
Public fields enable destructuring in pattern matches.
Diffstat (limited to 'compiler/src/lexer/mod.rs')
| -rw-r--r-- | compiler/src/lexer/mod.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/src/lexer/mod.rs b/compiler/src/lexer/mod.rs index ff7d51d..464d88e 100644 --- a/compiler/src/lexer/mod.rs +++ b/compiler/src/lexer/mod.rs | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | use crate::span::{Pos, Span}; | 1 | use crate::span::{Pos, Span, Spanned}; |
| 2 | 2 | ||
| 3 | #[cfg(test)] | 3 | #[cfg(test)] |
| 4 | mod tests; | 4 | mod tests; |
| @@ -113,7 +113,7 @@ impl<'a> Lexer<'a> { | |||
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | impl<'a> Iterator for Lexer<'a> { | 115 | impl<'a> Iterator for Lexer<'a> { |
| 116 | type Item = Span<Token<'a>>; | 116 | type Item = Spanned<Token<'a>>; |
| 117 | 117 | ||
| 118 | fn next(&mut self) -> Option<Self::Item> { | 118 | fn next(&mut self) -> Option<Self::Item> { |
| 119 | loop { | 119 | loop { |
| @@ -163,6 +163,6 @@ impl<'a> Iterator for Lexer<'a> { | |||
| 163 | }; | 163 | }; |
| 164 | 164 | ||
| 165 | let end = Pos::new(self.line, self.column, self.cursor); | 165 | let end = Pos::new(self.line, self.column, self.cursor); |
| 166 | Some(Span::new(token, start, end)) | 166 | Some(Spanned::new(token, Span::new(start, end))) |
| 167 | } | 167 | } |
| 168 | } | 168 | } |
