/** * Parse an identifier * * @return AbstractExpression */ private function _parseIdentifier() { $this->_validateToken(ExpressionTokenId::IDENTIFIER); // An open paren here would indicate calling a method $identifierIsFunction = $this->_lexer->peekNextToken()->Id == ExpressionTokenId::OPENPARAM; if ($identifierIsFunction) { return $this->_parseIdentifierAsFunction(); } else { return $this->_parsePropertyAccess(null); } }
public function testPeekNextToken() { //Peek for next token and then call nexttoken to see same token peeked is getting $expression = "IntIdentifier eq 123"; $lexer = new ExpressionLexer($expression); $token1 = $lexer->peekNextToken(); $lexer->nextToken(); $token2 = $lexer->getCurrentToken(); $this->AssertEquals($token1->Id, $token2->Id); $this->AssertEquals($token1->Text, $token2->Text); $this->AssertEquals($token1->Position, $token2->Position); }