JBenda / inkcpp

Inkle Ink C++ Runtime with JSON>Binary Compiler
MIT License
70 stars 13 forks source link

Bracketed choices which don't have content before their brackets error when a subsequently nested third-level choice is encountered #66

Closed LilithSilver closed 9 months ago

LilithSilver commented 9 months ago

This one's SUPER specific, but:


-> content
== content

*   Some choice
    blah blah 
    blah blah blah
*   *   [This is the killer!] Text can be here though, just not on the left.
        Blah blah
        Something something
*   *   *   Encountering this choice causes an error.
-   Weave...
-> DONE

The error is "Stack is empty! No top()!" from _container.top() on line 1176 of runner_impl.cpp:

            case Command::END_CONTAINER_MARKER:
            {
                container_t index = read<container_t>();
                inkAssert(_container.top().id == index, "Leaving container we are not in!");

                // Move up out of the current container
                _container.pop();

Unit test here. This occurs on MSVC regardless of configuration (Release or Debug).

I tried it on #65, but it's still broken there, so this is unrelated to #63.

Note that it is required to be in a knot; it doesn't occur at the top level.

JBenda commented 9 months ago

Thank you for catching it. There was a shortcut in the jump routine which resulted in errors. It is disabled for now. (also part of #65)