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 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 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; }
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); }