From df5ae9507f8e86c75da670b116f35614c37f6b59 Mon Sep 17 00:00:00 2001 From: anqiansong Date: Sat, 8 May 2021 21:35:27 +0800 Subject: [PATCH] replace antlr module (#672) * replace antlr module * refactor version of antlr --- go.mod | 3 +-- go.sum | 4 ++++ tools/goctl/api/parser/g4/ast/apiparser.go | 2 +- tools/goctl/api/parser/g4/ast/ast.go | 2 +- tools/goctl/api/parser/g4/gen/api/apiparser_base_visitor.go | 2 +- tools/goctl/api/parser/g4/gen/api/apiparser_lexer.go | 2 +- tools/goctl/api/parser/g4/gen/api/apiparser_parser.go | 2 +- tools/goctl/api/parser/g4/gen/api/apiparser_visitor.go | 2 +- tools/goctl/api/parser/g4/gen/api/baseparser.go | 2 +- 9 files changed, 12 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 60bd06ae..32bd2e86 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,6 @@ require ( github.com/ClickHouse/clickhouse-go v1.4.3 github.com/DATA-DOG/go-sqlmock v1.4.1 github.com/alicebob/miniredis/v2 v2.14.1 - github.com/antlr/antlr4 v0.0.0-20210105212045-464bcbc32de2 github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/emicklei/proto v1.9.0 @@ -44,6 +43,7 @@ require ( github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6 // indirect github.com/urfave/cli v1.22.5 github.com/xwb1989/sqlparser v0.0.0-20180606152119-120387863bf2 + github.com/zeromicro/antlr v0.0.1 // indirect go.etcd.io/etcd v0.0.0-20200402134248-51bdeb39e698 go.uber.org/automaxprocs v1.3.0 golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect @@ -61,4 +61,3 @@ require ( honnef.co/go/tools v0.0.1-2020.1.4 // indirect sigs.k8s.io/yaml v1.2.0 // indirect ) -replace github.com/antlr/antlr4/runtime/Go/antlr => github.com/antlr/antlr4 v0.0.0-20210105212045-464bcbc32de2 \ No newline at end of file diff --git a/go.sum b/go.sum index adf2df98..f33a8774 100644 --- a/go.sum +++ b/go.sum @@ -276,6 +276,10 @@ github.com/xwb1989/sqlparser v0.0.0-20180606152119-120387863bf2/go.mod h1:hzfGeI github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb h1:ZkM6LRnq40pR1Ox0hTHlnpkcOTuFIDQpZ1IN8rKKhX0= github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= +github.com/zeromicro/antlr v0.0.0-20210508120604-8d7a7786f5c4 h1:wt86gT5lsN+xWmij6lFCrDIqoxeOnqM2MxiO7cNm+Lo= +github.com/zeromicro/antlr v0.0.0-20210508120604-8d7a7786f5c4/go.mod h1:nfpjEwFR6Q4xGDJMcZnCL9tEfQRgszMwu3rDz2Z+p5M= +github.com/zeromicro/antlr v0.0.1 h1:CQpIn/dc0pUjgGQ81y98s/NGOm2Hfru2NNio2I9mQgk= +github.com/zeromicro/antlr v0.0.1/go.mod h1:nfpjEwFR6Q4xGDJMcZnCL9tEfQRgszMwu3rDz2Z+p5M= go.etcd.io/bbolt v1.3.4 h1:hi1bXHMVrlQh6WwxAy+qZCV/SYIlqo+Ushwdpa4tAKg= go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.etcd.io/etcd v0.0.0-20200402134248-51bdeb39e698 h1:jWtjCJX1qxhHISBMLRztWwR+EXkI7MJAF2HjHAE/x/I= diff --git a/tools/goctl/api/parser/g4/ast/apiparser.go b/tools/goctl/api/parser/g4/ast/apiparser.go index 3fe9abee..ce14f1a3 100644 --- a/tools/goctl/api/parser/g4/ast/apiparser.go +++ b/tools/goctl/api/parser/g4/ast/apiparser.go @@ -6,9 +6,9 @@ import ( "path/filepath" "strings" - "github.com/antlr/antlr4/runtime/Go/antlr" "github.com/tal-tech/go-zero/tools/goctl/api/parser/g4/gen/api" "github.com/tal-tech/go-zero/tools/goctl/util/console" + "github.com/zeromicro/antlr" ) type ( diff --git a/tools/goctl/api/parser/g4/ast/ast.go b/tools/goctl/api/parser/g4/ast/ast.go index e5f05c36..7a722ad4 100644 --- a/tools/goctl/api/parser/g4/ast/ast.go +++ b/tools/goctl/api/parser/g4/ast/ast.go @@ -5,9 +5,9 @@ import ( "sort" "strings" - "github.com/antlr/antlr4/runtime/Go/antlr" "github.com/tal-tech/go-zero/tools/goctl/api/parser/g4/gen/api" "github.com/tal-tech/go-zero/tools/goctl/util/console" + "github.com/zeromicro/antlr" ) type ( diff --git a/tools/goctl/api/parser/g4/gen/api/apiparser_base_visitor.go b/tools/goctl/api/parser/g4/gen/api/apiparser_base_visitor.go index 7750939d..e3877173 100644 --- a/tools/goctl/api/parser/g4/gen/api/apiparser_base_visitor.go +++ b/tools/goctl/api/parser/g4/gen/api/apiparser_base_visitor.go @@ -1,7 +1,7 @@ // Code generated from tools/goctl/api/parser/g4/ApiParser.g4 by ANTLR 4.9. DO NOT EDIT. package api // ApiParser -import "github.com/antlr/antlr4/runtime/Go/antlr" +import "github.com/zeromicro/antlr" type BaseApiParserVisitor struct { *antlr.BaseParseTreeVisitor diff --git a/tools/goctl/api/parser/g4/gen/api/apiparser_lexer.go b/tools/goctl/api/parser/g4/gen/api/apiparser_lexer.go index e1f791bb..306d6cd5 100644 --- a/tools/goctl/api/parser/g4/gen/api/apiparser_lexer.go +++ b/tools/goctl/api/parser/g4/gen/api/apiparser_lexer.go @@ -6,7 +6,7 @@ import ( "fmt" "unicode" - "github.com/antlr/antlr4/runtime/Go/antlr" + "github.com/zeromicro/antlr" ) // Suppress unused import error diff --git a/tools/goctl/api/parser/g4/gen/api/apiparser_parser.go b/tools/goctl/api/parser/g4/gen/api/apiparser_parser.go index c46cc150..938d3996 100644 --- a/tools/goctl/api/parser/g4/gen/api/apiparser_parser.go +++ b/tools/goctl/api/parser/g4/gen/api/apiparser_parser.go @@ -6,7 +6,7 @@ import ( "reflect" "strconv" - "github.com/antlr/antlr4/runtime/Go/antlr" + "github.com/zeromicro/antlr" ) // Suppress unused import errors diff --git a/tools/goctl/api/parser/g4/gen/api/apiparser_visitor.go b/tools/goctl/api/parser/g4/gen/api/apiparser_visitor.go index 2a961bb4..259565dd 100644 --- a/tools/goctl/api/parser/g4/gen/api/apiparser_visitor.go +++ b/tools/goctl/api/parser/g4/gen/api/apiparser_visitor.go @@ -1,7 +1,7 @@ // Code generated from tools/goctl/api/parser/g4/ApiParser.g4 by ANTLR 4.9. DO NOT EDIT. package api // ApiParser -import "github.com/antlr/antlr4/runtime/Go/antlr" +import "github.com/zeromicro/antlr" // A complete Visitor for a parse tree produced by ApiParserParser. type ApiParserVisitor interface { diff --git a/tools/goctl/api/parser/g4/gen/api/baseparser.go b/tools/goctl/api/parser/g4/gen/api/baseparser.go index 672fb037..3d6772e5 100644 --- a/tools/goctl/api/parser/g4/gen/api/baseparser.go +++ b/tools/goctl/api/parser/g4/gen/api/baseparser.go @@ -7,7 +7,7 @@ import ( "strings" "unicode" - "github.com/antlr/antlr4/runtime/Go/antlr" + "github.com/zeromicro/antlr" ) const (