From cdc7401d91eebce10bcad8f89708bcc7316120c4 Mon Sep 17 00:00:00 2001 From: nickysn Date: Mon, 3 Aug 2020 13:02:08 +0000 Subject: [PATCH] [PATCH 177/188] update parsing of module level elements From ee529729a987fda74c312a4e49e8246f127920ce Mon Sep 17 00:00:00 2001 From: Dmitry Boyarintsev Date: Wed, 8 Apr 2020 11:58:48 -0400 git-svn-id: branches/wasm@46173 - --- utils/wasmbin/watparser.pas | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/utils/wasmbin/watparser.pas b/utils/wasmbin/watparser.pas index 0e4e1bd498..c7e5581171 100644 --- a/utils/wasmbin/watparser.pas +++ b/utils/wasmbin/watparser.pas @@ -593,13 +593,9 @@ begin if sc.token = weElem then sc.Next; if parseIdOffset then begin - if sc.token<>weIdent then - ErrorExpectButFound(sc, 'identifier'); - - dst.tableIdx := sc.resInt32; - sc.Next; - + ParseId(sc, dst.tableId); if (sc.token = weOpenBrace) then begin + sc.Next; ParseInstrList(sc, dst.AddOffset); ConsumeToken(sc, weCloseBrace); end; @@ -679,6 +675,7 @@ var imp : TWasmImport; m : TWasmMemory; g : TWasmGlobal; + e : TWasmElement; begin if not ConsumeOpenToken(sc, weModule) then ErrorExpectButFound(sc, 'module'); @@ -732,6 +729,11 @@ begin symlist.Clear; ParseGlobal(sc, g); end; + weElem: begin + e:=dst.AddElement; + symlist.Clear; + ParseElem(sc, e, true); + end; else ErrorExpectButFound(sc, 'func', TokenStr[sc.token]); end;