Skip to content

Commit 4af1780

Browse files
committed
adds support for the trailing commas in the enum-list rule
Here is the test: ``` $ cat enum-{commas,no-comma}.c typedef enum { Little, Medium, Big, } Size; typedef enum { Little, Medium, Big } Size; $ ./printc/printc enum-{commas,no-comma}.c typedef enum { Little, Medium, Big } Size; typedef enum { Little, Medium, Big } Size; ```
1 parent 3951bf7 commit 4af1780

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

frontc/cparser.mly

+2
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,8 @@ STRUCT type_name
829829
{ENUM ($2, [])}
830830
| ENUM LBRACE enum_list RBRACE
831831
{ENUM ("", List.rev $3)}
832+
| ENUM LBRACE enum_list COMMA RBRACE
833+
{ENUM ("", List.rev $3)}
832834
| ENUM type_name LBRACE enum_list RBRACE
833835
{ENUM ($2, List.rev $4)}
834836
;

0 commit comments

Comments
 (0)