Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Commit

Permalink
Fix a bug with count() and quantification.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hywan committed Oct 1, 2013
1 parent afb107b commit 3fbc481
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Llk/Sampler/Uniform.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,12 @@ public function count ( \Hoa\Compiler\Llk\Rule $rule = null, $n = -1 ) {
$handle = &$this->_data[$ruleName][$n]['xy'];
$child = $this->_rules[$rule->getContent()];
$x = $rule->getMin();
$y = (-1 === $rule->getMax() ? $n : $rule->getMax());
$y = $rule->getMax();

if(-1 === $y)
$y = $n;
else
$y = min($n, $y);

if(0 === $x && $x === $y)
$out = 1;
Expand Down

0 comments on commit 3fbc481

Please sign in to comment.