From 4b24d9e5d52d520d9c6269359651f27a2975892b Mon Sep 17 00:00:00 2001 From: Ryan Chandler Date: Wed, 20 Jul 2022 21:33:59 +0100 Subject: [PATCH] lexer: start adding some more token types --- trunk_lexer/src/token.rs | 105 ++++++++++++++++++++++++++++----------- 1 file changed, 76 insertions(+), 29 deletions(-) diff --git a/trunk_lexer/src/token.rs b/trunk_lexer/src/token.rs index 2540a96..668c61d 100644 --- a/trunk_lexer/src/token.rs +++ b/trunk_lexer/src/token.rs @@ -7,44 +7,91 @@ pub enum OpenTagKind { #[derive(Debug, PartialEq, Clone)] pub enum TokenKind { - Identifier(String), - Variable(String), - Function, - Class, - Extends, - Implements, - Public, - Protected, - Private, - Static, - Final, Abstract, - If, + AndEqual, + Array, + ArrayCast, + As, + Asterisk, + Attribute, + BoolCast, + BooleanAnd, + BooleanOr, + Break, + Callable, + Case, + Catch, + Class, + ClassConstant, + Clone, + CloseTag, + Coalesce, + CoalesceEqual, + Comment, + Comma, + ConcatEqual, + Const, + ConstantString, + Continue, + CurlyOpen, + Decrement, + Declare, + Default, + DirConstant, + DivEqual, + Do, + DocComment, + DoubleCast, + DoubleColon, + DoubleArrow, + DoubleEquals, + Echo, + Ellipsis, Else, ElseIf, - Return, - Echo, - Int(i64), - Plus, - Minus, + Empty, + EndDeclare, + EndFor, + EndForeach, + EndIf, + EndSwitch, + EndWhile, + Enum, + Eof, Equals, - DoubleEquals, - TripleEquals, - LessThan, - LeftParen, - RightParen, + Extends, + Final, + Function, + GreaterThan, + GreaterThanEquals, + Identifier(String), + If, + Implements, + InlineHtml(String), + Int(i64), LeftBrace, LeftBracket, - RightBracket, - RightBrace, + LeftParen, + LessThan, + LessThanEquals, + Minus, OpenTag(OpenTagKind), - CloseTag, + Percent, + Plus, + Pow, + Private, + Protected, + Public, + Return, + RightBrace, + RightBracket, + RightParen, SemiColon, - Comma, - InlineHtml(String), - Eof, + Slash, + Static, + TripleEquals, Var, - DoubleArrow, + Variable(String), } #[derive(Debug, Clone)]