public static IoObject slotCode(IoObject target, IoObject locals, IoObject m) { string s = ""; IoBlock self = target as IoBlock; if (self.scope != null) { s += "block("; } else { s += "method("; } int nargs = self.argNames.Count; for (int i = 0; i < nargs; i++) { IoSeq name = self.argNames[i] as IoSeq; s += name.value + ", "; } IoMessage msg = self.containedMessage; IoSeq seq = IoMessage.slotCode(msg, locals, m) as IoSeq; s += seq.value + ")"; return(IoSeq.createObject(target.state, s)); }
public static IoObject slotCode(IoObject target, IoObject locals, IoObject message) { IoMessage self = target as IoMessage; string s = ""; s = self.descriptionToFollow(true); return(IoSeq.createObject(self.state, s)); }
public static IoSeq createSymbolInMachine(IoState state, string symbol) { if (state.symbols[symbol] == null) { state.symbols[symbol] = IoSeq.createObject(state, symbol); } return(state.symbols[symbol] as IoSeq); }
public static IoSeq createSymbolInMachine(IoState state, string symbol) { if (!state.symbols.ContainsKey(symbol)) { state.symbols[symbol] = IoSeq.createObject(state, symbol); } return(state.symbols[symbol]); }
public static IoObject slotAt(IoObject target, IoObject locals, IoObject message) { IoMessage m = message as IoMessage; IoSeq o = target as IoSeq; IoSeq res = IoSeq.createObject(target.state); IoNumber arg = m.localsNumberArgAt(locals, 0); res.value += o.value.Substring(arg.asInt(), 1); return(res); }
public static IoObject slotReverse(IoObject target, IoObject locals, IoObject message) { IoMessage m = message as IoMessage; IoSeq o = target as IoSeq; IoSeq res = IoSeq.createObject(target.state); char[] A = o.asCharArray; Array.Reverse(A); res.value = new string(A); return(res); }
public static IoSeq rawAsUnquotedSymbol(IoSeq s) { string str = ""; if (s.value.StartsWith("\"")) { str = s.value.Substring(1, s.value.Length - 1); } if (s.value.EndsWith("\"")) { str = str.Substring(0, s.value.Length - 2); } return(IoSeq.createObject(s.state, str)); }
public static IoSeq rawAsUnescapedSymbol(IoSeq s) { string str = ""; int i = 0; while (i < s.value.Length) { char c = s.value[i]; if (c != '\\') { str += c; } else { c = s.value[i]; switch (c) { case 'a': c = '\a'; break; case 'b': c = '\b'; break; case 'f': c = '\f'; break; case 'n': c = '\n'; break; case 'r': c = '\r'; break; case 't': c = '\t'; break; case 'v': c = '\v'; break; case '\0': c = '\\'; break; default: if (c > '0' && c < '9') { c -= '0'; } break; } str += c; } i++; } return(IoSeq.createObject(s.state, str)); }
void ifPossibleCacheToken(IoToken token) { IoSeq method = this.messageName; IoObject r = null; switch (token.type) { case IoTokenType.TRIQUOTE_TOKEN: break; case IoTokenType.MONOQUOTE_TOKEN: r = IoSeq.createSymbolInMachine( method.state, IoSeq.rawAsUnescapedSymbol( IoSeq.rawAsUnquotedSymbol( IoSeq.createObject(method.state, method.value) ) ).value ); break; case IoTokenType.NUMBER_TOKEN: r = IoNumber.newWithDouble(this.state, Convert.ToDouble(method.value, CultureInfo.InvariantCulture)); break; default: if (method.value.Equals("nil")) { r = state.ioNil; } else if (method.value.Equals("true")) { r = state.ioTrue; } else if (method.value.Equals("false")) { r = state.ioFalse; } break; } this.cachedResult = r; }
public static IoObject slotType(IoObject target, IoObject locals, IoObject message) { return(IoSeq.createObject(target.state, target.name)); }