Examples of IokeObject


Examples of ioke.lang.IokeObject

        }
    }

    public final static void createOrGetOpTables(IokeParser parser) throws ControlFlow {
        final ioke.lang.Runtime runtime = parser.runtime;
        IokeObject opTable = IokeObject.as(IokeObject.findCell(runtime.message, "OperatorTable"), null);
        if(opTable == runtime.nul) {
            opTable = runtime.newFromOrigin();
            opTable.setKind("Message OperatorTable");
            runtime.message.setCell("OperatorTable", opTable);
        }

        Map<Object, Object> tmpOperatorTable = getOpTable(parser, opTable, "operators", new OpTableCreator() {
                public Map<Object, Object> create(Runtime runtime) {
View Full Code Here

Examples of ioke.lang.IokeObject

    }

    public IokeObject prepareAssignmentMessage() throws ControlFlow {
        if(chains.last != null && chains.last == currentLevel.operatorMessage) {
            if(currentLevel.type == Level.Type.ASSIGNMENT && head == null) {
                IokeObject assgn = currentLevel.operatorMessage;
                IokeObject prev = (IokeObject)assgn.getArguments().get(0);
                assgn.getArguments().clear();
                pop();
                currentLevel = currentLevel.parent;

                IokeObject realPrev = Message.prev(assgn);
                if(realPrev != null) {
                    Message.setNext(realPrev, prev);
                    if(prev != null) {
                        Message.setPrev(prev, realPrev);
                    }
                    Message.setPrev(assgn, null);
                }
                if(head == last) {
                    head = prev;
                }
                last = prev;
                return assgn;
            } else if(last == null && currentLevel.type != Level.Type.ASSIGNMENT) {
                pop();
                currentLevel = currentLevel.parent;
            }
        }

        if(last == null) {
            return null;
        }

        IokeObject l = last;
        if(head == l) {
            head = last = null;
        } else {
            last = Message.prev(l);
            Message.setNext(last, null);
View Full Code Here

Examples of ioke.lang.IokeObject

                head = Message.next(head);
                Message.setPrev(head, null);
            }
        }

        IokeObject headToReturn = head;

        head = chains.head;
        last = chains.last;
        chains = chains.parent;
View Full Code Here

Examples of ioke.lang.IokeObject

        return headToReturn;
    }

    public void popOperatorsTo(int precedence) throws ControlFlow {
        while((currentLevel.precedence != -1 || currentLevel.type == Level.Type.UNARY) && currentLevel.precedence <= precedence) {
            IokeObject arg = pop();
            if(arg != null && Message.isTerminator(arg) && Message.next(arg) == null) {
                arg = null;
            }

            IokeObject op = currentLevel.operatorMessage;
            if(currentLevel.type == Level.Type.INVERTED && Message.prev(op) != null) {
                Message.setNext(Message.prev(op), null);
                op.getArguments().add(head);
                head = arg;
                Message.setNextOfLast(head, op);
                last = op;
            } else {
                if(arg != null) {
                    op.getArguments().add(arg);
                }
            }
            currentLevel = currentLevel.parent;
        }
    }
View Full Code Here

Examples of ioke.lang.IokeObject

        Operators.createOrGetOpTables(this);
    }

    public IokeObject parseFully() throws IOException, ControlFlow {
        IokeObject result = parseMessageChain();
        return result;
    }
View Full Code Here

Examples of ioke.lang.IokeObject

    protected IokeObject parseMessageChain() throws IOException, ControlFlow {
        top = new ChainContext(top);
        while(parseMessage());
        top.popOperatorsTo(999999);
        IokeObject ret = top.pop();
        top = top.parent;
        return ret;
    }
View Full Code Here

Examples of ioke.lang.IokeObject

    }

    protected List<Object> parseCommaSeparatedMessageChains() throws IOException, ControlFlow {
        ArrayList<Object> chain = new ArrayList<Object>();

        IokeObject curr = parseMessageChain();
        while(curr != null) {
            chain.add(curr);
            readWhiteSpace();
            int rr = peek();
            if(rr == ',') {
View Full Code Here

Examples of ioke.lang.IokeObject

    }

    protected void fail(int l, int c, String message, String expected, String got) throws ControlFlow {
        String file = ((IokeSystem)IokeObject.data(runtime.system)).currentFile();

        final IokeObject condition = IokeObject.as(IokeObject.getCellChain(runtime.condition,
                                                                           this.message,
                                                                           this.context,
                                                                           "Error",
                                                                           "Parser",
                                                                           "Syntax"), this.context).mimic(this.message, this.context);
        condition.setCell("message", this.message);
        condition.setCell("context", this.context);
        condition.setCell("receiver", this.context);

        if(expected != null) {
            condition.setCell("expected", runtime.newText(expected));
        }

        if(got != null) {
            condition.setCell("got", runtime.newText(got));
        }

        condition.setCell("file", runtime.newText(file));
        condition.setCell("line", runtime.newNumber(l));
        condition.setCell("character", runtime.newNumber(c));
        condition.setCell("text", runtime.newText(file + ":" + l + ":" + c + ": " + message));
        runtime.errorCondition(condition);
    }
View Full Code Here

Examples of ioke.lang.IokeObject

            top.push(op.precedence, mx, Level.Type.REGULAR);
        } else {
            OpArity opa = trinaryOperatorTable.get(name);
            if(opa != null) {
                if(opa.arity == 2) {
                    IokeObject last = top.prepareAssignmentMessage();
                    mx.getArguments().add(last);
                    top.add(mx);
                    top.push(13, mx, Level.Type.ASSIGNMENT);
                } else {
                    IokeObject last = top.prepareAssignmentMessage();
                    mx.getArguments().add(last);
                    top.add(mx);
                }
            } else {
                op = invertedOperatorTable.get(name);
View Full Code Here

Examples of ioke.lang.IokeObject

        Message m = new Message(runtime, "");
        m.setLine(l);
        m.setPosition(cc);

        IokeObject mx = runtime.createMessage(m);
        Message.setArguments(mx, args);
        top.add(mx);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.