It parses a factor. It assumes the following rule:
Fact -> ( Expr )
| CellRef
| CellRange
| Number
| Function

@access private
@return mixed The parsed ptg'd tree on success, PEAR_Error on failure
513522
function _fact()
    {
        if ($this->_current_token == SPREADSHEET_EXCEL_WRITER_OPEN) {
            $this->_advance();         // eat the "("
            $result = $this->_parenthesizedExpression();
            if ($this->_current_token != SPREADSHEET_EXCEL_WRITER_CLOSE) {
                return $this->raiseError("')' token expected.");
            }
            $this->_advance();         // eat the ")"
            return $result;
        }
        // if it's a reference
        if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/',$this->_current_token))
        {
            $result = $this->_createTree($this->_current_token, '', '');
            $this->_advance();
            return $result;
        }
        // If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1)
        elseif (preg_match("/^\w+(\:\w+)?\![A-Ia-i]?[A-Za-z][0-9]+$/u",$this->_current_token))
        {
            $result = $this->_createTree($this->_current_token, '', '');
            $this->_advance();
            return $result;
        }
        // If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1)
        elseif (preg_match("/^'[\w -]+(\:[\w -]+)?'\![A-Ia-i]?[A-Za-z][0-9]+$/u",$this->_current_token))
        {
            $result = $this->_createTree($this->_current_token, '', '');
            $this->_advance();
            return $result;
        }
        // if it's a range
        elseif (preg_match("/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/",$this->_current_token) or 
                preg_match("/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/",$this->_current_token))
        {
            $result = $this->_current_token;
            $this->_advance();
            return $result;
        }
        // If it's an external range (Sheet1!A1 or Sheet1!A1:B2)
        elseif (preg_match("/^\w+(\:\w+)?\!([A-Ia-i]?[A-Za-z])?[0-9]+:([A-Ia-i]?[A-Za-z])?[0-9]+$/u",$this->_current_token))
        {
            $result = $this->_current_token;
            $this->_advance();
            return $result;
        }
        // If it's an external range ('Sheet1'!A1 or 'Sheet1'!A1:B2)
        elseif (preg_match("/^'[\w -]+(\:[\w -]+)?'\!([A-Ia-i]?[A-Za-z])?[0-9]+:([A-Ia-i]?[A-Za-z])?[0-9]+$/u",$this->_current_token))
        {
            $result = $this->_current_token;
            $this->_advance();
            return $result;
        }
        elseif (is_numeric($this->_current_token))
        {
            $result = $this->_createTree($this->_current_token, '', '');
            $this->_advance();
            return $result;
        }
        // if it's a function call
        elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i",$this->_current_token))
        {
            $result = $this->_func();
            return $result;
        }
        return $this->raiseError("Syntax error: ".$this->_current_token.
                                 ", lookahead: ".$this->_lookahead.
                                 ", current char: ".$this->_current_char);
    }
471431
private function parseRuleProperty(){
		$offset = $this->pos;
		$name = array();
		$index = array();
		$length = 0;


		$this->rulePropertyMatch('/\\G(\*?)/', $offset, $length, $index, $name );
		while( $this->rulePropertyMatch('/\\G((?:[\w-]+)|(?:@\{[\w-]+\}))/', $offset, $length, $index, $name )); // !

		if( (count($name) > 1) && $this->rulePropertyMatch('/\\G\s*((?:\+_|\+)?)\s*:/', $offset, $length, $index, $name) ){
			// at last, we have the complete match now. move forward,
			// convert name particles to tree objects and return:
			$this->skipWhitespace($length);

			if( $name[0] === '' ){
				array_shift($name);
				array_shift($index);
			}
			foreach($name as $k => $s ){
				if( !$s || $s[0] !== '@' ){
					$name[$k] = $this->NewObj1('Less_Tree_Keyword',$s);
				}else{
					$name[$k] = $this->NewObj3('Less_Tree_Variable',array('@' . substr($s,2,-1), $index[$k], $this->env->currentFileInfo));
				}
			}
			return $name;
		}


	}
