Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Unexpected tag" error when parsing a call to an unnamed function #1

Open
sargunv opened this issue Nov 22, 2018 · 1 comment
Open

Comments

@sargunv
Copy link

sargunv commented Nov 22, 2018

When running luaflow on this file, I get the error "Unexpected tag".

It works fine on other files I've tried, but not this one.

19:33:24
sargunv@lincastle ~/Desktop  luaflow -g miner.lua
/usr/bin/lua5.1: /usr/local/share/lua/5.1/luaflow_lib.lua:127: Unexpected tag, t: {"1":{"1":{"2":{"2":{"1":"force","tag":"Id","pos":7948},"3":{"1":"forceMove","tag":"Id","pos":7958},"1":"and","pos":7948,"tag":"Op"},"3":{"1":{"1":{"1":"component","tag":"Id","pos":7971},"2":{"1":"robot","tag":"String","pos":7981},"pos":7971,"tag":"Index"},"2":{"1":"move","tag":"String","pos":7987},"pos":7971,"tag":"Index"},"1":"or","pos":7948,"tag":"Op"},"tag":"Paren","pos":7947},"2":{"1":"side","tag":"Id","pos":7993},"3":{"1":1,"tag":"Number","pos":7999},"pos":7947,"tag":"Call"}
stack traceback:
        [C]: in function 'error'
        /usr/local/share/lua/5.1/luaflow_lib.lua:127: in function 'enter'
        /usr/local/share/lua/5.1/luaflow_lib.lua:150: in function 'visit'
        /usr/local/share/lua/5.1/luaflow_lib.lua:155: in function 'visit'
        /usr/local/share/lua/5.1/luaflow_lib.lua:155: in function 'visit'
        /usr/local/share/lua/5.1/luaflow_lib.lua:155: in function 'visit'
        /usr/local/share/lua/5.1/luaflow_lib.lua:155: in function 'visit'
        /usr/local/share/lua/5.1/luaflow_lib.lua:155: in function 'visit'
        /usr/local/share/lua/5.1/luaflow_lib.lua:155: in function 'visit'
        /usr/local/share/lua/5.1/luaflow_lib.lua:155: in function 'visit'
        /usr/local/share/lua/5.1/luaflow_lib.lua:383: in function 'visit_tree'
        ...local/lib/luarocks/rocks/luaflow/0.1.4-1/bin/luaflow:184: in function 'main'
        ...local/lib/luarocks/rocks/luaflow/0.1.4-1/bin/luaflow:204: in main chunk
        [C]: ?

@sargunv
Copy link
Author

sargunv commented Nov 22, 2018

I've found the specific code that triggers the error; it's line 225 in the example file I linked above:

local result, reason = (force and forceMove or component.robot.move)(side, 1)

Here's a minimal example that causes the error:

-- testing.lua

function foo()
end

function bar()
  return foo
end

bar()()
19:43:00
sargunv@lincastle ~/Desktop  luaflow -d testing.lua 
/usr/bin/lua5.1: /usr/local/share/lua/5.1/luaflow_lib.lua:127: Unexpected tag, t: {"1":{"1":{"1":"bar","tag":"Id","pos":54},"pos":54,"tag":"Call"},"pos":54,"tag":"Call"}
stack traceback:
        [C]: in function 'error'
        /usr/local/share/lua/5.1/luaflow_lib.lua:127: in function 'enter'
        /usr/local/share/lua/5.1/luaflow_lib.lua:150: in function 'visit'
        /usr/local/share/lua/5.1/luaflow_lib.lua:155: in function 'visit'
        /usr/local/share/lua/5.1/luaflow_lib.lua:383: in function 'visit_tree'
        ...local/lib/luarocks/rocks/luaflow/0.1.4-1/bin/luaflow:184: in function 'main'
        ...local/lib/luarocks/rocks/luaflow/0.1.4-1/bin/luaflow:204: in main chunk
        [C]: ?

It seems luaflow has trouble handling the case when a function without a name is called.

@sargunv sargunv changed the title luaflow_lib.lua:127: Unexpected tag "Unexpected tag" error when parsing a call to an unnamed function Nov 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant