Changed my mind about oftype/typeof

This commit is contained in:
2022-09-07 15:02:17 +01:00
parent 4137b7f057
commit 23fdec541d
7 changed files with 10 additions and 10 deletions

View File

@@ -34,7 +34,7 @@ KeywordType keywordTypes[] = {
{TOKEN_RETURN, "return"},
{TOKEN_TYPE, "type"},
{TOKEN_ASTYPE, "astype"},
{TOKEN_OFTYPE, "oftype"},
{TOKEN_TYPEOF, "typeof"},
{TOKEN_VAR, "var"},
{TOKEN_WHILE, "while"},

View File

@@ -136,7 +136,7 @@ static Opcode asType(Parser* parser, Node** nodeHandle) {
return OP_EOF;
}
static Opcode ofType(Parser* parser, Node** nodeHandle) {
static Opcode typeOf(Parser* parser, Node** nodeHandle) {
Node* rhs = NULL;
parsePrecedence(parser, &rhs, PREC_TERNARY);
emitNodeUnary(nodeHandle, OP_TYPE_OF, rhs);
@@ -821,7 +821,7 @@ ParseRule parseRules[] = { //must match the token types
{NULL, NULL, PREC_NONE},// TOKEN_RETURN,
{atomic, NULL, PREC_NONE},// TOKEN_TYPE,
{asType, NULL, PREC_PRIMARY},// TOKEN_ASTYPE,
{ofType, NULL, PREC_CALL},// TOKEN_OFTYPE,
{typeOf, NULL, PREC_CALL},// TOKEN_TYPEOF,
{NULL, NULL, PREC_NONE},// TOKEN_VAR,
{NULL, NULL, PREC_NONE},// TOKEN_WHILE,

View File

@@ -32,7 +32,7 @@ typedef enum TokenType {
TOKEN_RETURN,
TOKEN_TYPE,
TOKEN_ASTYPE,
TOKEN_OFTYPE,
TOKEN_TYPEOF,
TOKEN_VAR,
TOKEN_WHILE,