jgm / djot

A light markup language
https://djot.net
MIT License
1.66k stars 43 forks source link

Fuzz test failure #106

Closed jgm closed 1 year ago

jgm commented 1 year ago
./run.sh

|`|
^D
lua: ./djot/ast.lua:756: unmatched -para encountered at byte 5
stack traceback:
    [C]: in function 'assert'
    ./djot/ast.lua:756: in local 'handle_match'
    ./djot/ast.lua:808: in function 'djot.ast.to_ast'
    ./djot.lua:35: in function <./djot.lua:33>
    (...tail calls...)
    bin/main.lua:86: in main chunk
    [C]: in ?
jgm commented 1 year ago

Here are the matches (note the overlap in 5-6 and lack of +para):

blankline 1-1
str 2-3
+verbatim 4-4
str 5-6
-verbatim 5-6
-para 7-7
jgm commented 1 year ago

Looks like we start the loop with self.matches

{ { 1, 1, "blankline" } }

and end with

    { { 2, 2, "+para" } }

so somehow the blankline match is getting replaced, and that's why the +para isn't rendered (the iterator thinks it has already returned this, the first, match).

Separate question is why -verbatim is two characters.

jgm commented 1 year ago

It's being removed by open in the table spec.