Fix the associativity of boolean logic operators

Change-Id: Icaf0fde0d74064532af4b110faef4014f8303f80
This commit is contained in:
Victor Vasiliev 2016-11-06 20:28:49 -05:00
parent c39169d155
commit 46faa02c49
3 changed files with 6 additions and 4 deletions

View file

@ -143,7 +143,7 @@ class AFPTreeParser {
// Current token handled by the parser and its position.
public $mCur, $mPos;
const CACHE_VERSION = 1;
const CACHE_VERSION = 2;
/**
* Create a new instance
@ -415,14 +415,14 @@ class AFPTreeParser {
protected function doLevelBoolOps() {
$leftOperand = $this->doLevelCompares();
$ops = [ '&', '|', '^' ];
if ( $this->mCur->type == AFPToken::TOP && in_array( $this->mCur->value, $ops ) ) {
while ( $this->mCur->type == AFPToken::TOP && in_array( $this->mCur->value, $ops ) ) {
$op = $this->mCur->value;
$position = $this->mPos;
$this->move();
$rightOperand = $this->doLevelBoolOps();
$rightOperand = $this->doLevelCompares();
return new AFPTreeNode(
$leftOperand = new AFPTreeNode(
AFPTreeNode::LOGIC,
[ $op, $leftOperand, $rightOperand ],
$position

View file

@ -0,0 +1 @@
MATCH

View file

@ -0,0 +1 @@
!(true | false & false)