Package com.sk89q.worldedit.internal.expression

Examples of com.sk89q.worldedit.internal.expression.Identifiable


        LinkedList<Identifiable> lhs = new LinkedList<Identifiable>();
        LinkedList<Identifiable> rhs = new LinkedList<Identifiable>();
        String operator = null;

        for (Iterator<Identifiable> it = input.descendingIterator(); it.hasNext();) {
            Identifiable identifiable = it.next();
            if (operator == null) {
                rhs.addFirst(identifiable);

                if (!(identifiable instanceof OperatorToken)) {
                    continue;
View Full Code Here


        return new Conditional(input.get(lhs.size()).getPosition(), lhsInvokable, mhsInvokable, rhsInvokable);
    }

    private static RValue processUnaryOps(LinkedList<Identifiable> input) throws ParserException {
        // Preprocess postfix operators into unary operators
        final Identifiable center;
        LinkedList<UnaryOperator> postfixes = new LinkedList<UnaryOperator>();
        do {
            if (input.isEmpty()) {
                throw new ParserException(-1, "Expression missing.");
            }

            final Identifiable last = input.removeLast();
            if (last instanceof OperatorToken) {
                postfixes.addLast(new UnaryOperator(last.getPosition(), "x" + ((OperatorToken) last).operator));
            } else if (last instanceof UnaryOperator) {
                postfixes.addLast(new UnaryOperator(last.getPosition(), "x" + ((UnaryOperator) last).operator));
            } else {
                center = last;
                break;
            }
        } while (true);

        if (!(center instanceof RValue)) {
            throw new ParserException(center.getPosition(), "Expected expression, found " + center);
        }

        input.addAll(postfixes);

        RValue ret = (RValue) center;
        while (!input.isEmpty()) {
            final Identifiable last = input.removeLast();
            final int lastPosition = last.getPosition();
            if (last instanceof UnaryOperator) {
                final String operator = ((UnaryOperator) last).operator;
                if (operator.equals("+")) {
                    continue;
                }
View Full Code Here

TOP

Related Classes of com.sk89q.worldedit.internal.expression.Identifiable

Copyright © 2018 www.massapicom. 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.