Skip to content

Commit

Permalink
Fixed broken examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
anatoo committed Nov 23, 2012
1 parent 52d9355 commit 1918937
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions sample/sample01.php → examples/example01.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
include_once dirname(__FILE__) . '/../code/PEG.php';
include_once dirname(__FILE__) . '/../vendor/autoload.php';

/**
* 括弧の対応をとる再帰的なパーサのサンプル。
Expand Down Expand Up @@ -70,4 +70,4 @@
[5]=>
string(1) "q"
}
*/
*/
4 changes: 2 additions & 2 deletions sample/sample02.php → examples/example02.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
include_once dirname(__FILE__) . '/../code/PEG.php';
include_once dirname(__FILE__) . '/../vendor/autoload.php';

/*
* 単語にヒットするパーサ。
Expand All @@ -17,4 +17,4 @@
var_dump($word->parse(PEG::context('hogehoge'))); //=> 'hogehoge'
var_dump($word->parse(PEG::context('some_id'))); //=> 'some_id'
var_dump($word->parse(PEG::context(' '))); //=> パースに失敗する
var_dump($word->parse(PEG::context('hoge fuga'))); //=> パースはコンテキストの途中で止まり 'hoge'が返る
var_dump($word->parse(PEG::context('hoge fuga'))); //=> パースはコンテキストの途中で止まり 'hoge'が返る
4 changes: 2 additions & 2 deletions sample/sample03.php → examples/example03.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
include_once dirname(__FILE__) . '/../code/PEG.php';
include_once dirname(__FILE__) . '/../vendor/autoload.php';
include_once 'Benchmark/Timer.php';

/**
Expand Down Expand Up @@ -59,4 +59,4 @@
---------------------------------------------------------
total - 1.210238 100.00%
---------------------------------------------------------
*/
*/
5 changes: 2 additions & 3 deletions sample/sample04.php → examples/example04.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?php
include_once dirname(__FILE__) . '/../vendor/autoload.php';
/**
* 行頭に#があったら無視するパーサのサンプル
*/

include_once dirname(__FILE__) . '/../code/PEG.php';

$line = PEG::line();
$ignore = PEG::drop(PEG::andalso('#', $line));
$parser = PEG::join(PEG::many(PEG::choice($ignore, $line)));
Expand All @@ -22,4 +21,4 @@
Lorem ipsum dolor sit amet,
labore et dolore magna aliqua.
"
*/
*/

0 comments on commit 1918937

Please sign in to comment.