generated/Parser/ParserImpl.php
protected function parseTernary()
    {
        $a = [];

        if (null === ($parsed = yield 'Disjunction')) { return $this; }
        $a[] = $parsed;

        // ( '?' Disjunction? ':' Disjunction )*
        $a2 = [];
        while (true) {
            $o2 = $this->offset;
            $c2 = [];

            if ($this->type !== '?') { $o2 = null; break; }
            $c2[] = $this->consume();

            // Disjunction?
            while (true) {
                $o4 = $this->offset;

                if (null === ($parsed = yield 'Disjunction')) { $o4 = null; break; }
                $c4 = $parsed;

                $c2[] = $c4;

                break;
            }

            if ($o4 === null) {
                $c2[] = null;
            }

            if ($this->type !== ':') { $this->error("Error parsing \"Ternary\" on line %s:"); }
            $c2[] = $this->consume();

            if (null === ($parsed = yield 'Disjunction')) { $this->error("Error parsing \"Ternary\" on line %s:"); }
            $c2[] = $parsed;

            $a2[] = $c2;
        }

        $a[] = $a2;

        return ($this->action)('Ternary', 'parseTernary', $a);
    }
protected function parseTernary()
    {
        $a = [];

        if (null === ($parsed = yield 'Disjunction')) { return $this; }
        $a[] = $parsed;

        // ( '?' Disjunction? ':' Disjunction )*
        $a2 = [];
        while (true) {
            $o2 = $this->offset;
            $c2 = [];

            if ($this->type !== '?') { $o2 = null; break; }
            $c2[] = $this->consume();

            // Disjunction?
            while (true) {
                $o4 = $this->offset;

                if (null === ($parsed = yield 'Disjunction')) { $o4 = null; break; }
                $c4 = $parsed;

                $c2[] = $c4;

                break;
            }

            if ($o4 === null) {
                $c2[] = null;
            }

            if ($this->type !== ':') { $this->error("Error parsing \"Ternary\" on line %s:"); }
            $c2[] = $this->consume();

            if (null === ($parsed = yield 'Disjunction')) { $this->error("Error parsing \"Ternary\" on line %s:"); }
            $c2[] = $parsed;

            $a2[] = $c2;
        }

        $a[] = $a2;

        return ($this->action)('Ternary', 'parseTernary', $a);
    }
Ternary ::= Disjunction ( '?' Disjunction? ':' Disjunction )*