private function DocParser::syntaxError

Generates a new syntax error.

Parameters

string $expected Expected string.:

array $token Optional token.:

Throws

AnnotationException

5 calls to DocParser::syntaxError()
DocParser::Identifier in drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocParser.php
Identifier ::= string
DocParser::match in drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocParser.php
Attempts to match the given token with the current lookahead token. If they match, updates the lookahead token; otherwise raises a syntax error.
DocParser::matchAny in drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocParser.php
Attempts to match the current lookahead token with any of the given tokens.
DocParser::PlainValue in drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocParser.php
PlainValue ::= integer | string | float | boolean | Array | Annotation
DocParser::Values in drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocParser.php
Values ::= Array | Value {"," Value}*

File

drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocParser.php, line 342

Class

DocParser
A parser for docblock annotations.

Namespace

Doctrine\Common\Annotations

Code

private function syntaxError($expected, $token = null) {
  if ($token === null) {
    $token = $this->lexer->lookahead;
  }
  $message = "Expected {$expected}, got ";
  if ($this->lexer->lookahead === null) {
    $message .= 'end of string';
  }
  else {
    $message .= "'{$token['value']}' at position {$token['position']}";
  }
  if (strlen($this->context)) {
    $message .= ' in ' . $this->context;
  }
  $message .= '.';
  throw AnnotationException::syntaxError($message);
}