Parse an inner statement.
@return Node
@throws ParserException
349670
private function innerStatement() {
    switch ($this->currentType) {
      case T_HALT_COMPILER:
        throw new ParserException(
          $this->filename,
          $this->iterator->getLineNumber(),
          $this->iterator->getColumnNumber(),
          "__halt_compiler can only be used from the outermost scope");
      case T_ABSTRACT:
      case T_FINAL:
      case T_CLASS:
        return $this->classDeclaration();
      case T_INTERFACE:
        return $this->interfaceDeclaration();
      case T_TRAIT:
        return $this->traitDeclaration();
      default:
        if ($this->currentType === T_FUNCTION && $this->isLookAhead(T_STRING, '&')) {
          return $this->functionDeclaration();
        }
        return $this->statement();
    }
  }
626326
public function parse()
    {
        $results = [];
        foreach ($this->parseStatementData() as $this->currentStatementData) {
            $statement = new Statement();
            if ($this->debug) {
                $statement->rawData = $this->currentStatementData;
            }
            $statement->setBank($this->parseStatementBank());
            $statement->setAccount($this->parseStatementAccount());
            $statement->setStartPrice($this->parseStatementStartPrice());
            $statement->setEndPrice($this->parseStatementEndPrice());
            $statement->setStartTimestamp($this->parseStatementStartTimestamp());
            $statement->setEndTimestamp($this->parseStatementEndTimestamp());
            $statement->setNumber($this->parseStatementNumber());
            $statement->setCurrency($this->parseStatementCurrency());

            foreach ($this->parseTransactionData() as $this->currentTransactionData) {
                $transaction = new HsbcTransaction();
                if ($this->debug) {
                    $transaction->rawData = $this->currentTransactionData;
                }
                $transaction->setAccount($this->parseTransactionAccount());
                $transaction->setAccountName($this->parseTransactionAccountName());
                $transaction->setPrice($this->parseTransactionPrice());
                $transaction->setDebitCredit($this->parseTransactionDebitCredit());
                $transaction->setCancellation($this->parseTransactionCancellation());
                $transaction->setDescription($this->parseTransactionDescription());
                $transaction->setValueTimestamp($this->parseTransactionValueTimestamp());
                $transaction->setEntryTimestamp($this->parseTransactionEntryTimestamp());
                $transaction->setTransactionCode($this->parseTransactionCode());
                $transaction->setVirtualAccount($this->parseVirtualAccount());
                $statement->addTransaction($transaction);
            }
            $results[] = $statement;
        }

        return $results;
    }
745218
private function exprStatement() {
    $node = new ExpressionStatementNode();
    $this->matchDocComment($node);
    $node->addChild($this->expr(), 'expression');
    $this->endStatement($node);
    return $node;
  }
58807
public function parse(){
		while($this->parser->hasText()){
			// Skip any white-space
			if(preg_match('/^\s+/is', $this->parser->getText(), $matches)){
				$this->parser->move(strlen($matches[0]));
				if(!$this->parser->hasText()) break;
			}
			
			if(preg_match('/^\/\*/', $this->parser->getText())){
				if(!preg_match('/^\/\*(.+?)\*\//s', $this->parser->getText(), $matches)) throw new \Exception('Unterminated comments');
				$this->parser->move(strlen($matches[0]));
			}else if(preg_match('/^@(\S+)/is', $this->parser->getText(), $matches)){
				switch($matches[2]){
					//case 'font-face': $atRule = new CSSFontFaceParser($this->parser, $this->parent); break;
					default: throw new Exception("Unknown At-rule '".$matches[0]."'");
				}
				$atRule->parse();
			}else{
				$ruleset = new RuleSet($this->parser, $this->parent);
				$ruleset->parse();
			}
		}
	}
1195336
protected function parse()
    {
        $lines = explode("\n", $this->comment);

        $current_annotation = null;
        $value = null;
        foreach ($lines as $line)
        {
            $line = trim(ltrim($line, "/* \t"));

            if (preg_match("/^@(\w+)( (.*))?$/", $line, $matches) === 1)
            {
                if (!empty($value))
                    $this->annotations[$current_annotation][] = $value;

                $current_annotation = $matches[1];
                $value = $matches[3] ?? '';
            }
            elseif ($current_annotation !== null)
            {
                $value .= "\n" . $line;
            }
            else
            {
                $this->preamble[] = $line;
            }
        }

        if (!empty($value))
            $this->annotations[$current_annotation][] = rtrim($value);
    }
792968
protected function parse()
    {
        $data = $this->_source->getData();

        $prefilters = $this->getPreFilterInstances();
        foreach($prefilters as $prefilter) {
            $data = $prefilter->filter($data);
        }

        $realpath = $this->_source->getRealPath();
        $parser = new PHPTAL_Dom_SaxXmlParser($this->_encoding);

        $builder = new PHPTAL_Dom_PHPTALDocumentBuilder();
        $tree = $parser->parseString($builder, $data, $realpath)->getResult();

        foreach($prefilters as $prefilter) {
            if ($prefilter instanceof PHPTAL_PreFilter) {
                if ($prefilter->filterDOM($tree) !== NULL) {
                    throw new PHPTAL_ConfigurationException("Don't return value from filterDOM()");
                }
            }
        }

        $state = new PHPTAL_Php_State($this);

        $codewriter = new PHPTAL_Php_CodeWriter($state);
        $codewriter->doTemplateFile($this->getFunctionName(), $tree);

        return $codewriter->getResult();
    }
