Examples of SimpleParserException


Examples of org.apache.camel.language.simple.types.SimpleParserException

                nextToken();
                if (!token.getType().isEol()) {
                    expect(TokenType.whiteSpace);
                }
            } else {
                throw new SimpleParserException("Logical operator " + operatorType + " does not support token " + token, token.getIndex());
            }
            return true;
        }
        return false;
    }
View Full Code Here

Examples of org.apache.camel.language.simple.types.SimpleParserException

                // a new block is started, so push on the stack
                stack.push((Block) token);
            } else if (token instanceof BlockEnd) {
                // end block is just an abstract mode, so we should not add it
                if (stack.isEmpty()) {
                    throw new SimpleParserException(token.getToken().getType().getType() + " has no matching start token", token.getToken().getIndex());
                }

                Block top = stack.pop();
                // if there is a block on the stack then it should accept the child token
                Block block = stack.isEmpty() ? null : stack.peek();
                if (block != null) {
                    if (!block.acceptAndAddNode(top)) {
                        throw new SimpleParserException(block.getToken().getType() + " cannot accept " + token.getToken().getType(), token.getToken().getIndex());
                    }
                } else {
                    // no block, so add to answer
                    answer.add(top);
                }
            } else {
                // if there is a block on the stack then it should accept the child token
                Block block = stack.isEmpty() ? null : stack.peek();
                if (block != null) {
                    if (!block.acceptAndAddNode(token)) {
                        throw new SimpleParserException(block.getToken().getType() + " cannot accept " + token.getToken().getType(), token.getToken().getIndex());
                    }
                } else {
                    // no block, so add to answer
                    answer.add(token);
                }
View Full Code Here

Examples of org.apache.camel.language.simple.types.SimpleParserException

                // remember the logical operator
                String operator = token.getOperator().toString();

                SimpleNode previous = stack.isEmpty() ? null : stack.pop();
                if (previous == null) {
                    throw new SimpleParserException("Unary operator " + operator + " has no left hand side token", token.getToken().getIndex());
                } else {
                    token.acceptLeft(previous);
                }
            }
            stack.push(node);
View Full Code Here

Examples of org.apache.camel.language.simple.types.SimpleParserException

    protected void expect(TokenType expect) throws SimpleParserException {
        if (token != null && token.getType().getType() == expect) {
            return;
        } else if (token == null) {
            // use the previous index as that is where the problem is
            throw new SimpleParserException("expected symbol " + expect + " but reached eol", previousIndex);
        } else {
            // use the previous index as that is where the problem is
            throw new SimpleParserException("expected symbol " + expect + " but was " + token.getType().getType(), previousIndex);
        }
    }
View Full Code Here

Examples of org.apache.camel.language.simple.types.SimpleParserException

            return createAndExpression(leftExp, rightExp);
        } else if (operator == LogicalOperatorType.OR) {
            return createOrExpression(leftExp, rightExp);
        }

        throw new SimpleParserException("Unknown logical operator " + operator, token.getIndex());
    }
View Full Code Here

Examples of org.apache.camel.language.simple.types.SimpleParserException

            return createInExpression(leftExp, rightExp);
        } else if (operator == BinaryOperatorType.RANGE || operator == BinaryOperatorType.NOT_RANGE) {
            return createRangeExpression(expression, leftExp, rightExp);
        }

        throw new SimpleParserException("Unknown binary operator " + operator, token.getIndex());
    }
View Full Code Here

Examples of org.apache.camel.language.simple.types.SimpleParserException

            return createIncExpression(leftExp);
        } else if (operator == UnaryOperatorType.DEC) {
            return createDecExpression(leftExp);
        }

        throw new SimpleParserException("Unknown unary operator " + operator, token.getIndex());
    }
View Full Code Here

Examples of org.apache.camel.language.simple.types.SimpleParserException

                    && !isBooleanValue()
                    && !token.getType().isWhitespace()
                    && !token.getType().isEol()) {
                // okay the symbol was not one of the above, so its not supported
                // use the previous index as that is where the problem is
                throw new SimpleParserException("Unexpected token " + token, previousIndex);
            }
            //CHECKSTYLE:ON
            // take the next token
            nextToken();
        }
View Full Code Here

Examples of org.apache.camel.language.simple.types.SimpleParserException

        }

        // validate the single, double quote pairs and functions is in balance
        if (startSingle.get()) {
            int index = lastSingle != null ? lastSingle.getToken().getIndex() : 0;
            throw new SimpleParserException("single quote has no ending quote", index);
        }
        if (startDouble.get()) {
            int index = lastDouble != null ? lastDouble.getToken().getIndex() : 0;
            throw new SimpleParserException("double quote has no ending quote", index);
        }
        if (startFunction.get()) {
            // we have a start function, but no ending function
            int index = lastFunction != null ? lastFunction.getToken().getIndex() : 0;
            throw new SimpleParserException("function has no ending token", index);
        }
    }
View Full Code Here

Examples of org.apache.camel.language.simple.types.SimpleParserException

                // remember the binary operator
                String operator = binary.getOperator().toString();

                if (left == null) {
                    throw new SimpleParserException("Binary operator " + operator + " has no left hand side token", token.getToken().getIndex());
                }
                if (!binary.acceptLeftNode(left)) {
                    throw new SimpleParserException("Binary operator " + operator + " does not support left hand side token " + left.getToken(), token.getToken().getIndex());
                }
                if (right == null) {
                    throw new SimpleParserException("Binary operator " + operator + " has no right hand side token", token.getToken().getIndex());
                }
                if (!binary.acceptRightNode(right)) {
                    throw new SimpleParserException("Binary operator " + operator + " does not support right hand side token " + right.getToken(), token.getToken().getIndex());
                }

                // pop previous as we need to replace it with this binary operator
                stack.pop();
                stack.push(token);
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.