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 NextUnaryOp(UnaryOpDictionary _unOps, object last, out UnaryOperator foundOp)
 {
     if (EndOfStream || (last != null && !(last is BinaryOperator)))
     {
         foundOp = default(UnaryOperator);
         return(false);
     }
     if (!MatchOperator(_buffer, position, _unOps, out foundOp))
     {
         return(false);
     }
     position += foundOp.OperatorString.Length;
     return(true);
 }