Skip to content

Commit

Permalink
Merge pull request #1132 from guwirth/cpp17/inline-variable
Browse files Browse the repository at this point in the history
C++17 inline variable support
  • Loading branch information
guwirth authored May 18, 2017
2 parents afb0424 + c3f78d4 commit 6e02d1d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
5 changes: 0 additions & 5 deletions cxx-squid/dox/grammar-diff.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,6 @@ decl-specifier:
friend
typedef
constexpr
inline

function-specifier:
virtual
explicit

type-specifier:
simple-type-specifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,8 @@ private static void declarations(LexerfulGrammarBuilder b) {
functionSpecifier, // C++
CxxKeyword.FRIEND, // C++
CxxKeyword.TYPEDEF, // C++
CxxKeyword.CONSTEXPR // C++
CxxKeyword.CONSTEXPR, // C++
CxxKeyword.INLINE // C++
)
);

Expand All @@ -858,7 +859,7 @@ private static void declarations(LexerfulGrammarBuilder b) {

b.rule(storageClassSpecifier).is(
b.firstOf(
CxxKeyword.REGISTER, // C++
CxxKeyword.REGISTER, // C++11, C++14, deprecated with C++17
CxxKeyword.STATIC, // C++
CxxKeyword.THREAD_LOCAL, // C++
CxxKeyword.EXTERN, // C++
Expand All @@ -868,7 +869,6 @@ private static void declarations(LexerfulGrammarBuilder b) {

b.rule(functionSpecifier).is(
b.firstOf(
CxxKeyword.INLINE, // C++
CxxKeyword.VIRTUAL, // C++
CxxKeyword.EXPLICIT // C++
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,15 @@ public void declSpecifier_reallife() {
p.setRootRule(g.rule(CxxGrammarImpl.declSpecifier));

assertThat(p).matches("register"); // a storage class
assertThat(p).matches("inline"); // a function specifier
assertThat(p).matches("friend"); // a function specifier
assertThat(p).matches("void"); // a built-in type

// declSpecifier
assertThat(p).matches("friend");
assertThat(p).matches("typedef");
assertThat(p).matches("constexpr");

assertThat(p).matches("inline");

// enum specifier
assertThat(p).matches("enum foo { MONDAY=1 }");

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
struct MyClass {
static inline const char* prefix = "> ";
static inline int counter = 0;
};

0 comments on commit 6e02d1d

Please sign in to comment.