Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions lib/source/pl/core/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,8 @@ namespace pl::core {

while (!sequence(tkn::Separator::RightBrace)) {
auto statement = parseFunctionStatement();
if (hasErrors())
break;
if (statement == nullptr)
continue;

Expand Down Expand Up @@ -970,13 +972,11 @@ namespace pl::core {
statement = parseFunctionVariableDecl();
} else if (sequence(tkn::Keyword::Const)) {
statement = parseFunctionVariableDecl(true);
} else if (m_curr[0].type == Token::Type::Keyword) {
errorHere("Invalid {} found in function.", getFormattedToken(0));
next();
return nullptr;
} else {
errorHere("Invalid function statement.");
next();
if (m_curr[0].type == Token::Type::Keyword)
errorHere("Invalid {} found in function.", getFormattedToken(0));
else
errorHere("Invalid function statement.");
return nullptr;
}

Expand Down Expand Up @@ -1268,6 +1268,8 @@ namespace pl::core {
std::vector<hlp::safe_unique_ptr<ast::ASTNode>> tryBody, catchBody;
while (!sequence(tkn::Separator::RightBrace)) {
auto member = memberParser();
if (hasErrors())
break;
if (member == nullptr)
continue;

Expand All @@ -1282,6 +1284,8 @@ namespace pl::core {

while (!sequence(tkn::Separator::RightBrace)) {
auto member = memberParser();
if (hasErrors())
break;
if (member == nullptr)
continue;

Expand Down Expand Up @@ -1935,7 +1939,7 @@ namespace pl::core {
else if (oneOf(tkn::Keyword::Return, tkn::Keyword::Break, tkn::Keyword::Continue))
member = parseFunctionControlFlowStatement();
else if (m_curr[0].type == Token::Type::Keyword) {
errorHere("Invalid {} found in struct.", getFormattedToken(0));
errorHere("Invalid {} found in custom type.", getFormattedToken(0));
return nullptr;
} else {
errorHere("Invalid struct member definition.");
Expand Down Expand Up @@ -2044,6 +2048,8 @@ namespace pl::core {
this->m_currTemplateType.push_back(typeDecl);
while (!sequence(tkn::Separator::RightBrace)) {
auto member = parseMember();
if (hasErrors())
break;
if(member == nullptr)
continue;

Expand Down Expand Up @@ -2315,6 +2321,8 @@ namespace pl::core {

while (!sequence(tkn::Separator::RightBrace)) {
auto entry = parseBitfieldEntry();
if (hasErrors())
break;
if (entry == nullptr)
continue;

Expand Down
Loading