Exemple #1
0
        internal ObjectContext(ObjectContext superContext)
        {
            _super     = superContext;
            _functions = new Library();
            _commands  = new Library();
            _variables = new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase);
            _constants = new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase);
            _blocks    = new Dictionary <string, BlockCreator>(StringComparer.OrdinalIgnoreCase);
            if (superContext == null)
            {
                _binaryOps = new BinOpDictionary();
                _unaryOps  = new UnaryOpDictionary();
            }
            else
            {
                _binaryOps = superContext._binaryOps; // binary operators are always global (for now)
                _unaryOps  = superContext._unaryOps;  // ^^^ dito
            }
#if SHOW_OBJECTS
            Console.WriteLine();
            Console.WriteLine("ObjectContext initialized.");
            Console.WriteLine("\tHash:\t{0}", GetHashCode());
            if (_super != null)
            {
                Console.WriteLine("\tSuper Context:\t{0}", _super.GetHashCode());
            }
#endif
        }
Exemple #2
0
 public bool NextBinaryOp(BinOpDictionary _binOps, out BinaryOperator foundOp)
 {
     if (EndOfStream || !MatchOperator(_buffer, position, _binOps, out foundOp))
     {
         foundOp = default(BinaryOperator);
         return(false);
     }
     position += foundOp.OperatorString.Length;
     return(true);
 }