Skip to content

Lunamark and LuLPeg #28

@ExeVirus

Description

@ExeVirus

I'm currently trying to write a markdown parser in pure lua with luaJIT, and have chosen lunamark as the dependency. It has lpeg as dependency and so here I am.

The issue is likely a mix of things, but the issue I am having seems to come down to a call like (P("=")^1+P("-")^1) returning nil.

This is the callstack:

../luajit.exe: .\lunamark/lulpeg.lua:2255: attempt to call a nil value
stack traceback:
 .\lunamark/lulpeg.lua:2255: in function 'factorize_choice'
        .\lunamark/lulpeg.lua:2476: in function '__add'
        .\lunamark\reader\markdown.lua:914: in function 'new'
        test.lua:3: in main chunk
        [C]: at 0x7ff60cec47d0

the markdown lua referred to above is here

At the end of the day, that markdown.lua just localizes all the LuLPeg.P and other functions to their capital letter equivalent, i.e. LuLPeg.P = P, and at line 916, Parsers.dash and Parsers.Equals are P("-") and P("=").

The only other gotcha in all this is I'm using a pure lua utf8 library to polyfill the 5.3 utf8 library.

Do you have any suggestions? Sadly I'm not smart about lpeg at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions