提交 da9e7e0f 编写于 作者: C codefairy08

Add a unified entry by importing file

上级 80ce2eed
grammar OracleAlterTable;
import OracleKeyword, DataType, Keyword,OracleIndexBase, OracleTableBase,OracleBase,BaseRule,Symbol;
import OracleKeyword, DataType, Keyword,OracleCreateIndex, OracleTableBase,OracleBase,BaseRule,Symbol;
alterTable:
ALTER TABLE tableName
......
grammar OracleIndexBase;
grammar OracleCreateIndex;
import OracleKeyword, DataType, Keyword,OracleBase,BaseRule,Symbol;
......
grammar OracleCreateTable;
import OracleKeyword, DataType, Keyword, OracleIndexBase,OracleTableBase,OracleBase,BaseRule,Symbol;
import OracleKeyword, DataType, Keyword, OracleCreateIndex, OracleTableBase, OracleBase, BaseRule, Symbol;
createTable:
CREATE (GLOBAL TEMPORARY)? TABLE tableName relationalTable
......
grammar MySQLStatement;
import MySQLDQL, MySQLDML, DQLBase, DMLBase, MySQLCreateIndex, MySQLDropIndex, MySQLCreateTable, MySQLAlterTable, MySQLDropTable, MySQLTruncateTable;
execute:
| select
| insert
| update
| delete
| createIndex
| dropIndex
| createTable
| alterTable
| dropTable
| truncateTable
;
\ No newline at end of file
grammar OracleStatement;
import OracleCreateIndex, OracleAlterIndex, OracleDropIndex, OracleCreateTable, OracleAlterTable, OracleDropTable, OracleTruncateTable;
execute:
createIndex
| alterIndex
| dropIndex
| createTable
| alterTable
| dropTable
| truncateTable
;
\ No newline at end of file
grammar PostgreStatement;
import PostgreCreateIndex, PostgreAlterIndex, PostgreDropIndex, PostgreCreateTable, PostgreAlterTable, PostgreDropTable, PostgreTruncateTable;
execute:
createIndex
| alterIndex
| dropIndex
| createTable
| alterTable
| dropTable
| truncateTable
;
\ No newline at end of file
grammar SQLServerStatement;
import SQLServerCreateIndex, SQLServerAlterIndex, SQLServerDropIndex, SQLServerCreateTable, SQLServerAlterTable, SQLServerDropTable, SQLServerTruncateTable;
execute:
createIndex
| alterIndex
| dropIndex
| createTable
| alterTable
| dropTable
| truncateTable
;
\ No newline at end of file
grammar OracleCreateIndex;
import OracleIndexBase;
matchNone:
'Default does not match anything'
;
\ No newline at end of file
/*
* Copyright 2016-2018 shardingsphere.io.
MySQLStatementParseTreeBuilder.java * Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -37,7 +37,12 @@ public abstract class AbstractParseTreeBuilder implements ParseTreeBuilder {
Lexer lexer = newLexer(stream);
CommonTokenStream tokenStream = new CommonTokenStream(lexer);
Parser parser = newParser(tokenStream);
return getParserTree(parser);
ParserRuleContext rootCtx = getParserTree(parser);
if(null != rootCtx) {
return (ParserRuleContext)rootCtx.getChild(0);
}
return null;
}
/** Create lexer instance.
......
......@@ -15,7 +15,7 @@
* </p>
*/
package io.shardingsphere.core.parsing.antler.ast.mysql;
package io.shardingsphere.core.parsing.antler.ast;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Lexer;
......@@ -23,11 +23,10 @@ import org.antlr.v4.runtime.Parser;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.ast.AbstractParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.parser.mysql.MySQLAdvancedDropTableParser;
import io.shardingsphere.parser.antlr.mysql.MySQLDropTableLexer;
import io.shardingsphere.core.parsing.antler.parser.MySQLStatementAdvancedParser;
import io.shardingsphere.parser.antlr.MySQLStatementLexer;
public class MySQLDropTableParseTreeBuilder extends AbstractParseTreeBuilder {
public class MySQLStatementParseTreeBuilder extends AbstractParseTreeBuilder {
/** Create lexer instance.
* @param stream text stream
......@@ -35,15 +34,16 @@ public class MySQLDropTableParseTreeBuilder extends AbstractParseTreeBuilder {
*/
@Override
protected Lexer newLexer(final CharStream stream) {
return new MySQLDropTableLexer(stream);
return new MySQLStatementLexer(stream);
}
/** Create parser instance.
* @param stream token stream
* @return antlr parser instance
*/
@Override
protected Parser newParser(final TokenStream tokenStream) {
return new MySQLAdvancedDropTableParser(tokenStream);
return new MySQLStatementAdvancedParser(tokenStream);
}
/** Get sql parse tree.
......@@ -52,8 +52,8 @@ public class MySQLDropTableParseTreeBuilder extends AbstractParseTreeBuilder {
*/
@Override
protected ParserRuleContext getParserTree(final Parser parser) {
MySQLAdvancedDropTableParser dropTableParser = (MySQLAdvancedDropTableParser) parser;
return dropTableParser.dropTable();
MySQLStatementAdvancedParser parse = (MySQLStatementAdvancedParser)parser;
return parse.execute();
}
}
......@@ -15,7 +15,7 @@
* </p>
*/
package io.shardingsphere.core.parsing.antler.ast.mysql;
package io.shardingsphere.core.parsing.antler.ast;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Lexer;
......@@ -23,11 +23,10 @@ import org.antlr.v4.runtime.Parser;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.ast.AbstractParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.parser.mysql.MySQLAdvancedAlterTableParser;
import io.shardingsphere.parser.antlr.mysql.MySQLAlterTableLexer;
import io.shardingsphere.core.parsing.antler.parser.OracleStatementAdvancedParser;
import io.shardingsphere.parser.antlr.OracleStatementLexer;
public class MySQLAlterTableParseTreeBuilder extends AbstractParseTreeBuilder {
public class OracleStatementParseTreeBuilder extends AbstractParseTreeBuilder {
/** Create lexer instance.
* @param stream text stream
......@@ -35,7 +34,7 @@ public class MySQLAlterTableParseTreeBuilder extends AbstractParseTreeBuilder {
*/
@Override
protected Lexer newLexer(final CharStream stream) {
return new MySQLAlterTableLexer(stream);
return new OracleStatementLexer(stream);
}
/** Create parser instance.
......@@ -44,7 +43,7 @@ public class MySQLAlterTableParseTreeBuilder extends AbstractParseTreeBuilder {
*/
@Override
protected Parser newParser(final TokenStream tokenStream) {
return new MySQLAdvancedAlterTableParser(tokenStream);
return new OracleStatementAdvancedParser(tokenStream);
}
/** Get sql parse tree.
......@@ -53,8 +52,8 @@ public class MySQLAlterTableParseTreeBuilder extends AbstractParseTreeBuilder {
*/
@Override
protected ParserRuleContext getParserTree(final Parser parser) {
MySQLAdvancedAlterTableParser alterTableParser = (MySQLAdvancedAlterTableParser)parser;
return alterTableParser.alterTable();
OracleStatementAdvancedParser parse = (OracleStatementAdvancedParser)parser;
return parse.execute();
}
}
......@@ -15,7 +15,7 @@
* </p>
*/
package io.shardingsphere.core.parsing.antler.ast.mysql;
package io.shardingsphere.core.parsing.antler.ast;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Lexer;
......@@ -23,11 +23,10 @@ import org.antlr.v4.runtime.Parser;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.ast.AbstractParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.parser.mysql.MySQLAdvancedCreateTableParser;
import io.shardingsphere.parser.antlr.mysql.MySQLCreateTableLexer;
import io.shardingsphere.core.parsing.antler.parser.PostgreStatementAdvancedParser;
import io.shardingsphere.parser.antlr.PostgreStatementLexer;
public class MySQLCreateTableParseTreeBuilder extends AbstractParseTreeBuilder {
public class PostgreStatementParseTreeBuilder extends AbstractParseTreeBuilder {
/** Create lexer instance.
* @param stream text stream
......@@ -35,7 +34,7 @@ public class MySQLCreateTableParseTreeBuilder extends AbstractParseTreeBuilder {
*/
@Override
protected Lexer newLexer(final CharStream stream) {
return new MySQLCreateTableLexer(stream);
return new PostgreStatementLexer(stream);
}
/** Create parser instance.
......@@ -44,7 +43,7 @@ public class MySQLCreateTableParseTreeBuilder extends AbstractParseTreeBuilder {
*/
@Override
protected Parser newParser(final TokenStream tokenStream) {
return new MySQLAdvancedCreateTableParser(tokenStream);
return new PostgreStatementAdvancedParser(tokenStream);
}
/** Get sql parse tree.
......@@ -53,8 +52,8 @@ public class MySQLCreateTableParseTreeBuilder extends AbstractParseTreeBuilder {
*/
@Override
protected ParserRuleContext getParserTree(final Parser parser) {
MySQLAdvancedCreateTableParser createTableParser = (MySQLAdvancedCreateTableParser) parser;
return createTableParser.createTable();
PostgreStatementAdvancedParser parse = (PostgreStatementAdvancedParser)parser;
return parse.execute();
}
}
......@@ -15,7 +15,7 @@
* </p>
*/
package io.shardingsphere.core.parsing.antler.ast.postgre;
package io.shardingsphere.core.parsing.antler.ast;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Lexer;
......@@ -23,11 +23,10 @@ import org.antlr.v4.runtime.Parser;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.ast.AbstractParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.parser.postgre.PostgreAdvancedCreateTableParser;
import io.shardingsphere.parser.antlr.postgre.PostgreCreateTableLexer;
import io.shardingsphere.core.parsing.antler.parser.SQLServerStatementAdvancedParser;
import io.shardingsphere.parser.antlr.SQLServerStatementLexer;
public class PostgreCreateTableParseTreeBuilder extends AbstractParseTreeBuilder {
public class SQLServerStatementParseTreeBuilder extends AbstractParseTreeBuilder {
/** Create lexer instance.
* @param stream text stream
......@@ -35,7 +34,7 @@ public class PostgreCreateTableParseTreeBuilder extends AbstractParseTreeBuilder
*/
@Override
protected Lexer newLexer(final CharStream stream) {
return new PostgreCreateTableLexer(stream);
return new SQLServerStatementLexer(stream);
}
/** Create parser instance.
......@@ -44,7 +43,7 @@ public class PostgreCreateTableParseTreeBuilder extends AbstractParseTreeBuilder
*/
@Override
protected Parser newParser(final TokenStream tokenStream) {
return new PostgreAdvancedCreateTableParser(tokenStream);
return new SQLServerStatementAdvancedParser(tokenStream);
}
/** Get sql parse tree.
......@@ -53,8 +52,8 @@ public class PostgreCreateTableParseTreeBuilder extends AbstractParseTreeBuilder
*/
@Override
protected ParserRuleContext getParserTree(final Parser parser) {
PostgreAdvancedCreateTableParser createTableParser = (PostgreAdvancedCreateTableParser) parser;
return createTableParser.createTable();
SQLServerStatementAdvancedParser parse = (SQLServerStatementAdvancedParser)parser;
return parse.execute();
}
}
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package io.shardingsphere.core.parsing.antler.ast.mysql;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.Parser;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.ast.AbstractParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.parser.mysql.MySQLAdvancedTruncateTableParser;
import io.shardingsphere.parser.antlr.mysql.MySQLTruncateTableLexer;
public class MySQLTruncateTableParseTreeBuilder extends AbstractParseTreeBuilder {
/** Create lexer instance.
* @param stream text stream
* @return antlr lexer instance
*/
@Override
protected Lexer newLexer(final CharStream stream) {
return new MySQLTruncateTableLexer(stream);
}
/** Create parser instance.
* @param stream token stream
* @return antlr parser instance
*/
@Override
protected Parser newParser(final TokenStream tokenStream) {
return new MySQLAdvancedTruncateTableParser(tokenStream);
}
/** Get sql parse tree.
* @param parser instance
* @return sql parse tree
*/
@Override
protected ParserRuleContext getParserTree(final Parser parser) {
MySQLAdvancedTruncateTableParser truncateTableParser = (MySQLAdvancedTruncateTableParser) parser;
return truncateTableParser.truncateTable();
}
}
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package io.shardingsphere.core.parsing.antler.ast.oracle;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.Parser;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.ast.AbstractParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.parser.oracle.OracleAdvancedAlterTableParser;
import io.shardingsphere.parser.antlr.oracle.OracleAlterTableLexer;
public class OracleAlterTableParseTreeBuilder extends AbstractParseTreeBuilder {
/**
* Create lexer instance.
*
* @param stream text stream
* @return antlr lexer instance
*/
@Override
protected Lexer newLexer(final CharStream stream) {
return new OracleAlterTableLexer(stream);
}
/**
* Create parser instance.
*
* @param stream token stream
* @return antlr parser instance
*/
@Override
protected Parser newParser(final TokenStream tokenStream) {
return new OracleAdvancedAlterTableParser(tokenStream);
}
/**
* Get sql parse tree.
*
* @param parser instance
* @return sql parse tree
*/
@Override
protected ParserRuleContext getParserTree(final Parser parser) {
OracleAdvancedAlterTableParser alterTableParser = (OracleAdvancedAlterTableParser) parser;
return alterTableParser.alterTable();
}
}
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package io.shardingsphere.core.parsing.antler.ast.oracle;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.Parser;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.ast.AbstractParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.parser.oracle.OracleAdvancedCreateTableParser;
import io.shardingsphere.parser.antlr.oracle.OracleCreateTableLexer;
public class OracleCreateTableParseTreeBuilder extends AbstractParseTreeBuilder {
/** Create lexer instance.
* @param stream text stream
* @return antlr lexer instance
*/
@Override
protected Lexer newLexer(final CharStream stream) {
return new OracleCreateTableLexer(stream);
}
/** Create parser instance.
* @param stream token stream
* @return antlr parser instance
*/
@Override
protected Parser newParser(final TokenStream tokenStream) {
return new OracleAdvancedCreateTableParser(tokenStream);
}
/** Get sql parse tree.
* @param parser instance
* @return sql parse tree
*/
@Override
protected ParserRuleContext getParserTree(final Parser parser) {
OracleAdvancedCreateTableParser createTableParser = (OracleAdvancedCreateTableParser) parser;
return createTableParser.createTable();
}
}
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package io.shardingsphere.core.parsing.antler.ast.oracle;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.Parser;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.ast.AbstractParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.parser.oracle.OracleAdvancedDropTableParser;
import io.shardingsphere.parser.antlr.oracle.OracleDropTableLexer;
public class OracleDropTableParseTreeBuilder extends AbstractParseTreeBuilder {
/** Create lexer instance.
* @param stream text stream
* @return antlr lexer instance
*/
@Override
protected Lexer newLexer(final CharStream stream) {
return new OracleDropTableLexer(stream);
}
/** Create parser instance.
* @param stream token stream
* @return antlr parser instance
*/
@Override
protected Parser newParser(final TokenStream tokenStream) {
return new OracleAdvancedDropTableParser(tokenStream);
}
/** Get sql parse tree.
* @param parser instance
* @return sql parse tree
*/
@Override
protected ParserRuleContext getParserTree(final Parser parser) {
OracleAdvancedDropTableParser dropTableParser = (OracleAdvancedDropTableParser) parser;
return dropTableParser.dropTable();
}
}
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package io.shardingsphere.core.parsing.antler.ast.oracle;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.Parser;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.ast.AbstractParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.parser.oracle.OracleAdvancedTruncateTableParser;
import io.shardingsphere.parser.antlr.oracle.OracleTruncateTableLexer;
public class OracleTruncateTableParseTreeBuilder extends AbstractParseTreeBuilder {
/** Create lexer instance.
* @param stream text stream
* @return antlr lexer instance
*/
@Override
protected Lexer newLexer(final CharStream stream) {
return new OracleTruncateTableLexer(stream);
}
/** Create parser instance.
* @param stream token stream
* @return antlr parser instance
*/
@Override
protected Parser newParser(final TokenStream tokenStream) {
return new OracleAdvancedTruncateTableParser(tokenStream);
}
/** Get sql parse tree.
* @param parser instance
* @return sql parse tree
*/
@Override
protected ParserRuleContext getParserTree(final Parser parser) {
OracleAdvancedTruncateTableParser truncateTableParser = (OracleAdvancedTruncateTableParser) parser;
return truncateTableParser.truncateTable();
}
}
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package io.shardingsphere.core.parsing.antler.ast.postgre;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.Parser;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.ast.AbstractParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.parser.postgre.PostgreAdvancedAlterTableParser;
import io.shardingsphere.parser.antlr.postgre.PostgreAlterTableLexer;
public class PostgreAlterTableParseTreeBuilder extends AbstractParseTreeBuilder {
/** Create lexer instance.
* @param stream text stream
* @return antlr lexer instance
*/
@Override
protected Lexer newLexer(final CharStream stream) {
return new PostgreAlterTableLexer(stream);
}
/** Create parser instance.
* @param stream token stream
* @return antlr parser instance
*/
@Override
protected Parser newParser(final TokenStream tokenStream) {
return new PostgreAdvancedAlterTableParser(tokenStream);
}
/** Get sql parse tree.
* @param parser instance
* @return sql parse tree
*/
@Override
protected ParserRuleContext getParserTree(final Parser parser) {
PostgreAdvancedAlterTableParser alterTableParser = (PostgreAdvancedAlterTableParser) parser;
return alterTableParser.alterTable();
}
}
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package io.shardingsphere.core.parsing.antler.ast.postgre;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.Parser;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.ast.AbstractParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.parser.postgre.PostgreAdvancedDropTableParser;
import io.shardingsphere.parser.antlr.postgre.PostgreDropTableLexer;
public class PostgreDropTableParseTreeBuilder extends AbstractParseTreeBuilder {
/** Create lexer instance.
* @param stream text stream
* @return antlr lexer instance
*/
@Override
protected Lexer newLexer(final CharStream stream) {
return new PostgreDropTableLexer(stream);
}
/** Create parser instance.
* @param stream token stream
* @return antlr parser instance
*/
@Override
protected Parser newParser(final TokenStream tokenStream) {
return new PostgreAdvancedDropTableParser(tokenStream);
}
/** Get sql parse tree.
* @param parser instance
* @return sql parse tree
*/
@Override
protected ParserRuleContext getParserTree(final Parser parser) {
PostgreAdvancedDropTableParser dropTableParser = (PostgreAdvancedDropTableParser) parser;
return dropTableParser.dropTable();
}
}
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package io.shardingsphere.core.parsing.antler.ast.postgre;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.Parser;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.ast.AbstractParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.parser.postgre.PostgreAdvancedTruncateTableParser;
import io.shardingsphere.parser.antlr.postgre.PostgreTruncateTableLexer;
public class PostgreTruncateTableParseTreeBuilder extends AbstractParseTreeBuilder {
/** Create lexer instance.
* @param stream text stream
* @return antlr lexer instance
*/
@Override
protected Lexer newLexer(final CharStream stream) {
return new PostgreTruncateTableLexer(stream);
}
/** Create parser instance.
* @param stream token stream
* @return antlr parser instance
*/
@Override
protected Parser newParser(final TokenStream tokenStream) {
return new PostgreAdvancedTruncateTableParser(tokenStream);
}
/** Get sql parse tree.
* @param parser instance
* @return sql parse tree
*/
@Override
protected ParserRuleContext getParserTree(final Parser parser) {
PostgreAdvancedTruncateTableParser truncateTableParser = (PostgreAdvancedTruncateTableParser) parser;
return truncateTableParser.truncateTable();
}
}
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package io.shardingsphere.core.parsing.antler.ast.sqlserver;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.Parser;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.ast.AbstractParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.parser.sqlserver.SQLServerAdvancedAlterTableParser;
import io.shardingsphere.parser.antlr.sqlserver.SQLServerAlterTableLexer;
public class SQLServerAlterTableParseTreeBuilder extends AbstractParseTreeBuilder {
/** Create lexer instance.
* @param stream text stream
* @return antlr lexer instance
*/
@Override
protected Lexer newLexer(final CharStream stream) {
return new SQLServerAlterTableLexer(stream);
}
/** Create parser instance.
* @param stream token stream
* @return antlr parser instance
*/
@Override
protected Parser newParser(final TokenStream tokenStream) {
return new SQLServerAdvancedAlterTableParser(tokenStream);
}
/** Get sql parse tree.
* @param parser instance
* @return sql parse tree
*/
@Override
protected ParserRuleContext getParserTree(final Parser parser) {
SQLServerAdvancedAlterTableParser alterTableParser = (SQLServerAdvancedAlterTableParser) parser;
return alterTableParser.alterTable();
}
}
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package io.shardingsphere.core.parsing.antler.ast.sqlserver;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.Parser;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.ast.AbstractParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.parser.sqlserver.SQLServerAdvancedCreateTableParser;
import io.shardingsphere.parser.antlr.sqlserver.SQLServerCreateTableLexer;
public class SQLServerCreateTableParseTreeBuilder extends AbstractParseTreeBuilder {
/** Create lexer instance.
* @param stream text stream
* @return antlr lexer instance
*/
@Override
protected Lexer newLexer(final CharStream stream) {
return new SQLServerCreateTableLexer(stream);
}
/** Create parser instance.
* @param stream token stream
* @return antlr parser instance
*/
@Override
protected Parser newParser(final TokenStream tokenStream) {
return new SQLServerAdvancedCreateTableParser(tokenStream);
}
/** Get sql parse tree.
* @param parser instance
* @return sql parse tree
*/
@Override
protected ParserRuleContext getParserTree(final Parser parser) {
SQLServerAdvancedCreateTableParser createTableParser = (SQLServerAdvancedCreateTableParser) parser;
return createTableParser.createTable();
}
}
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package io.shardingsphere.core.parsing.antler.ast.sqlserver;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.Parser;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.ast.AbstractParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.parser.sqlserver.SQLServerAdvancedDropTableParser;
import io.shardingsphere.parser.antlr.sqlserver.SQLServerDropTableLexer;
public class SQLServerDropTableParseTreeBuilder extends AbstractParseTreeBuilder {
/** Create lexer instance.
* @param stream text stream
* @return antlr lexer instance
*/
@Override
protected Lexer newLexer(final CharStream stream) {
return new SQLServerDropTableLexer(stream);
}
/** Create parser instance.
* @param stream token stream
* @return antlr parser instance
*/
@Override
protected Parser newParser(final TokenStream tokenStream) {
return new SQLServerAdvancedDropTableParser(tokenStream);
}
/** Get sql parse tree.
* @param parser instance
* @return sql parse tree
*/
@Override
protected ParserRuleContext getParserTree(final Parser parser) {
SQLServerAdvancedDropTableParser dropTableParser = (SQLServerAdvancedDropTableParser) parser;
return dropTableParser.dropTable();
}
}
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package io.shardingsphere.core.parsing.antler.ast.sqlserver;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.Parser;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.ast.AbstractParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.parser.sqlserver.SQLServerAdvancedTruncateTableParser;
import io.shardingsphere.parser.antlr.sqlserver.SQLServerTruncateTableLexer;
public class SQLServerTruncateTableParseTreeBuilder extends AbstractParseTreeBuilder {
/** Create lexer instance.
* @param stream text stream
* @return antlr lexer instance
*/
@Override
protected Lexer newLexer(final CharStream stream) {
return new SQLServerTruncateTableLexer(stream);
}
/** Create parser instance.
* @param stream token stream
* @return antlr parser instance
*/
@Override
protected Parser newParser(final TokenStream tokenStream) {
return new SQLServerAdvancedTruncateTableParser(tokenStream);
}
/** Get sql parse tree.
* @param parser instance
* @return sql parse tree
*/
@Override
protected ParserRuleContext getParserTree(final Parser parser) {
SQLServerAdvancedTruncateTableParser truncateTableParser = (SQLServerAdvancedTruncateTableParser) parser;
return truncateTableParser.truncateTable();
}
}
......@@ -15,7 +15,7 @@
* </p>
*/
package io.shardingsphere.core.parsing.antler.parser.mysql;
package io.shardingsphere.core.parsing.antler.parser;
import org.antlr.v4.runtime.CommonToken;
import org.antlr.v4.runtime.RecognitionException;
......@@ -24,11 +24,11 @@ import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.AdvancedErrorStrategy;
import io.shardingsphere.core.parsing.antler.AdvancedParserATNSimulator;
import io.shardingsphere.parser.antlr.mysql.MySQLDropTableParser;
import io.shardingsphere.parser.antlr.MySQLStatementParser;
public class MySQLAdvancedDropTableParser extends MySQLDropTableParser {
public class MySQLStatementAdvancedParser extends MySQLStatementParser {
public MySQLAdvancedDropTableParser(final TokenStream input) {
public MySQLStatementAdvancedParser(final TokenStream input) {
super(input);
_interp = new AdvancedParserATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache, ID);
this._errHandler = new AdvancedErrorStrategy(ID);
......
......@@ -15,7 +15,7 @@
* </p>
*/
package io.shardingsphere.core.parsing.antler.parser.mysql;
package io.shardingsphere.core.parsing.antler.parser;
import org.antlr.v4.runtime.CommonToken;
import org.antlr.v4.runtime.RecognitionException;
......@@ -24,11 +24,11 @@ import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.AdvancedErrorStrategy;
import io.shardingsphere.core.parsing.antler.AdvancedParserATNSimulator;
import io.shardingsphere.parser.antlr.mysql.MySQLAlterTableParser;
import io.shardingsphere.parser.antlr.OracleStatementParser;
public class MySQLAdvancedAlterTableParser extends MySQLAlterTableParser {
public class OracleStatementAdvancedParser extends OracleStatementParser {
public MySQLAdvancedAlterTableParser(final TokenStream input) {
public OracleStatementAdvancedParser(final TokenStream input) {
super(input);
_interp = new AdvancedParserATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache, ID);
this._errHandler = new AdvancedErrorStrategy(ID);
......
......@@ -15,7 +15,7 @@
* </p>
*/
package io.shardingsphere.core.parsing.antler.parser.mysql;
package io.shardingsphere.core.parsing.antler.parser;
import org.antlr.v4.runtime.CommonToken;
import org.antlr.v4.runtime.RecognitionException;
......@@ -24,11 +24,11 @@ import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.AdvancedErrorStrategy;
import io.shardingsphere.core.parsing.antler.AdvancedParserATNSimulator;
import io.shardingsphere.parser.antlr.mysql.MySQLCreateTableParser;
import io.shardingsphere.parser.antlr.PostgreStatementParser;
public class MySQLAdvancedCreateTableParser extends MySQLCreateTableParser {
public class PostgreStatementAdvancedParser extends PostgreStatementParser {
public MySQLAdvancedCreateTableParser(final TokenStream input) {
public PostgreStatementAdvancedParser(final TokenStream input) {
super(input);
_interp = new AdvancedParserATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache, ID);
this._errHandler = new AdvancedErrorStrategy(ID);
......
......@@ -15,7 +15,7 @@
* </p>
*/
package io.shardingsphere.core.parsing.antler.parser.oracle;
package io.shardingsphere.core.parsing.antler.parser;
import org.antlr.v4.runtime.CommonToken;
import org.antlr.v4.runtime.RecognitionException;
......@@ -24,11 +24,11 @@ import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.AdvancedErrorStrategy;
import io.shardingsphere.core.parsing.antler.AdvancedParserATNSimulator;
import io.shardingsphere.parser.antlr.oracle.OracleDropTableParser;
import io.shardingsphere.parser.antlr.SQLServerStatementParser;
public class OracleAdvancedDropTableParser extends OracleDropTableParser {
public class SQLServerStatementAdvancedParser extends SQLServerStatementParser {
public OracleAdvancedDropTableParser(final TokenStream input) {
public SQLServerStatementAdvancedParser(final TokenStream input) {
super(input);
_interp = new AdvancedParserATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache, ID);
this._errHandler = new AdvancedErrorStrategy(ID);
......
......@@ -20,24 +20,11 @@ package io.shardingsphere.core.parsing.antler.parser.factory;
import org.antlr.v4.runtime.ParserRuleContext;
import io.shardingsphere.core.constant.DatabaseType;
import io.shardingsphere.core.parsing.antler.ast.mysql.MySQLAlterTableParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.ast.mysql.MySQLCreateTableParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.ast.mysql.MySQLDropTableParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.ast.mysql.MySQLTruncateTableParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.ast.oracle.OracleAlterTableParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.ast.oracle.OracleCreateTableParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.ast.oracle.OracleDropTableParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.ast.oracle.OracleTruncateTableParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.ast.postgre.PostgreAlterTableParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.ast.postgre.PostgreCreateTableParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.ast.postgre.PostgreDropTableParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.ast.postgre.PostgreTruncateTableParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.ast.sqlserver.SQLServerAlterTableParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.ast.sqlserver.SQLServerCreateTableParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.ast.sqlserver.SQLServerDropTableParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.ast.sqlserver.SQLServerTruncateTableParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.ast.MySQLStatementParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.ast.OracleStatementParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.ast.PostgreStatementParseTreeBuilder;
import io.shardingsphere.core.parsing.antler.ast.SQLServerStatementParseTreeBuilder;
import io.shardingsphere.core.parsing.lexer.LexerEngine;
import io.shardingsphere.core.parsing.lexer.token.DefaultKeyword;
import io.shardingsphere.core.parsing.lexer.token.TokenType;
import io.shardingsphere.core.parsing.parser.exception.SQLParsingUnsupportedException;
import io.shardingsphere.core.rule.ShardingRule;
......@@ -55,81 +42,17 @@ public class ParseTreeFactory {
final ShardingRule shardingRule, final LexerEngine lexerEngine) {
switch (dbType) {
case MySQL:
return getMySQLTableDDLParser(tokenType, shardingRule, lexerEngine);
return new MySQLStatementParseTreeBuilder().parse(lexerEngine.getInput());
case Oracle:
return getOracleTableDDLParser(tokenType, shardingRule, lexerEngine);
return new OracleStatementParseTreeBuilder().parse(lexerEngine.getInput());
case SQLServer:
return getSQLServerTableDDLParser(tokenType, shardingRule, lexerEngine);
return new SQLServerStatementParseTreeBuilder().parse(lexerEngine.getInput());
case PostgreSQL:
return getPostgreTableDDLParser(tokenType, shardingRule, lexerEngine);
return new PostgreStatementParseTreeBuilder().parse(lexerEngine.getInput());
default:
throw new SQLParsingUnsupportedException(tokenType);
}
}
private static ParserRuleContext getMySQLTableDDLParser(final TokenType tokenType, final ShardingRule shardingRule,
final LexerEngine lexerEngine) {
switch ((DefaultKeyword) tokenType) {
case CREATE:
return new MySQLCreateTableParseTreeBuilder().parse(lexerEngine.getInput());
case ALTER:
return new MySQLAlterTableParseTreeBuilder().parse(lexerEngine.getInput());
case DROP:
return new MySQLDropTableParseTreeBuilder().parse(lexerEngine.getInput());
case TRUNCATE:
return new MySQLTruncateTableParseTreeBuilder().parse(lexerEngine.getInput());
default:
throw new SQLParsingUnsupportedException(tokenType);
}
}
private static ParserRuleContext getOracleTableDDLParser(final TokenType tokenType, final ShardingRule shardingRule,
final LexerEngine lexerEngine) {
switch ((DefaultKeyword) tokenType) {
case CREATE:
return new OracleCreateTableParseTreeBuilder().parse(lexerEngine.getInput());
case ALTER:
return new OracleAlterTableParseTreeBuilder().parse(lexerEngine.getInput());
case DROP:
return new OracleDropTableParseTreeBuilder().parse(lexerEngine.getInput());
case TRUNCATE:
return new OracleTruncateTableParseTreeBuilder().parse(lexerEngine.getInput());
default:
throw new SQLParsingUnsupportedException(tokenType);
}
}
private static ParserRuleContext getSQLServerTableDDLParser(final TokenType tokenType,
final ShardingRule shardingRule, final LexerEngine lexerEngine) {
switch ((DefaultKeyword) tokenType) {
case CREATE:
return new SQLServerCreateTableParseTreeBuilder().parse(lexerEngine.getInput());
case ALTER:
return new SQLServerAlterTableParseTreeBuilder().parse(lexerEngine.getInput());
case DROP:
return new SQLServerDropTableParseTreeBuilder().parse(lexerEngine.getInput());
case TRUNCATE:
return new SQLServerTruncateTableParseTreeBuilder().parse(lexerEngine.getInput());
default:
throw new SQLParsingUnsupportedException(tokenType);
}
}
private static ParserRuleContext getPostgreTableDDLParser(final TokenType tokenType,
final ShardingRule shardingRule, final LexerEngine lexerEngine) {
switch ((DefaultKeyword) tokenType) {
case CREATE:
return new PostgreCreateTableParseTreeBuilder().parse(lexerEngine.getInput());
case ALTER:
return new PostgreAlterTableParseTreeBuilder().parse(lexerEngine.getInput());
case DROP:
return new PostgreDropTableParseTreeBuilder().parse(lexerEngine.getInput());
case TRUNCATE:
return new PostgreTruncateTableParseTreeBuilder().parse(lexerEngine.getInput());
default:
throw new SQLParsingUnsupportedException(tokenType);
}
}
}
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package io.shardingsphere.core.parsing.antler.parser.mysql;
import org.antlr.v4.runtime.CommonToken;
import org.antlr.v4.runtime.RecognitionException;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.AdvancedErrorStrategy;
import io.shardingsphere.core.parsing.antler.AdvancedParserATNSimulator;
import io.shardingsphere.parser.antlr.mysql.MySQLTruncateTableParser;
public class MySQLAdvancedTruncateTableParser extends MySQLTruncateTableParser {
public MySQLAdvancedTruncateTableParser(final TokenStream input) {
super(input);
_interp = new AdvancedParserATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache, ID);
this._errHandler = new AdvancedErrorStrategy(ID);
}
public Token match(final int ttype) throws RecognitionException {
Token t = getCurrentToken();
boolean compatID = false;
if (ID == ttype && ID > t.getType()) {
compatID = true;
}
if (t.getType() == ttype || compatID) {
if (ttype == Token.EOF) {
matchedEOF = true;
}
if (!matchedEOF && compatID && (t instanceof CommonToken)) {
CommonToken commonToken = (CommonToken) t;
commonToken.setType(ID);
}
_errHandler.reportMatch(this);
consume();
} else {
t = _errHandler.recoverInline(this);
if (_buildParseTrees && t.getTokenIndex() == -1) {
// we must have conjured up a new token during single token insertion
// if it's not the current symbol
_ctx.addErrorNode(createErrorNode(_ctx, t));
}
}
return t;
}
}
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package io.shardingsphere.core.parsing.antler.parser.oracle;
import org.antlr.v4.runtime.CommonToken;
import org.antlr.v4.runtime.RecognitionException;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.AdvancedErrorStrategy;
import io.shardingsphere.core.parsing.antler.AdvancedParserATNSimulator;
import io.shardingsphere.parser.antlr.oracle.OracleAlterTableParser;
public class OracleAdvancedAlterTableParser extends OracleAlterTableParser {
public OracleAdvancedAlterTableParser(final TokenStream input) {
super(input);
_interp = new AdvancedParserATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache, ID);
this._errHandler = new AdvancedErrorStrategy(ID);
}
public Token match(final int ttype) throws RecognitionException {
Token t = getCurrentToken();
boolean compatID = false;
if (ID == ttype && ID > t.getType()) {
compatID = true;
}
if (t.getType() == ttype || compatID) {
if (ttype == Token.EOF) {
matchedEOF = true;
}
if (!matchedEOF && compatID && (t instanceof CommonToken)) {
CommonToken commonToken = (CommonToken) t;
commonToken.setType(ID);
}
_errHandler.reportMatch(this);
consume();
} else {
t = _errHandler.recoverInline(this);
if (_buildParseTrees && t.getTokenIndex() == -1) {
// we must have conjured up a new token during single token insertion
// if it's not the current symbol
_ctx.addErrorNode(createErrorNode(_ctx, t));
}
}
return t;
}
}
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package io.shardingsphere.core.parsing.antler.parser.oracle;
import org.antlr.v4.runtime.CommonToken;
import org.antlr.v4.runtime.RecognitionException;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.AdvancedErrorStrategy;
import io.shardingsphere.core.parsing.antler.AdvancedParserATNSimulator;
import io.shardingsphere.parser.antlr.oracle.OracleCreateTableParser;
public class OracleAdvancedCreateTableParser extends OracleCreateTableParser {
public OracleAdvancedCreateTableParser(final TokenStream input) {
super(input);
_interp = new AdvancedParserATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache, ID);
this._errHandler = new AdvancedErrorStrategy(ID);
}
public Token match(final int ttype) throws RecognitionException {
Token t = getCurrentToken();
boolean compatID = false;
if (ID == ttype && ID > t.getType()) {
compatID = true;
}
if (t.getType() == ttype || compatID) {
if (ttype == Token.EOF) {
matchedEOF = true;
}
if (!matchedEOF && compatID && (t instanceof CommonToken)) {
CommonToken commonToken = (CommonToken) t;
commonToken.setType(ID);
}
_errHandler.reportMatch(this);
consume();
} else {
t = _errHandler.recoverInline(this);
if (_buildParseTrees && t.getTokenIndex() == -1) {
// we must have conjured up a new token during single token insertion
// if it's not the current symbol
_ctx.addErrorNode(createErrorNode(_ctx, t));
}
}
return t;
}
}
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package io.shardingsphere.core.parsing.antler.parser.oracle;
import org.antlr.v4.runtime.CommonToken;
import org.antlr.v4.runtime.RecognitionException;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.AdvancedErrorStrategy;
import io.shardingsphere.core.parsing.antler.AdvancedParserATNSimulator;
import io.shardingsphere.parser.antlr.oracle.OracleTruncateTableParser;
public class OracleAdvancedTruncateTableParser extends OracleTruncateTableParser {
public OracleAdvancedTruncateTableParser(final TokenStream input) {
super(input);
_interp = new AdvancedParserATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache, ID);
this._errHandler = new AdvancedErrorStrategy(ID);
}
public Token match(final int ttype) throws RecognitionException {
Token t = getCurrentToken();
boolean compatID = false;
if (ID == ttype && ID > t.getType()) {
compatID = true;
}
if (t.getType() == ttype || compatID) {
if (ttype == Token.EOF) {
matchedEOF = true;
}
if (!matchedEOF && compatID && (t instanceof CommonToken)) {
CommonToken commonToken = (CommonToken) t;
commonToken.setType(ID);
}
_errHandler.reportMatch(this);
consume();
} else {
t = _errHandler.recoverInline(this);
if (_buildParseTrees && t.getTokenIndex() == -1) {
// we must have conjured up a new token during single token insertion
// if it's not the current symbol
_ctx.addErrorNode(createErrorNode(_ctx, t));
}
}
return t;
}
}
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package io.shardingsphere.core.parsing.antler.parser.postgre;
import org.antlr.v4.runtime.CommonToken;
import org.antlr.v4.runtime.RecognitionException;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.AdvancedErrorStrategy;
import io.shardingsphere.core.parsing.antler.AdvancedParserATNSimulator;
import io.shardingsphere.parser.antlr.postgre.PostgreAlterTableParser;
public class PostgreAdvancedAlterTableParser extends PostgreAlterTableParser {
public PostgreAdvancedAlterTableParser(final TokenStream input) {
super(input);
_interp = new AdvancedParserATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache, ID);
this._errHandler = new AdvancedErrorStrategy(ID);
}
public Token match(final int ttype) throws RecognitionException {
Token t = getCurrentToken();
boolean compatID = false;
if (ID == ttype && ID > t.getType()) {
compatID = true;
}
if (t.getType() == ttype || compatID) {
if (ttype == Token.EOF) {
matchedEOF = true;
}
if (!matchedEOF && compatID && (t instanceof CommonToken)) {
CommonToken commonToken = (CommonToken) t;
commonToken.setType(ID);
}
_errHandler.reportMatch(this);
consume();
} else {
t = _errHandler.recoverInline(this);
if (_buildParseTrees && t.getTokenIndex() == -1) {
// we must have conjured up a new token during single token insertion
// if it's not the current symbol
_ctx.addErrorNode(createErrorNode(_ctx, t));
}
}
return t;
}
}
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package io.shardingsphere.core.parsing.antler.parser.postgre;
import org.antlr.v4.runtime.CommonToken;
import org.antlr.v4.runtime.RecognitionException;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.AdvancedErrorStrategy;
import io.shardingsphere.core.parsing.antler.AdvancedParserATNSimulator;
import io.shardingsphere.parser.antlr.postgre.PostgreCreateTableParser;
public class PostgreAdvancedCreateTableParser extends PostgreCreateTableParser {
public PostgreAdvancedCreateTableParser(final TokenStream input) {
super(input);
_interp = new AdvancedParserATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache, ID);
this._errHandler = new AdvancedErrorStrategy(ID);
}
public Token match(final int ttype) throws RecognitionException {
Token t = getCurrentToken();
boolean compatID = false;
if (ID == ttype && ID > t.getType()) {
compatID = true;
}
if (t.getType() == ttype || compatID) {
if (ttype == Token.EOF) {
matchedEOF = true;
}
if (!matchedEOF && compatID && (t instanceof CommonToken)) {
CommonToken commonToken = (CommonToken) t;
commonToken.setType(ID);
}
_errHandler.reportMatch(this);
consume();
} else {
t = _errHandler.recoverInline(this);
if (_buildParseTrees && t.getTokenIndex() == -1) {
// we must have conjured up a new token during single token insertion
// if it's not the current symbol
_ctx.addErrorNode(createErrorNode(_ctx, t));
}
}
return t;
}
}
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package io.shardingsphere.core.parsing.antler.parser.postgre;
import org.antlr.v4.runtime.CommonToken;
import org.antlr.v4.runtime.RecognitionException;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.AdvancedErrorStrategy;
import io.shardingsphere.core.parsing.antler.AdvancedParserATNSimulator;
import io.shardingsphere.parser.antlr.postgre.PostgreDropTableParser;
public class PostgreAdvancedDropTableParser extends PostgreDropTableParser {
public PostgreAdvancedDropTableParser(final TokenStream input) {
super(input);
_interp = new AdvancedParserATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache, ID);
this._errHandler = new AdvancedErrorStrategy(ID);
}
public Token match(final int ttype) throws RecognitionException {
Token t = getCurrentToken();
boolean compatID = false;
if (ID == ttype && ID > t.getType()) {
compatID = true;
}
if (t.getType() == ttype || compatID) {
if (ttype == Token.EOF) {
matchedEOF = true;
}
if (!matchedEOF && compatID && (t instanceof CommonToken)) {
CommonToken commonToken = (CommonToken) t;
commonToken.setType(ID);
}
_errHandler.reportMatch(this);
consume();
} else {
t = _errHandler.recoverInline(this);
if (_buildParseTrees && t.getTokenIndex() == -1) {
// we must have conjured up a new token during single token insertion
// if it's not the current symbol
_ctx.addErrorNode(createErrorNode(_ctx, t));
}
}
return t;
}
}
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package io.shardingsphere.core.parsing.antler.parser.postgre;
import org.antlr.v4.runtime.CommonToken;
import org.antlr.v4.runtime.RecognitionException;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.AdvancedErrorStrategy;
import io.shardingsphere.core.parsing.antler.AdvancedParserATNSimulator;
import io.shardingsphere.parser.antlr.postgre.PostgreTruncateTableParser;
public class PostgreAdvancedTruncateTableParser extends PostgreTruncateTableParser {
public PostgreAdvancedTruncateTableParser(final TokenStream input) {
super(input);
_interp = new AdvancedParserATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache, ID);
this._errHandler = new AdvancedErrorStrategy(ID);
}
public Token match(final int ttype) throws RecognitionException {
Token t = getCurrentToken();
boolean compatID = false;
if (ID == ttype && ID > t.getType()) {
compatID = true;
}
if (t.getType() == ttype || compatID) {
if (ttype == Token.EOF) {
matchedEOF = true;
}
if (!matchedEOF && compatID && (t instanceof CommonToken)) {
CommonToken commonToken = (CommonToken) t;
commonToken.setType(ID);
}
_errHandler.reportMatch(this);
consume();
} else {
t = _errHandler.recoverInline(this);
if (_buildParseTrees && t.getTokenIndex() == -1) {
// we must have conjured up a new token during single token insertion
// if it's not the current symbol
_ctx.addErrorNode(createErrorNode(_ctx, t));
}
}
return t;
}
}
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package io.shardingsphere.core.parsing.antler.parser.sqlserver;
import org.antlr.v4.runtime.CommonToken;
import org.antlr.v4.runtime.RecognitionException;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.AdvancedErrorStrategy;
import io.shardingsphere.core.parsing.antler.AdvancedParserATNSimulator;
import io.shardingsphere.parser.antlr.sqlserver.SQLServerAlterTableParser;
public class SQLServerAdvancedAlterTableParser extends SQLServerAlterTableParser {
public SQLServerAdvancedAlterTableParser(final TokenStream input) {
super(input);
_interp = new AdvancedParserATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache, ID);
this._errHandler = new AdvancedErrorStrategy(ID);
}
public Token match(final int ttype) throws RecognitionException {
Token t = getCurrentToken();
boolean compatID = false;
if (ID == ttype && ID > t.getType()) {
compatID = true;
}
if (t.getType() == ttype || compatID) {
if (ttype == Token.EOF) {
matchedEOF = true;
}
if (!matchedEOF && compatID && (t instanceof CommonToken)) {
CommonToken commonToken = (CommonToken) t;
commonToken.setType(ID);
}
_errHandler.reportMatch(this);
consume();
} else {
t = _errHandler.recoverInline(this);
if (_buildParseTrees && t.getTokenIndex() == -1) {
// we must have conjured up a new token during single token insertion
// if it's not the current symbol
_ctx.addErrorNode(createErrorNode(_ctx, t));
}
}
return t;
}
}
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package io.shardingsphere.core.parsing.antler.parser.sqlserver;
import org.antlr.v4.runtime.CommonToken;
import org.antlr.v4.runtime.RecognitionException;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.AdvancedErrorStrategy;
import io.shardingsphere.core.parsing.antler.AdvancedParserATNSimulator;
import io.shardingsphere.parser.antlr.sqlserver.SQLServerCreateTableParser;
public class SQLServerAdvancedCreateTableParser extends SQLServerCreateTableParser {
public SQLServerAdvancedCreateTableParser(final TokenStream input) {
super(input);
_interp = new AdvancedParserATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache, ID);
this._errHandler = new AdvancedErrorStrategy(ID);
}
public Token match(final int ttype) throws RecognitionException {
Token t = getCurrentToken();
boolean compatID = false;
if (ID == ttype && ID > t.getType()) {
compatID = true;
}
if (t.getType() == ttype || compatID) {
if (ttype == Token.EOF) {
matchedEOF = true;
}
if (!matchedEOF && compatID && (t instanceof CommonToken)) {
CommonToken commonToken = (CommonToken) t;
commonToken.setType(ID);
}
_errHandler.reportMatch(this);
consume();
} else {
t = _errHandler.recoverInline(this);
if (_buildParseTrees && t.getTokenIndex() == -1) {
// we must have conjured up a new token during single token insertion
// if it's not the current symbol
_ctx.addErrorNode(createErrorNode(_ctx, t));
}
}
return t;
}
}
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package io.shardingsphere.core.parsing.antler.parser.sqlserver;
import org.antlr.v4.runtime.CommonToken;
import org.antlr.v4.runtime.RecognitionException;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.AdvancedErrorStrategy;
import io.shardingsphere.core.parsing.antler.AdvancedParserATNSimulator;
import io.shardingsphere.parser.antlr.sqlserver.SQLServerDropTableParser;
public class SQLServerAdvancedDropTableParser extends SQLServerDropTableParser {
public SQLServerAdvancedDropTableParser(final TokenStream input) {
super(input);
_interp = new AdvancedParserATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache, ID);
this._errHandler = new AdvancedErrorStrategy(ID);
}
public Token match(final int ttype) throws RecognitionException {
Token t = getCurrentToken();
boolean compatID = false;
if (ID == ttype && ID > t.getType()) {
compatID = true;
}
if (t.getType() == ttype || compatID) {
if (ttype == Token.EOF) {
matchedEOF = true;
}
if (!matchedEOF && compatID && (t instanceof CommonToken)) {
CommonToken commonToken = (CommonToken) t;
commonToken.setType(ID);
}
_errHandler.reportMatch(this);
consume();
} else {
t = _errHandler.recoverInline(this);
if (_buildParseTrees && t.getTokenIndex() == -1) {
// we must have conjured up a new token during single token insertion
// if it's not the current symbol
_ctx.addErrorNode(createErrorNode(_ctx, t));
}
}
return t;
}
}
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package io.shardingsphere.core.parsing.antler.parser.sqlserver;
import org.antlr.v4.runtime.CommonToken;
import org.antlr.v4.runtime.RecognitionException;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream;
import io.shardingsphere.core.parsing.antler.AdvancedErrorStrategy;
import io.shardingsphere.core.parsing.antler.AdvancedParserATNSimulator;
import io.shardingsphere.parser.antlr.sqlserver.SQLServerTruncateTableParser;
public class SQLServerAdvancedTruncateTableParser extends SQLServerTruncateTableParser {
public SQLServerAdvancedTruncateTableParser(final TokenStream input) {
super(input);
_interp = new AdvancedParserATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache, ID);
this._errHandler = new AdvancedErrorStrategy(ID);
}
public Token match(final int ttype) throws RecognitionException {
Token t = getCurrentToken();
boolean compatID = false;
if (ID == ttype && ID > t.getType()) {
compatID = true;
}
if (t.getType() == ttype || compatID) {
if (ttype == Token.EOF) {
matchedEOF = true;
}
if (!matchedEOF && compatID && (t instanceof CommonToken)) {
CommonToken commonToken = (CommonToken) t;
commonToken.setType(ID);
}
_errHandler.reportMatch(this);
consume();
} else {
t = _errHandler.recoverInline(this);
if (_buildParseTrees && t.getTokenIndex() == -1) {
// we must have conjured up a new token during single token insertion
// if it's not the current symbol
_ctx.addErrorNode(createErrorNode(_ctx, t));
}
}
return t;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册