This commit is contained in:
Will Faught 2017-01-11 01:47:38 -08:00
parent 58b7b71731
commit 2dd7eb1164
6 changed files with 16 additions and 18 deletions

View File

@ -93,11 +93,11 @@ func NewBaseATNConfig(c ATNConfig, state ATNState, context PredictionContext, se
}
return &BaseATNConfig{
state: state,
alt: c.GetAlt(),
context: context,
semanticContext: semanticContext,
reachesIntoOuterContext: c.GetReachesIntoOuterContext(),
state: state,
alt: c.GetAlt(),
context: context,
semanticContext: semanticContext,
reachesIntoOuterContext: c.GetReachesIntoOuterContext(),
precedenceFilterSuppressed: c.getPrecedenceFilterSuppressed(),
}
}
@ -202,8 +202,6 @@ func (b *BaseATNConfig) String() string {
return fmt.Sprintf("(%v,%v%v%v%v)", b.state, b.alt, s1, s2, s3)
}
type LexerATNConfig struct {
*BaseATNConfig
lexerActionExecutor *LexerActionExecutor

View File

@ -15,7 +15,7 @@ type IATNSimulator interface {
type BaseATNSimulator struct {
atn *ATN
sharedContextCache *PredictionContextCache
decisionToDFA []*DFA
decisionToDFA []*DFA
}
func NewBaseATNSimulator(atn *ATN, sharedContextCache *PredictionContextCache) *BaseATNSimulator {

View File

@ -10,7 +10,7 @@ import (
)
var (
LexerATNSimulatorDebug = false
LexerATNSimulatorDebug = false
LexerATNSimulatorDFADebug = false
LexerATNSimulatorMinDFAEdge = 0

View File

@ -11,10 +11,10 @@ import (
)
var (
ParserATNSimulatorDebug = false
ParserATNSimulatorDebug = false
ParserATNSimulatorListATNDecisions = false
ParserATNSimulatorDFADebug = false
ParserATNSimulatorRetryDebug = false
ParserATNSimulatorDFADebug = false
ParserATNSimulatorRetryDebug = false
)
type ParserATNSimulator struct {
@ -118,7 +118,7 @@ func (p *ParserATNSimulator) AdaptivePredict(input TokenStream, decision int, ou
// closure block that determines whether a precedence rule
// should continue or complete.
t2 := dfa.atnStartState
t2 := dfa.atnStartState
t, ok := t2.(*StarLoopEntryState)
if !dfa.precedenceDfa && ok {
if t.precedenceRuleDecision {

View File

@ -23,7 +23,7 @@ const (
var (
BasePredictionContextglobalNodeCount = 1
BasePredictionContextid = BasePredictionContextglobalNodeCount
BasePredictionContextid = BasePredictionContextglobalNodeCount
)
type PredictionContext interface {
@ -620,8 +620,8 @@ func mergeArrays(a, b *ArrayPredictionContext, rootIsWildcard bool, mergeCache *
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))
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
for i < len(a.returnStates) && j < len(b.returnStates) {
aParent := a.parents[i]

View File

@ -5,13 +5,13 @@
package antlr
import (
"bytes"
"errors"
"fmt"
"hash/fnv"
"sort"
"strings"
"bytes"
"strconv"
"strings"
)
func intMin(a, b int) int {