top() public method

public top ( ) : IoToken
return IoToken
Example #1
0
File: IoMessage.cs Project: ypyf/io
        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();
        }
Example #2
0
File: IoMessage.cs Project: 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);
        }
Example #3
0
File: IoMessage.cs Project: 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));
        }
Example #4
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();
        }
Example #5
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;
        }
Example #6
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);
        }