diff options
| author | Mike Buland <mike@xagasoft.com> | 2026-06-08 21:45:30 -0700 |
|---|---|---|
| committer | Mike Buland <mike@xagasoft.com> | 2026-06-08 21:45:30 -0700 |
| commit | 0f2bd09d269862105e603a9865201f521f49490b (patch) | |
| tree | 5326c452c41b5bd4a521ad5fa216dd999f31b5f8 /src/lexer.rs | |
| parent | 0736240f54ac90ded4d96b3ac35fc8571b141d1a (diff) | |
| download | crimtag-0f2bd09d269862105e603a9865201f521f49490b.tar.gz crimtag-0f2bd09d269862105e603a9865201f521f49490b.tar.bz2 crimtag-0f2bd09d269862105e603a9865201f521f49490b.tar.xz crimtag-0f2bd09d269862105e603a9865201f521f49490b.zip | |
It works again! and more!
About to change a few things:
- symbols and errors will have a range not a position
- remove view/output token type, those should just be View and Output
structs
- Figure out some formatting stuff? (add a dep? I dunno)
- Move to non-quoted dot-delimeted variable references.
- Add loops.
- Add conditionals?
- Add more!
Diffstat (limited to 'src/lexer.rs')
| -rw-r--r-- | src/lexer.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lexer.rs b/src/lexer.rs index 5ce7929..c7249b7 100644 --- a/src/lexer.rs +++ b/src/lexer.rs | |||
| @@ -24,7 +24,6 @@ pub enum SymbolType<'a> { | |||
| 24 | Literal(&'a str), | 24 | Literal(&'a str), |
| 25 | Text(&'a str), | 25 | Text(&'a str), |
| 26 | Error{ what: ErrorType }, | 26 | Error{ what: ErrorType }, |
| 27 | EOS, | ||
| 28 | } | 27 | } |
| 29 | 28 | ||
| 30 | #[derive(Copy,Clone)] | 29 | #[derive(Copy,Clone)] |
| @@ -36,7 +35,7 @@ pub struct Symbol<'a> { | |||
| 36 | 35 | ||
| 37 | impl<'a> fmt::Debug for Symbol<'a> { | 36 | impl<'a> fmt::Debug for Symbol<'a> { |
| 38 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | 37 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 39 | write!(f, "{:?} @ {}:{}", self.symbol, self.start.line, self.start.column ) | 38 | write!(f, "{:?} @ {:?}-{:?}", self.symbol, self.start, self.end ) |
| 40 | } | 39 | } |
| 41 | } | 40 | } |
| 42 | 41 | ||
| @@ -64,6 +63,7 @@ impl<'a> Symbol<'a> { | |||
| 64 | } | 63 | } |
| 65 | } | 64 | } |
| 66 | 65 | ||
| 66 | #[derive(Debug)] | ||
| 67 | enum Mode { | 67 | enum Mode { |
| 68 | Text, | 68 | Text, |
| 69 | InTag, | 69 | InTag, |
| @@ -300,6 +300,7 @@ impl<'a> Lexer<'a> { | |||
| 300 | } | 300 | } |
| 301 | 301 | ||
| 302 | fn parse_end_tag(&mut self) -> Option<Symbol<'a>> { | 302 | fn parse_end_tag(&mut self) -> Option<Symbol<'a>> { |
| 303 | self.skip_ws(); | ||
| 303 | let start_pos = self.pos.clone(); | 304 | let start_pos = self.pos.clone(); |
| 304 | if let Some(chr) = self.cur() && chr == '|' { | 305 | if let Some(chr) = self.cur() && chr == '|' { |
| 305 | match self.peek() { | 306 | match self.peek() { |
