Comment out all require statements and prototype tomfoolery

This commit is contained in:
Peter Boyer 2015-12-15 18:05:15 -05:00
parent a8da94cb2e
commit 02d9013ea1
25 changed files with 221 additions and 196 deletions

View File

@ -7,7 +7,7 @@ func TraceListener(parser) {
}
TraceListener.prototype = Object.create(ParseTreeListener)
TraceListener.prototype.constructor = TraceListener
//TraceListener.prototype.constructor = TraceListener
func (this *TraceListener) enterEveryRule(ctx) {
fmt.Println("enter " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text)
@ -54,7 +54,7 @@ func Parser(input) {
return this
}
Parser.prototype = Object.create(Recognizer.prototype)
//Parser.prototype = Object.create(Recognizer.prototype)
Parser.prototype.contructor = Parser
// p.field maps from the serialized ATN string to the deserialized {@link
@ -282,7 +282,7 @@ func (p.*Parser) getATNWithBypassAlts() {
// String id = m.get("ID")
// </pre>
var Lexer = require('./Lexer').Lexer
//var Lexer = require('./Lexer').Lexer
func (p.*Parser) compileParseTreePattern(pattern, patternRuleIndex, lexer) {
lexer = lexer || nil

View File

@ -1,6 +1,6 @@
package antlr4
var RuleContext = require('./RuleContext').RuleContext
//var RuleContext = require('./RuleContext').RuleContext
func PredictionContext(cachedHashString) {
this.cachedHashString = cachedHashString
@ -109,7 +109,7 @@ func SingletonPredictionContext(parent, returnState) {
this.returnState = returnState
}
SingletonPredictionContext.prototype = Object.create(PredictionContext.prototype)
//SingletonPredictionContext.prototype = Object.create(PredictionContext.prototype)
SingletonPredictionContext.prototype.contructor = SingletonPredictionContext
SingletonPredictionContext.create = function(parent, returnState) {
@ -174,8 +174,8 @@ type EmptyPredictionContext struct {
return this
}
EmptyPredictionContext.prototype = Object.create(SingletonPredictionContext.prototype)
EmptyPredictionContext.prototype.constructor = EmptyPredictionContext
//EmptyPredictionContext.prototype = Object.create(SingletonPredictionContext.prototype)
//EmptyPredictionContext.prototype.constructor = EmptyPredictionContext
func (this *EmptyPredictionContext) isEmpty() {
return true
@ -211,8 +211,8 @@ func ArrayPredictionContext(parents, returnStates) {
return this
}
ArrayPredictionContext.prototype = Object.create(PredictionContext.prototype)
ArrayPredictionContext.prototype.constructor = ArrayPredictionContext
//ArrayPredictionContext.prototype = Object.create(PredictionContext.prototype)
//ArrayPredictionContext.prototype.constructor = ArrayPredictionContext
func (this *ArrayPredictionContext) isEmpty() {
// since EMPTY_RETURN_STATE can only appear in the last position, we

View File

@ -1,8 +1,8 @@
package antlr4
var Token = require('./Token').Token
var ConsoleErrorListener = require('./error/ErrorListener').ConsoleErrorListener
var ProxyErrorListener = require('./error/ErrorListener').ProxyErrorListener
//var Token = require('./Token').Token
//var ConsoleErrorListener = require('./error/ErrorListener').ConsoleErrorListener
//var ProxyErrorListener = require('./error/ErrorListener').ProxyErrorListener
type Recognizer struct {
this._listeners = [ ConsoleErrorListener.INSTANCE ]

View File

@ -21,7 +21,7 @@ package antlr4
// @see ParserRuleContext
///
var RuleNode = require('./tree/Tree').RuleNode
//var RuleNode = require('./tree/Tree').RuleNode
var INVALID_INTERVAL = require('./tree/Tree').INVALID_INTERVAL
func RuleContext(parent, invokingState) {
@ -35,8 +35,8 @@ func RuleContext(parent, invokingState) {
return this
}
RuleContext.prototype = Object.create(RuleNode.prototype)
RuleContext.prototype.constructor = RuleContext
//RuleContext.prototype = Object.create(RuleNode.prototype)
//RuleContext.prototype.constructor = RuleContext
func (this *RuleContext) depth() {
var n = 0
@ -99,7 +99,7 @@ func (this *RuleContext) accept(visitor) {
//need to manage circular dependencies, so export now
var Trees = require('./tree/Trees').Trees
//var Trees = require('./tree/Trees').Trees
// Print out a whole tree, not just a node, in LISP format

View File

@ -1,7 +1,7 @@
package atn
var LL1Analyzer = require('./../LL1Analyzer').LL1Analyzer
var IntervalSet = require('./../IntervalSet').IntervalSet
//var LL1Analyzer = require('./../LL1Analyzer').LL1Analyzer
//var IntervalSet = require('./../IntervalSet').IntervalSet
type ATN struct {
grammarType
@ -123,7 +123,7 @@ func (this *ATN) getDecisionState( decision) {
// @panics IllegalArgumentException if the ATN does not contain a state with
// number {@code stateNumber}
var Token = require('./../Token').Token
//var Token = require('./../Token').Token
func (this *ATN) getExpectedTokens( stateNumber, ctx ) {
if ( stateNumber < 0 || stateNumber >= this.states.length ) {

View File

@ -8,8 +8,8 @@ package atn
// an ATN state.
///
var DecisionState = require('./ATNState').DecisionState
var SemanticContext = require('./SemanticContext').SemanticContext
//var DecisionState = require('./ATNState').DecisionState
//var SemanticContext = require('./SemanticContext').SemanticContext
func checkParams(params, isCfg) {
if(params==nil) {
@ -117,8 +117,8 @@ func LexerATNConfig(params, config) {
return this
}
LexerATNConfig.prototype = Object.create(ATNConfig.prototype)
LexerATNConfig.prototype.constructor = LexerATNConfig
//LexerATNConfig.prototype = Object.create(ATNConfig.prototype)
//LexerATNConfig.prototype.constructor = LexerATNConfig
func (this *LexerATNConfig) hashString() {
return "" + this.state.stateNumber + this.alt + this.context +

View File

@ -6,11 +6,11 @@ package atn
// graph-structured stack.
///
var ATN = require('./ATN').ATN
var Utils = require('./../Utils')
//var ATN = require('./ATN').ATN
//var Utils = require('./../Utils')
var Set = Utils.Set
var SemanticContext = require('./SemanticContext').SemanticContext
var merge = require('./../PredictionContext').merge
//var SemanticContext = require('./SemanticContext').SemanticContext
//var merge = require('./../PredictionContext').merge
func hashATNConfig(c) {
return c.shortHashString()
@ -246,8 +246,8 @@ type OrderedATNConfigSet struct {
return this
}
OrderedATNConfigSet.prototype = Object.create(ATNConfigSet.prototype)
OrderedATNConfigSet.prototype.constructor = OrderedATNConfigSet
//OrderedATNConfigSet.prototype = Object.create(ATNConfigSet.prototype)
//OrderedATNConfigSet.prototype.constructor = OrderedATNConfigSet

View File

@ -1,9 +1,9 @@
package atn
var Token = require('./../Token').Token
var ATN = require('./ATN').ATN
var ATNType = require('./ATNType').ATNType
var ATNStates = require('./ATNState')
//var Token = require('./../Token').Token
//var ATN = require('./ATN').ATN
//var ATNType = require('./ATNType').ATNType
//var ATNStates = require('./ATNState')
var ATNState = ATNStates.ATNState
var BasicState = ATNStates.BasicState
var DecisionState = ATNStates.DecisionState
@ -19,7 +19,7 @@ var StarLoopEntryState = ATNStates.StarLoopEntryState
var PlusBlockStartState = ATNStates.PlusBlockStartState
var StarBlockStartState = ATNStates.StarBlockStartState
var BasicBlockStartState = ATNStates.BasicBlockStartState
var Transitions = require('./Transition')
//var Transitions = require('./Transition')
var Transition = Transitions.Transition
var AtomTransition = Transitions.AtomTransition
var SetTransition = Transitions.SetTransition
@ -31,10 +31,10 @@ var EpsilonTransition = Transitions.EpsilonTransition
var WildcardTransition = Transitions.WildcardTransition
var PredicateTransition = Transitions.PredicateTransition
var PrecedencePredicateTransition = Transitions.PrecedencePredicateTransition
var IntervalSet = require('./../IntervalSet').IntervalSet
var Interval = require('./../IntervalSet').Interval
var ATNDeserializationOptions = require('./ATNDeserializationOptions').ATNDeserializationOptions
var LexerActions = require('./LexerAction')
//var IntervalSet = require('./../IntervalSet').IntervalSet
//var Interval = require('./../IntervalSet').Interval
//var ATNDeserializationOptions = require('./ATNDeserializationOptions').ATNDeserializationOptions
//var LexerActions = require('./LexerAction')
var LexerActionType = LexerActions.LexerActionType
var LexerSkipAction = LexerActions.LexerSkipAction
var LexerChannelAction = LexerActions.LexerChannelAction

View File

@ -1,8 +1,8 @@
package atn
var DFAState = require('./../dfa/DFAState').DFAState
var ATNConfigSet = require('./ATNConfigSet').ATNConfigSet
var getCachedPredictionContext = require('./../PredictionContext').getCachedPredictionContext
//var DFAState = require('./../dfa/DFAState').DFAState
//var ATNConfigSet = require('./ATNConfigSet').ATNConfigSet
//var getCachedPredictionContext = require('./../PredictionContext').getCachedPredictionContext
func ATNSimulator(atn, sharedContextCache) {

View File

@ -16,20 +16,20 @@ package atn
// can simply return the predicted token type.</p>
///
var Token = require('./../Token').Token
var Lexer = require('./../Lexer').Lexer
var ATN = require('./ATN').ATN
var ATNSimulator = require('./ATNSimulator').ATNSimulator
var DFAState = require('./../dfa/DFAState').DFAState
var ATNConfigSet = require('./ATNConfigSet').ATNConfigSet
var OrderedATNConfigSet = require('./ATNConfigSet').OrderedATNConfigSet
var PredictionContext = require('./../PredictionContext').PredictionContext
var SingletonPredictionContext = require('./../PredictionContext').SingletonPredictionContext
var RuleStopState = require('./ATNState').RuleStopState
var LexerATNConfig = require('./ATNConfig').LexerATNConfig
var Transition = require('./Transition').Transition
var LexerActionExecutor = require('./LexerActionExecutor').LexerActionExecutor
var LexerNoViableAltException = require('./../error/Errors').LexerNoViableAltException
//var Token = require('./../Token').Token
//var Lexer = require('./../Lexer').Lexer
//var ATN = require('./ATN').ATN
//var ATNSimulator = require('./ATNSimulator').ATNSimulator
//var DFAState = require('./../dfa/DFAState').DFAState
//var ATNConfigSet = require('./ATNConfigSet').ATNConfigSet
//var OrderedATNConfigSet = require('./ATNConfigSet').OrderedATNConfigSet
//var PredictionContext = require('./../PredictionContext').PredictionContext
//var SingletonPredictionContext = require('./../PredictionContext').SingletonPredictionContext
//var RuleStopState = require('./ATNState').RuleStopState
//var LexerATNConfig = require('./ATNConfig').LexerATNConfig
//var Transition = require('./Transition').Transition
//var LexerActionExecutor = require('./LexerActionExecutor').LexerActionExecutor
//var LexerNoViableAltException = require('./../error/Errors').LexerNoViableAltException
func resetSimState(sim) {
sim.index = -1
@ -69,8 +69,8 @@ func LexerATNSimulator(recog, atn, decisionToDFA, sharedContextCache) {
return this
}
LexerATNSimulator.prototype = Object.create(ATNSimulator.prototype)
LexerATNSimulator.prototype.constructor = LexerATNSimulator
//LexerATNSimulator.prototype = Object.create(ATNSimulator.prototype)
//LexerATNSimulator.prototype.constructor = LexerATNSimulator
LexerATNSimulator.debug = false
LexerATNSimulator.dfa_debug = false

View File

@ -40,8 +40,8 @@ type LexerSkipAction struct {
return this
}
LexerSkipAction.prototype = Object.create(LexerAction.prototype)
LexerSkipAction.prototype.constructor = LexerSkipAction
//LexerSkipAction.prototype = Object.create(LexerAction.prototype)
//LexerSkipAction.prototype.constructor = LexerSkipAction
// Provides a singleton instance of this parameterless lexer action.
LexerSkipAction.INSTANCE = NewLexerSkipAction()
@ -62,8 +62,8 @@ func LexerTypeAction(type) {
return this
}
LexerTypeAction.prototype = Object.create(LexerAction.prototype)
LexerTypeAction.prototype.constructor = LexerTypeAction
//LexerTypeAction.prototype = Object.create(LexerAction.prototype)
//LexerTypeAction.prototype.constructor = LexerTypeAction
func (this *LexerTypeAction) execute(lexer) {
lexer.type = this.type
@ -96,8 +96,8 @@ func LexerPushModeAction(mode) {
return this
}
LexerPushModeAction.prototype = Object.create(LexerAction.prototype)
LexerPushModeAction.prototype.constructor = LexerPushModeAction
//LexerPushModeAction.prototype = Object.create(LexerAction.prototype)
//LexerPushModeAction.prototype.constructor = LexerPushModeAction
// <p>This action is implemented by calling {@link Lexer//pushMode} with the
// value provided by {@link //getMode}.</p>
@ -133,8 +133,8 @@ type LexerPopModeAction struct {
return this
}
LexerPopModeAction.prototype = Object.create(LexerAction.prototype)
LexerPopModeAction.prototype.constructor = LexerPopModeAction
//LexerPopModeAction.prototype = Object.create(LexerAction.prototype)
//LexerPopModeAction.prototype.constructor = LexerPopModeAction
LexerPopModeAction.INSTANCE = NewLexerPopModeAction()
@ -156,8 +156,8 @@ type LexerMoreAction struct {
return this
}
LexerMoreAction.prototype = Object.create(LexerAction.prototype)
LexerMoreAction.prototype.constructor = LexerMoreAction
//LexerMoreAction.prototype = Object.create(LexerAction.prototype)
//LexerMoreAction.prototype.constructor = LexerMoreAction
LexerMoreAction.INSTANCE = NewLexerMoreAction()
@ -179,8 +179,8 @@ func LexerModeAction(mode) {
return this
}
LexerModeAction.prototype = Object.create(LexerAction.prototype)
LexerModeAction.prototype.constructor = LexerModeAction
//LexerModeAction.prototype = Object.create(LexerAction.prototype)
//LexerModeAction.prototype.constructor = LexerModeAction
// <p>This action is implemented by calling {@link Lexer//mode} with the
// value provided by {@link //getMode}.</p>
@ -232,8 +232,8 @@ func LexerCustomAction(ruleIndex, actionIndex) {
return this
}
LexerCustomAction.prototype = Object.create(LexerAction.prototype)
LexerCustomAction.prototype.constructor = LexerCustomAction
//LexerCustomAction.prototype = Object.create(LexerAction.prototype)
//LexerCustomAction.prototype.constructor = LexerCustomAction
// <p>Custom actions are implemented by calling {@link Lexer//action} with the
// appropriate rule and action indexes.</p>
@ -265,8 +265,8 @@ func LexerChannelAction(channel) {
return this
}
LexerChannelAction.prototype = Object.create(LexerAction.prototype)
LexerChannelAction.prototype.constructor = LexerChannelAction
//LexerChannelAction.prototype = Object.create(LexerAction.prototype)
//LexerChannelAction.prototype.constructor = LexerChannelAction
// <p>This action is implemented by calling {@link Lexer//setChannel} with the
// value provided by {@link //getChannel}.</p>
@ -320,8 +320,8 @@ func LexerIndexedCustomAction(offset, action) {
return this
}
LexerIndexedCustomAction.prototype = Object.create(LexerAction.prototype)
LexerIndexedCustomAction.prototype.constructor = LexerIndexedCustomAction
//LexerIndexedCustomAction.prototype = Object.create(LexerAction.prototype)
//LexerIndexedCustomAction.prototype.constructor = LexerIndexedCustomAction
// <p>This method calls {@link //execute} on the result of {@link //getAction}
// using the provided {@code lexer}.</p>

View File

@ -7,7 +7,7 @@ package atn
// efficiently, ensuring that actions appearing only at the end of the rule do
// not cause bloating of the {@link DFA} created for the lexer.</p>
var LexerIndexedCustomAction = require('./LexerAction').LexerIndexedCustomAction
//var LexerIndexedCustomAction = require('./LexerAction').LexerIndexedCustomAction
func LexerActionExecutor(lexerActions) {
this.lexerActions = lexerActions == nil ? [] : lexerActions

View File

@ -228,35 +228,35 @@ package atn
// the input.</p>
//
var Utils = require('./../Utils')
//var Utils = require('./../Utils')
var Set = Utils.Set
var BitSet = Utils.BitSet
var DoubleDict = Utils.DoubleDict
var ATN = require('./ATN').ATN
var ATNConfig = require('./ATNConfig').ATNConfig
var ATNConfigSet = require('./ATNConfigSet').ATNConfigSet
var Token = require('./../Token').Token
var DFAState = require('./../dfa/DFAState').DFAState
var PredPrediction = require('./../dfa/DFAState').PredPrediction
var ATNSimulator = require('./ATNSimulator').ATNSimulator
var PredictionMode = require('./PredictionMode').PredictionMode
var RuleContext = require('./../RuleContext').RuleContext
var ParserRuleContext = require('./../ParserRuleContext').ParserRuleContext
var SemanticContext = require('./SemanticContext').SemanticContext
var StarLoopEntryState = require('./ATNState').StarLoopEntryState
var RuleStopState = require('./ATNState').RuleStopState
var PredictionContext = require('./../PredictionContext').PredictionContext
var Interval = require('./../IntervalSet').Interval
var Transitions = require('./Transition')
//var ATN = require('./ATN').ATN
//var ATNConfig = require('./ATNConfig').ATNConfig
//var ATNConfigSet = require('./ATNConfigSet').ATNConfigSet
//var Token = require('./../Token').Token
//var DFAState = require('./../dfa/DFAState').DFAState
//var PredPrediction = require('./../dfa/DFAState').PredPrediction
//var ATNSimulator = require('./ATNSimulator').ATNSimulator
//var PredictionMode = require('./PredictionMode').PredictionMode
//var RuleContext = require('./../RuleContext').RuleContext
//var ParserRuleContext = require('./../ParserRuleContext').ParserRuleContext
//var SemanticContext = require('./SemanticContext').SemanticContext
//var StarLoopEntryState = require('./ATNState').StarLoopEntryState
//var RuleStopState = require('./ATNState').RuleStopState
//var PredictionContext = require('./../PredictionContext').PredictionContext
//var Interval = require('./../IntervalSet').Interval
//var Transitions = require('./Transition')
var Transition = Transitions.Transition
var SetTransition = Transitions.SetTransition
var NotSetTransition = Transitions.NotSetTransition
var RuleTransition = Transitions.RuleTransition
var ActionTransition = Transitions.ActionTransition
var NoViableAltException = require('./../error/Errors').NoViableAltException
//var NoViableAltException = require('./../error/Errors').NoViableAltException
var SingletonPredictionContext = require('./../PredictionContext').SingletonPredictionContext
var predictionContextFromRuleContext = require('./../PredictionContext').predictionContextFromRuleContext
//var SingletonPredictionContext = require('./../PredictionContext').SingletonPredictionContext
//var predictionContextFromRuleContext = require('./../PredictionContext').predictionContextFromRuleContext
func ParserATNSimulator(parser, atn, decisionToDFA, sharedContextCache) {
ATNSimulator.call(this, atn, sharedContextCache)
@ -281,8 +281,8 @@ func ParserATNSimulator(parser, atn, decisionToDFA, sharedContextCache) {
return this
}
ParserATNSimulator.prototype = Object.create(ATNSimulator.prototype)
ParserATNSimulator.prototype.constructor = ParserATNSimulator
//ParserATNSimulator.prototype = Object.create(ATNSimulator.prototype)
//ParserATNSimulator.prototype.constructor = ParserATNSimulator
ParserATNSimulator.prototype.debug = false
ParserATNSimulator.prototype.debug_list_atn_decisions = false

View File

@ -5,11 +5,11 @@ package atn
// utility methods for analyzing configuration sets for conflicts and/or
// ambiguities.
var Set = require('./../Utils').Set
var BitSet = require('./../Utils').BitSet
var AltDict = require('./../Utils').AltDict
var ATN = require('./ATN').ATN
var RuleStopState = require('./ATNState').RuleStopState
//var Set = require('./../Utils').Set
//var BitSet = require('./../Utils').BitSet
//var AltDict = require('./../Utils').AltDict
//var ATN = require('./ATN').ATN
//var RuleStopState = require('./ATNState').RuleStopState
type PredictionMode struct {
return this

View File

@ -8,7 +8,7 @@ package atn
// {@link SemanticContext} within the scope of this outer class.</p>
//
var Set = require('./../Utils').Set
//var Set = require('./../Utils').Set
type SemanticContext struct {
return this
@ -92,8 +92,8 @@ func Predicate(ruleIndex, predIndex, isCtxDependent) {
return this
}
Predicate.prototype = Object.create(SemanticContext.prototype)
Predicate.prototype.constructor = Predicate
//Predicate.prototype = Object.create(SemanticContext.prototype)
//Predicate.prototype.constructor = Predicate
//The default {@link SemanticContext}, which is semantically equivalent to
//a predicate of the form {@code {true}?}.
@ -131,8 +131,8 @@ func PrecedencePredicate(precedence) {
this.precedence = precedence == undefined ? 0 : precedence
}
PrecedencePredicate.prototype = Object.create(SemanticContext.prototype)
PrecedencePredicate.prototype.constructor = PrecedencePredicate
//PrecedencePredicate.prototype = Object.create(SemanticContext.prototype)
//PrecedencePredicate.prototype.constructor = PrecedencePredicate
func (this *PrecedencePredicate) evaluate(parser, outerContext) {
return parser.precpred(outerContext, this.precedence)
@ -216,8 +216,8 @@ func AND(a, b) {
return this
}
AND.prototype = Object.create(SemanticContext.prototype)
AND.prototype.constructor = AND
//AND.prototype = Object.create(SemanticContext.prototype)
//AND.prototype.constructor = AND
func (this *AND) equals(other) {
if (this == other) {
@ -320,8 +320,8 @@ func OR(a, b) {
return this
}
OR.prototype = Object.create(SemanticContext.prototype)
OR.prototype.constructor = OR
//OR.prototype = Object.create(SemanticContext.prototype)
//OR.prototype.constructor = OR
func (this *OR) constructor(other) {
if (this == other) {

View File

@ -12,11 +12,11 @@ package atn
// the states. We'll use the term Edge for the DFA to distinguish them from
// ATN transitions.</p>
var Token = require('./../Token').Token
var Interval = require('./../IntervalSet').Interval
var IntervalSet = require('./../IntervalSet').IntervalSet
var Predicate = require('./SemanticContext').Predicate
var PrecedencePredicate = require('./SemanticContext').PrecedencePredicate
//var Token = require('./../Token').Token
//var Interval = require('./../IntervalSet').Interval
//var IntervalSet = require('./../IntervalSet').IntervalSet
//var Predicate = require('./SemanticContext').Predicate
//var PrecedencePredicate = require('./SemanticContext').PrecedencePredicate
func Transition (target) {
// The target of this transition.
@ -78,8 +78,8 @@ func AtomTransition(target, label) {
return this
}
AtomTransition.prototype = Object.create(Transition.prototype)
AtomTransition.prototype.constructor = AtomTransition
//AtomTransition.prototype = Object.create(Transition.prototype)
//AtomTransition.prototype.constructor = AtomTransition
func (this *AtomTransition) makeLabel() {
var s = NewIntervalSet()
@ -105,8 +105,8 @@ func RuleTransition(ruleStart, ruleIndex, precedence, followState) {
return this
}
RuleTransition.prototype = Object.create(Transition.prototype)
RuleTransition.prototype.constructor = RuleTransition
//RuleTransition.prototype = Object.create(Transition.prototype)
//RuleTransition.prototype.constructor = RuleTransition
func (this *RuleTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) {
return false
@ -121,8 +121,8 @@ func EpsilonTransition(target, outermostPrecedenceReturn) {
return this
}
EpsilonTransition.prototype = Object.create(Transition.prototype)
EpsilonTransition.prototype.constructor = EpsilonTransition
//EpsilonTransition.prototype = Object.create(Transition.prototype)
//EpsilonTransition.prototype.constructor = EpsilonTransition
func (this *EpsilonTransition) matches( symbol, minVocabSymbol, maxVocabSymbol) {
return false
@ -141,8 +141,8 @@ func RangeTransition(target, start, stop) {
return this
}
RangeTransition.prototype = Object.create(Transition.prototype)
RangeTransition.prototype.constructor = RangeTransition
//RangeTransition.prototype = Object.create(Transition.prototype)
//RangeTransition.prototype.constructor = RangeTransition
func (this *RangeTransition) makeLabel() {
var s = NewIntervalSet()
@ -163,8 +163,8 @@ func AbstractPredicateTransition(target) {
return this
}
AbstractPredicateTransition.prototype = Object.create(Transition.prototype)
AbstractPredicateTransition.prototype.constructor = AbstractPredicateTransition
//AbstractPredicateTransition.prototype = Object.create(Transition.prototype)
//AbstractPredicateTransition.prototype.constructor = AbstractPredicateTransition
func PredicateTransition(target, ruleIndex, predIndex, isCtxDependent) {
AbstractPredicateTransition.call(this, target)
@ -176,8 +176,8 @@ func PredicateTransition(target, ruleIndex, predIndex, isCtxDependent) {
return this
}
PredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype)
PredicateTransition.prototype.constructor = PredicateTransition
//PredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype)
//PredicateTransition.prototype.constructor = PredicateTransition
func (this *PredicateTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) {
return false
@ -201,8 +201,8 @@ func ActionTransition(target, ruleIndex, actionIndex, isCtxDependent) {
return this
}
ActionTransition.prototype = Object.create(Transition.prototype)
ActionTransition.prototype.constructor = ActionTransition
//ActionTransition.prototype = Object.create(Transition.prototype)
//ActionTransition.prototype.constructor = ActionTransition
func (this *ActionTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) {
@ -227,8 +227,8 @@ func SetTransition(target, set) {
return this
}
SetTransition.prototype = Object.create(Transition.prototype)
SetTransition.prototype.constructor = SetTransition
//SetTransition.prototype = Object.create(Transition.prototype)
//SetTransition.prototype.constructor = SetTransition
func (this *SetTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) {
return this.label.contains(symbol)
@ -245,8 +245,8 @@ func NotSetTransition(target, set) {
return this
}
NotSetTransition.prototype = Object.create(SetTransition.prototype)
NotSetTransition.prototype.constructor = NotSetTransition
//NotSetTransition.prototype = Object.create(SetTransition.prototype)
//NotSetTransition.prototype.constructor = NotSetTransition
func (this *NotSetTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) {
return symbol >= minVocabSymbol && symbol <= maxVocabSymbol &&
@ -263,8 +263,8 @@ func WildcardTransition(target) {
return this
}
WildcardTransition.prototype = Object.create(Transition.prototype)
WildcardTransition.prototype.constructor = WildcardTransition
//WildcardTransition.prototype = Object.create(Transition.prototype)
//WildcardTransition.prototype.constructor = WildcardTransition
func (this *WildcardTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) {
@ -283,8 +283,8 @@ func PrecedencePredicateTransition(target, precedence) {
return this
}
PrecedencePredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype)
PrecedencePredicateTransition.prototype.constructor = PrecedencePredicateTransition
//PrecedencePredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype)
//PrecedencePredicateTransition.prototype.constructor = PrecedencePredicateTransition
func (this *PrecedencePredicateTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) {
return false

View File

@ -1,9 +1,9 @@
package dfa
var DFAState = require('./DFAState').DFAState
var ATNConfigSet = require('./../atn/ATNConfigSet').ATNConfigSet
var DFASerializer = require('./DFASerializer').DFASerializer
var LexerDFASerializer = require('./DFASerializer').LexerDFASerializer
//var DFAState = require('./DFAState').DFAState
//var ATNConfigSet = require('./../atn/ATNConfigSet').ATNConfigSet
//var DFASerializer = require('./DFASerializer').DFASerializer
//var LexerDFASerializer = require('./DFASerializer').LexerDFASerializer
type DFAStatesSet struct {
return this

View File

@ -64,8 +64,8 @@ func LexerDFASerializer(dfa) {
return this
}
LexerDFASerializer.prototype = Object.create(DFASerializer.prototype)
LexerDFASerializer.prototype.constructor = LexerDFASerializer
//LexerDFASerializer.prototype = Object.create(DFASerializer.prototype)
//LexerDFASerializer.prototype.constructor = LexerDFASerializer
func (this *LexerDFASerializer) getEdgeLabel(i) {
return "'" + String.fromCharCode(i) + "'"

View File

@ -1,6 +1,6 @@
package dfa
var ATNConfigSet = require('./../atn/ATNConfigSet').ATNConfigSet
//var ATNConfigSet = require('./../atn/ATNConfigSet').ATNConfigSet
// Map a predicate to a predicted alternative.///

View File

@ -19,9 +19,9 @@ package error
// this situation occurs.</li>
// </ul>
var BitSet = require('./../Utils').BitSet
var ErrorListener = require('./ErrorListener').ErrorListener
var Interval = require('./../IntervalSet').Interval
//var BitSet = require('./../Utils').BitSet
//var ErrorListener = require('./ErrorListener').ErrorListener
//var Interval = require('./../IntervalSet').Interval
func DiagnosticErrorListener(exactOnly) {
ErrorListener.call(this)
@ -31,8 +31,8 @@ func DiagnosticErrorListener(exactOnly) {
return this
}
DiagnosticErrorListener.prototype = Object.create(ErrorListener.prototype)
DiagnosticErrorListener.prototype.constructor = DiagnosticErrorListener
//DiagnosticErrorListener.prototype = Object.create(ErrorListener.prototype)
//DiagnosticErrorListener.prototype.constructor = DiagnosticErrorListener
func (this *DiagnosticErrorListener) reportAmbiguity(recognizer, dfa,
startIndex, stopIndex, exact, ambigAlts, configs) {

View File

@ -25,8 +25,8 @@ type ConsoleErrorListener struct {
return this
}
ConsoleErrorListener.prototype = Object.create(ErrorListener.prototype)
ConsoleErrorListener.prototype.constructor = ConsoleErrorListener
//ConsoleErrorListener.prototype = Object.create(ErrorListener.prototype)
//ConsoleErrorListener.prototype.constructor = ConsoleErrorListener
//
// Provides a default instance of {@link ConsoleErrorListener}.
@ -58,8 +58,8 @@ func ProxyErrorListener(delegates) {
return this
}
ProxyErrorListener.prototype = Object.create(ErrorListener.prototype)
ProxyErrorListener.prototype.constructor = ProxyErrorListener
//ProxyErrorListener.prototype = Object.create(ErrorListener.prototype)
//ProxyErrorListener.prototype.constructor = ProxyErrorListener
func (this *ProxyErrorListener) syntaxError(recognizer, offendingSymbol, line, column, msg, e) {
this.delegates.map(function(d) { d.syntaxError(recognizer, offendingSymbol, line, column, msg, e) })

View File

@ -58,8 +58,8 @@ type DefaultErrorStrategy struct {
return this
}
DefaultErrorStrategy.prototype = Object.create(ErrorStrategy.prototype)
DefaultErrorStrategy.prototype.constructor = DefaultErrorStrategy
//DefaultErrorStrategy.prototype = Object.create(ErrorStrategy.prototype)
//DefaultErrorStrategy.prototype.constructor = DefaultErrorStrategy
// <p>The default implementation simply calls {@link //endErrorCondition} to
// ensure that the handler is not in error recovery mode.</p>
@ -721,8 +721,8 @@ type BailErrorStrategy struct {
return this
}
BailErrorStrategy.prototype = Object.create(DefaultErrorStrategy.prototype)
BailErrorStrategy.prototype.constructor = BailErrorStrategy
//BailErrorStrategy.prototype = Object.create(DefaultErrorStrategy.prototype)
//BailErrorStrategy.prototype.constructor = BailErrorStrategy
// Instead of recovering from exception {@code e}, re-panic it wrapped
// in a {@link ParseCancellationException} so it is not caught by the

View File

@ -6,7 +6,7 @@ package error
// in the input, where it is in the ATN, the rule invocation stack,
// and what kind of problem occurred.
var PredicateTransition = require('./../atn/Transition').PredicateTransition
//var PredicateTransition = require('./../atn/Transition').PredicateTransition
func RecognitionException(params) {
Error.call(this)
@ -35,8 +35,8 @@ func RecognitionException(params) {
return this
}
RecognitionException.prototype = Object.create(Error.prototype)
RecognitionException.prototype.constructor = RecognitionException
//RecognitionException.prototype = Object.create(Error.prototype)
//RecognitionException.prototype.constructor = RecognitionException
// <p>If the state number is not known, this method returns -1.</p>
@ -69,8 +69,8 @@ func LexerNoViableAltException(lexer, input, startIndex, deadEndConfigs) {
return this
}
LexerNoViableAltException.prototype = Object.create(RecognitionException.prototype)
LexerNoViableAltException.prototype.constructor = LexerNoViableAltException
//LexerNoViableAltException.prototype = Object.create(RecognitionException.prototype)
//LexerNoViableAltException.prototype.constructor = LexerNoViableAltException
func (this *LexerNoViableAltException) toString() {
var symbol = ""
@ -102,8 +102,8 @@ func NoViableAltException(recognizer, input, startToken, offendingToken, deadEnd
this.offendingToken = offendingToken
}
NoViableAltException.prototype = Object.create(RecognitionException.prototype)
NoViableAltException.prototype.constructor = NoViableAltException
//NoViableAltException.prototype = Object.create(RecognitionException.prototype)
//NoViableAltException.prototype.constructor = NoViableAltException
// This signifies any kind of mismatched input exceptions such as
// when the current input does not match the expected token.
@ -113,8 +113,8 @@ func InputMismatchException(recognizer) {
this.offendingToken = recognizer.getCurrentToken()
}
InputMismatchException.prototype = Object.create(RecognitionException.prototype)
InputMismatchException.prototype.constructor = InputMismatchException
//InputMismatchException.prototype = Object.create(RecognitionException.prototype)
//InputMismatchException.prototype.constructor = InputMismatchException
// A semantic predicate failed during validation. Validation of predicates
// occurs when normally parsing the alternative just like matching a token.
@ -138,8 +138,8 @@ func FailedPredicateException(recognizer, predicate, message) {
return this
}
FailedPredicateException.prototype = Object.create(RecognitionException.prototype)
FailedPredicateException.prototype.constructor = FailedPredicateException
//FailedPredicateException.prototype = Object.create(RecognitionException.prototype)
//FailedPredicateException.prototype.constructor = FailedPredicateException
func (this *FailedPredicateException) formatMessage(predicate, message) {
if (message !=nil) {
@ -155,8 +155,8 @@ type ParseCancellationException struct {
return this
}
ParseCancellationException.prototype = Object.create(Error.prototype)
ParseCancellationException.prototype.constructor = ParseCancellationException
//ParseCancellationException.prototype = Object.create(Error.prototype)
//ParseCancellationException.prototype.constructor = ParseCancellationException

View File

@ -4,57 +4,76 @@ package tree
// It is the most abstract interface for all the trees used by ANTLR.
///
var Token = require('./../Token').Token
var Interval = require('./../IntervalSet').Interval
var INVALID_INTERVAL = NewInterval(-1, -2)
var Utils = require('../Utils.js')
type Tree struct {
}
func NewTree() *Tree{
return this
}
type SyntaxTree struct {
}
func NewSyntaxTree() *SyntaxTree{
Tree.call(this)
return this
}
SyntaxTree.prototype = Object.create(Tree.prototype)
SyntaxTree.prototype.constructor = SyntaxTree
type ParseTree struct {
}
func NewParseTree() *ParseTree{
SyntaxTree.call(this)
return this
}
ParseTree.prototype = Object.create(SyntaxTree.prototype)
ParseTree.prototype.constructor = ParseTree
type RuleNode struct {
}
func NewRuleNode() *RuleNode{
ParseTree.call(this)
return this
}
RuleNode.prototype = Object.create(ParseTree.prototype)
RuleNode.prototype.constructor = RuleNode
type TerminalNode struct {
}
func NewTerminalNode() *TerminalNode{
ParseTree.call(this)
return this
}
TerminalNode.prototype = Object.create(ParseTree.prototype)
TerminalNode.prototype.constructor = TerminalNode
type ErrorNode struct {
}
func NewErrorNode() *ErrorNode{
TerminalNode.call(this)
return this
}
ErrorNode.prototype = Object.create(TerminalNode.prototype)
ErrorNode.prototype.constructor = ErrorNode
type ParseTreeVisitor struct {
}
func NewParseTreeVisitor() *ParseTreeVisitor{
return this
}
@ -79,6 +98,10 @@ var visitAtom = function(visitor, ctx) {
}
type ParseTreeListener struct {
}
func NewParseTreeListener() *ParseTreeListener{
}
func NewParseTreeListener() ParseTreeListener {
@ -104,8 +127,7 @@ func TerminalNodeImpl(symbol) {
return this
}
TerminalNodeImpl.prototype = Object.create(TerminalNode.prototype)
TerminalNodeImpl.prototype.constructor = TerminalNodeImpl
func (this *TerminalNodeImpl) getChild(i) {
return nil
@ -162,8 +184,7 @@ func ErrorNodeImpl(token) {
return this
}
ErrorNodeImpl.prototype = Object.create(TerminalNodeImpl.prototype)
ErrorNodeImpl.prototype.constructor = ErrorNodeImpl
func (this *ErrorNodeImpl) isErrorNode() {
return true
@ -174,6 +195,10 @@ func (this *ErrorNodeImpl) accept(visitor) {
}
type ParseTreeWalker struct {
}
func NewParseTreeWalker() *ParseTreeWalker{
return this
}

View File

@ -1,11 +1,11 @@
package tree
var Utils = require('./../Utils')
var Token = require('./../Token').Token
var RuleNode = require('./Tree').RuleNode
var ErrorNode = require('./Tree').ErrorNode
var TerminalNode = require('./Tree').TerminalNode
var ParserRuleContext = require('./../ParserRuleContext').ParserRuleContext
//var Utils = require('./../Utils')
//var Token = require('./../Token').Token
//var RuleNode = require('./Tree').RuleNode
//var ErrorNode = require('./Tree').ErrorNode
//var TerminalNode = require('./Tree').TerminalNode
//var ParserRuleContext = require('./../ParserRuleContext').ParserRuleContext
/** A set of utility routines useful for all kinds of ANTLR trees. */
type Trees struct {