Permalink
Browse files

MINOR Remove php-peg third party PHPUnit tests to avoid them being ex…

…ecuted in default phpunit binary test runs (which auto-discover tests ignoring _manifest_exclude).
  • Loading branch information...
1 parent 1b544a4 commit e20304276f414cdc0f54e9f95946073a8085bdda @chillu chillu committed Dec 4, 2011
@@ -1,25 +0,0 @@
-<?php
-
-require '../Parser.php' ;
-
-class CalculatedLiterals extends Parser {
-
-/*!* CalculatedLiterals
-
-string: ( /\\./ | /[^${parent.q}]/ )*
-
-simplequote: q:/['"]/ string '$q'
-
-freequote-matched: "qq" q:/[{\[(<]/ string '$matched'
- function $matched( $res ) {
- $a = array( '{' => '}', '[' => ']', '(' => ')', '<' => '>' ) ;
- return $a[$res['q']] ;
- }
-
-freequote-unmatched: "qq" q:/./ string '$q'
-
-quoted-string: freequote-matched | freequote-unmatched | simplequote
-
-*/
-
-}
@@ -1,63 +0,0 @@
-<?php
-
-require '../Parser.php' ;
-
-class Calculator extends Parser {
-
-/*!* Calculator
-
-Number: /[0-9]+/
-Value: Number > | '(' > Expr > ')' >
- function Number( &$result, $sub ) {
- $result['val'] = $sub['text'] ;
- }
- function Expr( &$result, $sub ) {
- $result['val'] = $sub['val'] ;
- }
-
-Times: '*' > operand:Value >
-Div: '/' > operand:Value >
-Product: Value > ( Times | Div ) *
- function Value( &$result, $sub ) {
- $result['val'] = $sub['val'] ;
- }
- function Times( &$result, $sub ) {
- $result['val'] *= $sub['operand']['val'] ;
- }
- function Div( &$result, $sub ) {
- $result['val'] /= $sub['operand']['val'] ;
- }
-
-Plus: '+' > operand:Product >
-Minus: '-' > operand:Product >
-Sum: Product > ( Plus | Minus ) *
- function Product( &$result, $sub ) {
- $result['val'] = $sub['val'] ;
- }
- function Plus( &$result, $sub ) {
- $result['val'] += $sub['operand']['val'] ;
- }
- function Minus( &$result, $sub ) {
- $result['val'] -= $sub['operand']['val'] ;
- }
-
-Expr: Sum
- function Sum( &$result, $sub ) {
- $result['val'] = $sub['val'] ;
- }
-
-*/
-
-}
-
-$x = new Calculator( '(2 + 4) * 3 - 10' ) ;
-$res = $x->match_Expr() ;
-if ( $res === FALSE ) {
- print "No Match\n" ;
-}
-else {
- print_r( $res ) ;
-}
-
-
-
@@ -1,36 +0,0 @@
-<?php
-
-require '../Parser.php' ;
-
-class EqualRepeat extends Packrat {
-/* Any number of a followed by the same number of b and the same number of c characters
- * aabbcc - good
- * aaabbbccc - good
- * aabbc - bad
- * aabbacc - bad
- */
-
-/*!* Grammar1
-A: "a" A? "b"
-B: "b" B? "c"
-T: !"b"
-X: &(A !"b") "a"+ B !("a" | "b" | "c")
-*/
-}
-
-function match( $str ) {
- $p = new EqualRepeat( $str ) ;
- $r = $p->match_X() ;
- print "$str\n" ;
- print $r ? print_r( $r, true ) : 'No Match' ;
- print "\n\n" ;
-}
-
-match( 'aabbcc' ) ; // Should match
-match( 'aaabbbccc' ) ; // Should match
-
-match( 'aabbbccc' ) ; // Should not match
-match( 'aaabbccc' ) ; // Should not match
-match( 'aaabbbcc' ) ; // Should not match
-
-match( 'aaabbbcccc' ) ; // Should not match
@@ -1,88 +0,0 @@
-<?php
-
-require '../Parser.php';
-
-/**
- * This parser strictly matches the RFC822 standard. No characters outside the ASCII range 0-127 are allowed
- * @author Hamish Friedlander
- */
-class Rfc822 extends Parser {
-
-/*!* Rfc822
-
-crlf: /\r\n/
-
-lwsp-char: " " | "\t"
-
-linear-white-space: (crlf? lwsp-char)+
-
-atom: /[^\x00-\x1F\x20()<>@,;:\\".\[\]\x80-\xFF]+/
-
-qtext-chars: /[^"\\\x0D]+/
-
-qtext: linear-white-space | qtext-chars
-
-quoted-pair: /\\[\x00-\x7F]/
-
-quoted-string: .'"' ( quoted-pair | qtext )* .'"'
-
-word: atom | quoted-string
-
-phrase: (word >)+
-
-dtext-chars: /[^\[\]\\\r]+/
-
-dtext: linear-white-space | dtext-chars
-
-domain-literal: "[" ( dtext | quoted-pair )* "]"
-
-domain-ref: atom
-
-sub-domain: domain-ref | domain-literal
-
-domain: sub-domain ("." sub-domain)*
-
-route: "@" domain ("," "@" domain)* ":"
-
-route-addr: "<" route? addr-spec ">"
- function addr_spec ( &$self, $sub ) {
- $self['addr_spec'] = $sub['text'] ;
- }
-
-local-part: word ("." word)*
-
-addr-spec: local-part "@" domain
-
-mailbox: ( addr-spec | phrase route-addr ) >
- function __construct( &$self ) {
- $self['phrase'] = NULL ;
- $self['address'] = NULL ;
- }
- function phrase ( &$self, $sub ) {
- $self['phrase'] = $sub['text'] ;
- }
- function addr_spec ( &$self, $sub ) {
- $self['address'] = $sub['text'] ;
- }
- function route_addr ( &$self, $sub ) {
- $self['address'] = $sub['addr_spec'] ;
- }
-
-group: phrase ":" ( mailbox ("," mailbox)* )? ";"
-
-address: :mailbox | group
-
-address-header: address (<","> address)*
- function __construct( &$self ) {
- $self['addresses'] = array() ;
- }
- function address( &$self, $sub ) {
- $self['addresses'][] = $sub['mailbox'] ;
- }
-
-*/
-
-}
-
-$p = new Rfc822( 'John Byorgson <byorn@again.com>, "Akira \"Bad Boy\" Kenada" <akira@neotokyo.com>' ) ;
-print_r( $p->match_address_header() ) ;
@@ -1,30 +0,0 @@
-<?php
-
-require 'Rfc822.php';
-
-/**
- * This parser extends the RFC822 standard to allow XML entities and UTF-8 characters in atoms and quoted-strings
- * @author Hamish Friedlander
- */
-class Rfc822UTF8 extends Rfc822 {
-
-/*!* Rfc822UTF8
-
-crlf: /\r\n/u
-
-atom: /((&[A-Za-z]+;)|(&#(xX)?[A-Fa-f0-9]+;)|([^\x00-\x1F\x20()<>@,;:\\".\[\]]))+/u
-
-qtext-chars: /[^"\\\x0D]+/u
-
-quoted-pair: /\\./u
-
-*/
-
-}
-
-/**
- * Some trial code. Remove soon
- */
-$p = new Rfc822UTF8( 'JØhn ByØrgsØn <byorn@again.com>, "アキラ" <akira@neotokyo.com>' ) ;
-print_r( $p->match_address_header() ) ;
- /* */
@@ -1,123 +0,0 @@
-<?php
-
-require_once "ParserTestBase.php";
-
-class ParserInheritanceTest extends ParserTestBase {
-
- public function testBasicInheritance() {
-
- $parser = $this->buildParser('
- /*!* BasicInheritanceTestParser
- Foo: "a"
- Bar extends Foo
- */
- ');
-
- $this->assertTrue($parser->matches('Foo', 'a'));
- $this->assertTrue($parser->matches('Bar', 'a'));
-
- $this->assertFalse($parser->matches('Foo', 'b'));
- $this->assertFalse($parser->matches('Bar', 'b'));
- }
-
-
- public function testBasicInheritanceConstructFallback() {
-
- $parser = $this->buildParser('
- /*!* BasicInheritanceConstructFallbackParser
- Foo: "a"
- function __construct(&$res){ $res["test"] = "test"; }
- Bar extends Foo
- */
- ');
-
- $res = $parser->match('Foo', 'a');
- $this->assertEquals($res['test'], 'test');
-
- $res = $parser->match('Bar', 'a');
- $this->assertEquals($res['test'], 'test');
-
- $parser = $this->buildParser('
- /*!* BasicInheritanceConstructFallbackParser2
- Foo: "a"
- function __construct(&$res){ $res["testa"] = "testa"; }
- Bar extends Foo
- function __construct(&$res){ $res["testb"] = "testb"; }
- */
- ');
-
- $res = $parser->match('Foo', 'a');
- $this->assertArrayHasKey('testa', $res);
- $this->assertEquals($res['testa'], 'testa');
- $this->assertArrayNotHasKey('testb', $res);
-
- $res = $parser->match('Bar', 'a');
- $this->assertArrayHasKey('testb', $res);
- $this->assertEquals($res['testb'], 'testb');
- $this->assertArrayNotHasKey('testa', $res);
-
- }
-
- public function testBasicInheritanceStoreFallback() {
-
- $parser = $this->buildParser('
- /*!* BasicInheritanceStoreFallbackParser
- Foo: Pow:"a"
- function *(&$res, $sub){ $res["test"] = "test"; }
- Bar extends Foo
- */
- ');
-
- $res = $parser->match('Foo', 'a');
- $this->assertEquals($res['test'], 'test');
-
- $res = $parser->match('Bar', 'a');
- $this->assertEquals($res['test'], 'test');
-
- $parser = $this->buildParser('
- /*!* BasicInheritanceStoreFallbackParser2
- Foo: Pow:"a" Zap:"b"
- function *(&$res, $sub){ $res["testa"] = "testa"; }
- Bar extends Foo
- function *(&$res, $sub){ $res["testb"] = "testb"; }
- Baz extends Foo
- function Zap(&$res, $sub){ $res["testc"] = "testc"; }
- */
- ');
-
- $res = $parser->match('Foo', 'ab');
- $this->assertArrayHasKey('testa', $res);
- $this->assertEquals($res['testa'], 'testa');
- $this->assertArrayNotHasKey('testb', $res);
-
- $res = $parser->match('Bar', 'ab');
- $this->assertArrayHasKey('testb', $res);
- $this->assertEquals($res['testb'], 'testb');
- $this->assertArrayNotHasKey('testa', $res);
-
- $res = $parser->match('Baz', 'ab');
- $this->assertArrayHasKey('testa', $res);
- $this->assertEquals($res['testa'], 'testa');
- $this->assertArrayHasKey('testc', $res);
- $this->assertEquals($res['testc'], 'testc');
- $this->assertArrayNotHasKey('testb', $res);
- }
-
- public function testInheritanceByReplacement() {
- $parser = $this->buildParser('
- /*!* InheritanceByReplacementParser
- A: "a"
- B: "b"
- Foo: A B
- Bar extends Foo; B => A
- Baz extends Foo; A => ""
- */
- ');
-
- $parser->assertMatches('Foo', 'ab');
- $parser->assertMatches('Bar', 'aa');
- $parser->assertMatches('Baz', 'b');
- }
-
-
-}
@@ -1,26 +0,0 @@
-<?php
-
-require_once "ParserTestBase.php";
-
-class ParserSyntaxTest extends ParserTestBase {
-
- public function testBasicRuleSyntax() {
- $parser = $this->buildParser('
- /*!* BasicRuleSyntax
- Foo: "a" "b"
- Bar: "a"
- "b"
- Baz:
- "a" "b"
- Qux:
- "a"
- "b"
- */
- ');
-
- $parser->assertMatches('Foo', 'ab');
- $parser->assertMatches('Bar', 'ab');
- $parser->assertMatches('Baz', 'ab');
- $parser->assertMatches('Qux', 'ab');
- }
-}
Oops, something went wrong.

0 comments on commit e203042

Please sign in to comment.