diff --git a/src/HexBug/hexdecode/revealparser.lark b/src/HexBug/hexdecode/revealparser.lark index d4296c7..e1228bb 100644 --- a/src/HexBug/hexdecode/revealparser.lark +++ b/src/HexBug/hexdecode/revealparser.lark @@ -24,6 +24,7 @@ _list_item: _non_pattern_iota | pattern+ pattern: "HexPattern" "(" DIRECTION ANGLES? ")" | "<" DIRECTION ","? ANGLES? ">" + | "HexPattern" "[" DIRECTION "," ANGLES? "]" vector: "(" NUMBER "," NUMBER "," NUMBER ")" diff --git a/test/hexdecode/test_revealparser.py b/test/hexdecode/test_revealparser.py index 13d839a..e91d317 100644 --- a/test/hexdecode/test_revealparser.py +++ b/test/hexdecode/test_revealparser.py @@ -85,6 +85,10 @@ def test_matrix(text: str, want: Iota): ("", PatternIota(Direction.EAST)), ("", PatternIota(Direction.EAST, "w")), ("", PatternIota(Direction.EAST, "w")), + # Hex 0.11.2 + ("HexPattern[EAST, ]", PatternIota(Direction.EAST)), + ("HexPattern[EAST, w]", PatternIota(Direction.EAST, "w")), + ("HexPattern[EAST, aqweds]", PatternIota(Direction.EAST, "aqweds")), ], ) def test_pattern(text: str, want: Iota): @@ -133,6 +137,35 @@ def test_pattern(text: str, want: Iota): 0, ], ), + # latest.log (Hex 0.11.2) + ( + "[HexPattern[EAST, ]HexPattern[SOUTH_WEST, w], 0.00]", + [ + PatternIota(Direction.EAST), + PatternIota(Direction.SOUTH_WEST, "w"), + 0, + ], + ), + ( + "[HexPattern[EAST, ]HexPattern[EAST, w]HexPattern[NORTH_EAST, qaq]HexPattern[WEST, qqqaw]]", + [ + PatternIota(Direction.EAST), + PatternIota(Direction.EAST, "w"), + PatternIota(Direction.NORTH_EAST, "qaq"), + PatternIota(Direction.WEST, "qqqaw"), + ], + ), + ( + "[0.00, HexPattern[EAST, ], [HexPattern[NORTH_EAST, qaq]HexPattern[EAST, aa]]]", + [ + 0, + PatternIota(Direction.EAST), + [ + PatternIota(Direction.NORTH_EAST, "qaq"), + PatternIota(Direction.EAST, "aa"), + ], + ], + ), ], ) def test_list(text: str, want: Iota):