public static IoString createObject(IoState state, string symbol) { IoString str = new IoString(); str = str.clone(state) as IoString; str.value = symbol; return str; }
public static IoString rawAsUnescapedSymbol(IoString 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 IoString.createObject(s.state, str); }
public static new IoString createProto(IoState state) { IoString s = new IoString(); return s.proto(state) as IoString; }
public override IoObject proto(IoState state) { IoString pro = new IoString(); pro.state = state; // pro.tag.cloneFunc = new IoTagCloneFunc(this.clone); // pro.tag.compareFunc = new IoTagCompareFunc(this.compare); pro.createSlots(); pro.createProtos(); state.registerProtoWithFunc(name, new IoStateProto(name, pro, new IoStateProtoFunc(this.proto))); pro.protos.Add(state.protoWithInitFunc("Object")); IoCFunction[] methodTable = new IoCFunction[] { new IoCFunction("appendStr", new IoMethodFunc(IoString.slotAppendStr)), new IoCFunction("at", new IoMethodFunc(IoString.slotAt)), new IoCFunction("reverse", new IoMethodFunc(IoString.slotReverse)), }; pro.addTaglessMethodTable(state, methodTable); return pro; }
public static new IoString createObject(IoState state) { IoString s = new IoString(); return s.clone(state) as IoString; }
public static IoString rawAsUnquotedSymbol(IoString 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 IoString.createObject(s.state, str); }
public override IoObject clone(IoState state) { IoString proto = state.protoWithInitFunc(name) as IoString; IoString result = new IoString(); result.state = state; result.value = proto.value; result.createProtos(); result.createSlots(); result.protos.Add(proto); return result; }
public void setupSymbols() { activateSymbol = IOSYMBOL("activate"); callSymbol = IOSYMBOL("call"); forwardSymbol = IOSYMBOL("forward"); noShufflingSymbol = IOSYMBOL("__noShuffling__"); opShuffleSymbol = IOSYMBOL("opShuffle"); semicolonSymbol = IOSYMBOL(";"); selfSymbol = IOSYMBOL("self"); setSlotSymbol = IOSYMBOL("setSlot"); setSlotWithTypeSymbol = IOSYMBOL("setSlotWithType"); stackSizeSymbol = IOSYMBOL("stackSize"); typeSymbol = IOSYMBOL("type"); updateSlotSymbol = IOSYMBOL("updateSlot"); }
// Message Public Raw Methods public static IoMessage newWithName(IoState state, IoString ioSymbol) { IoMessage msg = IoMessage.createObject(state); msg.messageName = ioSymbol; return msg; }
void parseName(IoState state, IoLexer lexer) { IoToken token = lexer.pop(); messageName = IoString.createSymbolInMachine(state, token.name); ifPossibleCacheToken(token); //rawSetLineNumber(token.lineNumber); //rawSetCharNumber(token.charNumber); }
IoMessage newWithNameReturnsValue(IoState state, IoString symbol, IoObject v) { IoMessage self = clone(state) as IoMessage; self.messageName = symbol; self.cachedResult = v; return self; }
IoMessage newFromTextLabelSymbol(IoState state, string code, IoString labelSymbol) { IoLexer lexer = new IoLexer(); IoMessage msg = new IoMessage(); msg = msg.clone(state) as IoMessage; lexer.s = code; lexer.lex(); msg = this.newParse(state, lexer); msg.opShuffle(); msg.label = labelSymbol; return msg; }