mirror of
https://github.com/CPunch/Cosmo.git
synced 2026-01-07 23:40:04 +00:00
Added power operator '^', added OP_POW
- added TOKEN_CARROT to clex.[ch]
This commit is contained in:
@@ -465,6 +465,7 @@ static void binary(CParseState *pstate, bool canAssign, Precedence prec) {
|
||||
case TOKEN_STAR: writeu8Chunk(pstate->state, getChunk(pstate), OP_MULT, cachedLine); break;
|
||||
case TOKEN_SLASH: writeu8Chunk(pstate->state, getChunk(pstate), OP_DIV, cachedLine); break;
|
||||
case TOKEN_PERCENT: writeu8Chunk(pstate->state, getChunk(pstate), OP_MOD, cachedLine); break;
|
||||
case TOKEN_CARROT: writeu8Chunk(pstate->state, getChunk(pstate), OP_POW, cachedLine); break;
|
||||
// EQUALITY
|
||||
case TOKEN_EQUAL_EQUAL: writeu8Chunk(pstate->state, getChunk(pstate), OP_EQUAL, cachedLine); break;
|
||||
case TOKEN_GREATER: writeu8Chunk(pstate->state, getChunk(pstate), OP_GREATER, cachedLine); break;
|
||||
@@ -921,6 +922,7 @@ ParseRule ruleTable[] = {
|
||||
[TOKEN_SLASH] = {NULL, binary, PREC_FACTOR},
|
||||
[TOKEN_STAR] = {NULL, binary, PREC_FACTOR},
|
||||
[TOKEN_PERCENT] = {NULL, binary, PREC_FACTOR},
|
||||
[TOKEN_CARROT] = {NULL, binary, PREC_FACTOR},
|
||||
[TOKEN_POUND] = {unary, NULL, PREC_NONE},
|
||||
[TOKEN_EOS] = {NULL, NULL, PREC_NONE},
|
||||
[TOKEN_BANG] = {unary, NULL, PREC_NONE},
|
||||
|
||||
Reference in New Issue
Block a user