ngless-toolkit / ngless

NGLess: NGS with less work
https://ngless.embl.de
Other
142 stars 24 forks source link

External module and parser limitations #49

Closed unode closed 6 years ago

unode commented 6 years ago

arg1 fails if of atype: 'str'

Using Modules/test.ngm/0.1/module.yaml:

version: '0.1'
name: 'test'
functions:
    -
        nglName: "test"
        arg0: './dummy.sh'
        arg1:
            atype: 'str'
        return:
            rtype: 'void'
            name: 'output'
            extension: 'void'

and test.ngl:

ngless "0.6"
local import "test" version "0.1"

sample = "test"
test(sample)

results in:

Exiting after fatal error while loading and running script
Should Not Occur Error! This probably indicates a bug in ngless.
        Please get in touch with the authors with a description of how this happened.
        If possible run your script with the --trace flag and post the script and the resulting trace at 
                http://github.com/luispedro/ngless/issues
        or email us at coelho@embl.de.
AsFile path got NGOString "test"

return: rtype: void requires name and extension.

Despite using rtype = void, NGLess complained when I didn't include a name and an extension argument as part of return:

Could not load module file ./Modules/test.ngm/0.1/module.yaml. Error was `Error in $.functions[0].return: key "name" not present`
Could not load module file ./Modules/test.ngm/0.1/module.yaml. Error was `Error in $.functions[0].return: key "extension" not present`

Cannot define function with named arguments only

Trying to omit arg1 results in a parsing error.

This is both visible in the case of:

local import "test" version "0.1"
test()

as well as in:

local import "test" version "0.1"
sample = "test"
test(name=sample)

resulting in:

unexpected TOperator ')'
expecting len (reserved word), operator -, not (reserved word), operator (, function call, operator [ or variable

or

unexpected TOperator '='
expecting binary operator, keyword argument list or operator )
luispedro commented 6 years ago

Fixed the first 2 issues; the last one is just not supported (there may be a "better error message" bug in there, though).