Parses the conditions

@return Less_Tree_Condition|null
161531
private function parseConditions() {
		$index = $this->pos;
		$return = $a = $this->parseCondition();
		if( $a ){
			while( true ){
				if( !$this->PeekReg('/\\G,\s*(not\s*)?\(/') ||  !$this->MatchChar(',') ){
					break;
				}
				$b = $this->parseCondition();
				if( !$b ){
					break;
				}

				$return = $this->NewObj4('Less_Tree_Condition',array('or', $return, $b, $index));
			}
			return $return;
		}
	}
236146
protected function listifyScopeCondition()
    {
        $this->stringScopeValue = $this->normalizeListifyScope($this->getScopeName());

        $this->stringScopeNullExplicitlySet = (null === $this->stringScopeValue);

        return $this->stringScopeValue;
    }
1099089
public function leaves() {
        $condition = [
            'and',
            [$this->leftAttribute => ['$gt' => $this->owner->getAttribute($this->leftAttribute)]],
            [$this->rightAttribute => ['$lt' => $this->owner->getAttribute($this->rightAttribute)]],
            ['$where' => "this.{$this->rightAttribute} = this.{$this->leftAttribute} + 1"]
        ];

        $this->applyTreeAttributeCondition($condition);

        return $this->owner->find()->andWhere($condition)->addOrderBy([$this->leftAttribute => SORT_ASC]);
    }
173988
public function getTrieTree()
    {
        if ($this->_wordsTrieTree != [] && $this->_wordsTrieTreeLowCase != []) {
            return array(
                'Normal' => $this->_wordsTrieTree,
                'LowCase' => $this->_wordsTrieTreeLowCase
            );
        } else {
            return null;
        }
    }
1047382
protected function parseArguments()
    {
        $args = $this->getNamedArgs();

        $this->climate->arguments->add($args);

        if ($_SERVER['argc'] === 1) {
            $this->help();
            return false;
        }

        if ($this->climate->arguments->defined('help')) {
            $this->help();
            return;
        }

        if ($this->climate->arguments->defined('version')) {
            echo $this->version();
            return;
        }

        try {
            $this->climate->arguments->parse($_SERVER['argv']);

            $padding = count($args);
            foreach ($this->climate->arguments->toArray() as $arg) {
                if ($arg === null) {
                    --$padding;
                }
            }
            $argSize = count($_SERVER['argv']) - $padding - 1;
            for ($i = 0; $i < $argSize; $i++) {
                $args['arg-' . $i] = [];
            }
            $this->climate->arguments->add($args);
            $this->climate->arguments->parse($_SERVER['argv']);
        } catch (\Exception $e) {
        }

        return true;
    }
1286442
protected function parse()
    {
        // Parse Nodes user agent
        if (!preg_match('|Nodes/(.*)\s\((.*)\)|s', $this->userAgent, $match)) {
            return;
        }

        // Put matches into their own variables
        list($version, $parameters) = array_slice($match, 1);

        // Split comma-separated parameters
        $parameters = explode(',', $parameters);

        // Set version if available
        if (!empty($version)) {
            $this->setVersion($version);
        }

        // Set parameters if available
        if (!empty($parameters)) {
            $this->setParameters($parameters);
        }

        // Mark parsing as successful
        $this->successful = true;
    }
51128
protected function getConditions()
    {
        $conditionLoader = $this->loader->getConditions();
        $conditions = [];
        for ($number = 1; $number <= 4; $number++) {
            $element = 'gcon_condition_text' . $number;
            $conditionId = (int) $this->_data[$element];
            if ($conditionId >0) {
                $conditions[] = $conditionLoader->loadCondition($conditionId);
            }
        }

        return $conditions;
    }
657482
public function getCondition()
    {
        if (empty($this->condition)) {
            throw new LogicException(
                sprintf(self::ERROR_MISSING_ATTRIBUTE_FORMAT, 'condition')
            );
        }
        return $this->condition;
    }
455595
public function getConditions()
    {
        $conditions = $this->entity->getConditions();
        $result = [];
        if ($conditions) {
            foreach ($conditions as $condition) {
                $result[] = new Condition($condition, $this->locale);
            }

            return $result;
        }

        return;
    }
707685
private function getPositionContextConditions()
    {
        $pattern = $this->pool->getTypeProperty(get_class($this), 'position_context_conditions_pattern', function () {
            $conditions = [];

            foreach ($this->getPositionContext() as $field_name) {
                $conditions[] = $this->connection->escapeFieldName($field_name) . ' = ?';
            }

            return count($conditions) ? implode(' AND ', $conditions) : '';
        });

        if ($pattern) {
            $to_prepare = [$pattern];

            foreach ($this->getPositionContext() as $field_name) {
                $to_prepare[] = $this->getFieldValue($field_name);
            }

            return 'WHERE ' . call_user_func_array([&$this->connection, 'prepare'], $to_prepare);
        }

        return '';
    }
