mirror of
https://github.com/suchmememanyskill/TegraExplorer.git
synced 2024-11-22 20:06:43 +00:00
[script] add bitshifting
This commit is contained in:
parent
e1f292fe0d
commit
e0c62cbec4
3 changed files with 25 additions and 3 deletions
|
@ -263,6 +263,10 @@ Variable_t solveEquation(scriptCtx_t* ctx, lexarToken_t* tokens, u32 len, u8 sho
|
||||||
res.integerType = res.integerType & val.integerType;
|
res.integerType = res.integerType & val.integerType;
|
||||||
ELIFT(OR)
|
ELIFT(OR)
|
||||||
res.integerType = res.integerType | val.integerType;
|
res.integerType = res.integerType | val.integerType;
|
||||||
|
ELIFT(BitShiftLeft)
|
||||||
|
res.integerType = res.integerType << val.integerType;
|
||||||
|
ELIFT(BitShiftRight)
|
||||||
|
res.integerType = res.integerType >> val.integerType;
|
||||||
else
|
else
|
||||||
return ErrValue(ERRBADOPERATOR);
|
return ErrValue(ERRBADOPERATOR);
|
||||||
}
|
}
|
||||||
|
@ -396,7 +400,7 @@ Variable_t solveEquation(scriptCtx_t* ctx, lexarToken_t* tokens, u32 len, u8 sho
|
||||||
res = val;
|
res = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (tokens[i].token >= Plus && tokens[i].token <= Selector) {
|
else if (tokens[i].token >= Plus && tokens[i].token <= BitShiftRight) {
|
||||||
lastToken = tokens[i].token;
|
lastToken = tokens[i].token;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,8 +36,6 @@ lexarTranslation_t lexarTranslations[] = {
|
||||||
{'*', Multiply},
|
{'*', Multiply},
|
||||||
{'/', Division},
|
{'/', Division},
|
||||||
{'%', Mod},
|
{'%', Mod},
|
||||||
{'<', Smaller},
|
|
||||||
{'>', Bigger},
|
|
||||||
{'!', Not},
|
{'!', Not},
|
||||||
{':', Selector},
|
{':', Selector},
|
||||||
{')', RBracket},
|
{')', RBracket},
|
||||||
|
@ -46,6 +44,8 @@ lexarTranslation_t lexarTranslations[] = {
|
||||||
{'{', LCBracket},
|
{'{', LCBracket},
|
||||||
{'=', Equal},
|
{'=', Equal},
|
||||||
{'[', LSBracket},
|
{'[', LSBracket},
|
||||||
|
{'<', Smaller},
|
||||||
|
{'>', Bigger},
|
||||||
{'\0', 0},
|
{'\0', 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -240,6 +240,22 @@ Vector_t runLexar(const char* in, u32 len) {
|
||||||
vecAddElement(&vec, makeLexarToken(OR, 0));
|
vecAddElement(&vec, makeLexarToken(OR, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ELIFC('>'){
|
||||||
|
if (in[1] == '>'){
|
||||||
|
vecAddElement(&vec, makeLexarToken(BitShiftRight, 0));
|
||||||
|
in++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
vecAddElement(&vec, makeLexarToken(Bigger, 0));
|
||||||
|
}
|
||||||
|
ELIFC('<'){
|
||||||
|
if (in[1] == '<'){
|
||||||
|
vecAddElement(&vec, makeLexarToken(BitShiftLeft, 0));
|
||||||
|
in++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
vecAddElement(&vec, makeLexarToken(Smaller, 0));
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
int val = 0;
|
int val = 0;
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,8 @@ enum Tokens {
|
||||||
AND,
|
AND,
|
||||||
OR,
|
OR,
|
||||||
Selector,
|
Selector,
|
||||||
|
BitShiftLeft,
|
||||||
|
BitShiftRight,
|
||||||
EquationSeperator,
|
EquationSeperator,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue