Build parser configuration

@return Configuration
545371
public function buildParserConfiguration()
    {
        if ($this->parserConfiguration === null) {
            $this->parserConfiguration = parent::buildParserConfiguration();
            $this->parserConfiguration->addInterceptor(new ResourceInterceptor());
        }

        return $this->parserConfiguration;
    }
68056
public static function parser()
	{
		if ( ! empty(static::$_parser))
		{
			return static::$_parser;
		}

		$parser = new Jade\Parser(new Jade\Lexer\Lexer());
		$dumper = new Jade\Dumper\PHPDumper();
		$dumper->registerVisitor('tag', new Jade\Visitor\AutotagsVisitor());
		$dumper->registerFilter('javascript', new Jade\Filter\JavaScriptFilter());
		$dumper->registerFilter('cdata', new Jade\Filter\CDATAFilter());
		$dumper->registerFilter('php', new Jade\Filter\PHPFilter());
		$dumper->registerFilter('style', new Jade\Filter\CSSFilter());

		static::$_jade = new Jade\Jade($parser, $dumper, static::$_cache);

		return static::$_jade;
	}
1066692
public static function parser()
	{
		if ( ! empty(static::$_parser))
		{
			return static::$_parser;
		}

		// Parser
		static::$_parser = new Dwoo();
		static::$_parser->setCacheTime(\Config::get('parser.View_Dwoo.environment.cache_time', 0));
		static::$_parser->setCacheDir(\Config::get('parser.View_Dwoo.environment.cache_dir', APPPATH.'cache'.DS.'dwoo'.DS));
		static::$_parser->setCompileDir(\Config::get('parser.View_Dwoo.environment.compile_dir', APPPATH.'cache'.DS.'dwoo'.DS.'compiled'.DS));

		// Compiler
		static::$_parser_compiler = new Dwoo_Compiler;
		static::$_parser_compiler->setAutoEscape(\Config::get('parser.View_Dwoo.environment.autoescape', false));
		static::$_parser_compiler->setLooseOpeningHandling(\Config::get('parser.View_Dwoo.environment.allow_spaces', false));
		static::$_parser_compiler->setNestedCommentsHandling(\Config::get('parser.View_Dwoo.environment.nested_comments', false));
		static::$_parser_compiler->setDelimiters(
			\Config::get('parser.View_Dwoo.delimiters.left', '{'),
			\Config::get('parser.View_Dwoo.delimiters.right', '}')
		);

		// Security
		static::$_parser_security = new Dwoo_Security_Policy;
		static::$_parser_security->setPhpHandling(\Config::get('parser.View_Dwoo.environment.allow_php_tags', 2));
		static::$_parser_security->allowPhpFunction(\Config::get('parser.View_Dwoo.environment.allow_php_func', array()));

		static::$_parser->setSecurityPolicy(static::$_parser_security);

		return static::$_parser;
	}
83074
protected function buildOptionParser(ConsoleOptionParser $parser)
    {
        $parser->setDescription(__d('link-scanner', 'Performs a complete scan'));

        return $parser->addOptions([
            'export' => [
                'boolean' => true,
                'default' => false,
                'help' => __d('link-scanner', 'Export results. The filename will be generated automatically'),
                'short' => 'e',
            ],
            'export-with-filename' => [
                'help' => __d('link-scanner', 'Export results. You must pass a relative or absolute path'),
            ],
            'follow-redirects' => [
                'boolean' => true,
                'default' => false,
                'help' => __d('link-scanner', 'Follows redirect'),
            ],
            'force' => [
                'boolean' => true,
                'default' => false,
                'help' => __d('link-scanner', 'Force mode: removes the lock file and does not ask questions'),
                'short' => 'f',
            ],
            'full-base-url' => [
                'help' => __d('link-scanner', 'Full base url. By default, the `{0}` value will be used', 'App.fullBaseUrl'),
            ],
            'max-depth' => [
                'help' => __d('link-scanner', 'Maximum depth of the scan. Default: {0}', $this->LinkScanner->getConfig('maxDepth')),
                'short' => 'd',
            ],
            'no-cache' => [
                'boolean' => true,
                'default' => false,
                'help' => __d('link-scanner', 'Disables the cache'),
            ],
            'no-external-links' => [
                'boolean' => true,
                'default' => false,
                'help' => __d('link-scanner', 'Disable the scanning of external links'),
            ],
            'timeout' => [
                'help' => __d('link-scanner', 'Timeout in seconds for GET requests. Default: {0}', $this->LinkScanner->Client->getConfig('timeout')),
                'short' => 't',
            ],
        ]);
    }
