Diffs
PEG/trunk/test/FlexibleMany.php
@@ -1,14 +0,0 @@
-<?php
-include_once dirname(__FILE__) . '/t/t.php';
-
-$lime = new lime_test;
-
-$p = new PEG_FlexibleMany(PEG::token('a'), PEG::token('a'));
-$c = PEG::context('aaaa');
-
-$lime->is($p->parse($c), array(array('a', 'a', 'a'), 'a'));
-
-$p = PEG::fmany('a', 'ab');
-$c = PEG::context('aaab');
-
-$lime->is($p->parse($c), array(array('a', 'a'), 'ab'));
PEG/trunk/test/LookaheadNot.php
@@ -1,9 +0,0 @@
-<?php
-include_once dirname(__FILE__) . '/t/t.php';
-
-$lime = new lime_test;
-$parser = PEG::lookaheadNot(PEG::token('hoge'));
-$context = PEG::context('fuga');
-$lime->is($parser->parse($context), 'fuga');
-$lime->is($context->tell(), 0);
-
PEG/trunk/code/PEG.php
@@ -24,7 +24,6 @@
include_once dirname(__FILE__) . '/PEG/Failure.php';
include_once dirname(__FILE__) . '/PEG/Lookahead.php';
include_once dirname(__FILE__) . '/PEG/Many.php';
-include_once dirname(__FILE__) . '/PEG/FlexibleMany.php';
include_once dirname(__FILE__) . '/PEG/Memoize.php';
include_once dirname(__FILE__) . '/PEG/Not.php';
include_once dirname(__FILE__) . '/PEG/Optional.php';
@@ -109,18 +108,6 @@
}
/**
- * バックトラック可能なmanyパーサを返す
- *
- * @param PEG_IParser
- * @param PEG_IParser
- * @return PEG_FlexibleMany
- */
- static function fmany($parser, $following)
- {
- return new PEG_FlexibleMany(self::parser($parser), self::parser($following));
- }
-
- /**
* エラーを記録するパーサを返す
*
* @param string
PEG/trunk/code/PEG/FlexibleMany.php
@@ -1,61 +0,0 @@
-<?php
-/**
- * @package PEG
- * @author anatoo<anatoo@nequal.jp>
- * @license http://www.opensource.org/licenses/mit-license.php MIT License
- * @version $Id$
- */
-
-class PEG_FlexibleMany implements PEG_IParser
-{
- protected $parser, $following;
- function __construct(PEG_IParser $parser, PEG_IParser $following)
- {
- list($this->parser, $this->following) = func_get_args();
- }
-
- function parse(PEG_IContext $context)
- {
- $result_arr = $offset_arr = array();
- $result_tmp = $offset_tmp = null;
-
- do {
- $offset_tmp = $context->tell();
- $result_tmp = $this->parser->parse($context);
-
- if ($result_tmp instanceof PEG_Failure) {
- $context->seek($offset_tmp);
- break;
- }
-
- $result_arr[] = $result_tmp;
- $offset_arr[] = $offset_tmp;
-
- } while(!$context->eos());
-
- for (;;) {
- $following_result = $this->following->parse($context);
-
- if ($following_result instanceof PEG_Failure) {
- if (!$result_arr) {
- return PEG::failure();
- }
-
- array_pop($result_arr);
- $context->seek(array_pop($offset_arr));
- }
- else {
- return array($result_arr, $following_result);
- }
- }
- }
-
- protected function filterNull(Array $arr)
- {
- $ret = array();
- foreach ($arr as $elt) {
- if (!is_null($elt)) $ret[] = $elt;
- }
- return $ret;
- }
-}