Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parsley name was taken by another library.
- Loading branch information
Showing
12 changed files
with
61 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
<?php | ||
namespace Gajus\Parsley\Exception; | ||
namespace Gajus\Paggern\Exception; | ||
|
||
/** | ||
* @link https://github.com/gajus/parsley for the canonical source repository | ||
* @license https://github.com/gajus/parsley/blob/master/LICENSE BSD 3-Clause | ||
* @link https://github.com/gajus/paggern for the canonical source repository | ||
* @license https://github.com/gajus/paggern/blob/master/LICENSE BSD 3-Clause | ||
*/ | ||
class LogicException extends ParsleyException { | ||
class LogicException extends PaggernException { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
namespace Gajus\Paggern\Exception; | ||
|
||
/** | ||
* @link https://github.com/gajus/paggern for the canonical source repository | ||
* @license https://github.com/gajus/paggern/blob/master/LICENSE BSD 3-Clause | ||
*/ | ||
class PaggernException extends \Exception {} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
<?php | ||
namespace Gajus\Parsley\Exception; | ||
namespace Gajus\Paggern\Exception; | ||
|
||
/** | ||
* @link https://github.com/gajus/parsley for the canonical source repository | ||
* @license https://github.com/gajus/parsley/blob/master/LICENSE BSD 3-Clause | ||
* @link https://github.com/gajus/paggern for the canonical source repository | ||
* @license https://github.com/gajus/paggern/blob/master/LICENSE BSD 3-Clause | ||
*/ | ||
class RuntimeException extends ParsleyException { | ||
class RuntimeException extends PaggernException { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
<?php | ||
namespace Gajus\Parsley\Exception; | ||
namespace Gajus\Paggern\Exception; | ||
|
||
/** | ||
* @link https://github.com/gajus/parsley for the canonical source repository | ||
* @license https://github.com/gajus/parsley/blob/master/LICENSE BSD 3-Clause | ||
* @link https://github.com/gajus/paggern for the canonical source repository | ||
* @license https://github.com/gajus/paggern/blob/master/LICENSE BSD 3-Clause | ||
*/ | ||
class UnexpectedValueException extends ParsleyException { | ||
class UnexpectedValueException extends PaggernException { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,54 @@ | ||
<?php | ||
class TokenisationTest extends PHPUnit_Framework_TestCase { | ||
public function testLiteralString () { | ||
$lexer = new \Gajus\Parsley\Lexer(); | ||
$lexer = new \Gajus\Paggern\Lexer(); | ||
$tokens = $lexer->tokenise('abc'); | ||
|
||
$this->assertCount(1, $tokens); | ||
$this->assertSame(['type' => 'literal', 'string' => 'abc'], $tokens[0]); | ||
} | ||
|
||
public function testRangeImplicit () { | ||
$lexer = new \Gajus\Parsley\Lexer(); | ||
$lexer = new \Gajus\Paggern\Lexer(); | ||
$tokens = $lexer->tokenise('[0-9]'); | ||
|
||
$this->assertCount(1, $tokens); | ||
$this->assertSame(['type' => 'range', 'token' => '0-9', 'repetition' => 1], $tokens[0]); | ||
} | ||
|
||
public function testRangeExplicit () { | ||
$lexer = new \Gajus\Parsley\Lexer(); | ||
$lexer = new \Gajus\Paggern\Lexer(); | ||
$tokens = $lexer->tokenise('[a-z]{2}'); | ||
|
||
$this->assertCount(1, $tokens); | ||
$this->assertSame(['type' => 'range', 'token' => 'a-z', 'repetition' => 2], $tokens[0]); | ||
} | ||
|
||
public function testClassImplicit () { | ||
$lexer = new \Gajus\Parsley\Lexer(); | ||
$lexer = new \Gajus\Paggern\Lexer(); | ||
$tokens = $lexer->tokenise('\U'); | ||
|
||
$this->assertCount(1, $tokens); | ||
$this->assertSame(['type' => 'class', 'class' => \Gajus\Parsley\Lexer::CLASS_UPPERCASE_UNAMBIGUOUS, 'repetition' => 1], $tokens[0]); | ||
$this->assertSame(['type' => 'class', 'class' => \Gajus\Paggern\Lexer::CLASS_UPPERCASE_UNAMBIGUOUS, 'repetition' => 1], $tokens[0]); | ||
} | ||
|
||
public function testClassExplicit () { | ||
$lexer = new \Gajus\Parsley\Lexer(); | ||
$lexer = new \Gajus\Paggern\Lexer(); | ||
$tokens = $lexer->tokenise('\U{10}'); | ||
|
||
$this->assertCount(1, $tokens); | ||
$this->assertSame(['type' => 'class', 'class' => \Gajus\Parsley\Lexer::CLASS_UPPERCASE_UNAMBIGUOUS, 'repetition' => 10], $tokens[0]); | ||
$this->assertSame(['type' => 'class', 'class' => \Gajus\Paggern\Lexer::CLASS_UPPERCASE_UNAMBIGUOUS, 'repetition' => 10], $tokens[0]); | ||
} | ||
|
||
public function testCombined () { | ||
$lexer = new \Gajus\Parsley\Lexer(); | ||
$lexer = new \Gajus\Paggern\Lexer(); | ||
$tokens = $lexer->tokenise('abc[a-z]{2}[0-9]\U\U{3}'); | ||
$this->assertCount(5, $tokens); | ||
|
||
$this->assertSame(['type' => 'literal', 'string' => 'abc'], $tokens[0]); | ||
$this->assertSame(['type' => 'range', 'token' => 'a-z', 'repetition' => 2], $tokens[1]); | ||
$this->assertSame(['type' => 'range', 'token' => '0-9', 'repetition' => 1], $tokens[2]); | ||
$this->assertSame(['type' => 'class', 'class' => \Gajus\Parsley\Lexer::CLASS_UPPERCASE_UNAMBIGUOUS, 'repetition' => 1], $tokens[3]); | ||
$this->assertSame(['type' => 'class', 'class' => \Gajus\Parsley\Lexer::CLASS_UPPERCASE_UNAMBIGUOUS, 'repetition' => 3], $tokens[4]); | ||
$this->assertSame(['type' => 'class', 'class' => \Gajus\Paggern\Lexer::CLASS_UPPERCASE_UNAMBIGUOUS, 'repetition' => 1], $tokens[3]); | ||
$this->assertSame(['type' => 'class', 'class' => \Gajus\Paggern\Lexer::CLASS_UPPERCASE_UNAMBIGUOUS, 'repetition' => 3], $tokens[4]); | ||
} | ||
} |