415662
public static function classConstructor()
    {
        $locator = new ConfigurationLocator(array(
            __DIR__ . self::BAV_PATH,
            self::INCLUDE_PATH
        ));
        $configuration = $locator->locate();
        if ($configuration == null) {
            $configuration = new DefaultConfiguration();
            
        }
        self::setConfiguration($configuration);
    }
1168119
public function getOptionParser()
    {
        $parser = parent::getOptionParser();
        $parser
            ->description('Database maintenance commands.')
            ->addSubcommand('export', [
                'help' => 'Export database to portable format.',
                'parser' => $this->DatabaseExport->getOptionParser(),
            ])
            ->addSubcommand('tables', [
                'help' => 'List all database tables.',
            ])
            ->addSubcommand('connection', [
                'help' => 'Show connection settings.',
            ]);

        return $parser;
    }
363231
public function configure()
    {
        $projectDescriptorBuilder = $this->projectDescriptorBuilder;

        $fileGenerator      = new UrlGenerator\Standard\FileDescriptor();
        $namespaceGenerator = new UrlGenerator\Standard\NamespaceDescriptor();
        $packageGenerator   = new UrlGenerator\Standard\PackageDescriptor();
        $classGenerator     = new UrlGenerator\Standard\ClassDescriptor();
        $methodGenerator    = new UrlGenerator\Standard\MethodDescriptor();
        $constantGenerator  = new UrlGenerator\Standard\ConstantDescriptor();
        $functionGenerator  = new UrlGenerator\Standard\FunctionDescriptor();
        $propertyGenerator  = new UrlGenerator\Standard\PropertyDescriptor();

        // Here we cheat! If a string element is passed to this rule then we try to transform it into a Descriptor
        // if the node is translated we do not let it match and instead fall through to one of the other rules.
        $stringRule = function (&$node) use ($projectDescriptorBuilder) {
            $elements = $projectDescriptorBuilder->getProjectDescriptor()->getIndexes()->get('elements');
            if (is_string($node) && isset($elements[$node])) {
                $node = $elements[$node];
            };

            return false;
        };

        // @codingStandardsIgnoreStart
        $this[] = new Rule($stringRule, function () { return false; });
        $this[] = new Rule(function ($node) { return ($node instanceof FileDescriptor); }, $fileGenerator);
        $this[] = new Rule(function ($node) { return ($node instanceof PackageDescriptor); }, $packageGenerator);
        $this[] = new Rule(function ($node) { return ($node instanceof TraitDescriptor); }, $classGenerator);
        $this[] = new Rule(function ($node) { return ($node instanceof NamespaceDescriptor); }, $namespaceGenerator);
        $this[] = new Rule(function ($node) { return ($node instanceof InterfaceDescriptor); }, $classGenerator );
        $this[] = new Rule(function ($node) { return ($node instanceof ClassDescriptor); }, $classGenerator);
        $this[] = new Rule(function ($node) { return ($node instanceof ConstantDescriptor); }, $constantGenerator);
        $this[] = new Rule(function ($node) { return ($node instanceof MethodDescriptor); }, $methodGenerator);
        $this[] = new Rule(function ($node) { return ($node instanceof FunctionDescriptor); }, $functionGenerator);
        $this[] = new Rule( function ($node) { return ($node instanceof PropertyDescriptor); }, $propertyGenerator);

        // if this is a link to an external page; return that URL
        $this[] = new Rule(
            function ($node) {
                return is_string($node) && (substr($node, 0, 7) == 'http://' || substr($node, 0, 7) == 'https://');
            },
            function ($node) { return $node; }
        );

        // do not generate a file for every unknown type
        $this[] = new Rule(function () { return true; }, function () { return false; });
        // @codingStandardsIgnoreEnd
    }
975905
public function parse(): ConfigInterface
    {
        $config = new Config();
        array_map(
            function($line) use ($config) {
                if (preg_match('/^(\S+)\ (.*)/', $line, $matches)) {
                    switch ($matches[1]) {
                        case 'push':
                            $config->addPush($matches[2]);
                            break;
                        case 'ca':
                        case 'cert':
                        case 'key':
                        case 'dh':
                        case 'tls-auth':
                            $config->addCert($matches[1], $matches[2]);
                            break;
                        default:
                            $config->add($matches[1], $matches[2]);
                            break;
                    }
                }
            },
            $this->_lines
        );
        return $config;
    }
