/** * Parses all statements that exist in a scope an adds them to a scope * instance. * * @return PHP_Depend_Code_ASTScopeStatement * @since 0.10.0 */ private function _parseScopeStatements() { $scope = $this->builder->buildASTScopeStatement(); while (($child = $this->_parseOptionalStatement()) != null) { if ($child instanceof PHP_Depend_Code_ASTNode) { $scope->addChild($child); } } return $scope; }
/** * Parse a scope enclosed by curly braces. * * @return PHP_Depend_Code_ASTScope * @since 0.9.12 */ private function _parseScopeStatement() { $this->_tokenStack->push(); $this->_consumeComments(); $this->_consumeToken(self::T_CURLY_BRACE_OPEN); $scope = $this->_builder->buildASTScopeStatement(); while (($stmt = $this->_parseOptionalStatement()) != null) { if ($stmt instanceof PHP_Depend_Code_ASTNode) { $scope->addChild($stmt); } } $this->_consumeToken(self::T_CURLY_BRACE_CLOSE); return $this->_setNodePositionsAndReturn($scope); }