Skip to content

Commit

Permalink
adds support for the trailing commas in the enum-list rule
Browse files Browse the repository at this point in the history
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;
```
  • Loading branch information
ivg committed Jun 14, 2019
1 parent 3951bf7 commit 4af1780
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions frontc/cparser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,8 @@ STRUCT type_name
{ENUM ($2, [])}
| ENUM LBRACE enum_list RBRACE
{ENUM ("", List.rev $3)}
| ENUM LBRACE enum_list COMMA RBRACE
{ENUM ("", List.rev $3)}
| ENUM type_name LBRACE enum_list RBRACE
{ENUM ($2, List.rev $4)}
;
Expand Down

0 comments on commit 4af1780

Please sign in to comment.