Skip to content

Commit f575170

Browse files
committed
fix: fixed parser issues
1 parent eccd822 commit f575170

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

argon/lang/parser2/parser2.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ using namespace argon::lang::parser2::node;
2121
#define TKCUR_END this->tkcur_.loc.end
2222

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

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

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

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

10771076
expr = this->ParseBCFStatement(context);

0 commit comments

Comments
 (0)