function Parser::parseObjectLiteral
Parses an object literal
Return value
Node\ObjectExpression|null
1 call to Parser::parseObjectLiteral()
- Parser::parsePrimaryExpression in vendor/
mck89/ peast/ lib/ Peast/ Syntax/ Parser.php - Parses a primary expression
File
-
vendor/
mck89/ peast/ lib/ Peast/ Syntax/ Parser.php, line 2821
Class
- Parser
- Parser class
Namespace
Peast\SyntaxCode
protected function parseObjectLiteral() {
if ($token = $this->scanner
->consume("{")) {
$properties = array();
while ($prop = $this->parsePropertyDefinition()) {
$properties[] = $prop;
if (!$this->scanner
->consume(",")) {
break;
}
}
if ($this->scanner
->consume("}")) {
$node = $this->createNode("ObjectExpression", $token);
if ($properties) {
$node->setProperties($properties);
}
return $this->completeNode($node);
}
$this->error();
}
return null;
}