From 3dca55184f47f1687cd5d87d100eaed933459c04 Mon Sep 17 00:00:00 2001 From: DualFroz Date: Sun, 23 Aug 2026 15:50:00 +0200 Subject: [PATCH] feat(lexer): add token definitions --- src/main/kotlin/lumen/lexer/Token.kt | 64 ++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/main/kotlin/lumen/lexer/Token.kt diff --git a/src/main/kotlin/lumen/lexer/Token.kt b/src/main/kotlin/lumen/lexer/Token.kt new file mode 100644 index 0000000..9e1917b --- /dev/null +++ b/src/main/kotlin/lumen/lexer/Token.kt @@ -0,0 +1,64 @@ +package lumen.lexer + +enum class TokenType { + // literals + IntLiteral, + DoubleLiteral, + StringLiteral, + Identifier, + + // keywords + Let, + Var, + Fn, + Return, + If, + Else, + While, + For, + In, + True, + False, + Nil, + And, + Or, + Not, + Import, + + // punctuation + Plus, + Minus, + Star, + Slash, + Percent, + Assign, + EqualEqual, + BangEqual, + Less, + LessEqual, + Greater, + GreaterEqual, + LeftParen, + RightParen, + LeftBracket, + RightBracket, + LeftBrace, + RightBrace, + Comma, + Colon, + Semicolon, + Dot, + Newline, + + Eof +} + +data class Token( + val type: TokenType, + val lexeme: String, + val line: Int, + val column: Int = 1, + val intValue: Long = 0L, + val doubleValue: Double = 0.0, + val stringValue: String = "" +)