Update antlr4 version to 4.13.0 #81

Merged
fyrchik merged 2 commits from acid-ant/frostfs-sdk-go:bugfix/75-antlr4-in-docker into master 2023-06-01 13:15:13 +00:00
9 changed files with 501 additions and 381 deletions

4
Dockerfile Normal file
View file

@ -0,0 +1,4 @@
FROM golang:1.19
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install make openjdk-11-jre -y
WORKDIR /work

View file

@ -1,5 +1,7 @@
#!/usr/bin/make -f #!/usr/bin/make -f
ANTLR_VERSION="4.13.0"
# Run tests # Run tests
test: test:
@go test ./... -cover @go test ./... -cover
@ -29,6 +31,19 @@ format:
@echo "⇒ Processing goimports check" @echo "⇒ Processing goimports check"
@goimports -w ./ @goimports -w ./
policy:
@wget -q https://www.antlr.org/download/antlr-${ANTLR_VERSION}-complete.jar -O antlr4-tool.jar
@java -Xmx500M -cp "`pwd`/antlr4-tool.jar" "org.antlr.v4.Tool" -o `pwd`/netmap/parser/ -Dlanguage=Go -no-listener -visitor `pwd`/netmap/parser/Query.g4 `pwd`/netmap/parser/QueryLexer.g4
# Run `make %` in truecloudlab/frostfs-sdk-go container(Golang+Java)
docker/%:

Do we need to specify platform?

Do we need to specify platform?
@docker build -t truecloudlab/frostfs-sdk-go --platform linux/amd64 . > /dev/null
@docker run --rm -t \
-v `pwd`:/work \
-u "$$(id -u):$$(id -g)" \
--env HOME=/work \
truecloudlab/frostfs-sdk-go make $*
# Show this help prompt # Show this help prompt
help: help:
@echo ' Usage:' @echo ' Usage:'

4
go.mod
View file