619478
public static function parser()
	{
		if ( ! empty(static::$_parser))
		{
			return static::$_parser;
		}

		$options = array(
			// TODO: set 'logger' with Monolog instance.
			'cache'   => \Config::get('parser.View_Mustache.environment.cache_dir', APPPATH.'cache'.DS.'mustache'.DS),
			'charset' => \Config::get('parser.View_Mustache.environment.charset', 'UTF-8'),
		);

		if ($partials = \Config::get('parser.View_Mustache.environment.partials', array())) {
			$options['partials'] = $partials;
		}

		if ($helpers = \Config::get('parser.View_Mustache.environment.helpers', array())) {
			$options['helpers'] = $helpers;
		}

		static::$_parser = new Mustache_Engine($options);

		return static::$_parser;
	}
436018
public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode    = $treeBuilder->root('cache');

        $rootNode->children()
            ->append($this->addSessionSupportSection())
            ->append($this->addDoctrineSection())
            ->append($this->addRouterSection())
            ->append($this->addAnnotationSection())
            ->append($this->addSerializerSection())
            ->append($this->addValidationSection())
            ->append($this->addLoggingSection())
            ->append($this->addDataCollectorSection())
            ->end();

        return $treeBuilder;
    }
1205602
protected function buildParserStack()
    {
        $parsers = array_reverse($this->parsers);

        return array_reduce($parsers, $this->prepareParser(), $this);
    }
731996
public function getParser()
    {
        if (true === empty($this->parser)) {
            $typeParserClassName = sprintf('\ReadmeGen\Vcs\Type\%s', ucfirst($this->config['vcs']));

            if (false === class_exists($typeParserClassName)) {
                throw new \InvalidArgumentException(sprintf('Class "%s" does not exist', $typeParserClassName));
            }

            $this->parser = new Parser(new $typeParserClassName());
        }

        return $this->parser;
    }
173142
protected void configureParser(LSParser parser) {
        for (Map.Entry<String, Object> setting : parseSettings.entrySet()) {
            setParserConfigParameter(parser, setting.getKey(), setting.getValue());
        }
    }
285881
public function build()
    {
        $documentParser = $this->createDocumentParser();
        $stylesheetParser = new StylesheetParser();
        $stylesheetParser->setComplexAttributeFactory($this->configurationLoader->createComplexAttributeFactory());
        
        $engine = $this->engineFactory->createEngine($this->engineType, $this->engineOptions);

        $document = new Document($engine);
        $this->addStringFiltersTo($document);
        
        $facade = new Facade($this->configurationLoader, $document, $documentParser, $stylesheetParser);
        $this->addStringFiltersTo($facade);
        $facade->setEngineType($this->engineType);
        
        if($documentParser instanceof FacadeAware)
        {
            $documentParser->setFacade($facade);
        }
        
        $facade->setUseCacheForStylesheetConstraint($this->useCacheForStylesheetConstraint);

        if($this->cacheType && $this->cacheType !== 'Null')
        {
            $cache = new CacheImpl($this->cacheType, $this->cacheOptions);
            $facade->setCache($cache);
            
            if($this->useCacheForConfigurationLoader)
            {
                $this->configurationLoader->setCache($cache);
            }
        }

        return $facade;
    }
1246136
protected function buildOptionParser(ConsoleOptionParser $parser) {
		$parser->setDescription(
			'Get the list of controllers and make sure, they are synced into the ACL file.'
		)->addArgument('roles', [
			'help' => 'Role names, comma separated, e.g. `user,admin`.',
			'required' => true,
		])->addOption('plugin', [
			'short' => 'p',
			'help' => 'Plugin, use `all` to include all loaded plugins.',
			'default' => null,
		])->addOption('dry-run', [
			'short' => 'd',
			'help' => 'Dry Run (only output, do not modify ini files).',
			'boolean' => true,
		]);

		return $parser;
	}
161784
public function compileFiles()
    {
        foreach ($this->files as $file) {
            $activeConfig = $this->parser->setConfigFile($file)->getActiveConfig();
            $this->add($activeConfig);
        }

        return $this;
    }
791047
public function getOptionParser()
    {
        $parser = parent::getOptionParser();

        $parser->addOption('cli', [
                'help' => 'Use the bootstrap_cli file.',
                'boolean' => true,
                'default' => false,
            ])
            ->addOption('no_app', [
                'help' => 'Do not update the Application if it exist. Forces config/bootstrap.php to be updated.',
                'boolean' => true,
                'default' => false,
            ])
            ->addArgument('plugin', [
                'help' => 'Name of the plugin to load.',
            ]);

        return $parser;
    }