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

Breadcrumb

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

function ParserAbstract::error

Throws a syntax error

Parameters

string $message Error message:

Position $position Error position:

Return value

void

Throws

Exception

64 calls to ParserAbstract::error()
Parser::checkInvalidEscapeSequences in vendor/mck89/peast/lib/Peast/Syntax/Parser.php
Checks if the given string or number contains invalid escape sequences
Parser::parse in vendor/mck89/peast/lib/Peast/Syntax/Parser.php
Parses the source
Parser::parseArgumentList in vendor/mck89/peast/lib/Peast/Syntax/Parser.php
Parses an arguments list
Parser::parseArguments in vendor/mck89/peast/lib/Peast/Syntax/Parser.php
Parses an arguments list wrapped in round brackets
Parser::parseArrayLiteral in vendor/mck89/peast/lib/Peast/Syntax/Parser.php
Parses an array literal

... See full list

File

vendor/mck89/peast/lib/Peast/Syntax/ParserAbstract.php, line 291

Class

ParserAbstract
Base class for parsers.

Namespace

Peast\Syntax

Code

protected function error($message = "", $position = null) {
    if (!$message) {
        $token = $this->scanner
            ->getToken();
        if ($token === null) {
            $message = "Unexpected end of input";
        }
        else {
            $position = $token->location->start;
            $message = "Unexpected: " . $token->value;
        }
    }
    if (!$position) {
        $position = $this->scanner
            ->getPosition();
    }
    throw new Exception($message, $position);
}

API Navigation

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