pop() public method

public pop ( ) : IoToken
return IoToken
示例#1
0
文件: IoMessage.cs 项目: ypyf/io
        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);
        }
示例#2
0
文件: IoMessage.cs 项目: ypyf/io
        void parseName(IoState state, IoLexer lexer)
        {
            IoToken token = lexer.pop();

            messageName = IoSeq.createSymbolInMachine(state, token.name);
            ifPossibleCacheToken(token);
            //rawSetLineNumber(token.lineNumber);
            //rawSetCharNumber(token.charNumber);
        }
示例#3
0
文件: IoMessage.cs 项目: ypyf/io
        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));
        }
示例#4
0
 void parseName(IoState state, IoLexer lexer)
 {
     IoToken token = lexer.pop();
     messageName = IoSeq.createSymbolInMachine(state, token.name);
     ifPossibleCacheToken(token);
     //rawSetLineNumber(token.lineNumber);
     //rawSetCharNumber(token.charNumber);
 }
示例#5
0
        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();
        }
示例#6
0
        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;
        }
示例#7
0
        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);
        }