@ -7,13 +7,14 @@ require (
git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb
git.frostfs.info/TrueCloudLab/hrw v1.2.0 git.frostfs.info/TrueCloudLab/hrw v1.2.0
git.frostfs.info/TrueCloudLab/tzhash v1.8.0 git.frostfs.info/TrueCloudLab/tzhash v1.8.0
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230512164433-5d1fd1a340c9 github.com/antlr4-go/antlr/v4 v4.13.0
github.com/google/uuid v1.3.0 github.com/google/uuid v1.3.0
github.com/hashicorp/golang-lru/v2 v2.0.2 github.com/hashicorp/golang-lru/v2 v2.0.2
github.com/mr-tron/base58 v1.2.0 github.com/mr-tron/base58 v1.2.0
github.com/nspcc-dev/neo-go v0.101.1 github.com/nspcc-dev/neo-go v0.101.1
github.com/stretchr/testify v1.8.3 github.com/stretchr/testify v1.8.3
go.uber.org/zap v1.24.0 go.uber.org/zap v1.24.0
google.golang.org/grpc v1.55.0
) )
require ( require (
@ -50,7 +51,6 @@ require (
golang.org/x/sys v0.8.0 // indirect golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect golang.org/x/text v0.9.0 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
google.golang.org/grpc v1.55.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect
) )

BIN
go.sum

Binary file not shown.

View file

@ -1,8 +1,8 @@
// Code generated from Query.g4 by ANTLR 4.12.0. DO NOT EDIT. // Code generated from /work/netmap/parser/Query.g4 by ANTLR 4.13.0. DO NOT EDIT.
package parser // Query package parser // Query
import "github.com/antlr/antlr4/runtime/Go/antlr/v4" import "github.com/antlr4-go/antlr/v4"
type BaseQueryVisitor struct { type BaseQueryVisitor struct {
*antlr.BaseParseTreeVisitor *antlr.BaseParseTreeVisitor

View file

@ -1,13 +1,12 @@
// Code generated from QueryLexer.g4 by ANTLR 4.12.0. DO NOT EDIT. // Code generated from /work/netmap/parser/QueryLexer.g4 by ANTLR 4.13.0. DO NOT EDIT.
package parser package parser
import ( import (
"fmt" "fmt"
"github.com/antlr4-go/antlr/v4"
"sync" "sync"
"unicode" "unicode"
"github.com/antlr/antlr4/runtime/Go/antlr/v4"
) )
// Suppress unused import error // Suppress unused import error
@ -22,45 +21,45 @@ type QueryLexer struct {
// TODO: EOF string // TODO: EOF string
} }
var querylexerLexerStaticData struct { var QueryLexerLexerStaticData struct {
once sync.Once once sync.Once
serializedATN []int32 serializedATN []int32
channelNames []string ChannelNames []string
modeNames []string ModeNames []string
literalNames []string LiteralNames []string
symbolicNames []string SymbolicNames []string
ruleNames []string RuleNames []string
predictionContextCache *antlr.PredictionContextCache PredictionContextCache *antlr.PredictionContextCache
atn *antlr.ATN atn *antlr.ATN
decisionToDFA []*antlr.DFA decisionToDFA []*antlr.DFA
} }
func querylexerLexerInit() { func querylexerLexerInit() {
staticData := &querylexerLexerStaticData staticData := &QueryLexerLexerStaticData
staticData.channelNames = []string{ staticData.ChannelNames = []string{
"DEFAULT_TOKEN_CHANNEL", "HIDDEN", "DEFAULT_TOKEN_CHANNEL", "HIDDEN",
} }
staticData.modeNames = []string{ staticData.ModeNames = []string{
"DEFAULT_MODE", "DEFAULT_MODE",
} }
staticData.literalNames = []string{ staticData.LiteralNames = []string{
"", "'AND'", "'OR'", "", "'REP'", "'IN'", "'AS'", "'CBF'", "'SELECT'", "", "'AND'", "'OR'", "", "'REP'", "'IN'", "'AS'", "'CBF'", "'SELECT'",
"'FROM'", "'FILTER'", "'*'", "'SAME'", "'DISTINCT'", "'('", "')'", "'@'", "'FROM'", "'FILTER'", "'*'", "'SAME'", "'DISTINCT'", "'('", "')'", "'@'",
"", "", "'0'", "", "", "'0'",
} }
staticData.symbolicNames = []string{ staticData.SymbolicNames = []string{
"", "AND_OP", "OR_OP", "SIMPLE_OP", "REP", "IN", "AS", "CBF", "SELECT", "", "AND_OP", "OR_OP", "SIMPLE_OP", "REP", "IN", "AS", "CBF", "SELECT",
"FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", "CLAUSE_DISTINCT", "L_PAREN", "FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", "CLAUSE_DISTINCT", "L_PAREN",
"R_PAREN", "AT", "IDENT", "NUMBER1", "ZERO", "STRING", "WS", "R_PAREN", "AT", "IDENT", "NUMBER1", "ZERO", "STRING", "WS",
} }
staticData.ruleNames = []string{ staticData.RuleNames = []string{
"AND_OP", "OR_OP", "SIMPLE_OP", "REP", "IN", "AS", "CBF", "SELECT", "AND_OP", "OR_OP", "SIMPLE_OP", "REP", "IN", "AS", "CBF", "SELECT",
"FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", "CLAUSE_DISTINCT", "L_PAREN", "FROM", "FILTER", "WILDCARD", "CLAUSE_SAME", "CLAUSE_DISTINCT", "L_PAREN",
"R_PAREN", "AT", "IDENT", "Digit", "Nondigit", "NUMBER1", "ZERO", "STRING", "R_PAREN", "AT", "IDENT", "Digit", "Nondigit", "NUMBER1", "ZERO", "STRING",
"ESC", "UNICODE", "HEX", "SAFECODEPOINTSINGLE", "SAFECODEPOINTDOUBLE", "ESC", "UNICODE", "HEX", "SAFECODEPOINTSINGLE", "SAFECODEPOINTDOUBLE",
"WS", "WS",
} }
staticData.predictionContextCache = antlr.NewPredictionContextCache() staticData.PredictionContextCache = antlr.NewPredictionContextCache()
staticData.serializedATN = []int32{ staticData.serializedATN = []int32{
4, 0, 21, 198, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 0, 21, 198, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2,
4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2,
@ -166,7 +165,7 @@ func querylexerLexerInit() {
// NewQueryLexer(). You can call this function if you wish to initialize the static state ahead // NewQueryLexer(). You can call this function if you wish to initialize the static state ahead
// of time. // of time.
func QueryLexerInit() { func QueryLexerInit() {
staticData := &querylexerLexerStaticData staticData := &QueryLexerLexerStaticData
staticData.once.Do(querylexerLexerInit) staticData.once.Do(querylexerLexerInit)
} }
@ -175,13 +174,13 @@ func NewQueryLexer(input antlr.CharStream) *QueryLexer {
QueryLexerInit() QueryLexerInit()
l := new(QueryLexer) l := new(QueryLexer)
l.BaseLexer = antlr.NewBaseLexer(input) l.BaseLexer = antlr.NewBaseLexer(input)
staticData := &querylexerLexerStaticData staticData := &QueryLexerLexerStaticData
l.Interpreter = antlr.NewLexerATNSimulator(l, staticData.atn, staticData.decisionToDFA, staticData.predictionContextCache) l.Interpreter = antlr.NewLexerATNSimulator(l, staticData.atn, staticData.decisionToDFA, staticData.PredictionContextCache)
l.channelNames = staticData.channelNames l.channelNames = staticData.ChannelNames
l.modeNames = staticData.modeNames l.modeNames = staticData.ModeNames
l.RuleNames = staticData.ruleNames l.RuleNames = staticData.RuleNames
l.LiteralNames = staticData.literalNames l.LiteralNames = staticData.LiteralNames
l.SymbolicNames = staticData.symbolicNames l.SymbolicNames = staticData.SymbolicNames
l.GrammarFileName = "QueryLexer.g4" l.GrammarFileName = "QueryLexer.g4"
// TODO: l.EOF = antlr.TokenEOF // TODO: l.EOF = antlr.TokenEOF

File diff suppressed because it is too large Load diff

View file

@ -1,8 +1,8 @@
// Code generated from Query.g4 by ANTLR 4.12.0. DO NOT EDIT. // Code generated from /work/netmap/parser/Query.g4 by ANTLR 4.13.0. DO NOT EDIT.
package parser // Query package parser // Query
import "github.com/antlr/antlr4/runtime/Go/antlr/v4" import "github.com/antlr4-go/antlr/v4"
// A complete Visitor for a parse tree produced by Query. // A complete Visitor for a parse tree produced by Query.
type QueryVisitor interface { type QueryVisitor interface {

View file

@ -9,7 +9,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap/parser" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap/parser"
"github.com/antlr/antlr4/runtime/Go/antlr/v4" "github.com/antlr4-go/antlr/v4"
) )
// PlacementPolicy declares policy to store objects in the FrostFS container. // PlacementPolicy declares policy to store objects in the FrostFS container.