Skip to content

Commit

Permalink
[c mode] Allow optional macro after declarator in declarations
Browse files Browse the repository at this point in the history
Issue #258
  • Loading branch information
marijnh committed Jul 31, 2019
1 parent 3b7c080 commit 40bb66b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 25 deletions.
26 changes: 13 additions & 13 deletions dist/c.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,27 +152,27 @@
[1, 207, 80],
[1, 9, 81],
[3, "meta", e[12], 82,
[5, 219], 83,
3, "operator", "=", 84,
0, 85],
[1, 9, 86],
0, 83],
[1, 9, 84],
[1, 9, 85],
[2, 188, 83, {"name":"ParenTokens"},
0, 83],
[[5, 219], 86,
3, "operator", "=", 87,
0, 88],
[2, 222, -1, {"name":"FunctionDef"}],
[1, 9, 87],
[1, 9, 88],
[2, 188, 89, {"name":"ParenTokens"},
0, 89],
[1, 131, 85],
[",", 90,
[1, 9, 89],
[1, 9, 90],
[1, 131, 88],
[",", 91,
";", -1],
[1, 9, 91],
[1, 9, 92],
[/^\;?/, -1],
[3, "def", e[13], 93],
[1, 9, 94],
[3, "operator", "=", 95,
0, 96],
[1, 9, 97],
[1, 9, 88],
[1, 9, 90],
[1, 131, 96],
[1, 9, 99],
[";", -1],
Expand Down
18 changes: 9 additions & 9 deletions dist/cpp.js
Original file line number Diff line number Diff line change
Expand Up @@ -526,24 +526,24 @@
[1, 529, 324],
[1, 9, 325],
[3, "meta", e[16], 326,
[5, 585], 327,
1, 589, 328,
0, 328],
[1, 9, 327],
[2, 296, 328, {"name":"ParenTokens"},
0, 328],
[1, 9, 329],
[2, 241, -1, {"name":"FunctionDef"}],
[1, 9, 330],
[2, 296, 331, {"name":"ParenTokens"},
[[5, 585], 330,
1, 589, 331,
0, 331],
[",", 332,
[2, 241, -1, {"name":"FunctionDef"}],
[1, 9, 332],
[",", 333,
";", -1],
[1, 9, 333],
[1, 9, 334],
[/^\;?/, -1],
[1, 220, 335],
[1, 9, 336],
[1, 589, 337,
0, 337],
[1, 9, 330],
[1, 9, 332],
[3, "callee", e[56], -1,
e[22], -1],
["::", 344,
Expand Down
5 changes: 2 additions & 3 deletions src/c.grammar
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ skip whitespace {
}

DeclRest {
Declarator
(Macro ";"? |
~("(" (")" | modifier | qualifier | typeModifier | auto | maybeTypeName)) FunctionDef |
Declarator Macro?
(~("(" (")" | modifier | qualifier | typeModifier | auto | maybeTypeName)) FunctionDef |
Initializer? ("," declName Initializer?)* ";")
}

Expand Down
2 changes: 2 additions & 0 deletions test/cpp/grammar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,5 @@
}
[keyword friend] [keyword class] [def&type X];
};

[type int] [def z] [meta MACRO]() [operator =] [number 0];

0 comments on commit 40bb66b

Please sign in to comment.