private void BuildSerializedNumbers(CPreProcessor processor) { Interpreter runtime = new Interpreter(); foreach (string key in processor.PreProcMacros.Keys) { PreprocMacro m = processor.PreProcMacros[key]; if (m.Definition != null) { // hack. string definition = StripEverything(m.Definition); if (definition != "") { Parser p = new Parser(); Operation node = p.Parse(definition); if (node != null) { runtime.Reset(); Value v = node.Evaluate(runtime); if (v != null) { SerializedNumber n = v.Serialized; if (n != null) { n.Name = key; Numbers.Add(n); Trace.TraceInformation("Define {0} as {1}.", key, n); } } else { Trace.TraceError("Unable to evaluate: {0} [{1}]", definition, m.Definition); } } else { Trace.TraceError("Unable to parse: {0} [{1}]", definition, m.Definition); } } } } }
public abstract Value Evaluate(Interpreter i);
public Value(Operation o, Interpreter i) { Value src = o.Evaluate(i); Data = src.Data; Type = src.Type; }
public override Value Evaluate(Interpreter i) { return new Value(this); }
public abstract Value Evaluate(List<Operation> args, Interpreter i);