Examples of QueryCompilerSyntaxException


Examples of org.datanucleus.store.query.QueryCompilerSyntaxException

        if (p.parseChar('('))
        {
            processExpression();
            if (!p.parseChar(')'))
            {
                throw new QueryCompilerSyntaxException("expected ')'", p.getIndex(), p.getInput());
            }
            return;
        }

        // if primary == null, literal not found...
        // We will have an identifier (variable, parameter, or field of candidate class)
        if (!processIdentifier())
        {
            throw new QueryCompilerSyntaxException("Identifier expected", p.getIndex(), p.getInput());
        }
        int size = stack.size();

        // Generate Node tree, including chained operations
        // e.g identifier.methodX().methodY().methodZ()
        //     -> node (IDENTIFIER) with child (INVOKE), with child (INVOKE), with child (INVOKE)
        // e.g identifier.fieldX.fieldY.fieldZ
        //     -> node (IDENTIFIER) with child (IDENTIFIER), with child (IDENTIFIER), with child (IDENTIFIER)
        while (p.parseChar('.'))
        {
            if (processMethod())
            {
                // "a.method(...)"
            }
            else if (processIdentifier())
            {
                // "a.field"
            }
            else
            {
                throw new QueryCompilerSyntaxException("Identifier expected", p.getIndex(), p.getInput());
            }
        }

        // For all added nodes, step back and chain them so we have
        // Node[IDENTIFIER, a]
View Full Code Here