168414
private function parse() {
		// remove first line
		$lead = strstr($this->data, "\n", true);
		$this->data = substr(strstr($this->data, "\n"), 1);

		// parse first line
		$pieces = explode(" ", $lead);
		$this->httpVersion = (Integer)trim(substr(strstr($pieces[0], "/"), 1));
		$this->code = (Integer)trim($pieces[1]);

		// split into head and body
		$head = strstr($this->data, "\r\n\r\n", true);
		$this->body = substr(strstr($this->data, "\r\n\r\n"), 4);

		// parse headers
		foreach(explode("\n", $head) as $line) {
			$this->headers[strtolower(strstr($line, ":", true))] = trim(substr(strstr($line, ":"), 2));
		}

		// fix content type header, move charset to its own if present
		if(isset($this->headers["content-type"]) && strpos($this->headers["content-type"], ";")) {
			$this->headers["content-type"] = strtok($this->headers["content-type"], ";");
			if(!isset($this->headers["charset"])) $this->headers["charset"] = substr(strstr(strtok(";"), "="), 1);
		}

		// decode if chunked
		if($this->decodeChunked && isset($this->headers["transfer-encoding"]) && strtolower($this->headers["transfer-encoding"]) == "chunked") {
			for($decoded = ""; !empty($this->body); $this->body = trim($this->body)) {
				$position = strpos($this->body, "\r\n");
				$length = hexdec(substr($this->body, 0, $position));
				$decoded .= substr($this->body, $position + 2, $length);
				$this->body = substr($this->body, $position + 2 + $length);
			}

			$this->body = $decoded;
			unset($decoded);
		}

		// parse body as json if in json mode
		if($this->json && strtolower($this->headers["content-type"]) == "application/json") {
			$json = json_decode($this->body);
			if(json_last_error() == JSON_ERROR_NONE) $this->body = $json;
		}

		// cleanup
		unset($this->data, $head, $lead);

		
	}
419268
public function parse( $str ) {
        
        $this->reset();
        $parent = $this->treeRoot;
        
        $tokenManager = new TokenManager( $str );
                
        $nodeid = 1;
        $inTag = false;
        while( $tokenManager->hasCurrent() ) {
            // tokens are either "[", "]" or a string that contains neither a opening bracket nor a closing bracket
            
            if( $inTag ) {
                // this token should be a tag name
                
                // explode by = in case there's an attribute
                $pieces = explode('=', $tokenManager->getCurrent(), 2);
                
                // check if it's a closing tag
                if( substr($pieces[0], 0, 1) == "/" ) {
                    $tagName = substr($pieces[0], 1);
                    $closing = true;
                } else {
                    $tagName = $pieces[0];
                    $closing = false;
                }
                                                
                if( ($this->codeExists( $tagName, isset($pieces[1])) || $closing && $this->codeExists($tagName, true)) && $tokenManager->hasNext() && $tokenManager->next() == "]" )
                {
                    if( $closing )
                    {
                        $closestParent = $parent->closestParentOfType( $tagName );
                                                
                        if( $closestParent != null && $closestParent->hasParent() )
                        {
                            // closing an element... move to this element's parent
                            $parent->getCodeDefinition()->decrementCounter();
                            $parent = $closestParent->getParent();
                            $tokenManager->advance();
                            $tokenManager->advance();
                            $inTag = false;
                            continue;
                        }
                        
                    } else {
                        // new element
                        $el = new ElementNode();
                        $code = $this->getCode($tagName, isset($pieces[1]));
                        $code->incrementCounter();
                        $el->setNestDepth($code->getCounter());
                        $el->setCodeDefinition($code);
                        $el->setTagName( $tagName );
                        $el->setNodeId( $nodeid++ );
                        if( isset($pieces[1]) )
                            $el->setAttribute( $pieces[1] );
                        
                        $parent->addChild( $el );
                        $parent = $el;
                        $tokenManager->advance();
                        $tokenManager->advance();
                        $inTag = false;
                        continue;
                    }
                }
                
                // the opening bracket that sent us in here was really just plain text
                $node = new TextNode( "[" );
                $node->setNodeId($nodeid++);
                $parent->addChild( $node );
                $inTag = false; 
                // treat this token as regular text, and let the next if...else structure handle it as regular text
                
            }
            
            if( $tokenManager->getCurrent() == "[") {
                $inTag = true;
            }
            else {
                $node = new TextNode( $tokenManager->getCurrent() );
                $node->setNodeId($nodeid++);
                $parent->addChild( $node );
            }
            
            $tokenManager->advance();
            
        }
        
    }
