Debugger: Even more operators

This commit is contained in:
Vicki Pfau 2017-12-28 19:58:32 -05:00
parent e2f4fdbdac
commit 5d8403f5a3
2 changed files with 36 additions and 0 deletions

View File

@ -569,6 +569,21 @@ static uint32_t _performOperation(enum Operation operation, uint32_t current, ui
case OP_XOR:
current ^= next;
break;
case OP_LESS:
current = current < next;
break;
case OP_GREATER:
current = current > next;
break;
case OP_EQUAL:
current = current == next;
break;
case OP_LE:
current = current <= next;
break;
case OP_GE:
current = current >= next;
break;
}
return current;
}

View File

@ -43,6 +43,12 @@ static struct LexVector* _lexOperator(struct LexVector* lv, char operator) {
case '^':
lvNext->token.operatorValue = OP_XOR;
break;
case '<':
lvNext->token.operatorValue = OP_LESS;
break;
case '>':
lvNext->token.operatorValue = OP_GREATER;
break;
default:
lvNext->token.type = TOKEN_ERROR_TYPE;
break;
@ -125,6 +131,8 @@ size_t lexExpression(struct LexVector* lv, const char* string, size_t length) {
case '&':
case '|':
case '^':
case '<':
case '>':
lv->token.type = TOKEN_IDENTIFIER_TYPE;
lv->token.identifierValue = strndup(tokenStart, string - tokenStart - 1);
lv = _lexOperator(lv, token);
@ -151,6 +159,11 @@ size_t lexExpression(struct LexVector* lv, const char* string, size_t length) {
case '-':
case '*':
case '/':
case '&':
case '|':
case '^':
case '<':
case '>':
lv->token.type = TOKEN_UINT_TYPE;
lv->token.uintValue = next;
lv = _lexOperator(lv, token);
@ -189,6 +202,8 @@ size_t lexExpression(struct LexVector* lv, const char* string, size_t length) {
case '&':
case '|':
case '^':
case '<':
case '>':
lv->token.type = TOKEN_UINT_TYPE;
lv->token.uintValue = next;
lv = _lexOperator(lv, token);
@ -246,6 +261,8 @@ size_t lexExpression(struct LexVector* lv, const char* string, size_t length) {
case '&':
case '|':
case '^':
case '<':
case '>':
lv->token.type = TOKEN_UINT_TYPE;
lv->token.uintValue = next;
lv = _lexOperator(lv, token);
@ -291,6 +308,8 @@ size_t lexExpression(struct LexVector* lv, const char* string, size_t length) {
case '&':
case '|':
case '^':
case '<':
case '>':
lv->token.type = TOKEN_UINT_TYPE;
lv->token.uintValue = next;
lv = _lexOperator(lv, token);
@ -327,6 +346,8 @@ size_t lexExpression(struct LexVector* lv, const char* string, size_t length) {
case '&':
case '|':
case '^':
case '<':
case '>':
lvNext = malloc(sizeof(struct LexVector));
lvNext->next = lv->next;
lvNext->token.type = TOKEN_CLOSE_PAREN_TYPE;