function Parser::parseWhileStatement
Parses a while statement
Return value
Node\WhileStatement|null
1 call to Parser::parseWhileStatement()
- Parser::parseIterationStatement in vendor/
mck89/ peast/ lib/ Peast/ Syntax/ Parser.php - Parses do-while, while, for, for-in and for-of statements
File
-
vendor/
mck89/ peast/ lib/ Peast/ Syntax/ Parser.php, line 1036
Class
- Parser
- Parser class
Namespace
Peast\SyntaxCode
protected function parseWhileStatement() {
if ($token = $this->scanner
->consume("while")) {
if ($this->scanner
->consume("(") && ($test = $this->isolateContext(array(
"allowIn" => true,
), "parseExpression")) && $this->scanner
->consume(")") && ($body = $this->parseStatement())) {
$node = $this->createNode("WhileStatement", $token);
$node->setTest($test);
$node->setBody($body);
return $this->completeNode($node);
}
$this->error();
}
return null;
}