mirror of
https://github.com/suchmememanyskill/TegraExplorer.git
synced 2024-11-09 13:41:45 +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;
|
||||
ELIFT(OR)
|
||||
res.integerType = res.integerType | val.integerType;
|
||||
ELIFT(BitShiftLeft)
|
||||
res.integerType = res.integerType << val.integerType;
|
||||
ELIFT(BitShiftRight)
|
||||
res.integerType = res.integerType >> val.integerType;
|
||||
else
|
||||
return ErrValue(ERRBADOPERATOR);
|
||||
}
|
||||
|
@ -396,7 +400,7 @@ Variable_t solveEquation(scriptCtx_t* ctx, lexarToken_t* tokens, u32 len, u8 sho
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,8 +36,6 @@ lexarTranslation_t lexarTranslations[] = {
|
|||
{'*', Multiply},
|
||||
{'/', Division},
|
||||
{'%', Mod},
|
||||
{'<', Smaller},
|
||||
{'>', Bigger},
|
||||
{'!', Not},
|
||||
{':', Selector},
|
||||
{')', RBracket},
|
||||
|
@ -46,6 +44,8 @@ lexarTranslation_t lexarTranslations[] = {
|
|||
{'{', LCBracket},
|
||||
{'=', Equal},
|
||||
{'[', LSBracket},
|
||||
{'<', Smaller},
|
||||
{'>', Bigger},
|
||||
{'\0', 0},
|
||||
};
|
||||
|
||||
|
@ -240,6 +240,22 @@ Vector_t runLexar(const char* in, u32 len) {
|
|||
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 {
|
||||
int val = 0;
|
||||
|
||||
|
|
|
@ -38,6 +38,8 @@ enum Tokens {
|
|||
AND,
|
||||
OR,
|
||||
Selector,
|
||||
BitShiftLeft,
|
||||
BitShiftRight,
|
||||
EquationSeperator,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue