Dont consume the character immediately following a number
This commit is contained in:
parent
22e450e7e7
commit
600315d401
|
@ -70,12 +70,15 @@ IToken* Lexer::LexNumber(char c){
|
|||
bool has_point = false;
|
||||
bool is_searching = true;
|
||||
while (is_searching){
|
||||
char next = Lexer::Next();
|
||||
char next = Lexer::Peek();
|
||||
int next_val = CharToInt(next);
|
||||
if (next_val == -1){
|
||||
switch (next){
|
||||
case '_': continue;
|
||||
case '_':
|
||||
Lexer::Next();
|
||||
continue;
|
||||
case '.':
|
||||
Lexer::Next();
|
||||
has_point = true;
|
||||
decimal_index = 0;
|
||||
float_value = int_value;
|
||||
|
@ -86,6 +89,7 @@ IToken* Lexer::LexNumber(char c){
|
|||
}
|
||||
}
|
||||
else{
|
||||
Lexer::Next();
|
||||
if (has_point){
|
||||
decimal_index++;
|
||||
float_value += next_val / pow(10, decimal_index);
|
||||
|
|
Loading…
Reference in New Issue