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