Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Parser.php

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\Syntax

Code

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal