Returns the BooleanSyntax instance.

@return Tarsana\Syntax\BooleanSyntax
422710
public static function instance() : BooleanSyntax
    {
        if (self::$instance === null)
            self::$instance = new BooleanSyntax;
        return self::$instance;
    }
225981
public function getNext()
    {
        for (; $this->idx < $this->count; ++$this->idx) {
            if (($this->tokens[$this->idx]->type !== Token::TYPE_WHITESPACE)
                && ($this->tokens[$this->idx]->type !== Token::TYPE_COMMENT)
            ) {
                return $this->tokens[$this->idx++];
            }
        }

        return null;
    }
736186
public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode    = $treeBuilder->root($this->rootName);

        $rootNode
            ->children()
                ->booleanNode('use_doctrine_orm')->defaultFalse()->end()
                ->booleanNode('use_doctrine_odm')->defaultFalse()->end()
                ->booleanNode('use_propel')->defaultFalse()->end()
                ->booleanNode('use_jms_security')->defaultFalse()->end()
                ->booleanNode('guess_required')->defaultTrue()->end()
                ->booleanNode('default_required')->defaultTrue()->end()
                ->booleanNode('overwrite_if_exists')->defaultFalse()->end()
                ->booleanNode('throw_exceptions')->defaultFalse()->end()
                ->scalarNode('base_admin_template')
                    ->defaultValue("AdmingeneratorGeneratorBundle::base.html.twig")
                ->end()
                ->scalarNode('dashboard_route')->defaultNull()->end()
                ->scalarNode('login_route')->defaultNull()->end()
                ->scalarNode('logout_route')->defaultNull()->end()
                ->scalarNode('exit_route')->defaultNull()->end()
                ->scalarNode('generator_cache')->defaultNull()->end()
                ->scalarNode('default_action_after_save')->defaultValue('edit')->end()
                ->scalarNode('knp_menu_alias')->defaultNull()->end()
                ->booleanNode('use_doctrine_orm_batch_remove')->defaultFalse()->end()
                ->booleanNode('use_doctrine_odm_batch_remove')->defaultFalse()->end()
                ->booleanNode('use_propel_batch_remove')->defaultFalse()->end()
                ->arrayNode('twig')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->booleanNode('use_form_resources')->defaultTrue()->end()
                        ->booleanNode('use_localized_date')->defaultFalse()->end()
                        ->scalarNode('date_format')->defaultValue('Y-m-d')->end()
                        ->scalarNode('datetime_format')->defaultValue('Y-m-d H:i:s')->end()
                        ->scalarNode('localized_date_format')->defaultValue('medium')->end()
                        ->scalarNode('localized_datetime_format')->defaultValue('medium')->end()
                        ->arrayNode('number_format')
                            ->addDefaultsIfNotSet()
                            ->children()
                                ->scalarNode('decimal')->defaultValue(0)->end()
                                ->scalarNode('decimal_point')->defaultValue('.')->end()
                                ->scalarNode('thousand_separator')->defaultValue(',')->end()
                            ->end()
                        ->end()
                    ->end()
                ->end()
                ->arrayNode('templates_dirs')
                    ->prototype('scalar')->end()
                ->end()
                ->arrayNode('form_types')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->arrayNode('doctrine_orm')
                            ->useAttributeAsKey('name')
                            ->prototype('scalar')->end()
                            ->defaultValue($this->defaultFormTypes['doctrine_orm'])
                            ->validate()
                            ->ifNotInArray(array_keys($this->defaultFormTypes['doctrine_orm']))
                                ->then(function($v) {
                                    return array_merge($this->defaultFormTypes['doctrine_orm'], $v);
                                })
                            ->end()
                        ->end()
                        ->arrayNode('doctrine_odm')
                            ->useAttributeAsKey('name')
                            ->prototype('scalar')->end()
                            ->defaultValue($this->defaultFormTypes['doctrine_odm'])
                            ->validate()
                            ->ifNotInArray(array_values($this->defaultFormTypes['doctrine_odm']))
                                ->then(function ($v){
                                    return array_merge($this->defaultFormTypes['doctrine_odm'], $v);
                                })
                            ->end()
                        ->end()
                        ->arrayNode('propel')
                            ->useAttributeAsKey('name')
                            ->prototype('scalar')->end()
                            ->defaultValue($this->defaultFormTypes['propel'])
                            ->validate()
                            ->ifNotInArray(array_values($this->defaultFormTypes['propel']))
                                ->then(function ($v){
                                    return array_merge($this->defaultFormTypes['propel'], $v);
                                })
                            ->end()
                        ->end()
                    ->end()
                ->end()
                ->arrayNode('filter_types')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->arrayNode('doctrine_orm')
                            ->useAttributeAsKey('name')
                            ->prototype('scalar')->end()
                            ->defaultValue($this->defaultFilterTypes['doctrine_orm'])
                            ->validate()
                            ->ifNotInArray(array_values($this->defaultFilterTypes['doctrine_orm']))
                                ->then(function ($v){
                                    return array_merge($this->defaultFilterTypes['doctrine_orm'], $v);
                                })
                            ->end()
                        ->end()
                        ->arrayNode('doctrine_odm')
                            ->useAttributeAsKey('name')
                            ->prototype('scalar')->end()
                            ->defaultValue($this->defaultFilterTypes['doctrine_odm'])
                            ->validate()
                            ->ifNotInArray(array_keys($this->defaultFilterTypes['doctrine_odm']))
                                ->then(function ($v){
                                    return array_merge($this->defaultFilterTypes['doctrine_odm'], $v);
                                })
                            ->end()
                        ->end()
                        ->arrayNode('propel')
                            ->useAttributeAsKey('name')
                            ->prototype('scalar')->end()
                            ->defaultValue($this->defaultFilterTypes['propel'])
                            ->validate()
                            ->ifNotInArray(array_values($this->defaultFilterTypes['propel']))
                                ->then(function ($v){
                                    return array_merge($this->defaultFilterTypes['propel'], $v);
                                })
                            ->end()
                        ->end()
                    ->end()
                ->end()
                ->append($this->getStylesheetNode())
                ->append($this->getJavascriptsNode())
            ->end();

        return $treeBuilder;
    }
