Everywhere: Add Keyword parsing

This commit is contained in:
Riyyi
2023-03-24 21:46:01 +01:00
parent 0fea075953
commit 27e584ea84
7 changed files with 139 additions and 76 deletions
+10 -2
View File
@@ -117,14 +117,17 @@ ASTNode* Reader::readImpl()
case Token::Type::At: // @
return readDeref();
break;
case Token::Type::String:
case Token::Type::String: // "foobar"
return readString();
break;
case Token::Type::Keyword: // :keyword
return readKeyword();
break;
case Token::Type::Comment: // ;
ignore();
return nullptr;
break;
case Token::Type::Value:
case Token::Type::Value: // true, false, nil
return readValue();
break;
default:
@@ -301,6 +304,11 @@ ASTNode* Reader::readString()
return new String(symbol);
}
ASTNode* Reader::readKeyword()
{
return new Keyword(consume().symbol);
}
ASTNode* Reader::readValue()
{
Token token = consume();