Reworked the tokens to include a broad class to make parameter matching a bit easier, and removed the hexadecimal distinction.
This commit is contained in:
+3
-7
@@ -79,13 +79,11 @@ List* GenerateTokenList(const char* source) {
|
||||
|
||||
Token* ParseNumber(void) {
|
||||
int start = Position;
|
||||
int base = 10;
|
||||
|
||||
while(!ScannerAtEnd() && isdigit(PeekScanner()))
|
||||
AdvanceScanner();
|
||||
|
||||
if (PeekScanner() == 'x' && isdigit(PeekAheadScanner())) {
|
||||
base = 16;
|
||||
AdvanceScanner(); //Consume the 'x'
|
||||
while(!ScannerAtEnd() && isdigit(PeekScanner())) AdvanceScanner();
|
||||
}
|
||||
@@ -109,12 +107,10 @@ Token* ParseNumber(void) {
|
||||
}
|
||||
|
||||
memcpy(lexeme, &SourceCode[start], length);
|
||||
|
||||
*value = strtol(lexeme, NULL, base);
|
||||
// Setting the base to zero means the function will pick the base.
|
||||
*value = strtol(lexeme, NULL, 0);
|
||||
|
||||
if (base == 10) return CreateToken(lexeme, value, Line, NUMBER);
|
||||
|
||||
return CreateToken(lexeme, value, Line, HEX);
|
||||
return CreateToken(lexeme, value, Line, NUMBER);
|
||||
}
|
||||
|
||||
Token* ParseDirective(void) {
|
||||
|
||||
Reference in New Issue
Block a user