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

Breadcrumb

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

function Parser::parseTryStatement

Parses a try-catch statement

Return value

Node\TryStatement|null

1 call to Parser::parseTryStatement()
Parser::parseStatement in vendor/mck89/peast/lib/Peast/Syntax/Parser.php
Parses a statement

File

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

Class

Parser
Parser class

Namespace

Peast\Syntax

Code

protected function parseTryStatement() {
    if ($token = $this->scanner
        ->consume("try")) {
        if ($block = $this->parseBlock()) {
            $node = $this->createNode("TryStatement", $token);
            $node->setBlock($block);
            if ($handler = $this->parseCatch()) {
                $node->setHandler($handler);
            }
            if ($finalizer = $this->parseFinally()) {
                $node->setFinalizer($finalizer);
            }
            if ($handler || $finalizer) {
                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