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

Breadcrumb

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

function Parser::parseDoWhileStatement

Parses a do-while statement

Return value

Node\DoWhileStatement|null

1 call to Parser::parseDoWhileStatement()
Parser::parseIterationStatement in vendor/mck89/peast/lib/Peast/Syntax/Parser.php
Parses do-while, while, for, for-in and for-of statements

File

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

Class

Parser
Parser class

Namespace

Peast\Syntax

Code

protected function parseDoWhileStatement() {
    if ($token = $this->scanner
        ->consume("do")) {
        if (($body = $this->parseStatement()) && $this->scanner
            ->consume("while") && $this->scanner
            ->consume("(") && ($test = $this->isolateContext(array(
            "allowIn" => true,
        ), "parseExpression")) && $this->scanner
            ->consume(")")) {
            $node = $this->createNode("DoWhileStatement", $token);
            $node->setBody($body);
            $node->setTest($test);
            $node = $this->completeNode($node);
            $this->scanner
                ->consume(";");
            return $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