Esempio n. 1
0
 /**
  * Parse the string using the given parser. If a match has been found, move the cursor to the last symbol of the
  * matched string.
  *
  * @param CParser   $parser
  * @param int       $tokenType
  *
  * @return CParserResult|bool		CParserResult object if a match has been found, false otherwise
  */
 protected function parseUsing(CParser $parser, $tokenType)
 {
     $j = $this->pos;
     $result = $parser->parse($this->expression, $j);
     if (!$result) {
         return false;
     }
     $this->pos += $result->length - 1;
     $this->result->addToken($tokenType, $result->match, $result->pos, $result->length);
     return $result;
 }
 /**
  * Parse the string using the given parser. If a match has been found, move the cursor to the last symbol of the
  * matched string.
  *
  * @param CParser   $parser
  * @param int       $tokenType
  *
  * @return bool
  */
 protected function parseUsing(CParser $parser, $tokenType)
 {
     if ($parser->parse($this->expression, $this->pos) == CParser::PARSE_FAIL) {
         return false;
     }
     $this->result->addToken($tokenType, $parser->getMatch(), $this->pos, $parser->getLength());
     $this->pos += $parser->getLength() - 1;
     return true;
 }