mirth-lang / mirth

Compiler for the Mirth programming language.
BSD Zero Clause License
447 stars 14 forks source link

Add way to specify tag value. #305

Closed typeswitch-dev closed 6 months ago

typeswitch-dev commented 6 months ago

This PR adds a way to specify a tag value for data types. This closes #233.

To use it, place an integer value before the tag name, e.g.:

data(MyData, 10 Foo, 20 Bar, 30 Baz)

This causes the .tag value for Foo to be 10, Bar to be 20, and Baz to be 30.

If you omit a number, it will use the number than the previous tag's number. So for example, the following are equivalent:

data(MyData, 10 Foo, 11 Bar, 12 Baz)
data(MyData, 10 Foo, Bar, Baz)

If two tag values are the same, the compiler raises an error. (Use an alias instead.)