Open fsareshwala opened 5 months ago
Suppose I have the following emboss definitions, along with a very long boolean expression:
enum PacketType: FOO = 0 BAR = 1 BAZ = 2 ABC = 3 DEF = 4 GHI = 5 struct MyStruct: 0 [+1] PacketType packet_type if packet_type == PacketType.FOO || packet_type == PacketType.BAR || packet_type == PacketType.BAZ || packet_type == PacketType.ABC|| packet_type == PacketType.DEF || packet_type == PacketType.GHI: # ...
For readability's sake, I'd like to be able to break up the boolean expression into multiple lines, like this:
struct MyStruct: 0 [+1] PacketType packet_type if packet_type == PacketType.FOO || packet_type == PacketType.BAR || packet_type == PacketType.BAZ || packet_type == PacketType.ABC|| packet_type == PacketType.DEF || packet_type == PacketType.GHI: # ...
Doing so results in the following error:
error: Syntax error note: Found '\n' ("\n"), expected "$max", CamelWord, "(", SnakeWord, "$max_size_in_bits", "$upper_bound", "$is_statically_sized", "-", ShoutyWord, "$size_in_bytes", "$max_size_in_bytes", BooleanConstant, "$min_size_in_bytes", "$static_size_in_bits", "$present", "+", Number, "$lower_bound", "$next", "$size_in_bits", "$min_size_in_bits". if packet_type == PacketType.FOO || ^
Placing the || as a line prefix doesn't work either:
||
struct MyStruct: 0 [+1] PacketType packet_type if packet_type == PacketType.FOO || packet_type == PacketType.BAR || packet_type == PacketType.BAZ || packet_type == PacketType.ABC || packet_type == PacketType.DEF: # ...
error: Syntax error note: Found '\n' ("\n"), expected "-", "?", "&&", "==", "<", "+", ">", "<=", ":", ">=", "*", "||". if packet_type == PacketType.FOO ^
Using a backslash to indicate a continuation of the line on the next also doesn't work:
struct MyStruct: 0 [+1] PacketType packet_type if packet_type == PacketType.FOO || \ packet_type == PacketType.BAR || \ packet_type == PacketType.BAZ || \ packet_type == PacketType.ABC || \ packet_type == PacketType.DEF: $next [+1] UInt data
error: Unrecognized token if packet_type == PacketType.FOO || \ ^
Using a backslash to indicate a continuation of the line along with using the || as a line prefix also doesn't work:
struct MyStruct: 0 [+1] PacketType packet_type if packet_type == PacketType.FOO \ || packet_type == PacketType.BAR \ || packet_type == PacketType.BAZ \ || packet_type == PacketType.ABC \ || packet_type == PacketType.DEF: $next [+1] UInt data
error: Unrecognized token if packet_type == PacketType.FOO \ ^
It seems like there is no way to have multi-line boolean expressions at the moment.
Suppose I have the following emboss definitions, along with a very long boolean expression:
For readability's sake, I'd like to be able to break up the boolean expression into multiple lines, like this:
Doing so results in the following error:
Placing the
||
as a line prefix doesn't work either:Doing so results in the following error:
Using a backslash to indicate a continuation of the line on the next also doesn't work:
Doing so results in the following error:
Using a backslash to indicate a continuation of the line along with using the
||
as a line prefix also doesn't work:Doing so results in the following error:
It seems like there is no way to have multi-line boolean expressions at the moment.