Skip to content

Commit

Permalink
Allow trailing commas in bitfield updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Alasdair committed Apr 24, 2024
1 parent a3f4047 commit 8986a12
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ vector_update:
{ VU_single (mk_exp (E_id $1) $startpos $endpos, mk_exp (E_id $1) $startpos $endpos)}

vector_update_list:
| vector_update
| vector_update Comma?
{ [$1] }
| vector_update Comma vector_update_list
{ $1 :: $3 }
Expand Down
15 changes: 15 additions & 0 deletions test/typecheck/bitfield_trailing_comma.sail
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
default Order dec

$include <prelude.sail>

bitfield foo : bits(8) = {
f1 : 3 .. 0,
f2 : 7 .. 4,
}

val main : unit -> unit

function main() = {
let x = [Mk_foo(0x00) with f1 = 0xA, f2 = 0xB, ];
()
}

0 comments on commit 8986a12

Please sign in to comment.