Package org.antlr.runtime.tree

Examples of org.antlr.runtime.tree.CommonTree


    private final String columnName, tableName, databaseName;

    public SqlJetColumnExpression(CommonTree ast) {
        assert "column_expression".equalsIgnoreCase(ast.getText());
        CommonTree columnNode = (CommonTree) ast.getChild(0);
        columnName = columnNode.getText();
        if (columnNode.getChildCount() > 0) {
            CommonTree tableNode = (CommonTree) columnNode.getChild(0);
            tableName = tableNode.getText();
            databaseName = (tableNode.getChildCount() > 0) ? tableNode.getChild(0).getText() : null;
        } else {
            tableName = null;
            databaseName = null;
        }
    }
View Full Code Here


    private final ISqlJetForeignKeyDeferrable deferrable;

    public SqlJetForeignKey(CommonTree ast) {
        assert "references".equalsIgnoreCase(ast.getText());
        foreignTableName = ast.getChild(0).getText();
        CommonTree columnsNode = (CommonTree) ast.getChild(1);
        assert "columns".equalsIgnoreCase(columnsNode.getText());
        List<String> columnNames = new ArrayList<String>();
        for (int i = 0; i < columnsNode.getChildCount(); i++) {
            columnNames.add(columnsNode.getChild(i).getText());
        }
        this.columnNames = Collections.unmodifiableList(columnNames);
        List<ISqlJetForeignKeyAction> actions = new ArrayList<ISqlJetForeignKeyAction>();
        ISqlJetForeignKeyDeferrable deferrable = null;
        for (int i = 2; i < ast.getChildCount(); i++) {
            CommonTree child = (CommonTree) ast.getChild(i);
            if ("deferrable".equalsIgnoreCase(child.getText())) {
                assert deferrable == null;
                deferrable = new SqlJetForeignKeyDeferrable(child);
            } else if ("on".equalsIgnoreCase(child.getText())) {
                actions.add(new SqlJetForeignKeyUpdateAction(child));
            } else if ("match".equalsIgnoreCase(child.getText())) {
                actions.add(new SqlJetForeignKeyMatchAction(child));
            } else {
                assert false;
            }
        }
View Full Code Here

    public SqlJetColumnUnique(SqlJetColumnDef column, String name, CommonTree ast) {
        super(column, name);
        assert "unique".equalsIgnoreCase(ast.getText());
        for (int i = 0; i < ast.getChildCount(); i++) {
            CommonTree child = (CommonTree) ast.getChild(i);
            if ("conflict".equalsIgnoreCase(child.getText())) {
                assert child.getChildCount() == 1;
                child = (CommonTree) child.getChild(0);
                conflictAction = SqlJetConflictAction.decode(child.getText());
            } else {
                assert false;
            }
        }
    }
View Full Code Here

    public SqlJetColumnNotNull(SqlJetColumnDef column, String name, CommonTree ast) {
        super(column, name);
        assert "not_null".equalsIgnoreCase(ast.getText());
        for (int i = 0; i < ast.getChildCount(); i++) {
            CommonTree child = (CommonTree) ast.getChild(i);
            if ("conflict".equalsIgnoreCase(child.getText())) {
                assert child.getChildCount() == 1;
                child = (CommonTree) child.getChild(0);
                conflictAction = SqlJetConflictAction.decode(child.getText());
            } else {
                assert false;
            }
        }
    }
View Full Code Here

    private String sqlStatement;

    private long rowId;

    public SqlJetViewDef(String sql, CommonTree ast) {
        CommonTree optionsNode = (CommonTree) ast.getChild(0);

        sqlStatement = sql;
        temporary = SqlJetTableDef.hasOption(optionsNode, "temporary");
        ifNotExists = SqlJetTableDef.hasOption(optionsNode, "exists");

        CommonTree nameNode = (CommonTree) ast.getChild(1);
        name = nameNode.getText();
        databaseName = nameNode.getChildCount() > 0 ? nameNode.getChild(0).getText() : null;
    }
View Full Code Here

    private final List<String> names;
    private final Double size1;
    private final Double size2;

    public SqlJetTypeDef(CommonTree typeNode) {
        CommonTree paramsNode = (CommonTree) typeNode.getChild(0);
        if (paramsNode.getChildCount() > 0) {
            String text = paramsNode.getChild(0).getText();
            size1 = Double.valueOf(text);
        } else {
            size1 = null;
        }
        if (paramsNode.getChildCount() > 1) {
            String text = paramsNode.getChild(1).getText();
            size2 = Double.valueOf(text);
        } else {
            size2 = null;
        }
        List<String> typeNames = new ArrayList<String>();
View Full Code Here

    private final String tableName, databaseName;

    public SqlJetInTableExpression(CommonTree ast) throws SqlJetException {
        assert "in_table".equalsIgnoreCase(ast.getText());
        int idx = 0;
        CommonTree child = (CommonTree) ast.getChild(idx++);
        if ("not".equalsIgnoreCase(child.getText())) {
            not = true;
            child = (CommonTree) ast.getChild(idx++);
        } else {
            not = false;
        }
        assert "in".equalsIgnoreCase(child.getText());
        CommonTree tableNode = (CommonTree) child.getChild(0);
        tableName = tableNode.getText();
        if (tableNode.getChildCount() > 0) {
            databaseName = tableNode.getChild(0).getText();
        } else {
            databaseName = null;
        }
        expression = create((CommonTree) ast.getChild(idx));
    }
View Full Code Here

    private SqlJetConflictAction conflictAction;
    private String indexName;

    public SqlJetTableIndexConstraint(String name, CommonTree ast) {
        super(name);
        CommonTree columnsNode = (CommonTree) ast.getChild(0);
        assert "columns".equalsIgnoreCase(columnsNode.getText());
        List<String> columns = new ArrayList<String>();
        for (int i = 0; i < columnsNode.getChildCount(); i++) {
            CommonTree child = (CommonTree) columnsNode.getChild(i);
            columns.add(child.getText());
        }
        this.columns = Collections.unmodifiableList(columns);
        if (ast.getChildCount() > 1) {
            CommonTree child = (CommonTree) ast.getChild(1);
            assert "conflict".equalsIgnoreCase(child.getText());
            assert child.getChildCount() == 1;
            child = (CommonTree) child.getChild(0);
            conflictAction = SqlJetConflictAction.decode(child.getText());
        }
    }
View Full Code Here

    public SqlJetIndexedColumn(CommonTree ast) {
        name = ast.getText();
        String collation = null;
        SqlJetSortingOrder sortingOrder = null;
        for (int i = 0; i < ast.getChildCount(); i++) {
            CommonTree child = (CommonTree) ast.getChild(i);
            if ("collate".equalsIgnoreCase(child.getText())) {
                collation = child.getChild(0).getText();
            } else if ("asc".equalsIgnoreCase(child.getText())) {
                sortingOrder = SqlJetSortingOrder.ASC;
            } else if ("desc".equalsIgnoreCase(child.getText())) {
                sortingOrder = SqlJetSortingOrder.DESC;
            } else {
                assert false;
            }
        }
View Full Code Here

    private String sqlStatement;

    private long rowId;

    public SqlJetTriggerDef(String sql, CommonTree ast) {
        CommonTree optionsNode = (CommonTree) ast.getChild(0);

        sqlStatement = sql;
        temporary = SqlJetTableDef.hasOption(optionsNode, "temporary");
        ifNotExists = SqlJetTableDef.hasOption(optionsNode, "exists");

        CommonTree nameNode = (CommonTree) ast.getChild(1);
       
        name = nameNode.getText();
        tableName = nameNode.getChildCount() > 0 ? nameNode.getChild(0).getText() : null;
        databaseName = nameNode.getChildCount() > 1 ? nameNode.getChild(1).getText() : null;
    }
View Full Code Here

TOP

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

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.