Beispiel #1
0
 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);
                 }
             }
         }
     }
 }
Beispiel #2
0
 public abstract Value Evaluate(Interpreter i);
Beispiel #3
0
 public Value(Operation o, Interpreter i)
 {
     Value src = o.Evaluate(i);
     Data = src.Data;
     Type = src.Type;
 }
Beispiel #4
0
 public override Value Evaluate(Interpreter i)
 {
     return new Value(this);
 }
Beispiel #5
0
 public abstract Value Evaluate(List<Operation> args, Interpreter i);