Skip to content

Commit

Permalink
fix: fixed parser issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jacopodl committed Feb 29, 2024
1 parent eccd822 commit f575170
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions argon/lang/parser2/parser2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ using namespace argon::lang::parser2::node;
#define TKCUR_END this->tkcur_.loc.end

bool Parser::CheckIDExt() const {
return this->Match(scanner::TokenType::IDENTIFIER, scanner::TokenType::SELF);
return this->Match(scanner::TokenType::IDENTIFIER, scanner::TokenType::KW_DEFAULT, scanner::TokenType::SELF);
}

int Parser::PeekPrecedence(TokenType type) {
Expand Down Expand Up @@ -332,7 +332,7 @@ Node *Parser::ParseDecls(Context *context) {
pub = true;

if (!Parser::CheckScopeExt(context, ContextType::MODULE, ContextType::STRUCT, ContextType::TRAIT))
throw ParserException(TKCUR_LOC, "'pub' modifier not allowed in %s", kContextName[(int) context->type]);
throw ParserException(TKCUR_LOC, "'pub' modifier not allowed in %s", kContextName[(int) context->type]);
}

this->EatNL();
Expand Down Expand Up @@ -1070,8 +1070,7 @@ Node *Parser::ParseStatement(Context *context) {
expr = this->ParseAssertion(context);
break;
case TokenType::KW_BREAK:
if (!Parser::CheckScope(context, ContextType::SWITCH)
&& !Parser::CheckScopeRecursive(context, ContextType::LOOP))
if (!Parser::CheckScopeRecursive(context, ContextType::LOOP, ContextType::SWITCH))
throw ParserException(TKCUR_LOC, kStandardError[13], "break", kContextName[(int) context->type]);

expr = this->ParseBCFStatement(context);
Expand Down

0 comments on commit f575170

Please sign in to comment.