re code tags:
They've been an important part of some of the metaprogramming stuff in lua that I've been trying out.
I've set up a path to generate a C enum definition from:
enum("Grid_Rotation", "u8",
enum_val(0, "NONE"),
enum_val(1, "R90"),
enum_val(2, "R180"),
enum_val(3, "R270")
),
With code tags, I can add new nodes to the AST after the enum values have been defined such that it will emit the enum as well as an aux count variable and an array of strings:
enum("Grid_Rotation", "u8",
create_struct(),
enum_has_pretty_names(),
enum_has_count(),
enum_val(0, "NONE", pretty_name("None")),
enum_val(1, "R90", pretty_name("90")),
enum_val(2, "R180", pretty_name("180")),
enum_val(3, "R270", pretty_name("270"))
),
(edited)