New tokenizer tokens for variable binding
This commit is contained in:
parent
22394b2d6e
commit
16d77f494b
2 changed files with 19 additions and 4 deletions
|
@ -96,7 +96,7 @@ static Token _Tokenizer_IdentifierToken(StringView* source)
|
|||
|
||||
static Token _Tokenizer_SimpleToken(StringView* source)
|
||||
{
|
||||
const char* literal_table[] = { "{", "}", "&", ":", "+", "->", "-", "*", "/", "|", "==", "!=", "<", "<=", ">", ">=", ",", ";" };
|
||||
const char* literal_table[] = { "{", "}", "&", ":", "+", "->", "-", "*", "/", "|", "==", "!=", "<", "<=", ">", ">=", ",", ";", "bind", "as", "(", ")" };
|
||||
const enum TokenType type_table[] = {
|
||||
TOKENTYPE_LEFT_BRACE,
|
||||
TOKENTYPE_RIGHT_BRACE,
|
||||
|
@ -116,6 +116,10 @@ static Token _Tokenizer_SimpleToken(StringView* source)
|
|||
TOKENTYPE_GREATEREQUAL,
|
||||
TOKENTYPE_COMMA,
|
||||
TOKENTYPE_SEMICOLON,
|
||||
TOKENTYPE_BIND,
|
||||
TOKENTYPE_AS,
|
||||
TOKENTYPE_LEFT_PAREN,
|
||||
TOKENTYPE_RIGHT_PAREN,
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < sizeof(literal_table) / sizeof(literal_table[0]); i++) {
|
||||
|
@ -208,7 +212,14 @@ const char* TokenType_ToString(enum TokenType type)
|
|||
return "TOKENTYPE_COMMA";
|
||||
case TOKENTYPE_SEMICOLON:
|
||||
return "TOKENTYPE_SEMICOLON";
|
||||
|
||||
case TOKENTYPE_BIND:
|
||||
return "BIND";
|
||||
case TOKENTYPE_AS:
|
||||
return "AS";
|
||||
case TOKENTYPE_LEFT_PAREN:
|
||||
return "LEFT_PAREN";
|
||||
case TOKENTYPE_RIGHT_PAREN:
|
||||
return "RIGHT_PAREN";
|
||||
}
|
||||
|
||||
return "INVALID";
|
||||
|
|
|
@ -27,6 +27,10 @@ enum TokenType {
|
|||
TOKENTYPE_GREATERTHAN,
|
||||
TOKENTYPE_GREATEREQUAL,
|
||||
TOKENTYPE_COMMA,
|
||||
TOKENTYPE_BIND,
|
||||
TOKENTYPE_AS,
|
||||
TOKENTYPE_LEFT_PAREN,
|
||||
TOKENTYPE_RIGHT_PAREN,
|
||||
TOKENTYPE_ERROR,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue