protected function parseStatement() { //Here the token value is checked for performance so that functions won't be
//called if not necessary
$token =
$this->scanner->
getToken();
if (!
$token) { return null;
} $val =
$token->value;
if ($val === "{" &&
$statement =
$this->
parseBlock()) { return $statement;
} elseif ($val === "var" &&
$statement =
$this->
parseVariableStatement()) { return $statement;
} elseif ($val === ";" &&
$statement =
$this->
parseEmptyStatement()) { return $statement;
} elseif ($val === "if" &&
$statement =
$this->
parseIfStatement()) { return $statement;
} elseif ( ($val === "for" ||
$val === "while" ||
$val === "do" ||
$val === "switch"
) &&
$statement =
$this->
parseBreakableStatement() ) {