Skip to content

Commit

Permalink
Handle ellipsis in type parser
Browse files Browse the repository at this point in the history
  • Loading branch information
usiems authored and mrbean-bremen committed Nov 17, 2023
1 parent 13dcd8e commit 943fa0a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion generator/typeparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class Scanner
LessThanToken,
ColonToken,
CommaToken,
EllipsisToken,
OpenParenToken,
CloseParenToken,
SquareBegin,
Expand Down Expand Up @@ -115,6 +116,12 @@ Scanner::Token Scanner::nextToken()
Q_ASSERT(m_pos + 1 < m_length);
++m_pos;
break;
case '.':
if (m_pos + 2 < m_length && c == m_chars[m_pos + 1] && c == m_chars[m_pos + 2]) {
tok = EllipsisToken;
m_pos += 2;
break;
}
default:
if (c.isLetterOrNumber() || c == '_')
tok = Identifier;
Expand Down Expand Up @@ -168,6 +175,7 @@ TypeParser::Info TypeParser::parse(const QString &str)
// switch (tok) {
// case Scanner::StarToken: printf(" - *\n"); break;
// case Scanner::AmpersandToken: printf(" - &\n"); break;
// case Scanner::EllipsisToken: printf(" - ...\n"); break;
// case Scanner::LessThanToken: printf(" - <\n"); break;
// case Scanner::GreaterThanToken: printf(" - >\n"); break;
// case Scanner::ColonToken: printf(" - ::\n"); break;
Expand Down Expand Up @@ -215,7 +223,8 @@ TypeParser::Info TypeParser::parse(const QString &str)

case Scanner::OpenParenToken: // function pointers not supported
case Scanner::CloseParenToken:
{
case Scanner::EllipsisToken: // variadic templates not supported
{
Info i;
i.is_busted = true;
return i;
Expand Down

0 comments on commit 943fa0a

Please sign in to comment.