}
end
mlp.lexer:add 'POINT'
- mlp.stat:add{ 'POINT', mlp.string, ',', mlp.string, builder = point_builder }
+ mlp.stat:add{ 'POINT', mlp.string, ',', mlp.string, builder = point_builder }
} -- end of meta-block
function mlc.convert (x, src_fmt, dst_fmt, name)
local status -- status = compilation success
local lx=x
- if SHOW_METABUGS
+ if mlc.metabugs
-- If SHOW_METABUGS is true, errors should be attributed to a parser bug.
then status, x = true, mlp.chunk (lx)
-- If SHOW_METABUGS is false, errors should be attributed to an invalid entry.
if not status and x then
-- x = error msg; get rid of ???
x = x:strmatch "[^:]+:[0-9]+: (.*)" or x
- printf("Parsing error in %s line %s, char %s: \n%s",
- filename or "?", lx.line, lx.i, x)
+ local li = lx:lineinfo()
+ error(string.format("Parsing error in %s line %s, column %i, char %s: \n%s",
+ name or "<nofilename>", li[1], li[2], li[3], x))
return nil
end
+ if x then x.source = name end -- TODO [EVE] store debug info in the special part of ast
+
POINT 'ast', 'table' -- x is the AST
- x = bytecode.metalua_compile(x)
- x.source = name
+ x = bytecode.metalua_compile(x, name or x.source)
POINT 'proto', 'table'
x = bytecode.dump_string (x)
POINT 'luacstring', 'string' -- normally x is a bytecode dump