summaryrefslogtreecommitdiff
path: root/vendor/github.com/antlr4-go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/antlr4-go')
-rw-r--r--vendor/github.com/antlr4-go/antlr/v4/antlrdoc.go8
-rw-r--r--vendor/github.com/antlr4-go/antlr/v4/atn.go8
-rw-r--r--vendor/github.com/antlr4-go/antlr/v4/atn_config.go3
-rw-r--r--vendor/github.com/antlr4-go/antlr/v4/input_stream.go2
-rw-r--r--vendor/github.com/antlr4-go/antlr/v4/jcollect.go5
-rw-r--r--vendor/github.com/antlr4-go/antlr/v4/lexer.go2
-rw-r--r--vendor/github.com/antlr4-go/antlr/v4/ll1_analyzer.go1
-rw-r--r--vendor/github.com/antlr4-go/antlr/v4/mutex.go41
-rw-r--r--vendor/github.com/antlr4-go/antlr/v4/mutex_nomutex.go32
-rw-r--r--vendor/github.com/antlr4-go/antlr/v4/parser_atn_simulator.go4
-rw-r--r--vendor/github.com/antlr4-go/antlr/v4/prediction_context.go60
-rw-r--r--vendor/github.com/antlr4-go/antlr/v4/recognizer.go2
-rw-r--r--vendor/github.com/antlr4-go/antlr/v4/statistics.go3
-rw-r--r--vendor/github.com/antlr4-go/antlr/v4/token.go82
-rw-r--r--vendor/github.com/antlr4-go/antlr/v4/utils.go53
15 files changed, 94 insertions, 212 deletions
diff --git a/vendor/github.com/antlr4-go/antlr/v4/antlrdoc.go b/vendor/github.com/antlr4-go/antlr/v4/antlrdoc.go
index 48bd362..3bb4fd7 100644
--- a/vendor/github.com/antlr4-go/antlr/v4/antlrdoc.go
+++ b/vendor/github.com/antlr4-go/antlr/v4/antlrdoc.go
@@ -17,9 +17,9 @@ ANTLR4 that it is compatible with (I.E. uses the /v4 path).
However, this was found to be problematic, as it meant that with the runtime embedded so far underneath the root
of the repo, the `go get` and related commands could not properly resolve the location of the go runtime source code.
This meant that the reference to the runtime in your `go.mod` file would refer to the correct source code, but would not
-list the release tag such as @4.13.1 - this was confusing, to say the least.
+list the release tag such as @4.12.0 - this was confusing, to say the least.
-As of 4.13.0, the runtime is now available as a go module in its own repo, and can be imported as `github.com/antlr4-go/antlr`
+As of 4.12.1, the runtime is now available as a go module in its own repo, and can be imported as `github.com/antlr4-go/antlr`
(the go get command should also be used with this path). See the main documentation for the ANTLR4 project for more information,
which is available at [ANTLR docs]. The documentation for using the Go runtime is available at [Go runtime docs].
@@ -49,7 +49,7 @@ Here is a general/recommended template for an ANTLR based recognizer in Go:
.
├── parser
│ ├── mygrammar.g4
- │ ├── antlr-4.13.1-complete.jar
+ │ ├── antlr-4.12.1-complete.jar
│ ├── generate.go
│ └── generate.sh
├── parsing - generated code goes here
@@ -71,7 +71,7 @@ And the generate.sh file will look similar to this:
#!/bin/sh
- alias antlr4='java -Xmx500M -cp "./antlr4-4.13.1-complete.jar:$CLASSPATH" org.antlr.v4.Tool'
+ alias antlr4='java -Xmx500M -cp "./antlr4-4.12.1-complete.jar:$CLASSPATH" org.antlr.v4.Tool'
antlr4 -Dlanguage=Go -no-visitor -package parsing *.g4
depending on whether you want visitors or listeners or any other ANTLR options. Not that another option here
diff --git a/vendor/github.com/antlr4-go/antlr/v4/atn.go b/vendor/github.com/antlr4-go/antlr/v4/atn.go
index e749ebd..cdeefed 100644
--- a/vendor/github.com/antlr4-go/antlr/v4/atn.go
+++ b/vendor/github.com/antlr4-go/antlr/v4/atn.go
@@ -4,6 +4,8 @@
package antlr
+import "sync"
+
// ATNInvalidAltNumber is used to represent an ALT number that has yet to be calculated or
// which is invalid for a particular struct such as [*antlr.BaseRuleContext]
var ATNInvalidAltNumber int
@@ -54,9 +56,9 @@ type ATN struct {
//
states []ATNState
- mu Mutex
- stateMu RWMutex
- edgeMu RWMutex
+ mu sync.Mutex
+ stateMu sync.RWMutex
+ edgeMu sync.RWMutex
}
// NewATN returns a new ATN struct representing the given grammarType and is used
diff --git a/vendor/github.com/antlr4-go/antlr/v4/atn_config.go b/vendor/github.com/antlr4-go/antlr/v4/atn_config.go
index 267308b..a83f25d 100644
--- a/vendor/github.com/antlr4-go/antlr/v4/atn_config.go
+++ b/vendor/github.com/antlr4-go/antlr/v4/atn_config.go
@@ -73,6 +73,9 @@ func NewATNConfig1(c *ATNConfig, state ATNState, context *PredictionContext) *AT
// NewATNConfig creates a new ATNConfig instance given an existing config, a state, a context and a semantic context, other 'constructors'
// are just wrappers around this one.
func NewATNConfig(c *ATNConfig, state ATNState, context *PredictionContext, semanticContext SemanticContext) *ATNConfig {
+ if semanticContext == nil {
+ panic("semanticContext cannot be nil") // TODO: Remove this - probably put here for some bug that is now fixed
+ }
b := &ATNConfig{}
b.InitATNConfig(c, state, c.GetAlt(), context, semanticContext)
b.cType = parserConfig
diff --git a/vendor/github.com/antlr4-go/antlr/v4/input_stream.go b/vendor/github.com/antlr4-go/antlr/v4/input_stream.go
index ab4e96b..b737fe8 100644
--- a/vendor/github.com/antlr4-go/antlr/v4/input_stream.go
+++ b/vendor/github.com/antlr4-go/antlr/v4/input_stream.go
@@ -148,7 +148,7 @@ func (is *InputStream) GetTextFromInterval(i Interval) string {
}
func (*InputStream) GetSourceName() string {
- return "Obtained from string"
+ return ""
}
// String returns the entire input stream as a string
diff --git a/vendor/github.com/antlr4-go/antlr/v4/jcollect.go b/vendor/github.com/antlr4-go/antlr/v4/jcollect.go
index 6d668f7..ceccd96 100644
--- a/vendor/github.com/antlr4-go/antlr/v4/jcollect.go
+++ b/vendor/github.com/antlr4-go/antlr/v4/jcollect.go
@@ -8,6 +8,7 @@ import (
"container/list"
"runtime/debug"
"sort"
+ "sync"
)
// Collectable is an interface that a struct should implement if it is to be
@@ -586,12 +587,12 @@ type VisitRecord struct {
type VisitList struct {
cache *list.List
- lock RWMutex
+ lock sync.RWMutex
}
var visitListPool = VisitList{
cache: list.New(),
- lock: RWMutex{},
+ lock: sync.RWMutex{},
}
// NewVisitRecord returns a new VisitRecord instance from the pool if available.
diff --git a/vendor/github.com/antlr4-go/antlr/v4/lexer.go b/vendor/github.com/antlr4-go/antlr/v4/lexer.go
index e5594b2..3c7896a 100644
--- a/vendor/github.com/antlr4-go/antlr/v4/lexer.go
+++ b/vendor/github.com/antlr4-go/antlr/v4/lexer.go
@@ -207,7 +207,7 @@ func (b *BaseLexer) NextToken() Token {
for {
b.thetype = TokenInvalidType
- ttype := b.safeMatch() // Defaults to LexerSkip
+ ttype := b.safeMatch()
if b.input.LA(1) == TokenEOF {
b.hitEOF = true
diff --git a/vendor/github.com/antlr4-go/antlr/v4/ll1_analyzer.go b/vendor/github.com/antlr4-go/antlr/v4/ll1_analyzer.go
index dfdff00..4955ac8 100644
--- a/vendor/github.com/antlr4-go/antlr/v4/ll1_analyzer.go
+++ b/vendor/github.com/antlr4-go/antlr/v4/ll1_analyzer.go
@@ -40,7 +40,6 @@ func (la *LL1Analyzer) getDecisionLookahead(s ATNState) []*IntervalSet {
for alt := 0; alt < count; alt++ {
look[alt] = NewIntervalSet()
- // TODO: This is one of the reasons that ATNConfigs are allocated and freed all the time - fix this tomorrow jim!
lookBusy := NewJStore[*ATNConfig, Comparator[*ATNConfig]](aConfEqInst, ClosureBusyCollection, "LL1Analyzer.getDecisionLookahead for lookBusy")
la.look1(s.GetTransitions()[alt].getTarget(), nil, BasePredictionContextEMPTY, look[alt], lookBusy, NewBitSet(), false, false)
diff --git a/vendor/github.com/antlr4-go/antlr/v4/mutex.go b/vendor/github.com/antlr4-go/antlr/v4/mutex.go
deleted file mode 100644
index 2b0cda4..0000000
--- a/vendor/github.com/antlr4-go/antlr/v4/mutex.go
+++ /dev/null
@@ -1,41 +0,0 @@
-//go:build !antlr.nomutex
-// +build !antlr.nomutex
-
-package antlr
-
-import "sync"
-
-// Mutex is a simple mutex implementation which just delegates to sync.Mutex, it
-// is used to provide a mutex implementation for the antlr package, which users
-// can turn off with the build tag -tags antlr.nomutex
-type Mutex struct {
- mu sync.Mutex
-}
-
-func (m *Mutex) Lock() {
- m.mu.Lock()
-}
-
-func (m *Mutex) Unlock() {
- m.mu.Unlock()
-}
-
-type RWMutex struct {
- mu sync.RWMutex
-}
-
-func (m *RWMutex) Lock() {
- m.mu.Lock()
-}
-
-func (m *RWMutex) Unlock() {
- m.mu.Unlock()
-}
-
-func (m *RWMutex) RLock() {
- m.mu.RLock()
-}
-
-func (m *RWMutex) RUnlock() {
- m.mu.RUnlock()
-}
diff --git a/vendor/github.com/antlr4-go/antlr/v4/mutex_nomutex.go b/vendor/github.com/antlr4-go/antlr/v4/mutex_nomutex.go
deleted file mode 100644
index 35ce435..0000000
--- a/vendor/github.com/antlr4-go/antlr/v4/mutex_nomutex.go
+++ /dev/null
@@ -1,32 +0,0 @@
-//go:build antlr.nomutex
-// +build antlr.nomutex
-
-package antlr
-
-type Mutex struct{}
-
-func (m *Mutex) Lock() {
- // No-op
-}
-
-func (m *Mutex) Unlock() {
- // No-op
-}
-
-type RWMutex struct{}
-
-func (m *RWMutex) Lock() {
- // No-op
-}
-
-func (m *RWMutex) Unlock() {
- // No-op
-}
-
-func (m *RWMutex) RLock() {
- // No-op
-}
-
-func (m *RWMutex) RUnlock() {
- // No-op
-}
diff --git a/vendor/github.com/antlr4-go/antlr/v4/parser_atn_simulator.go b/vendor/github.com/antlr4-go/antlr/v4/parser_atn_simulator.go
index 724fa17..ae28696 100644
--- a/vendor/github.com/antlr4-go/antlr/v4/parser_atn_simulator.go
+++ b/vendor/github.com/antlr4-go/antlr/v4/parser_atn_simulator.go
@@ -10,6 +10,8 @@ import (
"strings"
)
+var ()
+
// ClosureBusy is a store of ATNConfigs and is a tiny abstraction layer over
// a standard JStore so that we can use Lazy instantiation of the JStore, mostly
// to avoid polluting the stats module with a ton of JStore instances with nothing in them.
@@ -881,7 +883,7 @@ func (p *ParserATNSimulator) getPredicatePredictions(ambigAlts *BitSet, altToPre
// the ERROR state was reached, outerContext as the initial parser context from the paper
// or the parser stack at the instant before prediction commences.
//
-// The func returns the value to return from [AdaptivePredict], or
+// Teh func returns the value to return from [AdaptivePredict], or
// [ATNInvalidAltNumber] if a suitable alternative was not
// identified and [AdaptivePredict] should report an error instead.
func (p *ParserATNSimulator) getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(configs *ATNConfigSet, outerContext ParserRuleContext) int {
diff --git a/vendor/github.com/antlr4-go/antlr/v4/prediction_context.go b/vendor/github.com/antlr4-go/antlr/v4/prediction_context.go
index a1d5186..c1b80cc 100644
--- a/vendor/github.com/antlr4-go/antlr/v4/prediction_context.go
+++ b/vendor/github.com/antlr4-go/antlr/v4/prediction_context.go
@@ -6,6 +6,7 @@ package antlr
import (
"fmt"
+ "golang.org/x/exp/slices"
"strconv"
)
@@ -100,7 +101,7 @@ func NewArrayPredictionContext(parents []*PredictionContext, returnStates []int)
hash = murmurUpdate(hash, returnState)
}
hash = murmurFinish(hash, len(parents)<<1)
-
+
nec := &PredictionContext{}
nec.cachedHash = hash
nec.pcType = PredictionContextArray
@@ -114,9 +115,6 @@ func (p *PredictionContext) Hash() int {
}
func (p *PredictionContext) Equals(other Collectable[*PredictionContext]) bool {
- if p == other {
- return true
- }
switch p.pcType {
case PredictionContextEmpty:
otherP := other.(*PredictionContext)
@@ -140,11 +138,13 @@ func (p *PredictionContext) ArrayEquals(o Collectable[*PredictionContext]) bool
if p.cachedHash != other.Hash() {
return false // can't be same if hash is different
}
-
+
// Must compare the actual array elements and not just the array address
//
- return intSlicesEqual(p.returnStates, other.returnStates) &&
- pcSliceEqual(p.parents, other.parents)
+ return slices.Equal(p.returnStates, other.returnStates) &&
+ slices.EqualFunc(p.parents, other.parents, func(x, y *PredictionContext) bool {
+ return x.Equals(y)
+ })
}
func (p *PredictionContext) SingletonEquals(other Collectable[*PredictionContext]) bool {
@@ -152,23 +152,23 @@ func (p *PredictionContext) SingletonEquals(other Collectable[*PredictionContext
return false
}
otherP := other.(*PredictionContext)
- if otherP == nil || otherP.pcType != PredictionContextSingleton {
+ if otherP == nil {
return false
}
-
+
if p.cachedHash != otherP.Hash() {
return false // Can't be same if hash is different
}
-
+
if p.returnState != otherP.getReturnState(0) {
return false
}
-
+
// Both parents must be nil if one is
if p.parentCtx == nil {
return otherP.parentCtx == nil
}
-
+
return p.parentCtx.Equals(otherP.parentCtx)
}
@@ -225,27 +225,27 @@ func (p *PredictionContext) String() string {
return "$"
case PredictionContextSingleton:
var up string
-
+
if p.parentCtx == nil {
up = ""
} else {
up = p.parentCtx.String()
}
-
+
if len(up) == 0 {
if p.returnState == BasePredictionContextEmptyReturnState {
return "$"
}
-
+
return strconv.Itoa(p.returnState)
}
-
+
return strconv.Itoa(p.returnState) + " " + up
case PredictionContextArray:
if p.isEmpty() {
return "[]"
}
-
+
s := "["
for i := 0; i < len(p.returnStates); i++ {
if i > 0 {
@@ -263,7 +263,7 @@ func (p *PredictionContext) String() string {
}
}
return s + "]"
-
+
default:
return "unknown"
}
@@ -309,18 +309,18 @@ func predictionContextFromRuleContext(a *ATN, outerContext RuleContext) *Predict
parent := predictionContextFromRuleContext(a, outerContext.GetParent().(RuleContext))
state := a.states[outerContext.GetInvokingState()]
transition := state.GetTransitions()[0]
-
+
return SingletonBasePredictionContextCreate(parent, transition.(*RuleTransition).followState.GetStateNumber())
}
func merge(a, b *PredictionContext, rootIsWildcard bool, mergeCache *JPCMap) *PredictionContext {
-
+
// Share same graph if both same
//
if a == b || a.Equals(b) {
return a
}
-
+
if a.pcType == PredictionContextSingleton && b.pcType == PredictionContextSingleton {
return mergeSingletons(a, b, rootIsWildcard, mergeCache)
}
@@ -334,7 +334,7 @@ func merge(a, b *PredictionContext, rootIsWildcard bool, mergeCache *JPCMap) *Pr
return b
}
}
-
+
// Convert either Singleton or Empty to arrays, so that we can merge them
//
ara := convertToArray(a)
@@ -395,7 +395,7 @@ func mergeSingletons(a, b *PredictionContext, rootIsWildcard bool, mergeCache *J
return previous
}
}
-
+
rootMerge := mergeRoot(a, b, rootIsWildcard)
if rootMerge != nil {
if mergeCache != nil {
@@ -564,7 +564,7 @@ func mergeArrays(a, b *PredictionContext, rootIsWildcard bool, mergeCache *JPCMa
i := 0 // walks a
j := 0 // walks b
k := 0 // walks target M array
-
+
mergedReturnStates := make([]int, len(a.returnStates)+len(b.returnStates))
mergedParents := make([]*PredictionContext, len(a.returnStates)+len(b.returnStates))
// walk and merge to yield mergedParents, mergedReturnStates
@@ -626,9 +626,9 @@ func mergeArrays(a, b *PredictionContext, rootIsWildcard bool, mergeCache *JPCMa
mergedParents = mergedParents[0:k]
mergedReturnStates = mergedReturnStates[0:k]
}
-
+
M := NewArrayPredictionContext(mergedParents, mergedReturnStates)
-
+
// if we created same array as a or b, return that instead
// TODO: JI track whether this is possible above during merge sort for speed and possibly avoid an allocation
if M.Equals(a) {
@@ -650,7 +650,7 @@ func mergeArrays(a, b *PredictionContext, rootIsWildcard bool, mergeCache *JPCMa
return b
}
combineCommonParents(&mergedParents)
-
+
if mergeCache != nil {
mergeCache.Put(a, b, M)
}
@@ -666,7 +666,7 @@ func mergeArrays(a, b *PredictionContext, rootIsWildcard bool, mergeCache *JPCMa
//goland:noinspection GoUnusedFunction
func combineCommonParents(parents *[]*PredictionContext) {
uniqueParents := NewJStore[*PredictionContext, Comparator[*PredictionContext]](pContextEqInst, PredictionContextCollection, "combineCommonParents for PredictionContext")
-
+
for p := 0; p < len(*parents); p++ {
parent := (*parents)[p]
_, _ = uniqueParents.Put(parent)
@@ -685,7 +685,7 @@ func getCachedBasePredictionContext(context *PredictionContext, contextCache *Pr
if present {
return existing
}
-
+
existing, present = contextCache.Get(context)
if present {
visited.Put(context, existing)
@@ -722,6 +722,6 @@ func getCachedBasePredictionContext(context *PredictionContext, contextCache *Pr
contextCache.add(updated)
visited.Put(updated, updated)
visited.Put(context, updated)
-
+
return updated
}
diff --git a/vendor/github.com/antlr4-go/antlr/v4/recognizer.go b/vendor/github.com/antlr4-go/antlr/v4/recognizer.go
index dcb8548..2e0b504 100644
--- a/vendor/github.com/antlr4-go/antlr/v4/recognizer.go
+++ b/vendor/github.com/antlr4-go/antlr/v4/recognizer.go
@@ -56,7 +56,7 @@ var tokenTypeMapCache = make(map[string]int)
var ruleIndexMapCache = make(map[string]int)
func (b *BaseRecognizer) checkVersion(toolVersion string) {
- runtimeVersion := "4.13.1"
+ runtimeVersion := "4.12.0"
if runtimeVersion != toolVersion {
fmt.Println("ANTLR runtime and generated code versions disagree: " + runtimeVersion + "!=" + toolVersion)
}
diff --git a/vendor/github.com/antlr4-go/antlr/v4/statistics.go b/vendor/github.com/antlr4-go/antlr/v4/statistics.go
index 8cb5f3e..70c0673 100644
--- a/vendor/github.com/antlr4-go/antlr/v4/statistics.go
+++ b/vendor/github.com/antlr4-go/antlr/v4/statistics.go
@@ -9,6 +9,7 @@ import (
"path/filepath"
"sort"
"strconv"
+ "sync"
)
// This file allows the user to collect statistics about the runtime of the ANTLR runtime. It is not enabled by default
@@ -29,7 +30,7 @@ type goRunStats struct {
// within this package.
//
jStats []*JStatRec
- jStatsLock RWMutex
+ jStatsLock sync.RWMutex
topN int
topNByMax []*JStatRec
topNByUsed []*JStatRec
diff --git a/vendor/github.com/antlr4-go/antlr/v4/token.go b/vendor/github.com/antlr4-go/antlr/v4/token.go
index f5bc342..9670efb 100644
--- a/vendor/github.com/antlr4-go/antlr/v4/token.go
+++ b/vendor/github.com/antlr4-go/antlr/v4/token.go
@@ -104,25 +104,6 @@ func (b *BaseToken) GetSource() *TokenSourceCharStreamPair {
return b.source
}
-func (b *BaseToken) GetText() string {
- if b.text != "" {
- return b.text
- }
- input := b.GetInputStream()
- if input == nil {
- return ""
- }
- n := input.Size()
- if b.GetStart() < n && b.GetStop() < n {
- return input.GetTextFromInterval(NewInterval(b.GetStart(), b.GetStop()))
- }
- return "<EOF>"
-}
-
-func (b *BaseToken) SetText(text string) {
- b.text = text
-}
-
func (b *BaseToken) GetTokenIndex() int {
return b.tokenIndex
}
@@ -139,28 +120,6 @@ func (b *BaseToken) GetInputStream() CharStream {
return b.source.charStream
}
-func (b *BaseToken) String() string {
- txt := b.GetText()
- if txt != "" {
- txt = strings.Replace(txt, "\n", "\\n", -1)
- txt = strings.Replace(txt, "\r", "\\r", -1)
- txt = strings.Replace(txt, "\t", "\\t", -1)
- } else {
- txt = "<no text>"
- }
-
- var ch string
- if b.GetChannel() > 0 {
- ch = ",channel=" + strconv.Itoa(b.GetChannel())
- } else {
- ch = ""
- }
-
- return "[@" + strconv.Itoa(b.GetTokenIndex()) + "," + strconv.Itoa(b.GetStart()) + ":" + strconv.Itoa(b.GetStop()) + "='" +
- txt + "',<" + strconv.Itoa(b.GetTokenType()) + ">" +
- ch + "," + strconv.Itoa(b.GetLine()) + ":" + strconv.Itoa(b.GetColumn()) + "]"
-}
-
type CommonToken struct {
BaseToken
}
@@ -211,3 +170,44 @@ func (c *CommonToken) clone() *CommonToken {
t.text = c.GetText()
return t
}
+
+func (c *CommonToken) GetText() string {
+ if c.text != "" {
+ return c.text
+ }
+ input := c.GetInputStream()
+ if input == nil {
+ return ""
+ }
+ n := input.Size()
+ if c.start < n && c.stop < n {
+ return input.GetTextFromInterval(NewInterval(c.start, c.stop))
+ }
+ return "<EOF>"
+}
+
+func (c *CommonToken) SetText(text string) {
+ c.text = text
+}
+
+func (c *CommonToken) String() string {
+ txt := c.GetText()
+ if txt != "" {
+ txt = strings.Replace(txt, "\n", "\\n", -1)
+ txt = strings.Replace(txt, "\r", "\\r", -1)
+ txt = strings.Replace(txt, "\t", "\\t", -1)
+ } else {
+ txt = "<no text>"
+ }
+
+ var ch string
+ if c.channel > 0 {
+ ch = ",channel=" + strconv.Itoa(c.channel)
+ } else {
+ ch = ""
+ }
+
+ return "[@" + strconv.Itoa(c.tokenIndex) + "," + strconv.Itoa(c.start) + ":" + strconv.Itoa(c.stop) + "='" +
+ txt + "',<" + strconv.Itoa(c.tokenType) + ">" +
+ ch + "," + strconv.Itoa(c.line) + ":" + strconv.Itoa(c.column) + "]"
+}
diff --git a/vendor/github.com/antlr4-go/antlr/v4/utils.go b/vendor/github.com/antlr4-go/antlr/v4/utils.go
index 36a37f2..733d7df 100644
--- a/vendor/github.com/antlr4-go/antlr/v4/utils.go
+++ b/vendor/github.com/antlr4-go/antlr/v4/utils.go
@@ -326,56 +326,3 @@ func isDirectory(dir string) (bool, error) {
}
return fileInfo.IsDir(), err
}
-
-// intSlicesEqual returns true if the two slices of ints are equal, and is a little
-// faster than slices.Equal.
-func intSlicesEqual(s1, s2 []int) bool {
- if s1 == nil && s2 == nil {
- return true
- }
- if s1 == nil || s2 == nil {
- return false
- }
- if len(s1) == 0 && len(s2) == 0 {
- return true
- }
-
- if len(s1) == 0 || len(s2) == 0 || len(s1) != len(s2) {
- return false
- }
- // If the slices are using the same memory, then they are the same slice
- if &s1[0] == &s2[0] {
- return true
- }
- for i, v := range s1 {
- if v != s2[i] {
- return false
- }
- }
- return true
-}
-
-func pcSliceEqual(s1, s2 []*PredictionContext) bool {
- if s1 == nil && s2 == nil {
- return true
- }
- if s1 == nil || s2 == nil {
- return false
- }
- if len(s1) == 0 && len(s2) == 0 {
- return true
- }
- if len(s1) == 0 || len(s2) == 0 || len(s1) != len(s2) {
- return false
- }
- // If the slices are using the same memory, then they are the same slice
- if &s1[0] == &s2[0] {
- return true
- }
- for i, v := range s1 {
- if !v.Equals(s2[i]) {
- return false
- }
- }
- return true
-}