示例#1
0
        internal CalculatorImpl(CommandProvider commandProvider)
        {
            _commands = commandProvider;
            _tokenizer = new Tokenizer(GetAllOperators(_commands));
            _scope = new Scope(); //scope lives with this instance
            _opStack = new Stack<OpSlot>();
            _valueStack = new Stack<ValueSlot>();
            _tokenBuffer = new TokenBufferItem[2]; //need to look 2 ahead to decide type of operator (e.g. prefix or suffix)

            _commands.loadConstants(_scope);
        }
 internal void loadConstants(Scope scope)
 {
     foreach (var entry in _constants) {
             scope.SetConstant(entry.Key, entry.Value);
         }
 }