protected function parseSection($section, $space0, $params, $open, $space1, $directives) : Context
    {
        switch ($section) {
            case 'server':
                return new Server($directives);
            
            case 'http':
                return new Http($directives);
            
            case 'location':
                $modifier = null;
                if (sizeof($params) == 2) {
                    list($modifier, $location) = $params;
                } elseif (sizeof($params) == 1) {
                    $location = $params[0];
                } else {
                    throw new GrammarException(
                        sprintf(
                            "Location context missing in %s",
                            $this->filename ? var_export($this->filename, true) : var_export($this->content, true)
                        )
                    );
                }
                return new Location($location, $modifier, $directives);
            
            case 'events':
                return new Events($directives);
            
            case 'upstream':
                list($upstream) = $params;
                return new Upstream($upstream, $directives);
        }

        throw new UnrecognizedContextException(
            sprintf(
                "Unrecognized context: {$section} found in %s",
                $this->filename ? var_export($this->filename, true) : var_export($this->content, true)
            )
        );
    }