@@ 241-247 (lines=7) @@ | ||
238 | array_push($stack, $token); |
|
239 | } |
|
240 | elseif ($token instanceof CommaToken) { |
|
241 | while (($current = array_pop($stack)) && (!$current instanceof ParenthesisOpenToken)) { |
|
242 | $output[] = $current; |
|
243 | ||
244 | if (empty($stack)) { |
|
245 | throw new IncorrectExpressionException(); |
|
246 | } |
|
247 | } |
|
248 | } |
|
249 | elseif ($token instanceof ParenthesisCloseToken) { |
|
250 | while (($current = array_pop($stack)) && !($current instanceof ParenthesisOpenToken)) { |
|
@@ 282-289 (lines=8) @@ | ||
279 | } |
|
280 | } |
|
281 | ||
282 | while (!empty($stack)) { |
|
283 | $token = array_pop($stack); |
|
284 | if ($token instanceof ParenthesisOpenToken || $token instanceof ParenthesisCloseToken) { |
|
285 | throw new IncorrectParenthesisException(); |
|
286 | } |
|
287 | ||
288 | $output[] = $token; |
|
289 | } |
|
290 | ||
291 | return $output; |
|
292 | } |