all repos — mgba @ fd1128f90a17151fd6e3a673332045cf534a3d21

mGBA Game Boy Advance Emulator

Fix 0 not being recognized as a valid token
Jeffrey Pfau jeffrey@endrift.com
Fri, 10 Oct 2014 02:28:27 -0700
commit

fd1128f90a17151fd6e3a673332045cf534a3d21

parent

e293134a787c4ab434b9f72e6e6d634e6ce92966

1 files changed, 15 insertions(+), 2 deletions(-)

jump to
M src/debugger/parser.csrc/debugger/parser.c

@@ -77,6 +77,7 @@ next = token - '0';

break; case '0': state = LEX_EXPECT_PREFIX; + next = 0; break; case '$': state = LEX_EXPECT_HEX;

@@ -216,8 +217,19 @@ case 'x':

next = 0; state = LEX_EXPECT_HEX; break; - default: - state = LEX_ERROR; + case '+': + 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;

@@ -247,6 +259,7 @@

switch (state) { case LEX_EXPECT_DECIMAL: case LEX_EXPECT_HEX: + case LEX_EXPECT_PREFIX: lv->token.type = TOKEN_UINT_TYPE; lv->token.uintValue = next; break;