184336
function parse()
    {
        $criteria        = $this->criteria;
        $expectAsLiteral = $this->expectAsLiteral;


        $TOKENS  = preg_quote(static::TOKENS);

        $expectAsLiteral = (empty($expectAsLiteral)) ? '/@+-.' : $expectAsLiteral;
        $LITERAL = preg_quote($expectAsLiteral).'A-Za-z0-9_';


        $currentPos = 0;
        $length     = strlen($criteria);
        $parts      = [];
        $levelParts = [&$parts];
        $level      = 0;

        while ($currentPos < $length)
        {
            preg_match("(\G(?P<_literal_>[$LITERAL]*)(?P<_token_>[$TOKENS]|$))"
                , $criteria
                , $matches
                , 0
                , $currentPos
            );

            if ( empty($matches) )
                break;

            if (! empty($matches['_literal_']) ) {
                $levelParts[$level][] = ['_literal_' => $matches['_literal_']];
                $currentPos += strlen($matches['_literal_']);
            }

            # Deal With Token:
            if ( !isset($matches['_token_']) || $matches['_token_'] == '' )
                continue;

            $currentPos += strlen($matches['_token_']);
            $Token = $matches['_token_'];

            ## Regular Expression Token
            #
            #
            if ($Token === '~') {
                // ^ match any character that is not in list
                $pmatch = preg_match("/~(?P<_delimiter_>[^~]+)~/"
                    , $criteria
                    , $matches
                    , 0
                    , 0
                );
                if (! $pmatch )
                    throw new \RuntimeException('Miss usage of ~ ~ token.');

                $val['_regex_'] = $matches['_delimiter_'];
                $levelParts[$level][] = $val;

                $currentPos += strlen($matches[0])+2/*~x~*/;
            }
            ##
            # Variable
            # /:hash_id~\w{24}~
            #
            elseif ($Token === ':') {
                // ^$TOKENS  match any character that is not in list
                $pmatch = preg_match("(\G(?P<_name_>[^$TOKENS]+)(?:~(?P<_delimiter_>[^~]+)~)?:?)"
                    , $criteria
                    , $matches
                    , 0
                    , $currentPos
                );

                if (! $pmatch && !(isset($matches['_name_']) && isset($matches['_delimiter_'])) )
                    throw new \RuntimeException(
                        'Found empty parameter name or delimiter on (%s).'
                        , $criteria
                    );

                $parameter = $matches['_name_'];
                $val       = ['_parameter_' => $parameter];
                if (isset($matches['_delimiter_']))
                    $val[$parameter] = $matches['_delimiter_'];

                $levelParts[$level][] = $val;
                $currentPos += strlen($matches[0]);
            }

            ## Literal Token
            #  localhost\:port
            #
            elseif ($Token === '\\') {
                // Consider next character as Literal
                $nextChar = $currentPos += 1;
                $levelParts[$level][]   = ['_literal_' => $criteria[$nextChar]];
            }

            ## Optional Part
            #  /<u/:username~[a-zA-Z0-9._]+~><-:userid~\w{24}~>
            #
            elseif ($Token === '<') {
                if (! isset($va) ) {
                    $va = [];
                    $n = 0;
                }

                $n++;
                $va[$n] = [];
                $levelParts[$level][] = ['_optional_' => &$va[$n]];
                $level++;
                $levelParts[$level] = &$va[$n];
            }
            ## Close Optional ##
            elseif ($Token === '>') {
                unset($levelParts[$level]);
                $level--;

                if ($level < 0)
                    throw new \RuntimeException('Found closing bracket without matching opening bracket');
            }

            else
                // Recognized unused token return immanently
                $levelParts[$level][]   = ['_token_' => $Token];

        } // end while

        if ($level > 0)
            throw new \RuntimeException('Found unbalanced brackets');


        return ParsedCriteria::of($parts);
    }
