[PATCH 141/188] parsing offset and align

From 828b36f3bc1b812aef0edde11a10e914a5432feb Mon Sep 17 00:00:00 2001
From: Dmitry Boyarintsev <skalogryz.lists@gmail.com>
Date: Wed, 25 Mar 2020 10:43:19 -0400

git-svn-id: branches/wasm@46137 -
This commit is contained in:
nickysn 2020-08-03 13:01:34 +00:00
parent f6c2e6d8b8
commit e31e57ceb1
2 changed files with 20 additions and 2 deletions

View File

@ -77,7 +77,8 @@ type
operandIdx : string;
operandNum : integer; // for "call_indirect" this is table index
// for "if", "loop", "block" - it's type
operandText : string;
operandText : string; // it's "offset" for load operations
operandText2: string; // it's "align" for load operations
insttype : TWasmFuncType; // used by call_indirect only
jumplabel : string; // the label is used only for "loop", "block" and "if"

View File

@ -30,7 +30,7 @@ const
'f32', 'f64',
'type',
'import', 'global', 'table', 'memory', 'local', 'export',
'elem', 'data', 'offset','align'
'elem', 'data', 'offset','align','='
);
WasmTypeTokens = [wei32, wei64, wef32, wef64];
@ -261,6 +261,23 @@ begin
ipLeb:
ParseNumOrIdx(sc, ci.operandNum, ci.operandIdx);
ipOfsAlign: begin
if sc.token = weOffset then begin
sc.Next;
ConsumeToken(sc, weEqual);
if sc.token<>weNumber then ErrorExpectButFound(sc, 'number');
ci.operandText := sc.resText;
sc.Next;
end;
if sc.token = weAlign then begin
sc.Next;
ConsumeToken(sc, weEqual);
if sc.token<>weNumber then ErrorExpectButFound(sc, 'number');
ci.operandText2 := sc.resText;
sc.Next;
end;
end;
ipi32,ipi64,ipf32,ipf64,ipi32OrFunc:
begin
if (INST_FLAGS[ci.code].Param = ipi32OrFunc) and (sc.token = weIdent) then