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

Breadcrumb

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

function Parser::parseObjectBindingPattern

Parses an object binding pattern

Return value

Node\ObjectPattern|null

1 call to Parser::parseObjectBindingPattern()
Parser::parseBindingPattern in vendor/mck89/peast/lib/Peast/Syntax/Parser.php
Parses a binding pattern

File

vendor/mck89/peast/lib/Peast/Syntax/Parser.php, line 2935

Class

Parser
Parser class

Namespace

Peast\Syntax

Code

protected function parseObjectBindingPattern() {
    $state = $this->scanner
        ->getState();
    if ($token = $this->scanner
        ->consume("{")) {
        $properties = array();
        while ($prop = $this->parseBindingProperty()) {
            $properties[] = $prop;
            if (!$this->scanner
                ->consume(",")) {
                break;
            }
        }
        if ($this->features->restSpreadProperties && ($rest = $this->parseRestProperty())) {
            $properties[] = $rest;
        }
        if ($this->scanner
            ->consume("}")) {
            $node = $this->createNode("ObjectPattern", $token);
            if ($properties) {
                $node->setProperties($properties);
            }
            return $this->completeNode($node);
        }
        $this->scanner
            ->setState($state);
    }
    return null;
}

API Navigation

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