/** * 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; }