bug in variable - it thought following text could be arguments

This commit is contained in:
Adam D. Ruppe 2012-10-12 17:13:07 -04:00
parent e677d8d445
commit 245f487702

25
html.d
View file

@ -1574,6 +1574,20 @@ class MacroExpander {
assert(0, to!string(args.length) ~ " args: " ~ to!string(args));
return null;
};
functions["include"] = &include;
}
string[string] includeFiles;
dstring include(dstring[] args) {
string s;
foreach(arg; args) {
string lol = to!string(arg);
s ~= to!string(includeFiles[lol]);
}
return to!dstring(s);
}
// the following are used inside the user text
@ -1698,6 +1712,8 @@ class MacroExpander {
argsBegin = possibility.length;
}
auto endOfVariable = argsBegin + idx + 1; // this is the offset into the original source
bool checkForAllArguments = true;
moreArguments:
@ -1837,9 +1853,13 @@ class MacroExpander {
returned = localVariables[functionName];
} else if(functionName in functions)
returned = functions[functionName](arguments);
else if(functionName in variables)
else if(functionName in variables) {
returned = variables[functionName];
else if(functionName in macros) {
// FIXME
// we also need to re-attach the arguments array, since variable pulls can't have args
assert(endOfVariable > startingSliceForReplacement);
endingSliceForReplacement = endOfVariable;
} else if(functionName in macros) {
returned = expandMacro(macros[functionName], arguments);
}
@ -1932,6 +1952,7 @@ class JavascriptMacroExpander : MacroExpander {
functions["foreach"] = &foreachLoop;
}
/**
¤foreach(item; array) {
// code