Skip to content

Commit 73058b0

Browse files
committed
Updates per Rossberg's feedback
1 parent af2eb9e commit 73058b0

File tree

4 files changed

+27
-21
lines changed

4 files changed

+27
-21
lines changed

document/core/text/modules.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ $${grammar: Tstart_}
344344
.. index:: import, name, tag type, global type, memory type, table type, function type
345345
pair: text format; import
346346
.. _text-import:
347+
.. _text-imports:
347348

348349
Imports
349350
~~~~~~~
@@ -356,7 +357,11 @@ $${grammar: Timport_/plain}
356357
Abbreviations
357358
.............
358359

359-
As an abbreviation, imports may also be specified inline with
360+
Multiple imports with the same ${:nm_1} may be declared together:
361+
362+
$${grammar: Timports_/abbrev}
363+
364+
Imports may also be specified inline with
360365
:ref:`tag <text-tag>`,
361366
:ref:`global <text-global>`,
362367
:ref:`memory <text-mem>`,

document/core/util/macros.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,7 @@
10721072
.. |Tglobal| mathdef:: \xref{text/modules}{text-global}{\T{global}}
10731073
.. |Ttag| mathdef:: \xref{text/modules}{text-tag}{\T{tag}}
10741074
.. |Timport| mathdef:: \xref{text/modules}{text-import}{\T{import}}
1075+
.. |Timports| mathdef:: \xref{text/modules}{text-imports}{\T{imports}}
10751076
.. |Texport| mathdef:: \xref{text/modules}{text-export}{\T{export}}
10761077
.. |Texternidx| mathdef:: \xref{text/modules}{text-externidx}{\T{externidx}}
10771078
.. |Telem| mathdef:: \xref{text/modules}{text-elem}{\T{elem}}

specification/wasm-3.0/5.4-binary.modules.spectec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ grammar Bimport : (name, externtype) =
3636

3737
grammar Bimports : import* =
3838
| nm_1:Bname (nm_2, xt):Bimport => IMPORT nm_1 nm_2 xt
39-
| 0x01 0xFF nm_1:Bname (nm_2, xt)*:Blist(Bimport) => $concat_(import, IMPORT nm_1 nm_2 xt)
39+
| 0x01 0xFF nm_1:Bname (nm_2, xt)*:Blist(Bimport) => (IMPORT nm_1 nm_2 xt)*
4040

4141
grammar Bimportsec : import* hint(desc "import section") =
42-
| im*:Bsection_(2, Blist(Bimports)) => im*
42+
| im**:Bsection_(2, Blist(Bimports)) => $concat_(import, im**)
4343

4444

4545
;; Function section

specification/wasm-3.0/6.3-text.modules.spectec

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -130,37 +130,37 @@ grammar Tstart_(I) : (start, idctxt) =
130130

131131
;; Imports
132132

133-
grammar Timport_(I)/plain : (name, externtype, idctxt) =
134-
| "(" "item" nm_2:Tname (xt,I'):Texterntype_(I) ")" => (nm_2, xt, I')
135-
136-
grammar Timports_(I)/plain : (import*, idctxt) =
137-
| "(" "import" nm_1:Tname (nm_2,xt,I')*:Timport_(I)* ")" => ($concat_(import, IMPORT nm_1 nm_2 xt), I')
133+
grammar Timport_(I)/plain : (import, idctxt) =
134+
| "(" "import" nm_1:Tname nm_2:Tname (xt,I'):Texterntype_(I) ")" => (IMPORT nm_1 nm_2 xt, I')
138135
| ...
139136

