summaryrefslogtreecommitdiffhomepage
path: root/lexer.c
diff options
context:
space:
mode:
Diffstat (limited to 'lexer.c')
-rw-r--r--lexer.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/lexer.c b/lexer.c
index 5c1b759..66ec8a0 100644
--- a/lexer.c
+++ b/lexer.c
@@ -126,8 +126,10 @@ static const struct token reserved_words[] = {
{ T_CONTINUE, "continue", 8 },
{ T_ENDWHILE, "endwhile", 8 },
{ T_FUNC, "function", 8 },
+ { T_DEFAULT, "default", 7 },
{ T_RETURN, "return", 6 },
{ T_ENDFOR, "endfor", 6 },
+ { T_SWITCH, "switch", 6 },
{ T_LOCAL, "local", 5 },
{ T_ENDIF, "endif", 5 },
{ T_WHILE, "while", 5 },
@@ -138,6 +140,7 @@ static const struct token reserved_words[] = {
{ T_ELSE, "else", 4 },
{ T_THIS, "this", 4 },
{ T_NULL, "null", 4 },
+ { T_CASE, "case", 4 },
{ T_NUMBER, "NaN", 3, parse_number },
{ T_TRY, "try", 3 },
{ T_FOR, "for", 3 },
@@ -146,12 +149,12 @@ static const struct token reserved_words[] = {
const char *tokennames[__T_MAX] = {
[0] = "End of file",
- [T_FUNC] = "'function'",
+ [T_FUNC] = "'function'",
[T_LOCAL] = "'local'",
- [T_WHILE] = "'while",
+ [T_WHILE] = "'while",
[T_ELSE] = "'else'",
[T_FOR] = "'for'",
- [T_IF] = "'if'",
+ [T_IF] = "'if'",
[T_IN] = "'in'",
[T_ASLEFT] = "'x<<=y'",
[T_ASRIGHT] = "'x>>=y'",
@@ -210,14 +213,17 @@ const char *tokennames[__T_MAX] = {
[T_ENDIF] = "'endif'",
[T_ENDFOR] = "'endfor'",
[T_ENDWHILE] = "'endwhile'",
- [T_ENDFUNC] = "'endfuncton'",
- [T_RETURN] = "'return'",
- [T_BREAK] = "'break'",
- [T_CONTINUE] = "'continue'",
+ [T_ENDFUNC] = "'endfuncton'",
+ [T_RETURN] = "'return'",
+ [T_BREAK] = "'break'",
+ [T_CONTINUE] = "'continue'",
[T_NULL] = "'null'",
- [T_THIS] = "'this'",
- [T_TRY] = "'try'",
- [T_CATCH] = "'catch'",
+ [T_THIS] = "'this'",
+ [T_TRY] = "'try'",
+ [T_CATCH] = "'catch'",
+ [T_SWITCH] = "'switch'",
+ [T_CASE] = "'case'",
+ [T_DEFAULT] = "'default'",
//[T_LSTM] = "'{%'",
//[T_RSTM] = "'%}'"
};