Examples of org.datanucleus.store.query.QueryCompilerSyntaxException

            int size = stack.size();
            if (!processMethod())
            {
                if (!processIdentifier())
                {
                    throw new QueryCompilerSyntaxException("Identifier expected", p.getIndex(), p.getInput());
                }

                // run function on literals or identifiers e.g. "primary.runMethod(arg)"
                while (p.parseChar('.'))
                {
                    if (processMethod())
                    {
                        // "a.method(...)"
                    }
                    else if (processIdentifier())
                    {
                        // "a.field"
                    }
                    else
                    {
                        throw new QueryCompilerSyntaxException("Identifier expected", p.getIndex(), p.getInput());
                    }
                }
            }
            while (stack.size() - 1 > size)
            {
View Full Code Here

Examples of org.jpox.store.query.QueryCompilerSyntaxException

        {
            found = p.parseString("select");
        }
        if (!found)
        {
            throw new QueryCompilerSyntaxException("Expected keyword SELECT", p.getIndex(), p.getInput(), new String[]{"SELECT"});
        }
        Node select = new Node(Node.OPERATOR, "select");

        boolean unique = p.parseString("UNIQUE");
        if (!unique)
        {
            unique = p.parseString("unique");
        }
        if (unique)
        {
            select.appendChildNode(new Node(Node.OPERATOR, "unique"));
        }

        Node[] result = compileTupple(p);
        if (result.length > 0)
        {
            select.appendChildNode(result);
        }
        boolean into = p.parseString("INTO");
        if (!into)
        {
            into = p.parseString("into");
        }
        if (into)
        {
            Node node = new Node(Node.OPERATOR, "into");
            select.appendChildNode(node);
            Node intoExpr = compileExpression();
            node.appendChildNode(intoExpr);
        }

        boolean from = p.parseString("FROM");
        if (!from)
        {
            from = p.parseString("from");
        }
        if (from)
        {
            Node fromExpr = compileExpression();
            Node node = new Node(Node.OPERATOR, "from");
            select.appendChildNode(node);
            node.appendChildNode(fromExpr);
        }

        boolean where = p.parseString("WHERE");
        if (!where)
        {
            where = p.parseString("where");
        }
        if (where)
        {
            Node whereExpr = compileExpression();
            Node node = new Node(Node.OPERATOR, "where");
            select.appendChildNode(node);
            node.appendChildNode(whereExpr);
        }

        boolean variables = p.parseString("VARIABLES");
        if (!variables)
        {
            variables = p.parseString("variables");
        }
        if (variables)
        {
            Node[][] variablesExpr = compileVariables(p);
            Node node = new Node(Node.OPERATOR, "variables");
            select.appendChildNode(node);
            node.appendChildNode(variablesExpr);
        }

        boolean parameters = p.parseString("PARAMETERS");
        if (!parameters)
        {
            parameters = p.parseString("parameters");
        }
        if (parameters)
        {
            Node[][] parametersExpr = compileParameters(p);
            Node node = new Node(Node.OPERATOR, "parameters");
            select.appendChildNode(node);
            node.appendChildNode(parametersExpr);
        }

        List imports = new ArrayList();
        while (p.parseString("import"))
        {
            compilePrimary();
            if (stack.isEmpty())
            {
                throw new QueryCompilerSyntaxException("expected identifier", p.getIndex(), p.getInput());
            }
            imports.add(stack.pop());
            if (!p.parseString(";"))
            {
                break;
View Full Code Here

Examples of org.jpox.store.query.QueryCompilerSyntaxException

    {
        p = new Lexer(expression);
        stack = new Stack();
        if (!compileIdentifier())
        {
            throw new QueryCompilerSyntaxException("expected identifier", p.getIndex(), p.getInput());
        }
        if (!compileIdentifier())
        {
            throw new QueryCompilerSyntaxException("expected identifier", p.getIndex(), p.getInput());
        }
        Node nodeVariable = (Node) stack.pop();
        Node nodeType = (Node) stack.pop();
        nodeType.appendChildNode(nodeVariable);
        return nodeType;
View Full Code Here

Examples of org.jpox.store.query.QueryCompilerSyntaxException

        do
        {
            compilePrimary();
            if (stack.isEmpty())
            {
                throw new QueryCompilerSyntaxException("expected identifier", p.getIndex(), p.getInput());
            }
            if (!compileIdentifier())
            {
                throw new QueryCompilerSyntaxException("expected identifier", p.getIndex(), p.getInput());
            }
            Node nodeVariable = (Node) stack.pop();
            Node nodeType = (Node) stack.pop();
            nodes.add(new Node[]{nodeType, nodeVariable});
        }
View Full Code Here

Examples of org.jpox.store.query.QueryCompilerSyntaxException

        do
        {
            compilePrimary();
            if (stack.isEmpty())
            {
                throw new QueryCompilerSyntaxException("expected identifier", p.getIndex(), p.getInput());
            }
            if (!compileIdentifier())
            {
                throw new QueryCompilerSyntaxException("expected identifier", p.getIndex(), p.getInput());
            }
            Node nodeVariable = (Node) stack.pop();
            Node nodeType = (Node) stack.pop();
            nodes.add(new Node[]{nodeType, nodeVariable});
        }
View Full Code Here

Examples of org.jpox.store.query.QueryCompilerSyntaxException

        do
        {
            compilePrimary();
            if (stack.isEmpty())
            {
                throw new QueryCompilerSyntaxException("expected identifier", p.getIndex(), p.getInput());
            }
            if (!compileIdentifier())
            {
                throw new QueryCompilerSyntaxException("expected identifier", p.getIndex(), p.getInput());
            }
            Node nodeVariable = (Node) stack.pop();
            Node nodeType = (Node) stack.pop();
            nodes.add(new Node[]{nodeType, nodeVariable});
        }
View Full Code Here

Examples of org.jpox.store.query.QueryCompilerSyntaxException

        if (p.parseChar('('))
        {
            compileExpression();
            if (!p.parseChar(')'))
            {
                throw new QueryCompilerSyntaxException("expected ')'", p.getIndex(), p.getInput());
            }
            return;
        }
        // if primary == null, literal not found...
        // We will have an identifier (variable, parameter, or field of candidate class)
        if (!compileIdentifier())
        {
            throw new QueryCompilerSyntaxException("Identifier expected", p.getIndex(), p.getInput());
        }
        int size = stack.size();
        /*
         * run function on literals or identifiers
         * e.g. "primary.runMethod(arg)"
         */
        while (p.parseChar('.'))
        {
            if (compileMethod())
            {
                //((ExpressionNode) stack.pop()).addChildNode((ExpressionNode) stack.pop());
            }
            else
            {
                if (!compileIdentifier())
                {
                    throw new QueryCompilerSyntaxException("Identifier expected", p.getIndex(), p.getInput());
                }
            }
        }
        while (stack.size() > size)
        {
View Full Code Here

Examples of org.jpox.store.query.QueryCompilerSyntaxException

            int size = stack.size();
            if (!compileMethod())
            {
                if (!compileIdentifier())
                {
                    throw new QueryCompilerSyntaxException("Identifier expected", p.getIndex(), p.getInput());
                }
                /*
                 * run function on literals or identifiers
                 * e.g. "primary.runMethod(arg)"
                 */
                while (p.parseChar('.'))
                {
                    if (compileMethod())
                    {
                        //((ExpressionNode) stack.pop()).addChildNode((ExpressionNode) stack.pop());
                    }
                    else
                    {
                        if (!compileIdentifier())
                        {
                            throw new QueryCompilerSyntaxException("Identifier expected", p.getIndex(), p.getInput());
                        }
                    }
                }
            }
            while (stack.size() - 1 > size)
View Full Code Here

Examples of org.jpox.store.query.QueryCompilerSyntaxException

                }
                while (p.parseChar(','));

                if (!p.parseChar(')'))
                {
                    throw new QueryCompilerSyntaxException("')' expected", p.getIndex(), p.getInput());
                }
            }
            stack.push(expr);
            return true;
        }
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.