140-
grammar Timports_(I)/abbrev-tag : (import*, idctxt) = ...
137+
grammar Timports_(I)/abbrev : (import*, idctxt) =
138+
| "(" "import" nm_1:Tname ("(" "item" nm_2:Tname Texterntype_(I) ")")* ")" ==
139+
("(" "import" nm_1:Tname nm_2:Tname Texterntype_(I) ")")*
140+
141+
grammar Timport_(I)/abbrev-tag : (import, idctxt) = ...
141142
| "(" "tag" Tid? "(" "import" Tname^2 ")" Ttagtype_(I) ")" ==
142-
"(" "import" Tname "(" "item" Tname "(" "tag" Tid? Ttagtype_(I) ")" ")" ")"
143+
"(" "import" Tname^2 "(" "tag" Tid? Ttagtype_(I) ")" ")"
143144
| ...
144145

145-
grammar Timports_(I)/abbrev-global : (import*, idctxt) = ...
146+
grammar Timport_(I)/abbrev-global : (import, idctxt) = ...
146147
| "(" "global" Tid? "(" "import" Tname^2 ")" Tglobaltype_(I) ")" ==
147-
"(" "import" Tname "(" "item" Tname "(" "global" Tid? Tglobaltype_(I) ")" ")" ")"
148+
"(" "import" Tname^2 "(" "global" Tid? Tglobaltype_(I) ")" ")"
148149
| ...
149150

150-
grammar Timports_(I)/abbrev-mem : (import*, idctxt) = ...
151+
grammar Timport_(I)/abbrev-mem : (import, idctxt) = ...
151152
| "(" "memory" Tid? "(" "import" Tname^2 ")" Tmemtype_(I) ")" ==
152-
"(" "import" Tname "(" "item" Tname "(" "memory" Tid? Tmemtype_(I) ")" ")" ")"
153+
"(" "import" Tname^2 "(" "memory" Tid? Tmemtype_(I) ")" ")"
153154
| ...
154155

155-
grammar Timports_(I)/abbrev-table : (import*, idctxt) = ...
156+
grammar Timport_(I)/abbrev-table : (import, idctxt) = ...
156157
| "(" "table" Tid? "(" "import" Tname^2 ")" Ttabletype_(I) ")" ==
157-
"(" "import" Tname "(" "item" Tname "(" "table" Tid? Ttabletype_(I) ")" ")" ")"
158+
"(" "import" Tname^2 "(" "table" Tid? Ttabletype_(I) ")" ")"
158159
| ...
159160

160-
grammar Timports_(I)/abbrev-func : (import*, idctxt) = ...
161+
grammar Timport_(I)/abbrev-func : (import, idctxt) = ...
161162
| "(" "func" Tid? "(" "import" Tname^2 ")" Ttypeuse_(I) ")" ==
162-
"(" "import" Tname "(" "item" Tname "(" "func" Tid? Ttypeuse_(I) ")" ")" ")"
163-
163+
"(" "import" Tname^2 "(" "func" Tid? Ttypeuse_(I) ")" ")"
164164

165165
;; Exports
166166

@@ -256,7 +256,7 @@ grammar Telemtable_(I)/abbrev : () hint(show Ttable_(%)) =
256256
;; Modules
257257

258258
syntax decl hint(name "declaration") =
259-
type | import* | tag | global | mem | table | func | data | elem | start | export
259+
type | import | tag | global | mem | table | func | data | elem | start | export
260260

261261
def $typesd(decl*) : type* hint(show $types(%)) hint(macro "typesd")
262262
def $importsd(decl*) : import* hint(show $imports(%)) hint(macro "importsd")
@@ -323,7 +323,7 @@ def $ordered(decl_1* import decl_2*) =
323323

324324

325325
grammar Tdecl_(I) : (decl, idctxt) =
326-
| Ttype_(I) | Timports_(I) | Ttag_(I) | Tglobal_(I) | Tmem_(I) | Ttable_(I)
326+
| Ttype_(I) | Timport_(I) | Ttag_(I) | Tglobal_(I) | Tmem_(I) | Ttable_(I)
327327
| Tfunc_(I) | Tdata_(I) | Telem_(I) | Tstart_(I) | Texport_(I)
328328

329329

0 commit comments

Comments
 (0)