package token import "../source" import "../symbol" Kind :: enum u8 { Invalid, Eof, Newline, Identifier, Integer, Float, String, Multiline_String, Character, Underscore, Colon, Colon_Colon, Colon_Equal, Equal, Equal_Equal, Bang, Bang_Equal, Less, Less_Equal, Less_Less, Less_Less_Equal, Less_Less_Pipe, Less_Less_Pipe_Equal, Greater, Greater_Equal, Greater_Greater, Greater_Greater_Equal, Plus, Minus, Slash, Plus_Equal, Minus_Equal, Star_Equal, Slash_Equal, Dot, Range, Range_Inclusive, Ellipsis, At, Dollar, Star, Ampersand, Ampersand_Equal, Caret, Tilde, Xor_Equal, Question, Semicolon, Left_Bracket, Right_Bracket, Left_Paren, Right_Paren, Left_Brace, Right_Brace, Comma, Pipe, Pipe_Equal, Keyword_Test, Keyword_Func, Keyword_C_Func, Keyword_Struct, Keyword_C_Struct, Keyword_Opaque, Keyword_Union, Keyword_Enum, Keyword_Distinct, Keyword_Alias, Keyword_Import, Keyword_Hide, Keyword_Return, Keyword_Try, Keyword_Catch, Keyword_Mut, Keyword_Null, Keyword_Undefined, Keyword_Orelse, Keyword_And, Keyword_Or, Keyword_Xor, Keyword_If, Keyword_While, Keyword_For, Keyword_Inline, Keyword_Break, Keyword_Continue, Keyword_Defer, Keyword_Errdefer, Keyword_Yield, Keyword_Match, Keyword_Else, Keyword_True, Keyword_False, Keyword_Void, Keyword_Noreturn, Keyword_Anyopaque, Keyword_Unreachable, Keyword_Bool, Keyword_Int, Keyword_Uint, Keyword_Float, Keyword_Range, Keyword_I8, Keyword_I16, Keyword_I32, Keyword_I64, Keyword_U8, Keyword_U16, Keyword_U32, Keyword_U64, Keyword_Isize, Keyword_Usize, Keyword_F32, Keyword_F64, Keyword_C_Char, Keyword_C_Schar, Keyword_C_Uchar, Keyword_C_Short, Keyword_C_Ushort, Keyword_C_Int, Keyword_C_Uint, Keyword_C_Long, Keyword_C_Ulong, Keyword_C_Longlong, Keyword_C_Ulonglong, Keyword_C_Float, Keyword_C_Double, Keyword_C_Longdouble, } is_keyword :: proc(kind: Kind) -> bool { return kind >= .Keyword_Test && kind <= .Keyword_C_Longdouble } Token :: struct { span: source.Span, symbol: symbol.Id, diagnostic: source.Diagnostic_Id, kind: Kind, } Stream :: struct { items: [dynamic]Token, symbols: ^symbol.Table, }