@@ 3444-3466 (lines=23) @@ | ||
3441 | return $this->match(self::$literalCache[$what], $m, $eatWhitespace); |
|
3442 | } |
|
3443 | ||
3444 | protected function genericList(&$out, $parseItem, $delim="", $flatten=true) { |
|
3445 | $s = $this->seek(); |
|
3446 | $items = array(); |
|
3447 | while ($this->$parseItem($value)) { |
|
3448 | $items[] = $value; |
|
3449 | if ($delim) { |
|
3450 | if (!$this->literal($delim)) break; |
|
3451 | } |
|
3452 | } |
|
3453 | ||
3454 | if (count($items) == 0) { |
|
3455 | $this->seek($s); |
|
3456 | return false; |
|
3457 | } |
|
3458 | ||
3459 | if ($flatten && count($items) == 1) { |
|
3460 | $out = $items[0]; |
|
3461 | } else { |
|
3462 | $out = array("list", $delim, $items); |
|
3463 | } |
|
3464 | ||
3465 | return true; |
|
3466 | } |
|
3467 | ||
3468 | ||
3469 | // advance counter to next occurrence of $what |
@@ 3127-3149 (lines=23) @@ | ||
3124 | return $this->genericList($out, "expression"); |
|
3125 | } |
|
3126 | ||
3127 | protected function genericList(&$out, $parseItem, $delim="", $flatten=true) { |
|
3128 | $s = $this->seek(); |
|
3129 | $items = array(); |
|
3130 | while ($this->$parseItem($value)) { |
|
3131 | $items[] = $value; |
|
3132 | if ($delim) { |
|
3133 | if (!$this->literal($delim)) break; |
|
3134 | } |
|
3135 | } |
|
3136 | ||
3137 | if (count($items) == 0) { |
|
3138 | $this->seek($s); |
|
3139 | return false; |
|
3140 | } |
|
3141 | ||
3142 | if ($flatten && count($items) == 1) { |
|
3143 | $out = $items[0]; |
|
3144 | } else { |
|
3145 | $out = array("list", $delim, $items); |
|
3146 | } |
|
3147 | ||
3148 | return true; |
|
3149 | } |
|
3150 | ||
3151 | protected function expression(&$out) { |
|
3152 | $s = $this->seek(); |