86952
public function parse() {
        $name_without_parens = preg_replace('/[{}]/', '', $this->full_name);

        $parts = explode('|', $name_without_parens);
        $name_without_pipes = trim($parts[0]);

        $parts = explode('::', $name_without_pipes);
        $name_without_case_keys = trim($parts[0]);
        array_shift($parts);
        $this->case_keys = array_map('trim', $parts);

        $parts = explode(':', $name_without_case_keys);
        $this->short_name = trim($parts[0]);
        array_shift($parts);
        $this->context_keys = array_map('trim', $parts);

        $this->separator = (strpos($this->full_name,'||') !== false) ? '||' : '|';

        $this->parameters = array();
        $parts = explode($this->separator, $name_without_parens);
        if (count($parts) > 1) {
            $parts = explode(',', $parts[1]);
            foreach($parts as $part) {
                array_push($this->parameters, trim($part));
            }
        }
    }
862981
function parse()
    {
        //The amount of opening braces is compared to the amount of closing braces
        //Braces inside comments are ignored
        $this->warnings = array();
        $this->data = array();
        $valid = true;
        $open = 0;
        $entry = false;
        $char = '';
        $lastchar = '';
        $buffer = '';
        for ($i = 0; $i < strlen($this->content); $i++) {
            $char = substr($this->content, $i, 1);
            if ((0 != $open) && ('@' == $char)) {
                if (!$this->_checkAt($buffer)) {
                    $this->_generateWarning('WARNING_MISSING_END_BRACE', '', $buffer);
                    //To correct the data we need to insert a closing brace
                    $char = '}';
                    $i--;
                }
            }
            if ((0 == $open) && ('@' == $char)) { //The beginning of an entry
                $entry = true;
            } elseif ($entry && ('{' == $char) && ('\\' != $lastchar)) { //Inside an entry and non quoted brace is opening
                $open++;
            } elseif ($entry && ('}' == $char) && ('\\' != $lastchar)) { //Inside an entry and non quoted brace is closing
                $open--;
                if ($open < 0) { //More are closed than opened
                    $valid = false;
                }
                if (0 == $open) { //End of entry
                    $entry = false;
                    $entrydata = $this->_parseEntry($buffer);
                    if (!$entrydata) {
                        /**
                         * This is not yet used.
                         * We are here if the Entry is either not correct or not supported.
                         * But this should already generate a warning.
                         * Therefore it should not be necessary to do anything here
                         */
                    } else {
                        $this->data[] = $entrydata;
                    }
                    $buffer = '';
                }
            }
            if ($entry) { //Inside entry
                $buffer .= $char;
            }
            $lastchar = $char;
        }
        //If open is one it may be possible that the last ending brace is missing
        if (1 == $open) {
            $entrydata = $this->_parseEntry($buffer);
            if (!$entrydata) {
                $valid = false;
            } else {
                $this->data[] = $entrydata;
                $buffer = '';
                $open = 0;
            }
        }
        //At this point the open should be zero
        if (0 != $open) {
            $valid = false;
        }
        //Are there Multiple entries with the same cite?
        if ($this->_options['validate']) {
            $cites = array();
            foreach ($this->data as $entry) {
                $cites[] = $entry['cite'];
            }
            $unique = array_unique($cites);
            if (sizeof($cites) != sizeof($unique)) { //Some values have not been unique!
                $notuniques = array();
                for ($i = 0; $i < sizeof($cites); $i++) {
                    if (empty($unique[$i])) {
                        $notuniques[] = $cites[$i];
                    }
                }
                $this->_generateWarning('WARNING_MULTIPLE_ENTRIES', implode(',', $notuniques));
            }
        }
        if ($valid) {
            $this->content = '';
            return true;
        } else {
            throw new BibtexException('Unbalanced parenthesis');
        }
    }
