Browse Source

[PATCH 158/188] update parsing of the wat format

From 03948b289d998a45ccdc57154da3f0c55f391bf3 Mon Sep 17 00:00:00 2001
From: Dmitry Boyarintsev <[email protected]>
Date: Fri, 27 Mar 2020 09:20:30 -0400

git-svn-id: branches/wasm@46154 -
nickysn 5 years ago
parent
commit
8dd03120c8
1 changed files with 12 additions and 3 deletions
  1. 12 3
      utils/wasmbin/watparser.pas

+ 12 - 3
utils/wasmbin/watparser.pas

@@ -490,11 +490,20 @@ procedure ParseMemory(sc: TWatScanner; dst: TWasmMemory);
 begin
 begin
   if sc.token=weMemory then sc.Next;
   if sc.token=weMemory then sc.Next;
 
 
-  if sc.token in [weIdent, weNumber] then
+  if sc.token in [weIdent] then
     ParseId(sc, dst.id);
     ParseId(sc, dst.id);
 
 
-  // todo: parsing of ImportInfo
-  // todo: parsing of ExportInfo
+  // todo: parsing of Import / Export
+
+  if sc.token in [weNumber] then begin
+    dst.min := sc.resInt32(0);
+    sc.Next;
+  end;
+
+  if sc.token in [weNumber] then begin
+    dst.max := sc.resInt32(0);
+    sc.Next;
+  end;
 
 
   ConsumeToken(sc, weCloseBrace);
   ConsumeToken(sc, weCloseBrace);
 end;
 end;