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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,7 +8,7 @@ package atn
// {@link SemanticContext} within the scope of this outer class.</p> // {@link SemanticContext} within the scope of this outer class.</p>
// //
var Set = require('./../Utils').Set //var Set = require('./../Utils').Set
type SemanticContext struct { type SemanticContext struct {
return this return this
@ -92,8 +92,8 @@ func Predicate(ruleIndex, predIndex, isCtxDependent) {
return this return this
} }
Predicate.prototype = Object.create(SemanticContext.prototype) //Predicate.prototype = Object.create(SemanticContext.prototype)
Predicate.prototype.constructor = Predicate //Predicate.prototype.constructor = Predicate
//The default {@link SemanticContext}, which is semantically equivalent to //The default {@link SemanticContext}, which is semantically equivalent to
//a predicate of the form {@code {true}?}. //a predicate of the form {@code {true}?}.
@ -131,8 +131,8 @@ func PrecedencePredicate(precedence) {
this.precedence = precedence == undefined ? 0 : precedence this.precedence = precedence == undefined ? 0 : precedence
} }
PrecedencePredicate.prototype = Object.create(SemanticContext.prototype) //PrecedencePredicate.prototype = Object.create(SemanticContext.prototype)
PrecedencePredicate.prototype.constructor = PrecedencePredicate //PrecedencePredicate.prototype.constructor = PrecedencePredicate
func (this *PrecedencePredicate) evaluate(parser, outerContext) { func (this *PrecedencePredicate) evaluate(parser, outerContext) {
return parser.precpred(outerContext, this.precedence) return parser.precpred(outerContext, this.precedence)
@ -216,8 +216,8 @@ func AND(a, b) {
return this return this
} }
AND.prototype = Object.create(SemanticContext.prototype) //AND.prototype = Object.create(SemanticContext.prototype)
AND.prototype.constructor = AND //AND.prototype.constructor = AND
func (this *AND) equals(other) { func (this *AND) equals(other) {
if (this == other) { if (this == other) {
@ -320,8 +320,8 @@ func OR(a, b) {
return this return this
} }
OR.prototype = Object.create(SemanticContext.prototype) //OR.prototype = Object.create(SemanticContext.prototype)
OR.prototype.constructor = OR //OR.prototype.constructor = OR
func (this *OR) constructor(other) { func (this *OR) constructor(other) {
if (this == 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 // the states. We'll use the term Edge for the DFA to distinguish them from
// ATN transitions.</p> // ATN transitions.</p>
var Token = require('./../Token').Token //var Token = require('./../Token').Token
var Interval = require('./../IntervalSet').Interval //var Interval = require('./../IntervalSet').Interval
var IntervalSet = require('./../IntervalSet').IntervalSet //var IntervalSet = require('./../IntervalSet').IntervalSet
var Predicate = require('./SemanticContext').Predicate //var Predicate = require('./SemanticContext').Predicate
var PrecedencePredicate = require('./SemanticContext').PrecedencePredicate //var PrecedencePredicate = require('./SemanticContext').PrecedencePredicate
func Transition (target) { func Transition (target) {
// The target of this transition. // The target of this transition.
@ -78,8 +78,8 @@ func AtomTransition(target, label) {
return this return this
} }
AtomTransition.prototype = Object.create(Transition.prototype) //AtomTransition.prototype = Object.create(Transition.prototype)
AtomTransition.prototype.constructor = AtomTransition //AtomTransition.prototype.constructor = AtomTransition
func (this *AtomTransition) makeLabel() { func (this *AtomTransition) makeLabel() {
var s = NewIntervalSet() var s = NewIntervalSet()
@ -105,8 +105,8 @@ func RuleTransition(ruleStart, ruleIndex, precedence, followState) {
return this return this
} }
RuleTransition.prototype = Object.create(Transition.prototype) //RuleTransition.prototype = Object.create(Transition.prototype)
RuleTransition.prototype.constructor = RuleTransition //RuleTransition.prototype.constructor = RuleTransition
func (this *RuleTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) { func (this *RuleTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) {
return false return false
@ -121,8 +121,8 @@ func EpsilonTransition(target, outermostPrecedenceReturn) {
return this return this
} }
EpsilonTransition.prototype = Object.create(Transition.prototype) //EpsilonTransition.prototype = Object.create(Transition.prototype)
EpsilonTransition.prototype.constructor = EpsilonTransition //EpsilonTransition.prototype.constructor = EpsilonTransition
func (this *EpsilonTransition) matches( symbol, minVocabSymbol, maxVocabSymbol) { func (this *EpsilonTransition) matches( symbol, minVocabSymbol, maxVocabSymbol) {
return false return false
@ -141,8 +141,8 @@ func RangeTransition(target, start, stop) {
return this return this
} }
RangeTransition.prototype = Object.create(Transition.prototype) //RangeTransition.prototype = Object.create(Transition.prototype)
RangeTransition.prototype.constructor = RangeTransition //RangeTransition.prototype.constructor = RangeTransition
func (this *RangeTransition) makeLabel() { func (this *RangeTransition) makeLabel() {
var s = NewIntervalSet() var s = NewIntervalSet()
@ -163,8 +163,8 @@ func AbstractPredicateTransition(target) {
return this return this
} }
AbstractPredicateTransition.prototype = Object.create(Transition.prototype) //AbstractPredicateTransition.prototype = Object.create(Transition.prototype)
AbstractPredicateTransition.prototype.constructor = AbstractPredicateTransition //AbstractPredicateTransition.prototype.constructor = AbstractPredicateTransition
func PredicateTransition(target, ruleIndex, predIndex, isCtxDependent) { func PredicateTransition(target, ruleIndex, predIndex, isCtxDependent) {
AbstractPredicateTransition.call(this, target) AbstractPredicateTransition.call(this, target)
@ -176,8 +176,8 @@ func PredicateTransition(target, ruleIndex, predIndex, isCtxDependent) {
return this return this
} }
PredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype) //PredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype)
PredicateTransition.prototype.constructor = PredicateTransition //PredicateTransition.prototype.constructor = PredicateTransition
func (this *PredicateTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) { func (this *PredicateTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) {
return false return false
@ -201,8 +201,8 @@ func ActionTransition(target, ruleIndex, actionIndex, isCtxDependent) {
return this return this
} }
ActionTransition.prototype = Object.create(Transition.prototype) //ActionTransition.prototype = Object.create(Transition.prototype)
ActionTransition.prototype.constructor = ActionTransition //ActionTransition.prototype.constructor = ActionTransition
func (this *ActionTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) { func (this *ActionTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) {
@ -227,8 +227,8 @@ func SetTransition(target, set) {
return this return this
} }
SetTransition.prototype = Object.create(Transition.prototype) //SetTransition.prototype = Object.create(Transition.prototype)
SetTransition.prototype.constructor = SetTransition //SetTransition.prototype.constructor = SetTransition
func (this *SetTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) { func (this *SetTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) {
return this.label.contains(symbol) return this.label.contains(symbol)
@ -245,8 +245,8 @@ func NotSetTransition(target, set) {
return this return this
} }
NotSetTransition.prototype = Object.create(SetTransition.prototype) //NotSetTransition.prototype = Object.create(SetTransition.prototype)
NotSetTransition.prototype.constructor = NotSetTransition //NotSetTransition.prototype.constructor = NotSetTransition
func (this *NotSetTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) { func (this *NotSetTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) {
return symbol >= minVocabSymbol && symbol <= maxVocabSymbol && return symbol >= minVocabSymbol && symbol <= maxVocabSymbol &&
@ -263,8 +263,8 @@ func WildcardTransition(target) {
return this return this
} }
WildcardTransition.prototype = Object.create(Transition.prototype) //WildcardTransition.prototype = Object.create(Transition.prototype)
WildcardTransition.prototype.constructor = WildcardTransition //WildcardTransition.prototype.constructor = WildcardTransition
func (this *WildcardTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) { func (this *WildcardTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) {
@ -283,8 +283,8 @@ func PrecedencePredicateTransition(target, precedence) {
return this return this
} }
PrecedencePredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype) //PrecedencePredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype)
PrecedencePredicateTransition.prototype.constructor = PrecedencePredicateTransition //PrecedencePredicateTransition.prototype.constructor = PrecedencePredicateTransition
func (this *PrecedencePredicateTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) { func (this *PrecedencePredicateTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) {
return false return false

View File

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

View File

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

View File

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

View File

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

View File

@ -25,8 +25,8 @@ type ConsoleErrorListener struct {
return this return this
} }
ConsoleErrorListener.prototype = Object.create(ErrorListener.prototype) //ConsoleErrorListener.prototype = Object.create(ErrorListener.prototype)
ConsoleErrorListener.prototype.constructor = ConsoleErrorListener //ConsoleErrorListener.prototype.constructor = ConsoleErrorListener
// //
// Provides a default instance of {@link ConsoleErrorListener}. // Provides a default instance of {@link ConsoleErrorListener}.
@ -58,8 +58,8 @@ func ProxyErrorListener(delegates) {
return this return this
} }
ProxyErrorListener.prototype = Object.create(ErrorListener.prototype) //ProxyErrorListener.prototype = Object.create(ErrorListener.prototype)
ProxyErrorListener.prototype.constructor = ProxyErrorListener //ProxyErrorListener.prototype.constructor = ProxyErrorListener
func (this *ProxyErrorListener) syntaxError(recognizer, offendingSymbol, line, column, msg, e) { func (this *ProxyErrorListener) syntaxError(recognizer, offendingSymbol, line, column, msg, e) {
this.delegates.map(function(d) { d.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 return this
} }
DefaultErrorStrategy.prototype = Object.create(ErrorStrategy.prototype) //DefaultErrorStrategy.prototype = Object.create(ErrorStrategy.prototype)
DefaultErrorStrategy.prototype.constructor = DefaultErrorStrategy //DefaultErrorStrategy.prototype.constructor = DefaultErrorStrategy
// <p>The default implementation simply calls {@link //endErrorCondition} to // <p>The default implementation simply calls {@link //endErrorCondition} to
// ensure that the handler is not in error recovery mode.</p> // ensure that the handler is not in error recovery mode.</p>
@ -721,8 +721,8 @@ type BailErrorStrategy struct {
return this return this
} }
BailErrorStrategy.prototype = Object.create(DefaultErrorStrategy.prototype) //BailErrorStrategy.prototype = Object.create(DefaultErrorStrategy.prototype)
BailErrorStrategy.prototype.constructor = BailErrorStrategy //BailErrorStrategy.prototype.constructor = BailErrorStrategy
// Instead of recovering from exception {@code e}, re-panic it wrapped // Instead of recovering from exception {@code e}, re-panic it wrapped
// in a {@link ParseCancellationException} so it is not caught by the // 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, // in the input, where it is in the ATN, the rule invocation stack,
// and what kind of problem occurred. // and what kind of problem occurred.
var PredicateTransition = require('./../atn/Transition').PredicateTransition //var PredicateTransition = require('./../atn/Transition').PredicateTransition
func RecognitionException(params) { func RecognitionException(params) {
Error.call(this) Error.call(this)
@ -35,8 +35,8 @@ func RecognitionException(params) {
return this return this
} }
RecognitionException.prototype = Object.create(Error.prototype) //RecognitionException.prototype = Object.create(Error.prototype)
RecognitionException.prototype.constructor = RecognitionException //RecognitionException.prototype.constructor = RecognitionException
// <p>If the state number is not known, this method returns -1.</p> // <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 return this
} }
LexerNoViableAltException.prototype = Object.create(RecognitionException.prototype) //LexerNoViableAltException.prototype = Object.create(RecognitionException.prototype)
LexerNoViableAltException.prototype.constructor = LexerNoViableAltException //LexerNoViableAltException.prototype.constructor = LexerNoViableAltException
func (this *LexerNoViableAltException) toString() { func (this *LexerNoViableAltException) toString() {
var symbol = "" var symbol = ""
@ -102,8 +102,8 @@ func NoViableAltException(recognizer, input, startToken, offendingToken, deadEnd
this.offendingToken = offendingToken this.offendingToken = offendingToken
} }
NoViableAltException.prototype = Object.create(RecognitionException.prototype) //NoViableAltException.prototype = Object.create(RecognitionException.prototype)
NoViableAltException.prototype.constructor = NoViableAltException //NoViableAltException.prototype.constructor = NoViableAltException
// This signifies any kind of mismatched input exceptions such as // This signifies any kind of mismatched input exceptions such as
// when the current input does not match the expected token. // when the current input does not match the expected token.
@ -113,8 +113,8 @@ func InputMismatchException(recognizer) {
this.offendingToken = recognizer.getCurrentToken() this.offendingToken = recognizer.getCurrentToken()
} }
InputMismatchException.prototype = Object.create(RecognitionException.prototype) //InputMismatchException.prototype = Object.create(RecognitionException.prototype)
InputMismatchException.prototype.constructor = InputMismatchException //InputMismatchException.prototype.constructor = InputMismatchException
// A semantic predicate failed during validation. Validation of predicates // A semantic predicate failed during validation. Validation of predicates
// occurs when normally parsing the alternative just like matching a token. // occurs when normally parsing the alternative just like matching a token.
@ -138,8 +138,8 @@ func FailedPredicateException(recognizer, predicate, message) {
return this return this
} }
FailedPredicateException.prototype = Object.create(RecognitionException.prototype) //FailedPredicateException.prototype = Object.create(RecognitionException.prototype)
FailedPredicateException.prototype.constructor = FailedPredicateException //FailedPredicateException.prototype.constructor = FailedPredicateException
func (this *FailedPredicateException) formatMessage(predicate, message) { func (this *FailedPredicateException) formatMessage(predicate, message) {
if (message !=nil) { if (message !=nil) {
@ -155,8 +155,8 @@ type ParseCancellationException struct {
return this return this
} }
ParseCancellationException.prototype = Object.create(Error.prototype) //ParseCancellationException.prototype = Object.create(Error.prototype)
ParseCancellationException.prototype.constructor = ParseCancellationException //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. // 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 INVALID_INTERVAL = NewInterval(-1, -2)
var Utils = require('../Utils.js')
type Tree struct { type Tree struct {
}
func NewTree() *Tree{
return this return this
} }
type SyntaxTree struct { type SyntaxTree struct {
}
func NewSyntaxTree() *SyntaxTree{
Tree.call(this) Tree.call(this)
return this return this
} }
SyntaxTree.prototype = Object.create(Tree.prototype)
SyntaxTree.prototype.constructor = SyntaxTree
type ParseTree struct { type ParseTree struct {
}
func NewParseTree() *ParseTree{
SyntaxTree.call(this) SyntaxTree.call(this)
return this return this
} }
ParseTree.prototype = Object.create(SyntaxTree.prototype)
ParseTree.prototype.constructor = ParseTree
type RuleNode struct { type RuleNode struct {
}
func NewRuleNode() *RuleNode{
ParseTree.call(this) ParseTree.call(this)
return this return this
} }
RuleNode.prototype = Object.create(ParseTree.prototype)
RuleNode.prototype.constructor = RuleNode
type TerminalNode struct { type TerminalNode struct {
}
func NewTerminalNode() *TerminalNode{
ParseTree.call(this) ParseTree.call(this)
return this return this
} }
TerminalNode.prototype = Object.create(ParseTree.prototype)
TerminalNode.prototype.constructor = TerminalNode
type ErrorNode struct { type ErrorNode struct {
}
func NewErrorNode() *ErrorNode{
TerminalNode.call(this) TerminalNode.call(this)
return this return this
} }
ErrorNode.prototype = Object.create(TerminalNode.prototype)
ErrorNode.prototype.constructor = ErrorNode
type ParseTreeVisitor struct { type ParseTreeVisitor struct {
}
func NewParseTreeVisitor() *ParseTreeVisitor{
return this return this
} }
@ -79,6 +98,10 @@ var visitAtom = function(visitor, ctx) {
} }
type ParseTreeListener struct { type ParseTreeListener struct {
}
func NewParseTreeListener() *ParseTreeListener{
} }
func NewParseTreeListener() ParseTreeListener { func NewParseTreeListener() ParseTreeListener {
@ -104,8 +127,7 @@ func TerminalNodeImpl(symbol) {
return this return this
} }
TerminalNodeImpl.prototype = Object.create(TerminalNode.prototype)
TerminalNodeImpl.prototype.constructor = TerminalNodeImpl
func (this *TerminalNodeImpl) getChild(i) { func (this *TerminalNodeImpl) getChild(i) {
return nil return nil
@ -162,8 +184,7 @@ func ErrorNodeImpl(token) {
return this return this
} }
ErrorNodeImpl.prototype = Object.create(TerminalNodeImpl.prototype)
ErrorNodeImpl.prototype.constructor = ErrorNodeImpl
func (this *ErrorNodeImpl) isErrorNode() { func (this *ErrorNodeImpl) isErrorNode() {
return true return true
@ -174,6 +195,10 @@ func (this *ErrorNodeImpl) accept(visitor) {
} }
type ParseTreeWalker struct { type ParseTreeWalker struct {
}
func NewParseTreeWalker() *ParseTreeWalker{
return this return this
} }

View File

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