From 5f20c9b269eb5f2722e3ff3deb295fb6ee9c3f75 Mon Sep 17 00:00:00 2001 From: nickysn Date: Mon, 3 Aug 2020 13:00:29 +0000 Subject: [PATCH] [PATCH 093/188] update number parsing From 3a04c920a0e521c9be7f61e5fc2d7f6725ade511 Mon Sep 17 00:00:00 2001 From: Dmitry Boyarintsev Date: Tue, 10 Mar 2020 09:07:24 -0400 git-svn-id: branches/wasm@46089 - --- utils/wasmbin/watscanner.pas | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/utils/wasmbin/watscanner.pas b/utils/wasmbin/watscanner.pas index 40abd59457..6c04caeb95 100644 --- a/utils/wasmbin/watscanner.pas +++ b/utils/wasmbin/watscanner.pas @@ -198,10 +198,8 @@ end; function TWatScanner.Next: Boolean; var - has2chars: Boolean; cmt : string; done: boolean; - ch : char; begin Result := idx<=length(buf); if not Result then Exit; @@ -242,19 +240,11 @@ begin token:=weIdent; resText:=ScanWhile(buf, idx, IdBody); end else if buf[idx] in SignNumericChars then begin - token:=weNumber; - if buf[idx] in SignChars then begin - ch:=buf[idx]; - inc(idx); - resText:=ScanWhile(buf, idx, NumericChars); - if resText = '' then begin - token:=weError; - Exit; - end; - if (ch='-') then - resText:=ch+resText; + if not ScanNumberC(buf, idx, resText) then begin + token := weError; + Exit; end else - resText:=ScanWhile(buf, idx, Numericchars); + token:=weNumber; end else if buf[idx] in AlphaNumChars then begin resText:=ScanWhile(buf, idx, GrammarChars); GetGrammar(resText, token, instrCode);