Skip to content

Commit

Permalink
fix(Parser): allow the use of reserved words (e.g., break, default) a…
Browse files Browse the repository at this point in the history
…s identifiers in specific contexts
  • Loading branch information
jacopodl committed Sep 28, 2023
1 parent 20d5f99 commit d7ca4bb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions argon/lang/parser/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1699,7 +1699,7 @@ Node *Parser::ParseIDNamedParam(bool parse_expr) {
if (parse_expr)
id = (ArObject *) this->ParseExpression(PeekPrecedence(scanner::TokenType::COMMA));
else
id = (ArObject *) this->ParseIdentifier();
id = (ArObject *) this->Unknown2Identifier();

loc = this->tkcur_.loc;

Expand Down Expand Up @@ -2441,7 +2441,7 @@ Node *Parser::Unknown2Identifier() {
bool literal = true;

for (ArSize i = 0; i < this->tkcur_.length; i++) {
if (!isalnum(this->tkcur_.buffer[i])) {
if (!isalnum(this->tkcur_.buffer[i]) && this->tkcur_.buffer[i] != '_') {
literal = false;
break;
}
Expand Down

0 comments on commit d7ca4bb

Please sign in to comment.