void parseArgs(IoLexer lexer) { lexer.pop(); if (lexer.top() != null && lexer.top().isValidMessageName()) { IoMessage arg = newParseNextMessageChain(this.state, lexer); addArg(arg); while (lexer.topType() == IoTokenType.COMMA_TOKEN) { lexer.pop(); if (lexer.top() != null && lexer.top().isValidMessageName()) { IoMessage arg2 = newParseNextMessageChain(this.state, lexer); addArg(arg2); } else { } } } if (lexer.topType() != IoTokenType.CLOSEPAREN_TOKEN) { // TODO: Exception, missing close paren } lexer.pop(); }
IoMessage newParseNextMessageChain(IoState state, IoLexer lexer) { IoMessage msg = clone(state) as IoMessage; if (lexer.top() != null && lexer.top().isValidMessageName()) { msg.parseName(state, lexer); } if (lexer.topType() == IoTokenType.OPENPAREN_TOKEN) { msg.parseArgs(lexer); } if (lexer.top() != null && lexer.top().isValidMessageName()) { msg.parseNext(lexer); } while (lexer.topType() == IoTokenType.TERMINATOR_TOKEN) { lexer.pop(); if (lexer.top() != null && lexer.top().isValidMessageName()) { IoMessage eol = IoMessage.newWithName(state, state.semicolonSymbol); msg.next = eol; eol.parseNext(lexer); } } return(msg); }
void parseName(IoState state, IoLexer lexer) { IoToken token = lexer.pop(); messageName = IoSeq.createSymbolInMachine(state, token.name); ifPossibleCacheToken(token); //rawSetLineNumber(token.lineNumber); //rawSetCharNumber(token.charNumber); }
IoMessage newFromTextLabelSymbol(IoState state, string code, IoSeq 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); }
IoMessage newParse(IoState state, IoLexer lexer) { if (lexer.errorToken != null) { } if (lexer.topType() == IoTokenType.TERMINATOR_TOKEN) { lexer.pop(); } if (lexer.top() != null && lexer.top().isValidMessageName()) { IoMessage self = newParseNextMessageChain(state, lexer); if (lexer.topType() != IoTokenType.NO_TOKEN) { state.error(self, "compile error: %s", "unused tokens"); } return(self); } return(newWithNameReturnsValue(state, IoSeq.createSymbolInMachine(state, "nil"), state.ioNil)); }
void parseNext(IoLexer lexer) { IoMessage nextMessage = newParseNextMessageChain(this.state, lexer); this.next = nextMessage; }
IoMessage newParseNextMessageChain(IoState state, IoLexer lexer) { IoMessage msg = clone(state) as IoMessage; if (lexer.top() != null && lexer.top().isValidMessageName()) { msg.parseName(state, lexer); } if (lexer.topType() == IoTokenType.OPENPAREN_TOKEN) { msg.parseArgs(lexer); } if (lexer.top() != null && lexer.top().isValidMessageName()) { msg.parseNext(lexer); } while (lexer.topType() == IoTokenType.TERMINATOR_TOKEN) { lexer.pop(); if (lexer.top() != null && lexer.top().isValidMessageName()) { IoMessage eol = IoMessage.newWithName(state, state.semicolonSymbol); msg.next = eol; eol.parseNext(lexer); } } return msg; }
IoMessage newParse(IoState state, IoLexer lexer) { if (lexer.errorToken != null) { } if (lexer.topType() == IoTokenType.TERMINATOR_TOKEN) { lexer.pop(); } if (lexer.top() != null && lexer.top().isValidMessageName()) { IoMessage self = newParseNextMessageChain(state, lexer); if (lexer.topType() != IoTokenType.NO_TOKEN) { state.error(self, "compile error: %s", "unused tokens"); } return self; } return newWithNameReturnsValue(state, IoSeq.createSymbolInMachine(state, "nil"), state.ioNil); }
IoMessage newFromTextLabelSymbol(IoState state, string code, IoSeq 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; }