mirror of
https://github.com/adamdruppe/arsd.git
synced 2025-04-27 22:00:13 +03:00
bug in variable - it thought following text could be arguments
This commit is contained in:
parent
e677d8d445
commit
245f487702
1 changed files with 23 additions and 2 deletions
25
html.d
25
html.d
|
@ -1574,6 +1574,20 @@ class MacroExpander {
|
||||||
assert(0, to!string(args.length) ~ " args: " ~ to!string(args));
|
assert(0, to!string(args.length) ~ " args: " ~ to!string(args));
|
||||||
return null;
|
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
|
// the following are used inside the user text
|
||||||
|
@ -1698,6 +1712,8 @@ class MacroExpander {
|
||||||
argsBegin = possibility.length;
|
argsBegin = possibility.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto endOfVariable = argsBegin + idx + 1; // this is the offset into the original source
|
||||||
|
|
||||||
bool checkForAllArguments = true;
|
bool checkForAllArguments = true;
|
||||||
|
|
||||||
moreArguments:
|
moreArguments:
|
||||||
|
@ -1837,9 +1853,13 @@ class MacroExpander {
|
||||||
returned = localVariables[functionName];
|
returned = localVariables[functionName];
|
||||||
} else if(functionName in functions)
|
} else if(functionName in functions)
|
||||||
returned = functions[functionName](arguments);
|
returned = functions[functionName](arguments);
|
||||||
else if(functionName in variables)
|
else if(functionName in variables) {
|
||||||
returned = variables[functionName];
|
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);
|
returned = expandMacro(macros[functionName], arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1932,6 +1952,7 @@ class JavascriptMacroExpander : MacroExpander {
|
||||||
functions["foreach"] = &foreachLoop;
|
functions["foreach"] = &foreachLoop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
¤foreach(item; array) {
|
¤foreach(item; array) {
|
||||||
// code
|
// code
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue