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 has_point = false;
|
||||||
bool is_searching = true;
|
bool is_searching = true;
|
||||||
while (is_searching){
|
while (is_searching){
|
||||||
char next = Lexer::Next();
|
char next = Lexer::Peek();
|
||||||
int next_val = CharToInt(next);
|
int next_val = CharToInt(next);
|
||||||
if (next_val == -1){
|
if (next_val == -1){
|
||||||
switch (next){
|
switch (next){
|
||||||
case '_': continue;
|
case '_':
|
||||||
|
Lexer::Next();
|
||||||
|
continue;
|
||||||
case '.':
|
case '.':
|
||||||
|
Lexer::Next();
|
||||||
has_point = true;
|
has_point = true;
|
||||||
decimal_index = 0;
|
decimal_index = 0;
|
||||||
float_value = int_value;
|
float_value = int_value;
|
||||||
|
@ -86,6 +89,7 @@ IToken* Lexer::LexNumber(char c){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
Lexer::Next();
|
||||||
if (has_point){
|
if (has_point){
|
||||||
decimal_index++;
|
decimal_index++;
|
||||||
float_value += next_val / pow(10, decimal_index);
|
float_value += next_val / pow(10, decimal_index);
|
||||||
|
|
Loading…
Reference in New Issue