Skip to content

Commit

Permalink
Merge pull request #894 from Bertk/MS-exception-throw
Browse files Browse the repository at this point in the history
support Visual C++ throw(...)
  • Loading branch information
guwirth authored Jun 24, 2016
2 parents b3ffea5 + 80fa402 commit b36b6b6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1751,7 +1751,12 @@ private static void exceptionHandling(LexerfulGrammarBuilder b) {

b.rule(dynamicExceptionSpecification).is(CxxKeyword.THROW, "(", b.optional(typeIdList), ")"); // C++

b.rule(typeIdList).is(typeId, b.optional("..."), b.zeroOrMore(",", typeId, b.optional("..."))); // C++
b.rule(typeIdList).is(
b.firstOf(
b.sequence(typeId, b.optional("..."), b.zeroOrMore(",", typeId, b.optional("..."))), // C++
"..."// Microsoft extension
)
);

b.rule(noexceptSpecification).is(
b.firstOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public void exceptionSpecification_reallife() {
p.setRootRule(g.rule(CxxGrammarImpl.exceptionSpecification));

assertThat(p).matches("throw()");
assertThat(p).matches("throw(...)");
}

@Test
Expand All @@ -60,6 +61,7 @@ public void typeIdList() {
assertThat(p).matches("typeId ...");
assertThat(p).matches("typeId , typeId");
assertThat(p).matches("typeId , typeId ...");
assertThat(p).matches("...");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
int myfunc1() throw(){
}

int myfunc2() throw(int){
}

int myfunc3() throw(int, int){
}

int myfunc4() throw(int ...){
}

int myfunc5() throw(int ..., int ...){
}

int myfunc() throw(...){
}

0 comments on commit b36b6b6

Please sign in to comment.