637756
protected function parse()
    {
        $fileContent = file($this->getFile(), FILE_IGNORE_NEW_LINES);

        $found = false;
        $open = false;
        foreach ($fileContent as $line) {
            if ($line == $this->startMarker) {
                if ($open) {
                    throw ClassHelper::create('AutoGitIgnoreParserException', 'There are two openings in this file.');
                } else {
                    if ($found) {
                        throw ClassHelper::create('AutoGitIgnoreParserException', 'There are two blocks in this file.');
                    } else {
                        $open = true;
                    }
                }
            } elseif ($line == $this->endMarker) {
                if (!$open) {
                    throw ClassHelper::create('AutoGitIgnoreParserException', 'The line ending is before the start.');
                } else {
                    $found = true;
                    $open = false;
                    $this->afterLine = count($this->fileContent);
                }
            } else {
                if (!$open) {
                    $this->fileContent[] = $line;
                }
            }
        }

        if (!$found) {
            $this->afterLine = count($this->fileContent);
        }

        return $this;
    }
507617
private function parse()
    {
        if (! $this->state = self::STATE_COMPLETE) {
            throw new QueryBuilderException("Query is not yet completed!");
        }

        if ($this->parser === null) {
            $this->parser = new Parser($this);
        }

        $this->parser->validate();

        return $this->parser;
    }
1318689
final public function parse()
    {
        $wsdl = $this->generator->getWsdl();
        if ($wsdl instanceof Wsdl) {
            $content = $wsdl->getContent();
            if ($content instanceof WsdlDocument) {
                if ($this->isWsdlParsed($wsdl) === false) {
                    $this->setWsdlAsParsed($wsdl)->setTags($content->getElementsByName($this->parsingTag()))->parseWsdl($wsdl);
                }
                foreach ($content->getExternalSchemas() as $schema) {
                    if ($this->isSchemaParsed($wsdl, $schema) === false) {
                        $this->setSchemaAsParsed($wsdl, $schema);
                        $schemaContent = $schema->getContent();
                        if ($schemaContent instanceof SchemaDocument) {
                            $this->setTags($schemaContent->getElementsByName($this->parsingTag()))->parseSchema($wsdl, $schema);
                        }
                    }
                }
            }
        }
    }
474755
public function toArrayNode() {
    return ($this->parent instanceof ArrayNode) ? clone $this->parent : Parser::parseExpression('[' . $this->getText() . ']');
  }
409249
public function parse()
    {
        if ($this->getProtocol()==='RSS') {
            // channel
            $parser                 = new Parser($this->xml->channel, $this, 'channel');
            $channel                = $parser->getData();
            $channel->protocol      = strtolower($this->getProtocol());
            $this->setData($channel);

            // items
            $this->items            = new XMLObjectsCollection($this->xml->channel);
            foreach ($this->items as $i=>$item) {
                $parser             = new Parser($item, $this, 'item');
                $item               = $parser->getData();
                $item->protocol     = strtolower($this->getProtocol());
                $item->id           = $this->id.'_'.Helper::encodeStringToId($item->title->content);
                $this->items->addData($i, $item);
            }
        } elseif ($this->getProtocol()==='ATOM') {
            // entry
            $parser             = new Parser($this->xml, $this, 'feed');
            $channel            = $parser->getData();
            $channel->protocol  = strtolower($this->getProtocol());
            $this->setData($channel);

            // entry
            $this->items            = new XMLObjectsCollection($this->xml);
            foreach ($this->items as $i=>$item) {
                $parser             = new Parser($item, $this, 'feed');
                $item               = $parser->getData();
                $item->protocol     = strtolower($this->getProtocol());
                $item->id           = $this->id.'_'.Helper::encodeStringToId($item->title->content);
                $this->items->addData($i, $item);
            }
        }
    }
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;
    }
1287434
public function parseUnknown()
    {
        $token = $this->str[$this->last];
        if (Context::isSeparator($token)) {
            return null;
        }

        while (++$this->last < $this->len && ! Context::isSeparator($this->str[$this->last])) {
            $token .= $this->str[$this->last];
        }
        --$this->last;

        return new Token($token);
    }
1135872
protected function parseExpression()
    {
        switch ($type = $this->predictTokenType()) {
            case 'Feature':
                return $this->parseFeature();
            case 'Background':
                return $this->parseBackground();
            case 'Scenario':
                return $this->parseScenario();
            case 'Outline':
                return $this->parseOutline();
            case 'Examples':
                return $this->parseExamples();
            case 'TableRow':
                return $this->parseTable();
            case 'PyStringOp':
                return $this->parsePyString();
            case 'Step':
                return $this->parseStep();
            case 'Text':
                return $this->parseText();
            case 'Newline':
                return $this->parseNewline();
            case 'Tag':
                return $this->parseTags();
            case 'Comment':
                return $this->parseComment();
            case 'Language':
                return $this->parseLanguage();
            case 'EOS':
                return '';
        }

        throw new ParserException(sprintf('Unknown token type: %s', $type));
    }
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);
    }