Skip to content

Commit 4c963ac

Browse files
committed
Add parsing of noexcept exception specifier
- the specifier is just ignored
1 parent b8c6f5d commit 4c963ac

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

generator/parser/lexer.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,6 +1563,20 @@ void Lexer::scanKeyword8()
15631563
}
15641564
break;
15651565

1566+
case 'n':
1567+
if (*(cursor + 1) == 'o' &&
1568+
*(cursor + 2) == 'e' &&
1569+
*(cursor + 3) == 'x' &&
1570+
*(cursor + 4) == 'c' &&
1571+
*(cursor + 5) == 'e' &&
1572+
*(cursor + 6) == 'p' &&
1573+
*(cursor + 7) == 't')
1574+
{
1575+
token_stream[(int) index++].kind = Token_noexcept;
1576+
return;
1577+
}
1578+
break;
1579+
15661580
case 'o':
15671581
if (*(cursor + 1) == 'p' &&
15681582
*(cursor + 2) == 'e' &&

generator/parser/parser.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2109,6 +2109,13 @@ bool Parser::parseExceptionSpecification(ExceptionSpecificationAST *&node)
21092109
{
21102110
std::size_t start = token_stream.cursor();
21112111

2112+
if (token_stream.lookAhead() == Token_noexcept)
2113+
{
2114+
// ignore noexcept
2115+
token_stream.nextToken();
2116+
return true;
2117+
}
2118+
21122119
CHECK(Token_throw);
21132120
ADVANCE('(', "(");
21142121

generator/parser/tokens.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ static char const * const _S_token_names[] = {
103103
"mutable",
104104
"namespace",
105105
"new",
106+
"noexcept",
106107
"not",
107108
"not_eq",
108109
"number_literal",

generator/parser/tokens.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ enum TOKEN_KIND
105105
Token_mutable,
106106
Token_namespace,
107107
Token_new,
108+
Token_noexcept,
108109
Token_not,
109110
Token_not_eq,
110111
Token_number_literal,

0 commit comments

Comments
 (0)