src/Parser.php
private function parseIf() {
        // consume required tokens
        $if_open = $this->pop('IF_OPEN');
        $output = 'if(' . $if_open[1] . ') {' . "\n";
        $this->currLine++;

        $seeking = true;
        while($seeking) {
            list($type, $value) = $this->peek();

            switch($type) {
            case 'IF_CLOSE':
                $this->pop();
                $output .= "}\n";
                $seeking = false;
                $this->currLine++;
                break;
            case 'ELSE':
                $this->pop();
                $output .= "} else {\n";
                $this->currLine++;
                break;
            case 'ELSE_IF':
                $token = $this->pop();
                $output .= '} elseif(' . $token[1] . ") {\n";
                $this->currLine++;
                break;
            default:
                $output .= $this->parseExpression();
                break;
            }
        }

        return $output;
    }
private function parseIf() {
        // consume required tokens
        $if_open = $this->pop('IF_OPEN');
        $output = 'if(' . $if_open[1] . ') {' . "\n";
        $this->currLine++;

        $seeking = true;
        while($seeking) {
            list($type, $value) = $this->peek();

            switch($type) {
            case 'IF_CLOSE':
                $this->pop();
                $output .= "}\n";
                $seeking = false;
                $this->currLine++;
                break;
            case 'ELSE':
                $this->pop();
                $output .= "} else {\n";
                $this->currLine++;
                break;
            case 'ELSE_IF':
                $token = $this->pop();
                $output .= '} elseif(' . $token[1] . ") {\n";
                $this->currLine++;
                break;
            default:
                $output .= $this->parseExpression();
                break;
            }
        }

        return $output;
    }
Parses an IF expression