Skip to content

Constant string values to indicate selected branches from parse. #9

@bigeasy

Description

@bigeasy

With the addition of conditionals, it maybe be useful to add constants, which would indicate which branch matched. Consider the following that reports the class of an IP address, even though classes are now a bygone concept.

b8(&0xC0: "C", b32 | &0xA0: "B", b32 | "A", b32)

Here the address is always a 32-bit word, but the class changes based on leading bits. We can use Packet to perform this test and pass the results into a callback using a constant value.

When serializing, the constant is skipped. My best guess for the correct behavior.

Constant values would simply be JavaScript scalars.

"\"Hello, World!\n\", b32"     // Constant string followed by 32-bit integer.
"0xFF, b32"                    // Constant number followed by 32-bit integer.
"0.32, b32"                    // Constant number followed by 32-bit integer.

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions