mirror of
https://github.com/CPunch/Cosmo.git
synced 2026-03-01 11:20:04 +00:00
extended lexer to support 'this'
This commit is contained in:
@@ -21,6 +21,7 @@ CReservedWord reservedWords[] = {
|
||||
{TOKEN_THEN, "then", 4},
|
||||
{TOKEN_TRUE, "true", 4},
|
||||
{TOKEN_VAR, "var", 3},
|
||||
{TOKEN_THIS, "this", 4},
|
||||
{TOKEN_WHILE, "while", 5}
|
||||
};
|
||||
|
||||
@@ -198,6 +199,8 @@ _scanTokenEnter:
|
||||
case ')': state->openedBraces--; return makeToken(state, TOKEN_RIGHT_PAREN);
|
||||
case '{': state->openedBraces++; return makeToken(state, TOKEN_LEFT_BRACE);
|
||||
case '}': state->openedBraces--; return makeToken(state, TOKEN_RIGHT_BRACE);
|
||||
case '[': state->openedBraces++; return makeToken(state, TOKEN_LEFT_BRACKET);
|
||||
case ']': state->openedBraces--; return makeToken(state, TOKEN_RIGHT_BRACKET);
|
||||
case '\0':
|
||||
state->isEnd = true;
|
||||
if (state->lastType == TOKEN_EOS)
|
||||
|
||||
Reference in New Issue
Block a user