|
@@ -22,8 +22,9 @@ typedef struct Literal {
|
|
|
Token token;
|
|
|
} Literal;
|
|
|
|
|
|
-Literal LITERALS[] = {{"print", T_PRINT}, {"null", T_NULL}, {"true", T_TRUE}, {"false", T_FALSE},
|
|
|
- {"function", T_FUNCTION}, {"return", T_RETURN}, {"if", T_IF}, {"else", T_ELSE}};
|
|
|
+Literal LITERALS[] = {{"print", T_PRINT}, {"null", T_NULL}, {"true", T_TRUE},
|
|
|
+ {"false", T_FALSE}, {"function", T_FUNCTION}, {"return", T_RETURN},
|
|
|
+ {"if", T_IF}, {"else", T_ELSE}, {"while", T_WHILE}};
|
|
|
const int LITERAL_AMOUNT = sizeof(LITERALS) / sizeof(Literal);
|
|
|
|
|
|
static void tError(const char* format, ...) {
|
|
@@ -270,6 +271,7 @@ const char* tGetTokenName(Token token) {
|
|
|
case T_PRINT: return "print";
|
|
|
case T_IF: return "if";
|
|
|
case T_ELSE: return "else";
|
|
|
+ case T_WHILE: return "while";
|
|
|
case T_FUNCTION: return "function";
|
|
|
case T_RETURN: return "return";
|
|
|
case T_COMMA: return ",";
|