Package org.antlr.runtime.tree

Examples of org.antlr.runtime.tree.Tree


    }

    // process a statement of the form: connect hostname/port
    private void executeConnect(Tree statement)
    {
        Tree idList = statement.getChild(0);
        int portNumber = Integer.parseInt(statement.getChild(1).getText());

        StringBuilder hostName = new StringBuilder();
        int idCount = idList.getChildCount();
        for (int idx = 0; idx < idCount; idx++)
        {
            hostName.append(idList.getChild(idx).getText());
        }
       
        // disconnect current connection, if any.
        // This is a no-op, if you aren't currently connected.
        CliMain.disconnect();
View Full Code Here


        List<ColumnDef> columnDefinitions = new ArrayList<ColumnDef>();
       
        // each child node is a ^(HASH ...)
        for (int i = 0; i < meta.getChildCount(); i++)
        {
            Tree metaHash = meta.getChild(i);

            ColumnDef columnDefinition = new ColumnDef();
           
            // each child node is ^(PAIR $key $value)
            for (int j = 0; j < metaHash.getChildCount(); j++)
            {
                Tree metaPair = metaHash.getChild(j);

                // current $key
                String metaKey = CliUtils.unescapeSQLString(metaPair.getChild(0).getText());
                // current $value
                String metaVal = CliUtils.unescapeSQLString(metaPair.getChild(1).getText());

                if (metaKey.equals("column_name"))
                {
                    if (cfDef.column_type.equals("Super"))
                        columnDefinition.setName(subColumnNameAsByteArray(metaVal, cfDef));
View Full Code Here

        Map<String, String> strategyOptions = new HashMap<String, String>();

        // each child node is a ^(HASH ...)
        for (int i = 0; i < options.getChildCount(); i++)
        {
            Tree optionsHash = options.getChild(i);
           
            // each child node is ^(PAIR $key $value)
            for (int j = 0; j < optionsHash.getChildCount(); j++)
            {
                Tree optionPair = optionsHash.getChild(j);

                // current $key
                String key = CliUtils.unescapeSQLString(optionPair.getChild(0).getText());
                // current $value
                String val = CliUtils.unescapeSQLString(optionPair.getChild(1).getText());

                strategyOptions.put(key, val);
            }
        }
View Full Code Here

     * @return byte[] - string value as byte[]
     */
    private ByteBuffer convertValueByFunction(Tree functionCall, CfDef columnFamily, ByteBuffer columnName, boolean withUpdate)
    {
        String functionName = functionCall.getChild(0).getText();
        Tree argumentTree = functionCall.getChild(1);
        String functionArg  = (argumentTree == null) ? "" : CliUtils.unescapeSQLString(argumentTree.getText());
        AbstractType validator = getTypeByFunction(functionName);

        try
        {

View Full Code Here

            return true;
        }

        int count = node.getChildCount();
        for (int i=0; i<count && !found; i++) {
            Tree child = node.getChild(i);
            found = traverseTreeAndFindNodeInColumnMap(child, colRefs);
        }
        return found;
    }
View Full Code Here

        if (node==colRef) {
            return true;
        }
        boolean found = false;
        for (int i=0; i<count && !found; i++) {
            Tree child = node.getChild(i);
            found = traverseTreeAndFindNodeInColumnMap2(child, colRef);
        }
        return found;
    }
View Full Code Here

    public void printTreeTest() {
        // System.out.println("printTreeTest():");
        String statement = "SELECT p1, p2, p3.t3 mycol FROM MyType AS MyAlias WHERE p1='abc' and p2=123 ORDER BY abc.def ASC";
        try {
            getWalker(statement);
            Tree parserTree = (Tree) walker.getTreeNodeStream().getTreeSource();
            printTree(parserTree, statement);

        } catch (Exception e) {
            fail("Cannot parse query: " + statement + " (" + e + ")");
        }
View Full Code Here

        // System.out.println("extractWhereTreeTest():");
        String statement = "SELECT p1, p2, p3.t3 mycol FROM MyType AS MyAlias WHERE p1='abc' and p2=123 ORDER BY abc.def ASC";

        try {
            traverseStatementAndCatchExc(statement);
            Tree whereTree = walker.getWherePredicateTree(); // getWhereTree(parserTree);
            printTree(whereTree);
            LOG.info("Evaluate WHERE subtree: ...");
            evalWhereTree(whereTree);
        } catch (Exception e) {
            fail("Cannot parse query: " + statement + " (" + e + ")");
View Full Code Here

    @Test
    public void whereTestContains() {
        String statement = "SELECT p1 FROM MyType WHERE CONTAINS('Beethoven')";
        checkTreeWhere(statement);
        Tree tree = findSearchExpression(statement);
        printSearchTree(tree, statement);
    }
View Full Code Here

   
    @Test
    public void whereTestContains2() {
        String statement = "SELECT p1 FROM MyType WHERE CONTAINS('Beethoven OR \\'Johann Sebastian\\' Mozart -Cage AND Orff')";
        checkTreeWhere(statement);
        Tree tree = findSearchExpression(statement);
        printSearchTree(tree, statement);
    }
View Full Code Here

TOP

Related Classes of org.antlr.runtime.tree.Tree

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.