示例#1
0
文件: Operators.cs 项目: nope/ioke
 public IDictionary Create(Runtime runtime)
 {
     IDictionary table = new SaneHashtable();
     foreach(OpArity ot in DEFAULT_ASSIGNMENT_OPERATORS.Values) {
         table[runtime.GetSymbol(ot.name)] = runtime.NewNumber(ot.arity);
     }
     return table;
 }
示例#2
0
文件: Levels.cs 项目: fronx/ioke
 public IDictionary Create(Runtime runtime)
 {
     IDictionary table = new SaneHashtable();
     foreach(OpTable ot in defaultTrinaryOperators) {
         table[runtime.GetSymbol(ot.name)] = runtime.NewNumber(ot.precedence);
     }
     return table;
 }
示例#3
0
文件: Operators.cs 项目: nope/ioke
 public IDictionary Create(Runtime runtime)
 {
     IDictionary table = new SaneHashtable();
     foreach(OpEntry ot in DEFAULT_INVERTED_OPERATORS.Values) {
         table[runtime.GetSymbol(ot.name)] = runtime.NewNumber(ot.precedence);
     }
     return table;
 }
示例#4
0
文件: Levels.cs 项目: fronx/ioke
        public Levels(IokeObject msg, IokeObject context, IokeObject message)
        {
            this.runtime = context.runtime;
            this._context = context;
            this._message = message;

            IokeObject opTable = IokeObject.As(msg.FindCell(_message, _context, "OperatorTable"), null);
            if(opTable == runtime.nul) {
                opTable = runtime.NewFromOrigin();
                opTable.Kind = "Message OperatorTable";
                runtime.Message.SetCell("OperatorTable", opTable);
                opTable.SetCell("precedenceLevelCount", runtime.NewNumber(OP_LEVEL_MAX));
            }

            this.operatorTable = GetOpTable(opTable, "operators", new BinaryOpTableCreator());
            this.trinaryOperatorTable = GetOpTable(opTable, "trinaryOperators", new TrinaryOpTableCreator());
            this.invertedOperatorTable = GetOpTable(opTable, "invertedOperators", new InvertedOpTableCreator());
            this.stack = new SaneList<Level>();
            this.Reset();
        }