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