Esempio n. 1
0
 public function parse($string)
 {
     $result = $this->parser->parse($string);
     if ($result === null) {
         return null;
     }
     $result = $this->result_rewriter->reverseRewriteExpressionResult($result);
     return $result;
 }
 public function parseInputStreamWithBacktracking(InputStreamInterface $input, ExpressionResultInterface $previous_result = null)
 {
     if ($previous_result !== null) {
         return null;
     }
     $string = $input->getRemainingString();
     $result = $this->string_parser->parse($string);
     if ($result === null) {
         $input->move(-strlen($string));
         return null;
     }
     $input->move($result->getLength() - strlen($string));
     return $result;
 }
Esempio n. 3
0
 private function runParser(ParserInterface $parser)
 {
     $target = '"ab\\"cd\\e"';
     $n = 10000;
     //increase for more useful data
     for ($i = 0; $i < $n; $i += 1) {
         $result = $parser->parse($target);
     }
 }