Dont consume the character immediately following a number

This commit is contained in:
Deukhoofd 2019-05-19 12:20:08 +02:00
parent 22e450e7e7
commit 600315d401
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
1 changed files with 6 additions and 2 deletions

View File

@ -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);