function Parser::parse
Same name in this branch
- 11.1.x vendor/sebastian/cli-parser/src/Parser.php \SebastianBergmann\CliParser\Parser::parse()
- 11.1.x vendor/sebastian/diff/src/Parser.php \SebastianBergmann\Diff\Parser::parse()
- 11.1.x vendor/egulias/email-validator/src/Parser.php \Egulias\EmailValidator\Parser::parse()
- 11.1.x vendor/nikic/php-parser/lib/PhpParser/Parser.php \PhpParser\Parser::parse()
- 11.1.x vendor/twig/twig/src/Parser.php \Twig\Parser::parse()
- 11.1.x vendor/symfony/css-selector/Parser/Parser.php \Symfony\Component\CssSelector\Parser\Parser::parse()
- 11.1.x vendor/symfony/yaml/Parser.php \Symfony\Component\Yaml\Parser::parse()
- 11.1.x vendor/mck89/peast/lib/Peast/Selector/Parser.php \Peast\Selector\Parser::parse()
Parses the source
Return value
Node\Program
Overrides ParserAbstract::parse
File
-
vendor/
mck89/ peast/ lib/ Peast/ Syntax/ Parser.php, line 193
Class
- Parser
- Parser class
Namespace
Peast\SyntaxCode
public function parse() {
if ($this->sourceType === \Peast\Peast::SOURCE_TYPE_MODULE) {
$this->scanner
->setStrictMode(true);
$body = $this->parseModuleItemList();
}
else {
$body = $this->parseStatementList(true);
}
$node = $this->createNode("Program", $body ?: $this->scanner
->getPosition());
$node->setSourceType($this->sourceType);
if ($body) {
$node->setBody($body);
}
$program = $this->completeNode($node);
if ($this->scanner
->getToken()) {
$this->error();
}
//Execute scanner end operations
$this->scanner
->consumeEnd();
//Emit the EndParsing event and pass the resulting program node as
//event data
$this->eventsEmitter && $this->eventsEmitter
->fire("EndParsing", array(
$program,
));
return $program;
}