cdfa / frugel

An error-tolerant live programming environment (my Master's thesis)
GNU General Public License v3.0
18 stars 3 forks source link

Cursor is moved back after writing ... in a construction site #31

Open cdfa opened 2 years ago

cdfa commented 2 years ago

When we use the empty construction site syntax ... in a construction site that contains a syntax error (e.g. (...), the cursor is moved back 3 spaces. This happens because the editor needs to account for the disappearance of the 3 dots when they are replaced by a 0-width empty construction site, but it's erroneously also doing this when the parsing of the construction site with the 3 dots fails.

To fix this, we need to add custom state to the parser that backtracks when a parse fails (as described in the Megaparsec tutorial).