Beispiel #1
0
 /**
  * Construct a generator.
  *
  * @param   \Hoa\Compiler\Llk\Parser  $compiler        Compiler/parser.
  * @param   \Hoa\Visitor\Visit        $tokenSampler    Token sampler.
  * @return  void
  */
 public function __construct(Compiler\Llk\Parser $compiler, Visitor\Visit $tokenSampler, $length = 5)
 {
     parent::__construct($compiler, $tokenSampler);
     foreach ($this->_rules as $name => $_) {
         $this->_data[$name] = [];
     }
     $this->setLength($length);
     $this->_sampler = new Math\Sampler\Random();
     return;
 }
 /**
  * Construct a generator.
  *
  * @param   \Hoa\Compiler\Llk\Parser  $compiler        Compiler/parser.
  * @param   \Hoa\Visitor\Visit        $tokenSampler    Token sampler.
  * @param   int                       $length          Max data length.
  * @return  void
  */
 public function __construct(Compiler\Llk\Parser $compiler, Visitor\Visit $tokenSampler, $length = 5)
 {
     parent::__construct($compiler, $tokenSampler);
     $this->setLength($length);
     return;
 }