868149
protected function parseOrder()
    {
        if (!isset($this->parts['order']) || !is_array($this->parts['order']) || count($this->parts['order']) < 1) {
            return false;
        }

        $orderParts = [];

        foreach ($this->parts['order'] as $itemOrder) {
            if ($itemOrder) {
                if (!is_array($itemOrder)) {
                    $itemOrder = [$itemOrder];
                }

                $column = isset($itemOrder[0]) ? $itemOrder[0] : false;
                $type = isset($itemOrder[1]) ? $itemOrder[1] : '';
                $protected = isset($itemOrder[2]) ? $itemOrder[2] : true;

                $column = ($protected ? $this->protect($column) : $column).' '.strtoupper($type);

                $orderParts[] = trim($column);
            }
        }

        return implode(', ', $orderParts);
    }
123965
public function parse()
    {
        if ($this->query !== null) {
            return $this->query;
        }
        $query = preg_replace_callback('~{(.*?)}~', array($this, 'tableClb'), $this->pattern);
        $pattern = '~\?([a-z\?-]+)?(:([a-z0-9_-]*))?;?~i';
        $callback = array($this, 'placeholderClb');
        $query = preg_replace_callback($pattern, $callback, $query);
        if ((!$this->named) && (count($this->data) > $this->counter)) {
            if (($this->counter > 0) || (isset($this->data[0]))) {
                throw new DataMuch(count($this->data), $this->counter);
            }
        }
        $this->query = $query;
        return $this->query;
    }
531505
function parse($formula)
    {
        $this->_current_char = 0;
        $this->_formula      = $formula;
        $this->_lookahead    = $formula{1};
        $this->_advance();
        $this->_parse_tree   = $this->_condition();
        if (PEAR::isError($this->_parse_tree)) {
            return $this->_parse_tree;
        }
        return true;
    }
238958
protected function _parseFunction() {
        $this->_content = preg_replace('`' . $this->_openTag . $this->_name . preg_quote($this->markup['function'][0]) . $this->_spaceR . preg_quote($this->markup['function'][1]) . $this->_space . '=' . $this->_space . '"' . $this->_space . '(.+)' . $this->_space . '"' . $this->_space . '/' . $this->_closeTag . '`isU', '<?php $1 ?>', $this->_content);
    }
