示例#1
0
 protected function _match($string, Node $curmatch)
 {
     foreach ($this->expressions as $expr) {
         $curmatch->startTransaction();
         $match = $expr->match($string, $curmatch);
         if ($match !== FALSE) {
             $curmatch->commitTransaction();
             return $match;
         }
         $curmatch->revertTransaction();
     }
     return FALSE;
 }
示例#2
0
 protected function _match($string, Node $curmatch)
 {
     $matches = new SimpleNode();
     $curmatch->startTransaction();
     $matchpos = 0;
     foreach ($this->expressions as $expr) {
         $match = $expr->match(substr($string, $matchpos), $curmatch);
         if ($match === FALSE) {
             $curmatch->revertTransaction();
             return FALSE;
         }
         $matchpos += $match->getLen();
         $matches->addLen($match->getLen());
         if (!$expr->ignore) {
             $matches->addText($match->getText());
         }
     }
     $curmatch->commitTransaction();
     return $matches;
 }