torch / argcheck

A powerful (and blazing fast) argument checker and function overloading system for Lua or LuaJIT
Other
54 stars 17 forks source link

Beggining a doc line with an hyphen fails #14

Open AlexMili opened 8 years ago

AlexMili commented 8 years ago

Just found that sundown is bugging when a line in the argcheck documentation bloc begins with an hyphen. Check the following code :

Dataframe.upgrade_frame = argcheck{doc =  [[
<a name="Dataframe.upgrade_frame">
### Dataframe.upgrade_frame(@ARGP)

Some text :
- First point
- Second point

@ARGT

_Return value_: void
]],
    {name = "self", type = "Dataframe"},
    call = function(self)
end}

Here is the error I have with Lua 5.1, 5.2 and 5.3 :

ascii.lua:227: attempt to index global 'bit' (a nil value)

Everything works perfectly with Luajit. Replacing the hyphen by an underscore or preceding it by a random letter do the trick.

Here is the full stacktrace :

/opt/torch/install/share/lua/5.1/sundown/ascii.lua:227: attempt to index global 'bit' (a nil value)
stack traceback:
    /opt/torch/install/share/lua/5.1/trepl/init.lua:501: in function </opt/torch/install/share/lua/5.1/trepl/init.lua:494>
    /opt/torch/install/share/lua/5.1/sundown/ascii.lua:227: in function </opt/torch/install/share/lua/5.1/sundown/ascii.lua:223>
    [C]: in function 'sd_markdown_render'
    /opt/torch/install/share/lua/5.1/sundown/ascii.lua:391: in function 'preprocess'
    /opt/torch/install/share/lua/5.1/sundown/ascii.lua:583: in function 'render'
    /opt/torch/install/share/lua/5.1/argcheck/usage.lua:84: in function 'render'
    /opt/torch/install/share/lua/5.1/argcheck/init.lua:102: in function 'argcheck'
    ...dataframe/sub_classes/subset_extensions/samplers.lua:23: in main chunk
    /opt/torch-dataframe/sub_classes/subset.lua:220: in main chunk
    /opt/torch-dataframe/init.lua:39: in main chunk
    [C]: in function 'dofile'
    /opt/torch/install/share/lua/5.1/trepl/init.lua:361: in function 'require'
    [string "_RESULT={require './init.lua'}"]:1: in main chunk
    [C]: in function 'xpcall'
    /opt/torch/install/share/lua/5.1/trepl/init.lua:651: in function 'repl'
    .../torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:199: in main chunk
    [C]: ?
gforge commented 8 years ago

This seems to be an old sundown-ffi version issue. Running luarocks install sundown solved this. Guess the sundown dependency should be updated to the latest version.