Worst-case scenario: the UEd Goblin wipes the map and burns down your house.
Legacy:BruteForce/Main
From Unreal Wiki, The Unreal Engine Documentation Site
class BruteForce extends Commandlet config(BruteForce);
var private Tokenizer t;
var private Scope s;
var private Compiler c;
var private AST a;
var private Interpreter i;
var config array<string> Code;
Just edit the BruteForce.ini file to change the code.
var array<string> Input;
The input, with argc() and argv() function you can get this info from within BruteForce
/* Main */
event int Main( string Parms )
{
local int n;
local bool showTree, saveTree, noCompile;
showTree = false;
saveTree = false;
noCompile = false;
class'wString'.static.split2(Parms, " ", Input, true, "\"");
for (n = input.length-1; n >= 0; n--)
{
if (input[n] ~= "-showtree")
{
input.remove(n, 1);
showTree = true;
}
else if (input[n] ~= "-savetree")
{
input.remove(n, 1);
saveTree = true;
}
else if (input[n] ~= "-nocompile")
{
input.remove(n, 1);
noCompile = true;
}
}
Process the commandline arguments, we have three special case parameters that we use for certain parts:
-showtree will display the AST-
-savetree will save the tree to the config file, if the tree is saved you no longer need to compile the code-
-nocompile don't compile the code, just execute the AST-
s = new class'Scope';
a = new class'AST';
i = new class'Interpreter';
if (!noCompile)
{
t = new class'Tokenizer';
c = new class'Compiler';
t.Create(Code);
a.Create();
StopWatch(false);
t.nextToken();
c.Compile(t, a);
Log("Compile time: ");
StopWatch(true);
}
if (showTree) a.printTree();
StopWatch(false);
i.Create(a, s, input);
i.Execute();
Log("Execution time: ");
StopWatch(true);
if (saveTree) a.SaveConfig();
return 0;
}
