Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
ae7c0f8a
Shardingsphere
项目概览
apache
/
Shardingsphere
通知
56
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Shardingsphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ae7c0f8a
编写于
9月 23, 2018
作者:
C
codefairy08
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add MySQL DDL table related ast builder
上级
5825730f
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
160 addition
and
0 deletion
+160
-0
sharding-jdbc-ddl-parser/src/main/java/io/shardingsphere/core/parsing/antler/ast/AbstractParseTreeBuilder.java
...ere/core/parsing/antler/ast/AbstractParseTreeBuilder.java
+28
-0
sharding-jdbc-ddl-parser/src/main/java/io/shardingsphere/core/parsing/antler/ast/ParseTreeBuilder.java
...rdingsphere/core/parsing/antler/ast/ParseTreeBuilder.java
+7
-0
sharding-jdbc-ddl-parser/src/main/java/io/shardingsphere/core/parsing/antler/ast/mysql/MySQLAlterTableParseTreeBuilder.java
...ing/antler/ast/mysql/MySQLAlterTableParseTreeBuilder.java
+33
-0
sharding-jdbc-ddl-parser/src/main/java/io/shardingsphere/core/parsing/antler/ast/mysql/MySQLCreateTableParseTreeBuilder.java
...ng/antler/ast/mysql/MySQLCreateTableParseTreeBuilder.java
+31
-0
sharding-jdbc-ddl-parser/src/main/java/io/shardingsphere/core/parsing/antler/ast/mysql/MySQLDropTableParseTreeBuilder.java
...sing/antler/ast/mysql/MySQLDropTableParseTreeBuilder.java
+30
-0
sharding-jdbc-ddl-parser/src/main/java/io/shardingsphere/core/parsing/antler/ast/mysql/MySQLTruncateTableParseTreeBuilder.java
.../antler/ast/mysql/MySQLTruncateTableParseTreeBuilder.java
+31
-0
未找到文件。
sharding-jdbc-ddl-parser/src/main/java/io/shardingsphere/core/parsing/antler/ast/AbstractParseTreeBuilder.java
0 → 100644
浏览文件 @
ae7c0f8a
package
io.shardingsphere.core.parsing.antler.ast
;
import
org.antlr.v4.runtime.CharStream
;
import
org.antlr.v4.runtime.CharStreams
;
import
org.antlr.v4.runtime.CommonTokenStream
;
import
org.antlr.v4.runtime.Lexer
;
import
org.antlr.v4.runtime.Parser
;
import
org.antlr.v4.runtime.ParserRuleContext
;
import
org.antlr.v4.runtime.TokenStream
;
public
abstract
class
AbstractParseTreeBuilder
implements
ParseTreeBuilder
{
@Override
public
ParserRuleContext
parse
(
final
String
input
)
{
CharStream
stream
=
CharStreams
.
fromString
(
input
);
Lexer
lexer
=
newLexer
(
stream
);
CommonTokenStream
tokenStream
=
new
CommonTokenStream
(
lexer
);
Parser
parser
=
newParser
(
tokenStream
);
return
getParserTree
(
parser
);
}
protected
abstract
Lexer
newLexer
(
final
CharStream
stream
);
protected
abstract
Parser
newParser
(
final
TokenStream
tokenStream
);
protected
abstract
ParserRuleContext
getParserTree
(
final
Parser
parser
);
}
sharding-jdbc-ddl-parser/src/main/java/io/shardingsphere/core/parsing/antler/ast/ParseTreeBuilder.java
0 → 100644
浏览文件 @
ae7c0f8a
package
io.shardingsphere.core.parsing.antler.ast
;
import
org.antlr.v4.runtime.ParserRuleContext
;
public
interface
ParseTreeBuilder
{
ParserRuleContext
parse
(
final
String
input
);
}
sharding-jdbc-ddl-parser/src/main/java/io/shardingsphere/core/parsing/antler/ast/mysql/MySQLAlterTableParseTreeBuilder.java
0 → 100644
浏览文件 @
ae7c0f8a
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.MySQLAdvancedAlterTableParser
;
import
io.shardingsphere.parser.antlr.mysql.MySQLAlterTableLexer
;
public
class
MySQLAlterTableParseTreeBuilder
extends
AbstractParseTreeBuilder
{
@Override
protected
Lexer
newLexer
(
final
CharStream
stream
)
{
return
new
MySQLAlterTableLexer
(
stream
);
}
@Override
protected
Parser
newParser
(
final
TokenStream
tokenStream
)
{
return
new
MySQLAdvancedAlterTableParser
(
tokenStream
);
}
@Override
protected
ParserRuleContext
getParserTree
(
final
Parser
parser
)
{
MySQLAdvancedAlterTableParser
alterTableParser
=
(
MySQLAdvancedAlterTableParser
)
parser
;
return
alterTableParser
.
alterTable
();
}
}
sharding-jdbc-ddl-parser/src/main/java/io/shardingsphere/core/parsing/antler/ast/mysql/MySQLCreateTableParseTreeBuilder.java
0 → 100644
浏览文件 @
ae7c0f8a
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.MySQLAdvancedCreateTableParser
;
import
io.shardingsphere.parser.antlr.mysql.MySQLCreateTableLexer
;
public
class
MySQLCreateTableParseTreeBuilder
extends
AbstractParseTreeBuilder
{
@Override
protected
Lexer
newLexer
(
final
CharStream
stream
)
{
return
new
MySQLCreateTableLexer
(
stream
);
}
@Override
protected
Parser
newParser
(
final
TokenStream
tokenStream
)
{
return
new
MySQLAdvancedCreateTableParser
(
tokenStream
);
}
@Override
protected
ParserRuleContext
getParserTree
(
final
Parser
parser
)
{
MySQLAdvancedCreateTableParser
createTableParser
=
(
MySQLAdvancedCreateTableParser
)
parser
;
return
createTableParser
.
createTable
();
}
}
sharding-jdbc-ddl-parser/src/main/java/io/shardingsphere/core/parsing/antler/ast/mysql/MySQLDropTableParseTreeBuilder.java
0 → 100644
浏览文件 @
ae7c0f8a
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.MySQLAdvancedDropTableParser
;
import
io.shardingsphere.parser.antlr.mysql.MySQLDropTableLexer
;
public
class
MySQLDropTableParseTreeBuilder
extends
AbstractParseTreeBuilder
{
@Override
protected
Lexer
newLexer
(
final
CharStream
stream
)
{
return
new
MySQLDropTableLexer
(
stream
);
}
protected
Parser
newParser
(
final
TokenStream
tokenStream
)
{
return
new
MySQLAdvancedDropTableParser
(
tokenStream
);
}
@Override
protected
ParserRuleContext
getParserTree
(
final
Parser
parser
)
{
MySQLAdvancedDropTableParser
dropTableParser
=
(
MySQLAdvancedDropTableParser
)
parser
;
return
dropTableParser
.
dropTable
();
}
}
sharding-jdbc-ddl-parser/src/main/java/io/shardingsphere/core/parsing/antler/ast/mysql/MySQLTruncateTableParseTreeBuilder.java
0 → 100644
浏览文件 @
ae7c0f8a
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
{
@Override
protected
Lexer
newLexer
(
final
CharStream
stream
)
{
return
new
MySQLTruncateTableLexer
(
stream
);
}
@Override
protected
Parser
newParser
(
final
TokenStream
tokenStream
)
{
return
new
MySQLAdvancedTruncateTableParser
(
tokenStream
);
}
@Override
protected
ParserRuleContext
getParserTree
(
final
Parser
parser
)
{
MySQLAdvancedTruncateTableParser
truncateTableParser
=
(
MySQLAdvancedTruncateTableParser
)
parser
;
return
truncateTableParser
.
truncateTable
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录