588486
public static function STDEVP()
    {
        $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());

        $returnValue = null;

        $aMean = self::AVERAGE($aArgs);
        if (!is_null($aMean)) {
            $aCount = 0;
            foreach ($aArgs as $k => $arg) {
                if ((is_bool($arg)) &&
                    ((!PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) {
                    $arg = (integer) $arg;
                }
                // Is it a numeric value?
                if ((is_numeric($arg)) && (!is_string($arg))) {
                    if (is_null($returnValue)) {
                        $returnValue = pow(($arg - $aMean), 2);
                    } else {
                        $returnValue += pow(($arg - $aMean), 2);
                    }
                    ++$aCount;
                }
            }

            if (($aCount > 0) && ($returnValue >= 0)) {
                return sqrt($returnValue / $aCount);
            }
        }
        return PHPExcel_Calculation_Functions::DIV0();
    }
874159
public function primeFactors()
    {
        $number = $this->cloneValue();
        $divisor = 2;
        $zero = gmp_init(0);
        $one = gmp_init(1);
        $dmax = gmp_sqrt($number);
        $factors = array();
        $sieve = array_fill(1, intval(gmp_strval($dmax)), 1);
        do {
            $rFlag = false;
            while (gmp_cmp(gmp_mod($number, $divisor), $zero) == 0) {
                $factors[$divisor] = (isset($factors[$divisor]) ? $factors[$divisor] + 1 : 1);
                $number = gmp_div_q($number, $divisor);
                $rFlag = true;
            }
            if ($rFlag) {
                $dmax = gmp_sqrt($number);
            }
            if (gmp_cmp($number, $one) > 0) {
                for ($i = $divisor; gmp_cmp($i, $dmax) <= 0; $i += $divisor) {
                    $sieve[$i] = 0;
                }
                do {
                    $divisor ++;
                } while (gmp_cmp($divisor, $dmax) < 0 && $sieve[$divisor] != 1);
                if (gmp_cmp($divisor, $dmax) > 0) {
                    $key = gmp_strval($number);
                    $factors[$key] = (isset($factors[$key]) ? $factors[$key] + 1 : 1);
                }
            }
        } while (gmp_cmp($number, $one) > 0 && gmp_cmp($divisor, $dmax) <= 0);

        return $factors;
    }
403378
protected function _parse()
    {
        $origCss = '';
        $length = 0;
        foreach (@file($this->_absoluteCssPath) as $line) {
            $origCss .= $line;
            $length += strlen($line);
            $this->_lines[] = $length;
        }
        $css = $origCss;
        $peek = 0;
        $block = null;

        // Consume all CSS data (blockwise)
        while ($peek < $length) {

            // Consume whitespace
            if (preg_match("%^(\s+)%isSu", $css, $whitespace)) {
                $block .= $whitespace[0];
                $peek += strlen($whitespace[0]);

                // Consume Block comment
            } else {
                if (!strncmp('/*', $css, 2)) {
                    $commentEnd = strpos($css, '*/', 2);

                    // If no comment end is found: Error
                    if ($commentEnd === false) {
                        throw new \Tollwerk\Squeezr\Exception(sprintf(\Tollwerk\Squeezr\Exception::UNBALANCED_BLOCK_COMMENT_STR,
                            $this->_peekToLine($peek)), \Tollwerk\Squeezr\Exception::UNBALANCED_BLOCK_COMMENT);
                    }

                    $commentLength = $commentEnd + 2;
                    $block .= substr($css, 0, $commentLength);
                    $peek += $commentLength;

                    // Consume @-rule
                } elseif (!strncmp('@', $css, 1)) {

                    // Determine the rule identifier
                    if (!preg_match("%^\@([\w\-]+)%", $css, $atRule)) {
                        throw new \Tollwerk\Squeezr\Exception(sprintf(\Tollwerk\Squeezr\Exception::INVALID_AT_RULE_IDENTIFIER_STR,
                            $this->_peekToLine($peek)), \Tollwerk\Squeezr\Exception::INVALID_AT_RULE_IDENTIFIER);
                    }

                    // Consume @-rule by identifier
                    switch ($atRule[1]) {

                        // @media rule
                        case 'media':
                            $declarationBlockStart = 0;
                            $declarationBlock = $this->_consumeDeclarationBlock($css, $peek, strlen($atRule[1]) + 1,
                                $declarationBlockStart);
                            $peek += strlen($declarationBlock);
                            $breakpoints = $this->_breakpoints(substr($css, 6, $declarationBlockStart - 6));

                            // If the @media query is squeezable
                            if (is_array($breakpoints)) {

                                // If there's already block data to be registered
                                if (strlen($block)) {
                                    $this->_registerBlock($block);
                                }

                                $this->_registerBlock($declarationBlock, $breakpoints);

                                // Else: Not a squeezable @media query, register as regular block
                            } else {
                                $block .= $declarationBlock;
                            }

                            break;

                        // @import rule: May contain media query, should be implemented
                        case 'import':

                            // Find the next line break or semicolon
                            if (preg_match("%[\r\n\;]%", $css, $delimiter, PREG_OFFSET_CAPTURE, strlen($atRule[1]))) {
                                $declarationBlock = substr($css, 0, $delimiter[0][1] + 1);

                                // Else: this must be the end of the data
                            } else {
                                $declarationBlock = $css;
                            }

                            $peek += strlen($declarationBlock);

                            // Examine the import rule
                            $import = trim(substr($declarationBlock, 7), ' ;');
                            foreach (self::$_importPatterns as $start => $pattern) {
                                if (!strncmp($start, $import, strlen($start)) && preg_match($pattern, $import,
                                        $importMediaQuery)
                                ) {
                                    $breakpoints = $this->_breakpoints($importMediaQuery[4]);

                                    // If the @import rule has a squeezable media query part
                                    if (is_array($breakpoints)) {

                                        // If there's already block data to be registered
                                        if (strlen($block)) {
                                            $this->_registerBlock($block);
                                        }

                                        $this->_registerBlock($declarationBlock, $breakpoints);
                                        break 2;
                                    }
                                }
                            }

                            $block .= $declarationBlock;
                            break;

                        // Single line @-rules (except @import)
                        case 'charset';
                        case 'namespace':

                            // Find the next line break or semicolon
                            if (preg_match("%[\r\n\;]%", $css, $delimiter, PREG_OFFSET_CAPTURE, strlen($atRule[1]))) {
                                $block .=
                                $declarationBlock = substr($css, 0, $delimiter[0][1] + 1);
                                $peek += strlen($declarationBlock);

                                // Else: this must be the end of the data
                            } else {
                                $block .= $css;
                                $peek += strlen($css);
                            }

                            break;

                        // Block @-rules (e.g. *-keyframes)
                        case 'page':
                        case 'font-face':
                        default:
                            $block .=
                            $declarationBlock = $this->_consumeDeclarationBlock($css, $peek, strlen($atRule[1]) + 1);
                            $peek += strlen($declarationBlock);
                            break;
                    }

                    // Consume declaration blocks
                } else {
                    $block .=
                    $declarationBlock = $this->_consumeDeclarationBlock($css, $peek);
                    $peek += strlen($declarationBlock);
                }
            }

            $css = substr($origCss, $peek);
        }

        // Register the last block (if any)
        if (strlen($block)) {
            $this->_registerBlock($block);
        }
    }
1328241
public function parse(): bool
    {
        if ($this->valid === true) {
            /**
             * Before processing through the deltas, generate new deltas by splliting
             * on all new lines, will make it much simpler to work out which
             * delta belong to headings, lists etc.
             */
            $this->quill_json = $this->splitInsertsByNewline($this->quill_json['ops']);

            foreach ($this->quill_json as $quill) {

                if ($quill['insert'] !== null) {
                    if (
                        array_key_exists('attributes', $quill) === true &&
                        is_array($quill['attributes']) === true
                    ) {
                        if (count($quill['attributes']) === 1) {
                            foreach ($quill['attributes'] as $attribute => $value) {
                                switch ($attribute) {
                                    case Options::ATTRIBUTE_BOLD:
                                        $this->attributeBold($quill);
                                        break;

                                    case Options::ATTRIBUTE_COLOR:
                                        $this->attributeColor($quill);
                                        break;

                                    case Options::ATTRIBUTE_HEADER:
                                        $this->attributeHeader($quill);
                                        break;

                                    case Options::ATTRIBUTE_ITALIC:
                                        $this->attributeItalic($quill);
                                        break;

                                    case Options::ATTRIBUTE_LINK:
                                        $this->attributeLink($quill);
                                        break;

                                    case Options::ATTRIBUTE_LIST:
                                        $this->attributeList($quill);
                                        break;

                                    case Options::ATTRIBUTE_SCRIPT:
                                        $this->attributeScript($quill);
                                        break;

                                    case Options::ATTRIBUTE_STRIKE:
                                        $this->attributeStrike($quill);
                                        break;

                                    case Options::ATTRIBUTE_UNDERLINE:
                                        $this->attributeUnderline($quill);
                                        break;

                                    default:
                                        $this->insert($quill);
                                        break;
                                }
                            }
                        } else {
                            $this->compoundInsert($quill);
                        }
                    } else {
                        if (is_string($quill['insert']) === true) {
                            $this->insert($quill);
                        } else {
                            if (is_array($quill['insert']) === true) {
                                if (array_key_exists('image', $quill['insert']) === true) {
                                    $this->image($quill);
                                } else if (array_key_exists('video', $quill['insert']) === true) {
                                    $this->video($quill);
                                }
                            }
                        }
                    }
                }
            }
            return true;
        } else {
            return false;
        }
    }
905390
public function parse()
    {
        $result = new stdClass();
        $cache = $parser = $exception = $cacheKey = $path = null;
        try {
            $path = $this->find(false);
            // Cached response
            $cache = new PathCache(__FUNCTION__, $this->options);
            $cacheKey = $cache->getKey([$path]);
            $result = $cache->readFrom($cacheKey);
            if ($result !== false) {
                return $result;
            }
            // Real response
            $parser = $this->getParser();
            $result = $parser->parse($path);
        } catch (InvalidArgumentException $exception) {
            $this->mergeMessages($exception, __FUNCTION__);
        }
        $this->mergeMessages($parser, __FUNCTION__);
        $this->mergeMessages($cache, __FUNCTION__);

        // Re-throw parser exception
        if ($exception) {
            throw $exception;
        }

        if ($cache && $cacheKey) {
            $cache->writeTo($cacheKey, $result, ['path' => $path]);
        }

        return $result;
    }
1114226
public function parse(){
		$where = $order = $group = $limit = $q = '';
		$source = $this->parseSource();

		if($this->stmt->getConditions())
			$where = $this->parseWhere();
		if($this->stmt instanceof Result && $this->stmt->getGrouping())
			$group = $this->parseGrouping();
		if($this->stmt->getSorting())
			$order = $this->parseSorting();

		$this->clauses = array($source, $where, $group, $order);

		if($this->stmt->getType() === Manager::STMT_SELECT)
			$q = $this->parseSelectStmt();
		elseif($this->stmt->getType() === Manager::STMT_INSERT)
			$q = $this->parseInsertStmt();
		elseif($this->stmt->getType() === Manager::STMT_UPDATE)
			$q = $this->parseUpdateStmt();
		elseif($this->stmt->getType() === Manager::STMT_DELETE)
			$q = $this->parseDeleteStmt();

		return trim($q);
	}
1287062
function _func()
    {
        $num_args = 0; // number of arguments received
        $function = strtoupper($this->_current_token);
        $result   = ''; // initialize result
        $this->_advance();
        $this->_advance();         // eat the "("
        while ($this->_current_token != ')') {
        /**/
            if ($num_args > 0) {
                if ($this->_current_token == SPREADSHEET_EXCEL_WRITER_COMA or
                    $this->_current_token == SPREADSHEET_EXCEL_WRITER_SEMICOLON)
                {
                    $this->_advance();  // eat the "," or ";"
                } else {
                    return $this->raiseError("Syntax error: comma expected in ".
                                      "function $function, arg #{$num_args}");
                }
                $result2 = $this->_condition();
                if (PEAR::isError($result2)) {
                    return $result2;
                }
                $result = $this->_createTree('arg', $result, $result2);
            } else { // first argument
                $result2 = $this->_condition();
                if (PEAR::isError($result2)) {
                    return $result2;
                }
                $result = $this->_createTree('arg', '', $result2);
            }
            $num_args++;
        }
        if (!isset($this->_functions[$function])) {
            return $this->raiseError("Function $function() doesn't exist");
        }
        $args = $this->_functions[$function][1];
        // If fixed number of args eg. TIME($i,$j,$k). Check that the number of args is valid.
        if (($args >= 0) and ($args != $num_args)) {
            return $this->raiseError("Incorrect number of arguments in function $function() ");
        }

        $result = $this->_createTree($function, $result, $num_args);
        $this->_advance();         // eat the ")"
        return $result;
    }
264848
protected function parse()
    {
        if ($this->hasElement()) {
            return $this->getElement();
        }

        $stack = [];
        foreach ($this->stack as $offset => $where) {
            $stack[$offset] = $where->parse();
        }

        return sprintf('(%s)', join(sprintf(' %s ', $this->operator), $stack));
    }