function Parser::parseCaseClause
Parses a case in a switch statement
Return value
Node\SwitchCase|null
1 call to Parser::parseCaseClause()
- Parser::parseCaseClauses in vendor/
mck89/ peast/ lib/ Peast/ Syntax/ Parser.php - Parses cases in a switch statement
File
-
vendor/
mck89/ peast/ lib/ Peast/ Syntax/ Parser.php, line 922
Class
- Parser
- Parser class
Namespace
Peast\SyntaxCode
protected function parseCaseClause() {
if ($token = $this->scanner
->consume("case")) {
if (($test = $this->isolateContext(array(
"allowIn" => true,
), "parseExpression")) && $this->scanner
->consume(":")) {
$node = $this->createNode("SwitchCase", $token);
$node->setTest($test);
if ($consequent = $this->parseStatementList()) {
$node->setConsequent($consequent);
}
return $this->completeNode($node);
}
$this->error();
}
return null;
}