Skip to content

Commit

Permalink
Use macros instead of byte literals
Browse files Browse the repository at this point in the history
  • Loading branch information
virgil-serbanuta committed Jan 30, 2025
1 parent ba6e74d commit 96bf72d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ module BINARY-PARSER-ELEM [private]
syntax DefnResult ::= parseElem1(BytesWithIndex) [function, total]
| #parseElem1a(BytesWithIndexOrError) [function, total]
| #parseElem1b(IntsResult) [function, total]
rule parseElem1(BWI:BytesWithIndex) => #parseElem1a(parseConstant(BWI, b"\x00"))
rule parseElem1(BWI:BytesWithIndex) => #parseElem1a(parseConstant(BWI, ELT_KIND_FUNCREF))
rule #parseElem1a(BWI:BytesWithIndex) => #parseElem1b(parseUnsignedIntVec(BWI))
rule #parseElem1a(E:ParseError) => E
rule #parseElem1b(intsResult(L:Ints, BWI:BytesWithIndex))
Expand All @@ -97,7 +97,7 @@ module BINARY-PARSER-ELEM [private]
=> #parseElem2b(TableIdx, parseExpr(BWI))
rule #parseElem2a(E:ParseError) => E
rule #parseElem2b(TableIdx:Int, exprResult(Is:BinaryInstrs, BWI:BytesWithIndex))
=> #parseElem2c(TableIdx, Is, parseConstant(BWI, b"\x00"))
=> #parseElem2c(TableIdx, Is, parseConstant(BWI, ELT_KIND_FUNCREF))
rule #parseElem2b(_, E:ParseError) => E
rule #parseElem2c(TableIdx:Int, Is:BinaryInstrs, BWI:BytesWithIndex)
=> #parseElem2d(TableIdx, Is, parseUnsignedIntVec(BWI))
Expand All @@ -117,7 +117,7 @@ module BINARY-PARSER-ELEM [private]
syntax DefnResult ::= parseElem3(BytesWithIndex) [function, total]
| #parseElem3a(BytesWithIndexOrError) [function, total]
| #parseElem3b(IntsResult) [function, total]
rule parseElem3(BWI:BytesWithIndex) => #parseElem3a(parseConstant(BWI, b"\x00"))
rule parseElem3(BWI:BytesWithIndex) => #parseElem3a(parseConstant(BWI, ELT_KIND_FUNCREF))
rule #parseElem3a(BWI:BytesWithIndex) => #parseElem3b(parseUnsignedIntVec(BWI))
rule #parseElem3a(E:ParseError) => E
rule #parseElem3b(intsResult(L:Ints, BWI:BytesWithIndex))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ The special _element kind_ constant is used to describe possible element kinds.
Currently, only one element kind is supported.

```k
syntax Bytes ::= "ELT_KIND" [macro] rule ELT_KIND => b"\x00"
syntax Bytes ::= "ELT_KIND_FUNCREF" [macro] rule ELT_KIND_FUNCREF => b"\x00"
```

_Data_ sections are tagged based on their kind.
Expand Down

0 comments on commit 96bf72d

Please sign in to comment.