1308265
private function parseEntitiesVariableCurly() {
		$index = $this->pos;

		if( $this->input_len > ($this->pos+1) && $this->input[$this->pos] === '@' && ($curly = $this->MatchReg('/\\G@\{([\w-]+)\}/')) ){
			return $this->NewObj3('Less_Tree_Variable',array('@'.$curly[1], $index, $this->env->currentFileInfo));
		}
	}
388449
public function parseSubExpressions()
    {
        $parsedSubExpressions = array();
        foreach ($this->tree as $leaf) {
            $operand = $leaf[self::INDEX_OPERAND];

            $operand = urldecode($operand);

            $operator = $leaf[self::INDEX_BOOL_OPERATOR];
            $pattern = '/^(.+?)(' . self::MATCH_EQUAL . '|'
                . self::MATCH_NOT_EQUAL . '|'
                . self::MATCH_GREATER_OR_EQUAL . '|'
                . self::MATCH_GREATER . '|'
                . self::MATCH_LESS_OR_EQUAL . '|'
                . self::MATCH_LESS . '|'
                . self::MATCH_CONTAINS . '|'
                . self::MATCH_DOES_NOT_CONTAIN . '|'
                . preg_quote(self::MATCH_STARTS_WITH) . '|'
                . preg_quote(self::MATCH_ENDS_WITH)
                . '){1}(.*)/';
            $match = preg_match($pattern, $operand, $matches);
            if ($match == 0) {
                throw new Exception('The segment condition \'' . $operand . '\' is not valid.');
            }

            $leftMember = $matches[1];
            $operation  = $matches[2];
            $valueRightMember = urldecode($matches[3]);

            // is null / is not null
            if ($valueRightMember === '') {
                if ($operation == self::MATCH_NOT_EQUAL) {
                    $operation = self::MATCH_IS_NOT_NULL_NOR_EMPTY;
                } elseif ($operation == self::MATCH_EQUAL) {
                    $operation = self::MATCH_IS_NULL_OR_EMPTY;
                } else {
                    throw new Exception('The segment \'' . $operand . '\' has no value specified. You can leave this value empty ' .
                        'only when you use the operators: ' . self::MATCH_NOT_EQUAL . ' (is not) or ' . self::MATCH_EQUAL . ' (is)');
                }
            }

            $parsedSubExpressions[] = array(
                self::INDEX_BOOL_OPERATOR => $operator,
                self::INDEX_OPERAND       => array(
                    self::INDEX_OPERAND_NAME => $leftMember,
                    self::INDEX_OPERAND_OPERATOR => $operation,
                    self::INDEX_OPERAND_VALUE => $valueRightMember,
                ));
        }
        $this->parsedSubExpressions = $parsedSubExpressions;
        return $parsedSubExpressions;
    }
1141634
public function parse()
    {
        $this->lexer->moveNext();

        while (true) {
            if (!$this->lexer->lookahead) {
                break;
            }

            $this->lexer->moveNext();
            $thisLine = null;

            switch ($this->lexer->token['type']) {
                case Lexer::T_OPEN_PARENTHESIS:
                case Lexer::T_OPEN_BRACKET:
                case Lexer::T_OPEN_CURLY_BRACE:
                    $thisLine = '[';
                    $this->currentLevel++;
                    break;
                case Lexer::T_CLOSE_PARENTHESIS:
                case Lexer::T_CLOSE_BRACKET:
                case Lexer::T_CLOSE_CURLY_BRACE:
                    $thisLine = ']';
                    $this->currentLevel--;
                    break;
                case Lexer::T_STRING:
                    $thisLine = "'".str_replace("'", "\'", $this->lexer->token['value'])."'";
                    break;
                case Lexer::T_DOUBLEPOINT:
                    $thisLine = '=>';
                    break;
                case Lexer::T_COMMENT_PARAMSTART:
                    $paramName = $this->lexer->lookahead['value'];
                    $thisLine = '$this->getParam("'.$paramName.'")';
                    // scroll to end of param
                    while ($this->lexer->token['type'] != Lexer::T_COMMENT_PARAMEND) {
                        $this->lexer->moveNext();
                    }
                    break;
                case Lexer::T_COMMENT_IFPARAMSTART:
                case Lexer::T_COMMENT_IFNOTPARAMSTART:
                    $conditionalId = str_pad((string) $this->conditionalCounter, 5, '0', STR_PAD_LEFT);
                    $this->conditionalCounter++;

                    $isNegated = '';
                    if ($this->lexer->token['type'] == Lexer::T_COMMENT_IFNOTPARAMSTART) {
                        $isNegated = 'true';
                    }

                    $this->addContent('$this->getConditional'.$conditionalId.'('.$isNegated.'),');
                    $this->openConditional($conditionalId, $this->lexer->lookahead['value']);
                    break;
                case Lexer::T_COMMENT_IFPARAMEND:
                case Lexer::T_COMMENT_IFNOTPARAMEND:
                    $this->closeConditional();
                    break;
                case Lexer::T_DATE_EMPTY:
                    $thisLine = 'new '.$this->mongoDateClass.'()';
                    break;
                case Lexer::T_DATE_WITH_PARAM:
                    $paramName = $this->lexer->lookahead['value'];
                    $thisLine = '$this->getParam("'.$paramName.'")';
                    break;
                case Lexer::T_BOOLEAN_TRUE:
                    $thisLine = 'true';
                    break;
                case Lexer::T_BOOLEAN_FALSE:
                    $thisLine = 'false';
                    break;
                case Lexer::T_NULL:
                    $thisLine = 'null';
                    break;
                case Lexer::T_COMMA:
                case Lexer::T_NUMBER:
                case Lexer::T_DASH:
                    $thisLine = $this->lexer->token['value'];
                    break;
                default:
                    // nothing
            }

            if (!is_null($thisLine)) {
                $this->addContent($thisLine);
            }
        }

        return implode(PHP_EOL, $this->lines);
    }
