-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from smuuf/logicexpr
Logic expressions and other stuff
- Loading branch information
Showing
51 changed files
with
1,524 additions
and
880 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
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,7 @@ | ||
<?php | ||
|
||
namespace Smuuf\Primi; | ||
|
||
class InternalUndefinedTruthnessException extends InternalException { | ||
|
||
} |
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
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace Smuuf\Primi\Handlers; | ||
|
||
use \Smuuf\Primi\InternalUndefinedTruthnessException; | ||
use \Smuuf\Primi\ErrorException; | ||
use \Smuuf\Primi\Context; | ||
use \Smuuf\Primi\Helpers\LogicalLTR; | ||
|
||
class LogicalAnd extends \Smuuf\Primi\StrictObject implements IHandler, IReducer { | ||
|
||
public static function handle(array $node, Context $context) { | ||
|
||
try { | ||
return LogicalLTR::handle($node, $context); | ||
} catch (InternalUndefinedTruthnessException $e) { | ||
throw new ErrorException($e->getMessage(), $node); | ||
} | ||
|
||
} | ||
|
||
public static function reduce(array $node) { | ||
|
||
if (!isset($node['ops'])) { | ||
return $node['operands']; | ||
} | ||
|
||
} | ||
|
||
} |
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,30 @@ | ||
<?php | ||
|
||
namespace Smuuf\Primi\Handlers; | ||
|
||
use \Smuuf\Primi\InternalUndefinedTruthnessException; | ||
use \Smuuf\Primi\ErrorException; | ||
use \Smuuf\Primi\Context; | ||
use \Smuuf\Primi\Helpers\LogicalLTR; | ||
|
||
class LogicalOr extends \Smuuf\Primi\StrictObject implements IHandler, IReducer { | ||
|
||
public static function handle(array $node, Context $context) { | ||
|
||
try { | ||
return LogicalLTR::handle($node, $context); | ||
} catch (InternalUndefinedTruthnessException $e) { | ||
throw new ErrorException($e->getMessage(), $node); | ||
} | ||
|
||
} | ||
|
||
public static function reduce(array $node) { | ||
|
||
if (!isset($node['ops'])) { | ||
return $node['operands']; | ||
} | ||
|
||
} | ||
|
||
} |
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
Oops, something went wrong.