wordplaydev / wordplay

An accessible, language-inclusive programming language and IDE for creating interactive typography on the web.
Other
55 stars 16 forks source link

Unparsable changed expression consumes end of code example #503

Closed amyjko closed 1 day ago

amyjko commented 3 days ago

Expected behavior

If some markup has the expression in it, it should parse correctly. For example:

``This is my markup example \∆\ with a delta.``

Actual behavior

What actually happens is that the closing \ is consumed as unparsable, which causes a whole line to be read, and then the rest of the markup is interpreted as code, causing markup to be rendered incorrectly.

Design specification

Unparsable should not read to the end of a line, it should read to the end of either code example delimiters if in markup, or the end of the line. But we also need to do this in a way that doesn't cause infinite loops in parsing, as in this case, no additional tokens would be read after the Unparsable or in the program in general.