mirror of https://github.com/mgba-emu/mgba.git
Fix 0 not being recognized as a valid token
This commit is contained in:
parent
e293134a78
commit
fd1128f90a
|
@ -77,6 +77,7 @@ size_t lexExpression(struct LexVector* lv, const char* string, size_t length) {
|
||||||
break;
|
break;
|
||||||
case '0':
|
case '0':
|
||||||
state = LEX_EXPECT_PREFIX;
|
state = LEX_EXPECT_PREFIX;
|
||||||
|
next = 0;
|
||||||
break;
|
break;
|
||||||
case '$':
|
case '$':
|
||||||
state = LEX_EXPECT_HEX;
|
state = LEX_EXPECT_HEX;
|
||||||
|
@ -216,8 +217,19 @@ size_t lexExpression(struct LexVector* lv, const char* string, size_t length) {
|
||||||
next = 0;
|
next = 0;
|
||||||
state = LEX_EXPECT_HEX;
|
state = LEX_EXPECT_HEX;
|
||||||
break;
|
break;
|
||||||
default:
|
case '+':
|
||||||
state = LEX_ERROR;
|
case '-':
|
||||||
|
case '*':
|
||||||
|
case '/':
|
||||||
|
lv->token.type = TOKEN_UINT_TYPE;
|
||||||
|
lv->token.uintValue = next;
|
||||||
|
lv = _lexOperator(lv, token);
|
||||||
|
state = LEX_ROOT;
|
||||||
|
break;
|
||||||
|
case ')':
|
||||||
|
lv->token.type = TOKEN_UINT_TYPE;
|
||||||
|
lv->token.uintValue = next;
|
||||||
|
state = LEX_EXPECT_OPERATOR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -247,6 +259,7 @@ size_t lexExpression(struct LexVector* lv, const char* string, size_t length) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case LEX_EXPECT_DECIMAL:
|
case LEX_EXPECT_DECIMAL:
|
||||||
case LEX_EXPECT_HEX:
|
case LEX_EXPECT_HEX:
|
||||||
|
case LEX_EXPECT_PREFIX:
|
||||||
lv->token.type = TOKEN_UINT_TYPE;
|
lv->token.type = TOKEN_UINT_TYPE;
|
||||||
lv->token.uintValue = next;
|
lv->token.uintValue = next;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue