diff --git a/src/parser/Parser.cpp b/src/parser/Parser.cpp index 03d6205..15affab 100644 --- a/src/parser/Parser.cpp +++ b/src/parser/Parser.cpp @@ -325,8 +325,18 @@ std::unique_ptr Parser::exprLiteral() { ); } else if(this->peek().getType() == TokenType::IDENTIFIER) { + Token var = this->consume(TokenType::IDENTIFIER); + while(this->isNext(".", TokenType::OPERATOR)) { + this->consume("."); + var.appendToImage( + "." + + this->consume(TokenType::IDENTIFIER) + .getImage() + ); + } + expr = std::make_unique( - std::make_unique(this->consume(TokenType::IDENTIFIER)) + std::make_unique(var) ); while(this->isNext("[", TokenType::OPERATOR)) { @@ -566,8 +576,18 @@ std::unique_ptr Parser::exprPrimary() { else if(this->isNext("[", TokenType::OPERATOR)) expression = this->exprArray(); else if(this->peek().getType() == TokenType::IDENTIFIER) { + Token var = this->consume(TokenType::IDENTIFIER); + while(this->isNext(".", TokenType::OPERATOR)) { + this->consume("."); + var.appendToImage( + "." + + this->consume(TokenType::IDENTIFIER) + .getImage() + ); + } + expression = std::make_unique( - std::make_unique(this->consume(TokenType::IDENTIFIER)) + std::make_unique(var) ); while(this->isNext("[", TokenType::OPERATOR)) { @@ -889,6 +909,14 @@ std::unique_ptr Parser::stmtVal() { std::unique_ptr value; Token variable = this->consume(TokenType::IDENTIFIER); + while(this->isNext(".", TokenType::OPERATOR)) { + this->consume("."); + variable.appendToImage( + "." + + this->consume(TokenType::IDENTIFIER) + .getImage() + ); + } if(nativePath == "") { this->consume("=");