function ParserAbstract::error
Throws a syntax error
Parameters
string $message Error message:
Position $position Error position:
Return value
void
Throws
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
File
-
vendor/
mck89/ peast/ lib/ Peast/ Syntax/ ParserAbstract.php, line 291
Class
- ParserAbstract
- Base class for parsers.
Namespace
Peast\SyntaxCode
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);
}