| @@ 182-196 (lines=15) @@ | ||
| 179 | * |
|
| 180 | * @return mixed |
|
| 181 | */ |
|
| 182 | protected function parseOrToken() |
|
| 183 | { |
|
| 184 | $x = $this->parseAndToken(); |
|
| 185 | while (($token = $this->peek()) && in_array(strtolower($token), ['||', 'or'])) { |
|
| 186 | $this->consume($token); |
|
| 187 | $y = $this->parseAndToken(); |
|
| 188 | ||
| 189 | if ($this->compileToCode === true) { |
|
| 190 | $x = '(' . $x . ' || ' . $y . ')'; |
|
| 191 | continue; |
|
| 192 | } |
|
| 193 | $x = $this->evaluateOr($x, $y); |
|
| 194 | } |
|
| 195 | return $x; |
|
| 196 | } |
|
| 197 | ||
| 198 | /** |
|
| 199 | * Passes the torch down to the next deeper parsing leve (compare) |
|
| @@ 204-218 (lines=15) @@ | ||
| 201 | * |
|
| 202 | * @return mixed |
|
| 203 | */ |
|
| 204 | protected function parseAndToken() |
|
| 205 | { |
|
| 206 | $x = $this->parseCompareToken(); |
|
| 207 | while (($token = $this->peek()) && in_array(strtolower($token), ['&&', 'and'])) { |
|
| 208 | $this->consume($token); |
|
| 209 | $y = $this->parseCompareToken(); |
|
| 210 | ||
| 211 | if ($this->compileToCode === true) { |
|
| 212 | $x = '(' . $x . ' && ' . $y . ')'; |
|
| 213 | continue; |
|
| 214 | } |
|
| 215 | $x = $this->evaluateAnd($x, $y); |
|
| 216 | } |
|
| 217 | return $x; |
|
| 218 | } |
|
| 219 | ||
| 220 | /** |
|
| 221 | * Passes the torch down to the next deeper parsing leven (not) |
|