835188
protected function processLastLogicalOperatorNode()
    {
        if (null !== $this->scope->getCurrentLeftNode()) {
            $this->addError('Logical operator must be followed by a valid operation.', self::ERROR_CODE_LOGICAL_OPERATOR_FOLLOWED);
        } elseif (null !== $this->scope->getLastOrNode()) {
            $node = new BooleanNode($this->scope->getLastOrNode(), $this->scope->getNode(), self::LOGICAL_OR);
            $this->scope->setNode($node);
        }

        return $this;
    }
546694
public function boolean() {
        $this->check_role = 'boolean';
        $result = in_array($this->value, [true, false, 0, 1, '0', '1'], true);
        $this->checkResult($result);
        return $this;
    }
1335842
private function getNextExpanderNode()
    {
        if ($this->endOfPattern()) {
            return ;
        }

        $expander = new AST\Expander($this->getExpanderName());

        if ($this->endOfPattern()) {
            $this->unexpectedEndOfString(')');
        }

        $this->addArgumentValues($expander);

        if ($this->endOfPattern()) {
            $this->unexpectedEndOfString(')');
        }

        if (!$this->isNextCloseParenthesis()) {
            $this->unexpectedSyntaxError($this->lexer->lookahead, ')');
        }

        return $expander;
    }
244572
private function getNextArgumentValue()
    {
        $validArgumentTypes = [
            Lexer::T_STRING,
            Lexer::T_NUMBER,
            Lexer::T_BOOLEAN,
            Lexer::T_NULL
        ];

        if ($this->lexer->isNextToken(Lexer::T_CLOSE_PARENTHESIS)) {
            return ;
        }

        if ($this->lexer->isNextToken(Lexer::T_OPEN_CURLY_BRACE)) {
            return $this->getArrayArgument();
        }

        if ($this->lexer->isNextToken(Lexer::T_EXPANDER_NAME)) {
            return $this->getNextExpanderNode();
        }

        if (!$this->lexer->isNextTokenAny($validArgumentTypes)) {
            $this->unexpectedSyntaxError($this->lexer->lookahead, 'string, number, boolean or null argument');
        }

        $tokenType = $this->lexer->lookahead['type'];
        $argument = $this->lexer->lookahead['value'];
        $this->lexer->moveNext();

        if ($tokenType === Lexer::T_NULL) {
            $argument = self::NULL_VALUE;
        }

        return $argument;
    }
