示例#1
0
 public function __construct(Parser $p)
 {
     $t = new Parser\Sequence();
     $t->add(new Parser\CharClass(array('+', '-')));
     $t->add($p);
     $t->setHandler(new Handler\Signed());
     parent::__construct($t);
 }
示例#2
0
 public function __construct(Parser $p, $min = 0, $max = 0)
 {
     parent::__construct($p);
     if ($max < $min && $max > 0) {
         throw new \Exception("maximum({$max}) greater than minimum({$min})");
     }
     $this->min = $min;
     $this->max = $max;
 }