fab13n/metalua — Issue #11: Unable to compile Lua source file
Author: KINFOO
Created: 2011-12-27 18:39:17+00:00
State: open

Hi,
I'm working on _luaeclipse_ branch.
When trying to compile a plain lua file I get:

M> =mlc.luafile_to_ast("/d/runs/spaces/spaces/src/errornode.lua")
Evaluation error:
Parsing error in @/d/runs/spaces/spaces/src/errornode.lua line 10, column 29, char 316:
interrupted!
stack traceback:
[C]: in function 'error'
compiler/mlc.mlua:142: in function
(tail call): ?
(tail call): ?
[C]: in function 'xpcall'
/d/metalua/build/lib/metalua/metaloop.mlua:56: in function 'run'
compiler/metalua.mlua:251: in function 'main'
compiler/metalua.mlua:258: in main chunk
(tail call): ?
[C]: ?
Here is the file

local Q = require 'metalua.treequery'
local sources = {
notypo = "function() end",
onetypo = "function() typo end",
twotypos = "function() typo retypo end"
}
for sample, source in pairs(sources) do
local generated, ast = pcall(mlc.luastring_to_ast, source)
if generated then x
local status, message = pcall(mlc.check_ast, ast)
if not status then
print ('On sample: '..sample)
print (message)
else
local errornode = Q(ast):filter('Error'):first()
if not errornode then
print 'No error node in ast'
else
print 'Error node found'
table.print(errornode, 'nohash', 1)
end
end
else
print('No AST generated for '..sample)
end
end
Am I doing something wrong or did I find a bug?