799605
public function ExistsExpression()
    {
        $not = false;

        if ($this->lexer->isNextToken(Lexer::T_NOT)) {
            $this->match(Lexer::T_NOT);
            $not = true;
        }

        $this->match(Lexer::T_EXISTS);
        $this->match(Lexer::T_OPEN_PARENTHESIS);

        $existsExpression      = new AST\ExistsExpression($this->Subselect());
        $existsExpression->not = $not;

        $this->match(Lexer::T_CLOSE_PARENTHESIS);

        return $existsExpression;
    }
987935
public function isAlpha() {
        $this->check_role = 'alpha';
        $result = $this->checkRegex($this->value, '/^[A-Za-z]+$/');
        $this->checkResult($result);
        return $this;
    }
412625
public function getNextIdentifier()
    {
        $next = $this->getNext();

        if (!$next->isIdentifier()) {
            throw SyntaxErrorException::unexpectedToken('identifier', $next);
        }

        return $next->getValue();
    }
167961
public function getInitOptionsResolver()
    {
        if (null === $this->initOptionsResolver) {
            if (null !== $this->parent) {
                $this->initOptionsResolver = clone $this->parent->getInitOptionsResolver();
            } else {
                $this->initOptionsResolver = new OptionsResolver();
            }

            $this->innerType->setInitOptions($this->initOptionsResolver);

            foreach ($this->typeExtensions as $extension) {
                $extension->setInitOptions($this->initOptionsResolver);
            }
        }

        return $this->initOptionsResolver;
    }
1329727
public static function instance(): self
    {
        if (!self::$instance) {
            self::$instance = new self(
                AnyMatcher::instance(),
                WildcardMatcher::instance(),
                InlineExporter::instance()
            );
            self::$instance
                ->addMatcherDriver(HamcrestMatcherDriver::instance());
        }

        return self::$instance;
    }
1339250
protected function normalization()
    {
        if (null === $this->normalization) {
            $this->normalization = new NormalizationBuilder($this);
        }

        return $this->normalization;
    }
1166384
public function IndexBy()
    {
        $this->match(Lexer::T_INDEX);
        $this->match(Lexer::T_BY);
        $pathExpr = $this->StateFieldPathExpression();

        // Add the INDEX BY info to the query component
        $this->queryComponents[$pathExpr->identificationVariable]['map'] = $pathExpr->field;

        return new AST\IndexBy($pathExpr);
    }
387857
public function toBool()
    {
        return (!is_null($this->returnValue)) &&
            (!empty($this->returnValue)) &&
            (!in_array(strtolower($this->returnValue), $this->falseStrings));
    }
520429
private function topStatement() {
    switch ($this->currentType) {
      case T_USE:
        return $this->useBlock();
      case T_CONST:
        return $this->_const();
      case T_ABSTRACT:
      case T_FINAL:
      case T_CLASS:
        return $this->classDeclaration();
      case T_INTERFACE:
        return $this->interfaceDeclaration();
      case T_TRAIT:
        return $this->traitDeclaration();
      case T_HALT_COMPILER:
        $node = new HaltCompilerNode();
        $this->mustMatch(T_HALT_COMPILER, $node, 'name');
        $this->mustMatch('(', $node, 'openParen');
        $this->mustMatch(')', $node, 'closeParen');
        $this->endStatement($node);
        $this->tryMatch(T_INLINE_HTML, $node);
        return $node;
      default:
        if ($this->currentType === T_FUNCTION && $this->isLookAhead(T_STRING, '&')) {
          return $this->functionDeclaration();
        }
        elseif ($this->currentType === T_NAMESPACE && !$this->isLookAhead(T_NS_SEPARATOR)) {
          return $this->_namespace();
        }
        return $this->statement();
    }
  }
919899
public function conditionalTerm()
    {
        $conditionalFactors = array();
        $conditionalFactors[] = $this->conditionalFactor();

        while ($this->lexer->isNextToken(Lexer::T_AND)) {
            $this->match(Lexer::T_AND);

            $conditionalFactors[] = $this->conditionalFactor();
        }

        // Phase 1 AST optimization: Prevent AST\ConditionalTerm
        // if only one AST\ConditionalFactor is defined
        if (count($conditionalFactors) == 1) {
            return $conditionalFactors[0];
        }

        return new ConditionalTermNode($conditionalFactors);
    }