compiler: keep source in FunctionCall ASTs

This commit is contained in:
Henri DF 2016-02-29 13:36:14 -08:00
parent 55b2490314
commit 1b7a5bd119

View File

@ -167,8 +167,8 @@ local function outputformat (format)
return {type = "OutputFormat", value = format} return {type = "OutputFormat", value = format}
end end
local function functioncall (name, args) local function functioncall (str, name, args)
return {type = "FunctionCall", name = name, arguments = args} return {type = "FunctionCall", name = name, arguments = args, source = str}
end end
local function rule(filter, output) local function rule(filter, output)
@ -217,7 +217,7 @@ local G = {
MacroDef = (C(V"Macro") * V"Skip" * V"Colon" * (V"Filter")); MacroDef = (C(V"Macro") * V"Skip" * V"Colon" * (V"Filter"));
FuncArgs = symb("(") * list(V"Value", symb(",")) * symb(")"); FuncArgs = symb("(") * list(V"Value", symb(",")) * symb(")");
Output = ((V"Name" * V"FuncArgs") / functioncall) + P(1)^0 / outputformat; Output = (C(V"Name" * V"FuncArgs") / functioncall) + P(1)^0 / outputformat;
-- Terminals -- Terminals
Value = terminal "Number" + terminal "String" + terminal "BareString"; Value = terminal "Number" + terminal "String" + terminal "BareString";