From 8702d6d2f3ae4a1bd930eb42aa9e7af9a72c35a7 Mon Sep 17 00:00:00 2001 From: Hadrien Renaud Date: Thu, 24 Oct 2024 12:27:47 +0100 Subject: [PATCH] [asl0] Allow equality with bitmasks --- asllib/Parser0.mly | 1 + asllib/tests/regressions.t/asl0-patterns.asl | 2 ++ 2 files changed, 3 insertions(+) diff --git a/asllib/Parser0.mly b/asllib/Parser0.mly index 031b02770..c6f42616e 100644 --- a/asllib/Parser0.mly +++ b/asllib/Parser0.mly @@ -349,6 +349,7 @@ let binop_expr(e, b) == | ~=e; ~=bracketed(clist(slice)); < AST.E_Slice > | ~=bracketed(clist(expr)); < AST.E_Concat > | ~=e; IN; ~=bpattern; < AST.E_Pattern > + | e=e; EQ_EQ; m=MASK_LIT; { AST.(E_Pattern (e, Pattern_Mask (m))) } | ~=annotated(ty_non_tuple); UNKNOWN; < AST.E_Unknown > (* | ~=e; LT; ~=clist(slice); GT; < AST.E_Slice > diff --git a/asllib/tests/regressions.t/asl0-patterns.asl b/asllib/tests/regressions.t/asl0-patterns.asl index 9d34a388b..b2ecbd51d 100644 --- a/asllib/tests/regressions.t/asl0-patterns.asl +++ b/asllib/tests/regressions.t/asl0-patterns.asl @@ -1,6 +1,8 @@ integer main() bits(64) x = Zeros(64); y = x[1+:10]; // this would be invalid ASL0, but we use it in the XML + if x IN {'10x1101010'} then z = 1; // valid + if x == '10x1101010' then z = 1; // valid if x[0+:4] IN '10x1' then z = 1; return 1;