From 240670ca85f65b1bdb755782c8693c80ad5ec474 Mon Sep 17 00:00:00 2001 From: Valk Richard Li <48872266+ValKmjolnir@users.noreply.github.com> Date: Tue, 7 Apr 2020 01:49:29 -0700 Subject: [PATCH] update --- version2.0/nasal_lexer.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/version2.0/nasal_lexer.h b/version2.0/nasal_lexer.h index 5a90f28..199fc66 100644 --- a/version2.0/nasal_lexer.h +++ b/version2.0/nasal_lexer.h @@ -242,18 +242,38 @@ std::string nasal_lexer::identifier_gen(std::vector& res,int& ptr,int& lin } std::string nasal_lexer::number_gen(std::vector& res,int& ptr,int& line) { + bool scientific_notation=false; std::string token_str=""; while(('0'<=res[ptr] && res[ptr]<='9') || ('a'<=res[ptr] && res[ptr]<='f') || ('A'<=res[ptr] && res[ptr]<='F') || res[ptr]=='.' || res[ptr]=='x' || res[ptr]=='o' || - res[ptr]=='e' || res[ptr]=='E' || res[ptr]=='-') + res[ptr]=='e' || res[ptr]=='E') { token_str+=res[ptr]; + if(res[ptr]=='e' || res[ptr]=='E') + { + scientific_notation=true; + ++ptr; + break; + } ++ptr; if(ptr>=res.size()) break; } + if(scientific_notation && ptr