749672
protected function getCondition()
    {
        $condition = ['and'];
        foreach ((array)$this->conditionAttributes as $attribute) {
            if ($this->owner->hasAttribute($attribute)) {
                $condition[] = [$attribute => $this->owner->$attribute];
            }
        }
        return $condition;
    }
995427
protected function _constraintsStatement()
    {
        $cons = $this->_sql->getConstraints();
        if (empty($cons)) {
            return null;
        }

        return $this->_parseConstraints();
    }
458076
public function parse()
    {
        $newTokens = array();
        $len = count($this->tokens);
        $this->stack = array();
        $propValue = 'PROPERTY';
        $pushes = array(
            'L_BRACKET' => 'bracket',
            'L_BRACE' => 'brace',
            'AT_IDENTIFIER' => 'at',
            'L_SQ_BRACKET' => 'square'
        );
        $pops = array(
            'R_BRACKET' => 'bracket',
            'R_BRACE' => 'brace',
            'R_SQ_BRACKET' => 'square'
        );
        $this->index = 0;
        while ($this->index < $len) {
            $token = &$this->tokens[$this->index];
            $stackSize = count($this->stack);
            $state = !$stackSize? null : $this->stack[$stackSize - 1];
            $tokName = &$token[0];
            $inBrace = in_array('brace', $this->stack);
            $inBracket = in_array('bracket', $this->stack);
            $inSq = in_array('square', $this->stack);
            $inAt = in_array('at', $this->stack);
            if ($tokName === self::$deleteToken) {
                continue;
            }

            if ($tokName === 'L_BRACE') {
                if ($state === 'at') {
                    array_pop($this->stack);
                }
                $this->stack[] = $pushes[$tokName];
                $propValue = 'PROPERTY';
            } elseif (isset($pushes[$tokName])) {
                $this->stack[] = $pushes[$tokName];
            } elseif (isset($pops[$tokName]) && $state === $pops[$tokName]) {
                array_pop($this->stack);
            } elseif (!$inBracket && $tokName === 'COLON') {
                $propValue = 'VALUE';
            } elseif ($tokName === 'SEMICOLON') {
                $propValue = 'PROPERTY';
                if ($state === 'at') {
                    array_pop($this->stack);
                }
            } elseif ($tokName === 'GENERIC_IDENTIFIER') {
                // this is where the fun starts.
                // we have to figure out exactly what this is
                // if we can look ahead and find a '{' before we find a
                // ';', then this is part of a selector.
                // Otherwise it's part of a property/value pair.
                // the exception is when we have something like:
                // font : { family : sans-serif; }
                // then we need to check for ':{'
                if ($inSq) {
                    $token[0] = 'ATTR_SELECTOR';
                } elseif ($inBracket) {
                    $this->parseIdentifier($token);
                } elseif (!$inAt) {
                    $semi = $this->nextOfType('SEMICOLON');
                    $colonBrace = $this->nextSequence(array('COLON', 'L_BRACE'), array('WHITESPACE'));
                    $brace = $this->nextOfType('L_BRACE');

                    $ruleTerminator = min($semi, $colonBrace);
                    if ($brace < $ruleTerminator) {
                        $this->parseRule();
                        $propValue = 'PROPERTY';
                    } else {
                        $this->tokens[$this->index][0] = $propValue;
                        if ($propValue === 'VALUE') {
                            $this->parseIdentifier($token);
                        }
                    }
                }
            }
            $this->index++;
        }
        $this->cleanup();
    }
357597
private function parseExpression (){
		$entities = array();

		do{
			$e = $this->MatchFuncs(array('parseAddition','parseEntity'));
			if( $e ){
				$entities[] = $e;
				// operations do not allow keyword "/" dimension (e.g. small/20px) so we support that here
				if( !$this->PeekReg('/\\G\/[\/*]/') ){
					$delim = $this->MatchChar('/');
					if( $delim ){
						$entities[] = $this->NewObj1('Less_Tree_Anonymous',$delim);
					}
				}
			}
		}while($e);

		if( $entities ){
			return $this->NewObj1('Less_Tree_Expression',$entities);
		}
	}