aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCody <cody@codyq.dev>2023-03-27 04:47:00 -0500
committerCody <cody@codyq.dev>2023-03-27 04:47:00 -0500
commitbb95375f8b24141bf7dfe5a8b1bba5c995f61253 (patch)
tree10eb423cf881afaba7d854f8150a8f5d55d6d1db /src
parentff2d00dec2317df8de0afaf56beb35e2edb70cd7 (diff)
downloadsloth-bb95375f8b24141bf7dfe5a8b1bba5c995f61253.tar.gz
hm
Diffstat (limited to 'src')
-rw-r--r--src/lexer.rs96
1 files changed, 84 insertions, 12 deletions
diff --git a/src/lexer.rs b/src/lexer.rs
index ef79716..8631eef 100644
--- a/src/lexer.rs
+++ b/src/lexer.rs
@@ -14,18 +14,82 @@ pub enum TokenType {
DocComment,
Comment,
- // Operatiors
- Plus,
- Minus,
- Star,
- Slash,
- Perc,
-
- PlusEq,
- MinusEq,
- StarEq,
- SlashEq,
- PercEq,
+ // Brackets
+ OpeningParen, // (
+ ClosingParen, // )
+ OpeningBracket, // [
+ ClosingBracket, // ]
+ OpeningBrace, // {
+ ClosingBrace, // }
+
+ // Operators
+ Plus, // +
+ PlusPlus, // ++
+ Minus, // -
+ Star, // *
+ StarStar, // **
+ Slash, // /
+ Perc, // %
+ Tilde, // ~
+
+ PlusEq, // +=
+ PlusPlusEq, // ++=
+ MinusEq, // -=
+ StarEq, // *=
+ StarStarEq, // **=
+ SlashEq, // /=
+ PercEq, // %=
+
+ Amp, // &
+ AmpAmp, // &&
+ Pipe, // |
+ PipePipe, // ||
+
+ Eq, // =
+ EqEq, // ==
+ Bang, // !
+ BangBang, // !!
+ BangEq, // !=
+
+ Lt, // <
+ LtLt, // <<
+ LtEq, // <=
+ Gt, // >
+ GtGt, // >>
+ GtEq, // >=
+
+ Comma,
+
+ Question, // ?
+ QuestionDot, // ?.
+ QuestionQuestion, // ??
+ Dot, // .
+ DotDot, // ..
+
+ Colon, // :
+ ColonColon, // ::
+ SemiColon, // ;
+
+ Arrow, // ->
+
+ // Keywords
+ Val,
+ Var,
+
+ Fn,
+
+ If,
+ Else,
+
+ While,
+ For,
+ In,
+
+ Loop,
+ Break,
+ Continue,
+
+ As,
// Misc
Literal(Literal),
@@ -79,3 +143,11 @@ impl<'a> Iterator for Lexer<'a> {
unimplemented!()
}
}
+
+#[cfg(test)]
+mod tests {
+ #[test]
+ fn basic_test_a() {
+ //
+ }
+}