From 89427b7f4510745e58c188d16eef407fef410e9c Mon Sep 17 00:00:00 2001 From: Peter Boyer Date: Thu, 31 Dec 2015 13:42:59 -0500 Subject: [PATCH] Allow disabling debug statements --- pb/src/parserTest/foo.txt | 2 +- runtime/Go/src/antlr4/ATN.go | 14 +++- runtime/Go/src/antlr4/CommonTokenFactory.go | 8 ++- runtime/Go/src/antlr4/CommonTokenStream.go | 20 ++++-- runtime/Go/src/antlr4/ErrorListener.go | 16 +++-- runtime/Go/src/antlr4/ErrorStrategy.go | 26 ++++++-- runtime/Go/src/antlr4/FileStream.go | 4 +- runtime/Go/src/antlr4/InputStream.go | 4 +- runtime/Go/src/antlr4/IntervalSet.go | 12 +++- runtime/Go/src/antlr4/LL1Analyzer.go | 65 ++++++++++++------- runtime/Go/src/antlr4/Lexer.go | 24 +++++-- runtime/Go/src/antlr4/LexerATNSimulator.go | 38 ++++++++--- runtime/Go/src/antlr4/Parser.go | 20 ++++-- runtime/Go/src/antlr4/ParserATNSimulator.go | 44 +++++++++---- runtime/Go/src/antlr4/Recognizer.go | 4 +- .../v4/runtime/atn/ParserATNSimulator.java | 1 - runtime/JavaScript/src/ArithmeticParser.js | 3 - .../src/antlr4/BufferedTokenStream.js | 20 ++++-- .../src/antlr4/CommonTokenFactory.js | 8 ++- runtime/JavaScript/src/antlr4/FileStream.js | 4 +- runtime/JavaScript/src/antlr4/InputStream.js | 4 +- runtime/JavaScript/src/antlr4/IntervalSet.js | 12 +++- runtime/JavaScript/src/antlr4/LL1Analyzer.js | 56 +++++++++++----- runtime/JavaScript/src/antlr4/Lexer.js | 16 +++-- runtime/JavaScript/src/antlr4/Parser.js | 20 ++++-- runtime/JavaScript/src/antlr4/Recognizer.js | 4 +- runtime/JavaScript/src/antlr4/atn/ATN.js | 10 ++- .../src/antlr4/atn/LexerATNSimulator.js | 30 ++++++--- .../src/antlr4/atn/ParserATNSimulator.js | 44 +++++++++---- .../src/antlr4/error/ErrorStrategy.js | 21 ++++-- runtime/JavaScript/src/foo.txt | 2 +- runtime/JavaScript/src/test.js | 2 + 32 files changed, 399 insertions(+), 159 deletions(-) diff --git a/pb/src/parserTest/foo.txt b/pb/src/parserTest/foo.txt index 067b749fd..ea2793e5b 100644 --- a/pb/src/parserTest/foo.txt +++ b/pb/src/parserTest/foo.txt @@ -1 +1 @@ -1 + 2 = 3 + 5 +1 + 2 + 32 + (1 + 2) = 3 + 5 diff --git a/runtime/Go/src/antlr4/ATN.go b/runtime/Go/src/antlr4/ATN.go index 3dbd57afc..aa03bdf43 100644 --- a/runtime/Go/src/antlr4/ATN.go +++ b/runtime/Go/src/antlr4/ATN.go @@ -1,6 +1,10 @@ package antlr4 import "fmt" +const ( + PortDebug = false +) + var ATNINVALID_ALT_NUMBER = 0 type ATN struct { @@ -65,11 +69,15 @@ func (this *ATN) nextTokensInContext(s IATNState, ctx IRuleContext) *IntervalSet // rule. func (this *ATN) nextTokensNoContext(s IATNState) *IntervalSet { if s.GetNextTokenWithinRule() != nil { - fmt.Println("DEBUG 1") + if PortDebug { + fmt.Println("DEBUG 1") + } return s.GetNextTokenWithinRule() } - fmt.Println("DEBUG 2") - fmt.Println(this.nextTokensInContext(s, nil)) + if PortDebug { + fmt.Println("DEBUG 2") + fmt.Println(this.nextTokensInContext(s, nil)) + } s.SetNextTokenWithinRule(this.nextTokensInContext(s, nil)) s.GetNextTokenWithinRule().readOnly = true return s.GetNextTokenWithinRule() diff --git a/runtime/Go/src/antlr4/CommonTokenFactory.go b/runtime/Go/src/antlr4/CommonTokenFactory.go index e7a08c121..55fd93f5d 100644 --- a/runtime/Go/src/antlr4/CommonTokenFactory.go +++ b/runtime/Go/src/antlr4/CommonTokenFactory.go @@ -48,7 +48,9 @@ var CommonTokenFactoryDEFAULT = NewCommonTokenFactory(false) func (this *CommonTokenFactory) Create(source *TokenSourceCharStreamPair, ttype int, text string, channel, start, stop, line, column int) IToken { - fmt.Println("Token factory creating: " + text) + if PortDebug { + fmt.Println("Token factory creating: " + text) + } var t = NewCommonToken(source, ttype, channel, start, stop) t.line = line @@ -65,7 +67,9 @@ func (this *CommonTokenFactory) Create(source *TokenSourceCharStreamPair, ttype func (this *CommonTokenFactory) createThin(ttype int, text string) IToken { - fmt.Println("Token factory creating: " + text) + if PortDebug { + fmt.Println("Token factory creating: " + text) + } var t = NewCommonToken(nil, ttype, TokenDefaultChannel, -1, -1) t.SetText(text) diff --git a/runtime/Go/src/antlr4/CommonTokenStream.go b/runtime/Go/src/antlr4/CommonTokenStream.go index 3abbf457d..ca7aa8c35 100644 --- a/runtime/Go/src/antlr4/CommonTokenStream.go +++ b/runtime/Go/src/antlr4/CommonTokenStream.go @@ -55,12 +55,16 @@ func (bt *CommonTokenStream) Consume() { skipEofCheck = false } - fmt.Println("Consume 1") + if PortDebug { + fmt.Println("Consume 1") + } if !skipEofCheck && bt.LA(1) == TokenEOF { panic("cannot consume EOF") } if bt.Sync(bt.index + 1) { - fmt.Println("Consume 2") + if PortDebug { + fmt.Println("Consume 2") + } bt.index = bt.adjustSeekIndex(bt.index + 1) } } @@ -75,7 +79,9 @@ func (bt *CommonTokenStream) Sync(i int) bool { var n = i - len(bt.tokens) + 1 // how many more elements we need? if n > 0 { var fetched = bt.fetch(n) - fmt.Println("Sync done") + if PortDebug { + fmt.Println("Sync done") + } return fetched >= n } return true @@ -92,7 +98,9 @@ func (bt *CommonTokenStream) fetch(n int) int { for i := 0; i < n; i++ { var t IToken = bt.tokenSource.nextToken() - fmt.Println("fetch loop") + if PortDebug { + fmt.Println("fetch loop") + } t.SetTokenIndex( len(bt.tokens) ) bt.tokens = append(bt.tokens, t) if t.GetTokenType() == TokenEOF { @@ -101,7 +109,9 @@ func (bt *CommonTokenStream) fetch(n int) int { } } - fmt.Println("fetch done") + if PortDebug { + fmt.Println("fetch done") + } return n } diff --git a/runtime/Go/src/antlr4/ErrorListener.go b/runtime/Go/src/antlr4/ErrorListener.go index 91d3308d2..d32701564 100644 --- a/runtime/Go/src/antlr4/ErrorListener.go +++ b/runtime/Go/src/antlr4/ErrorListener.go @@ -24,19 +24,27 @@ func NewDefaultErrorListener() *DefaultErrorListener { } func (this *DefaultErrorListener) SyntaxError(recognizer IRecognizer, offendingSymbol interface{}, line, column int, msg string, e IRecognitionException) { - fmt.Println("SyntaxError!") + if PortDebug { + fmt.Println("SyntaxError!") + } } func (this *DefaultErrorListener) ReportAmbiguity(recognizer IParser, dfa *DFA, startIndex, stopIndex int, exact bool, ambigAlts *BitSet, configs *ATNConfigSet) { - fmt.Println("ReportAmbiguity!") + if PortDebug { + fmt.Println("ReportAmbiguity!") + } } func (this *DefaultErrorListener) ReportAttemptingFullContext(recognizer IParser, dfa *DFA, startIndex, stopIndex int, conflictingAlts *BitSet, configs *ATNConfigSet) { - fmt.Println("ReportAttemptingFullContext!") + if PortDebug { + fmt.Println("ReportAttemptingFullContext!") + } } func (this *DefaultErrorListener) ReportContextSensitivity(recognizer IParser, dfa *DFA, startIndex, stopIndex, prediction int, configs *ATNConfigSet) { - fmt.Println("ReportContextSensitivity!") + if PortDebug { + fmt.Println("ReportContextSensitivity!") + } } type ConsoleErrorListener struct { diff --git a/runtime/Go/src/antlr4/ErrorStrategy.go b/runtime/Go/src/antlr4/ErrorStrategy.go index cb2be657d..c4d4b0f3d 100644 --- a/runtime/Go/src/antlr4/ErrorStrategy.go +++ b/runtime/Go/src/antlr4/ErrorStrategy.go @@ -209,26 +209,36 @@ func (this *DefaultErrorStrategy) Sync(recognizer IParser) { return } - fmt.Println("STATE" + strconv.Itoa(recognizer.GetState())) + if PortDebug { + fmt.Println("STATE" + strconv.Itoa(recognizer.GetState())) + } var s = recognizer.GetInterpreter().atn.states[recognizer.GetState()] var la = recognizer.GetTokenStream().LA(1) - fmt.Println("LA" + strconv.Itoa(la)) + if PortDebug { + fmt.Println("LA" + strconv.Itoa(la)) + } // try cheaper subset first might get lucky. seems to shave a wee bit off if la == TokenEOF || recognizer.GetATN().nextTokens(s, nil).contains(la) { - fmt.Println("OK1") + if PortDebug { + fmt.Println("OK1") + } return } // Return but don't end recovery. only do that upon valid token Match if recognizer.isExpectedToken(la) { - fmt.Println("OK2") + if PortDebug { + fmt.Println("OK2") + } return } - fmt.Println("LA" + strconv.Itoa(la)) - fmt.Println(recognizer.GetATN().nextTokens(s, nil)) + if PortDebug { + fmt.Println("LA" + strconv.Itoa(la)) + fmt.Println(recognizer.GetATN().nextTokens(s, nil)) + } switch s.GetStateType() { case ATNStateBLOCK_START: @@ -545,7 +555,9 @@ func (this *DefaultErrorStrategy) getMissingSymbol(recognizer IParser) IToken { tf := recognizer.GetTokenFactory() - fmt.Println("Missing symbol error") + if PortDebug { + fmt.Println("Missing symbol error") + } return tf.Create( current.GetSource(), expectedTokenType, tokenText, TokenDefaultChannel, -1, -1, current.GetLine(), current.GetColumn()) } diff --git a/runtime/Go/src/antlr4/FileStream.go b/runtime/Go/src/antlr4/FileStream.go index e2c299c69..fa3b4182b 100644 --- a/runtime/Go/src/antlr4/FileStream.go +++ b/runtime/Go/src/antlr4/FileStream.go @@ -31,7 +31,9 @@ func NewFileStream(fileName string) *FileStream { fs.filename = fileName s := string(buf.Bytes()) - fmt.Println(s) + if PortDebug { + fmt.Println(s) + } fs.InputStream = NewInputStream(s) return fs diff --git a/runtime/Go/src/antlr4/InputStream.go b/runtime/Go/src/antlr4/InputStream.go index 25166db30..ecaec0ed4 100644 --- a/runtime/Go/src/antlr4/InputStream.go +++ b/runtime/Go/src/antlr4/InputStream.go @@ -67,7 +67,9 @@ func (is *InputStream) Mark() int { } func (is *InputStream) Release(marker int) { - fmt.Println("RELEASING") + if PortDebug { + fmt.Println("RELEASING") + } } func (is *InputStream) Seek(index int) { diff --git a/runtime/Go/src/antlr4/IntervalSet.go b/runtime/Go/src/antlr4/IntervalSet.go index 5b30a2a21..26ff9baa0 100644 --- a/runtime/Go/src/antlr4/IntervalSet.go +++ b/runtime/Go/src/antlr4/IntervalSet.go @@ -68,7 +68,9 @@ func (i *IntervalSet) addRange(l, h int) { } func (is *IntervalSet) addInterval(v *Interval) { - fmt.Println("addInterval" + v.String()) + if PortDebug { + fmt.Println("addInterval" + v.String()) + } if is.intervals == nil { is.intervals = make([]*Interval, 0) is.intervals = append(is.intervals, v) @@ -96,9 +98,13 @@ func (is *IntervalSet) addInterval(v *Interval) { } func (i *IntervalSet) addSet(other *IntervalSet) *IntervalSet { - fmt.Println("addSet") + if PortDebug { + fmt.Println("addSet") + } if other.intervals != nil { - fmt.Println(len(other.intervals)) + if PortDebug { + fmt.Println(len(other.intervals)) + } for k := 0; k < len(other.intervals); k++ { var i2 = other.intervals[k] i.addInterval(NewInterval(i2.start, i2.stop)) diff --git a/runtime/Go/src/antlr4/LL1Analyzer.go b/runtime/Go/src/antlr4/LL1Analyzer.go index 422cce1e4..f3d0a1395 100644 --- a/runtime/Go/src/antlr4/LL1Analyzer.go +++ b/runtime/Go/src/antlr4/LL1Analyzer.go @@ -75,16 +75,20 @@ func (la *LL1Analyzer) LOOK(s, stopState IATNState, ctx IRuleContext) *IntervalS if ctx != nil { lookContext = predictionContextFromRuleContext(s.GetATN(), ctx) } - fmt.Println("DEBUG 5") -// fmt.Println("DEBUG" + lookContext.String()) - fmt.Println(s) - fmt.Println(stopState) - fmt.Println(lookContext) - fmt.Println(r) - fmt.Println(seeThruPreds) - fmt.Println("=====") + if PortDebug { + fmt.Println("DEBUG 5") + // fmt.Println("DEBUG" + lookContext.String()) + fmt.Println(s) + fmt.Println(stopState) + fmt.Println(lookContext) + fmt.Println(r) + fmt.Println(seeThruPreds) + fmt.Println("=====") + } la._LOOK(s, stopState, lookContext, r, NewSet(nil, nil), NewBitSet(), seeThruPreds, true) - fmt.Println(r) + if PortDebug { + fmt.Println(r) + } return r } @@ -147,7 +151,9 @@ func (la *LL1Analyzer) _LOOK(s, stopState IATNState, ctx IPredictionContext, loo lookBusy.add(c) if s == stopState { - fmt.Println("DEBUG 6") + if PortDebug { + fmt.Println("DEBUG 6") + } if ctx == nil { look.addOne(TokenEpsilon) return @@ -169,7 +175,9 @@ func (la *LL1Analyzer) _LOOK(s, stopState IATNState, ctx IPredictionContext, loo } if ctx != PredictionContextEMPTY { - fmt.Println("DEBUG 7") + if PortDebug { + fmt.Println("DEBUG 7") + } // run thru all possible stack tops in ctx for i := 0; i < ctx.length(); i++ { @@ -188,7 +196,9 @@ func (la *LL1Analyzer) _LOOK(s, stopState IATNState, ctx IPredictionContext, loo t := s.GetTransitions()[i] if t1, ok := t.(*RuleTransition); ok { - fmt.Println("DEBUG 8") + if PortDebug { + fmt.Println("DEBUG 8") + } if calledRuleStack.contains(t1.getTarget().GetRuleIndex()) { continue @@ -198,32 +208,37 @@ func (la *LL1Analyzer) _LOOK(s, stopState IATNState, ctx IPredictionContext, loo la.___LOOK(stopState, newContext, look, lookBusy, calledRuleStack, seeThruPreds, addEOF, t1) - fmt.Println(look) -// -// defer func() { -// calledRuleStack.remove(t1.getTarget().GetRuleIndex()) -// }() -// -// calledRuleStack.add(t1.getTarget().GetRuleIndex()) -// la._LOOK(t1.getTarget(), stopState, newContext, look, lookBusy, calledRuleStack, seeThruPreds, addEOF) + if PortDebug { + fmt.Println(look) + } } else if t2, ok := t.(IAbstractPredicateTransition); ok { - fmt.Println("DEBUG 9") + if PortDebug { + fmt.Println("DEBUG 9") + } if seeThruPreds { la._LOOK(t2.getTarget(), stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF) } else { look.addOne(LL1AnalyzerHIT_PRED) } } else if t.getIsEpsilon() { - fmt.Println("DEBUG 10") + if PortDebug { + fmt.Println("DEBUG 10") + } la._LOOK(t.getTarget(), stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF) } else if _, ok := t.(*WildcardTransition); ok { - fmt.Println("DEBUG 11") + if PortDebug { + fmt.Println("DEBUG 11") + } look.addRange(TokenMinUserTokenType, la.atn.maxTokenType) } else { - fmt.Println("DEBUG 12") + if PortDebug { + fmt.Println("DEBUG 12") + } set := t.getLabel() - fmt.Println(set) + if PortDebug { + fmt.Println(set) + } if set != nil { if _, ok := t.(*NotSetTransition); ok { set = set.complement(TokenMinUserTokenType, la.atn.maxTokenType) diff --git a/runtime/Go/src/antlr4/Lexer.go b/runtime/Go/src/antlr4/Lexer.go index ca98787d8..3af4e4466 100644 --- a/runtime/Go/src/antlr4/Lexer.go +++ b/runtime/Go/src/antlr4/Lexer.go @@ -211,10 +211,14 @@ func (l *Lexer) nextToken() IToken { if l._type != LexerMore { break } - fmt.Println("lex inner loop") + if PortDebug { + fmt.Println("lex inner loop") + } } - fmt.Println("lex loop") + if PortDebug { + fmt.Println("lex loop") + } if continueOuter { continue } @@ -293,7 +297,9 @@ func (l *Lexer) emitToken(token IToken) { // custom Token objects or provide a Newfactory. // / func (l *Lexer) emit() IToken { - fmt.Println("emit") + if PortDebug { + fmt.Println("emit") + } var t = l._factory.Create(l._tokenFactorySourcePair, l._type, l._text, l._channel, l._tokenStartCharIndex, l.getCharIndex()-1, l._tokenStartLine, l._tokenStartColumn) l.emitToken(t) return t @@ -302,7 +308,9 @@ func (l *Lexer) emit() IToken { func (l *Lexer) emitEOF() IToken { cpos := l.getCharPositionInLine() lpos := l.getLine() - fmt.Println("emitEOF") + if PortDebug { + fmt.Println("emitEOF") + } var eof = l._factory.Create(l._tokenFactorySourcePair, TokenEOF, "", TokenDefaultChannel, l._input.Index(), l._input.Index()-1, lpos, cpos) l.emitToken(eof) return eof @@ -351,12 +359,16 @@ func (this *Lexer) GetATN() *ATN { // Forces load of all tokens. Does not include EOF token. // / func (l *Lexer) getAllTokens() []IToken { - fmt.Println("getAllTokens") + if PortDebug { + fmt.Println("getAllTokens") + } var tokens = make([]IToken, 0) var t = l.nextToken() for t.GetTokenType() != TokenEOF { tokens = append(tokens, t) - fmt.Println("getAllTokens") + if PortDebug { + fmt.Println("getAllTokens") + } t = l.nextToken() } return tokens diff --git a/runtime/Go/src/antlr4/LexerATNSimulator.go b/runtime/Go/src/antlr4/LexerATNSimulator.go index d846931b6..d9961041f 100644 --- a/runtime/Go/src/antlr4/LexerATNSimulator.go +++ b/runtime/Go/src/antlr4/LexerATNSimulator.go @@ -88,7 +88,7 @@ func NewLexerATNSimulator(recog ILexer, atn *ATN, decisionToDFA []*DFA, sharedCo return this } -var LexerATNSimulatorDebug = true +var LexerATNSimulatorDebug = false var LexerATNSimulatorDFADebug = false var LexerATNSimulatorMIN_DFA_EDGE = 0 @@ -105,14 +105,18 @@ func (this *LexerATNSimulator) copyState(simulator *LexerATNSimulator) { func (this *LexerATNSimulator) Match(input CharStream, mode int) int { - fmt.Println("Match") + if PortDebug { + fmt.Println("Match") + } this.Match_calls += 1 this.mode = mode var mark = input.Mark() defer func() { - fmt.Println("FINALLY") + if PortDebug { + fmt.Println("FINALLY") + } input.Release(mark) }() @@ -122,10 +126,14 @@ func (this *LexerATNSimulator) Match(input CharStream, mode int) int { var dfa = this.decisionToDFA[mode] if dfa.s0 == nil { - fmt.Println("MatchATN") + if PortDebug { + fmt.Println("MatchATN") + } return this.MatchATN(input) } else { - fmt.Println("execATN") + if PortDebug { + fmt.Println("execATN") + } return this.execATN(input, dfa.s0) } } @@ -224,7 +232,9 @@ func (this *LexerATNSimulator) execATN(input CharStream, ds0 *DFAState) int { s = target // flip current DFA target becomes Newsrc/from state } - fmt.Println("DONE WITH execATN loop") + if PortDebug { + fmt.Println("DONE WITH execATN loop") + } return this.failOrAccept(this.prevAccept, input, s.configs, t) } @@ -286,7 +296,9 @@ func (this *LexerATNSimulator) failOrAccept(prevAccept *SimState, input CharStre var lexerActionExecutor = prevAccept.dfaState.lexerActionExecutor this.accept(input, lexerActionExecutor, this.startIndex, prevAccept.index, prevAccept.line, prevAccept.column) - fmt.Println(prevAccept.dfaState.prediction) + if PortDebug { + fmt.Println(prevAccept.dfaState.prediction) + } return prevAccept.dfaState.prediction } else { // if no accept and EOF is first char, return EOF @@ -357,7 +369,9 @@ func (this *LexerATNSimulator) getReachableTarget(trans ITransition, t int) IATN func (this *LexerATNSimulator) computeStartState(input CharStream, p IATNState) *OrderedATNConfigSet { - fmt.Println("DEBUG" + strconv.Itoa(len(p.GetTransitions()))) + if PortDebug { + fmt.Println("DEBUG" + strconv.Itoa(len(p.GetTransitions()))) + } var configs = NewOrderedATNConfigSet() for i := 0; i < len(p.GetTransitions()); i++ { @@ -366,7 +380,9 @@ func (this *LexerATNSimulator) computeStartState(input CharStream, p IATNState) this.closure(input, cfg, configs.ATNConfigSet, false, false, false) } - fmt.Println("DEBUG" + configs.String()) + if PortDebug { + fmt.Println("DEBUG" + configs.String()) + } return configs } @@ -661,7 +677,9 @@ func (this *LexerATNSimulator) consume(input CharStream) { } func (this *LexerATNSimulator) GetTokenName(tt int) string { - fmt.Println(tt) + if PortDebug { + fmt.Println(tt) + } if tt == -1 { return "EOF" } else { diff --git a/runtime/Go/src/antlr4/Parser.go b/runtime/Go/src/antlr4/Parser.go index d155047f9..f5341a600 100644 --- a/runtime/Go/src/antlr4/Parser.go +++ b/runtime/Go/src/antlr4/Parser.go @@ -126,10 +126,14 @@ func (p *Parser) GetParseListeners() []ParseTreeListener { func (p *Parser) Match(ttype int) IToken { - fmt.Println("get current token") + if PortDebug { + fmt.Println("get current token") + } var t = p.getCurrentToken() - fmt.Println("TOKEN IS " + t.GetText()) + if PortDebug { + fmt.Println("TOKEN IS " + t.GetText()) + } if t.GetTokenType() == ttype { p._errHandler.ReportMatch(p) @@ -144,7 +148,9 @@ func (p *Parser) Match(ttype int) IToken { } } - fmt.Println("match done") + if PortDebug { + fmt.Println("match done") + } return t } @@ -411,9 +417,13 @@ func (p *Parser) NotifyErrorListeners(msg string, offendingToken IToken, err IRe func (p *Parser) Consume() IToken { var o = p.getCurrentToken() if o.GetTokenType() != TokenEOF { - fmt.Println("Consuming") + if PortDebug { + fmt.Println("Consuming") + } p.GetInputStream().Consume() - fmt.Println("Done consuming") + if PortDebug { + fmt.Println("Done consuming") + } } var hasListener = p._parseListeners != nil && len(p._parseListeners) > 0 if p.BuildParseTrees || hasListener { diff --git a/runtime/Go/src/antlr4/ParserATNSimulator.go b/runtime/Go/src/antlr4/ParserATNSimulator.go index c2cfa1756..f0a57ef2c 100644 --- a/runtime/Go/src/antlr4/ParserATNSimulator.go +++ b/runtime/Go/src/antlr4/ParserATNSimulator.go @@ -47,7 +47,7 @@ func NewParserATNSimulator(parser IParser, atn *ATN, decisionToDFA []*DFA, share return this } -var ParserATNSimulatorDebug = true +var ParserATNSimulatorDebug = false var ParserATNSimulatorListATNDecisions = false var ParserATNSimulatorDFADebug = false var ParserATNSimulatorRetryDebug = false @@ -57,7 +57,9 @@ func (this *ParserATNSimulator) reset() { func (this *ParserATNSimulator) AdaptivePredict(input TokenStream, decision int, outerContext IParserRuleContext) int { - fmt.Println("Adaptive preduct") + if PortDebug { + fmt.Println("Adaptive predict") + } if ParserATNSimulatorDebug || ParserATNSimulatorListATNDecisions { @@ -998,7 +1000,9 @@ func (this *ParserATNSimulator) closureCheckingStopState(config IATNConfig, conf } else { // we have no context info, just chase follow links (if greedy) if ParserATNSimulatorDebug { - fmt.Println("DEBUG 1") + if PortDebug { + fmt.Println("DEBUG 1") + } fmt.Println("FALLING off rule " + this.getRuleName(config.GetState().GetRuleIndex())) } this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) @@ -1023,7 +1027,9 @@ func (this *ParserATNSimulator) closureCheckingStopState(config IATNConfig, conf } else { // else if we have no context info, just chase follow links (if greedy) if ParserATNSimulatorDebug { - fmt.Println("DEBUG 2") + if PortDebug { + fmt.Println("DEBUG 2") + } fmt.Println("FALLING off rule " + this.getRuleName(config.GetState().GetRuleIndex())) } } @@ -1033,7 +1039,9 @@ func (this *ParserATNSimulator) closureCheckingStopState(config IATNConfig, conf // Do the actual work of walking epsilon edges// func (this *ParserATNSimulator) closure_(config IATNConfig, configs *ATNConfigSet, closureBusy *Set, collectPredicates, fullCtx bool, depth int, treatEofAsEpsilon bool) { - fmt.Println("closure_") + if PortDebug { + fmt.Println("closure_") + } var p = config.GetState() // optimization if !p.GetEpsilonOnlyTransitions() { @@ -1047,7 +1055,9 @@ func (this *ParserATNSimulator) closure_(config IATNConfig, configs *ATNConfigSe var continueCollecting = collectPredicates && !ok var c = this.getEpsilonTarget(config, t, continueCollecting, depth == 0, fullCtx, treatEofAsEpsilon) if c != nil { - fmt.Println("DEBUG 1") + if PortDebug { + fmt.Println("DEBUG 1") + } if !t.getIsEpsilon() && closureBusy.add(c) != c { // avoid infinite recursion for EOF* and EOF+ continue @@ -1056,7 +1066,9 @@ func (this *ParserATNSimulator) closure_(config IATNConfig, configs *ATNConfigSe if _, ok := config.GetState().(*RuleStopState); ok { - fmt.Println("DEBUG 2") + if PortDebug { + fmt.Println("DEBUG 2") + } // target fell off end of rule mark resulting c as having dipped into outer context // We can't get here if incoming config was rule stop and we had context // track how far we dip into outer context. Might @@ -1064,16 +1076,22 @@ func (this *ParserATNSimulator) closure_(config IATNConfig, configs *ATNConfigSe // preds if this is > 0. if closureBusy.add(c) != c { - fmt.Println("DEBUG 3") + if PortDebug { + fmt.Println("DEBUG 3") + } // avoid infinite recursion for right-recursive rules continue } else { - fmt.Println(c) - fmt.Println(closureBusy) + if PortDebug { + fmt.Println(c) + fmt.Println(closureBusy) + } } if this._dfa != nil && this._dfa.precedenceDfa { - fmt.Println("DEBUG 4") + if PortDebug { + fmt.Println("DEBUG 4") + } if t.(*EpsilonTransition).outermostPrecedenceReturn == this._dfa.atnStartState.GetRuleIndex() { c.precedenceFilterSuppressed = true } @@ -1292,7 +1310,9 @@ func (this *ParserATNSimulator) getConflictingAltsOrUniqueAlt(configs *ATNConfig func (this *ParserATNSimulator) GetTokenName(t int) string { - fmt.Println("Get token name") + if PortDebug { + fmt.Println("Get token name") + } if t == TokenEOF { return "EOF" diff --git a/runtime/Go/src/antlr4/Recognizer.go b/runtime/Go/src/antlr4/Recognizer.go index 8e37e20c7..06e3b0caa 100644 --- a/runtime/Go/src/antlr4/Recognizer.go +++ b/runtime/Go/src/antlr4/Recognizer.go @@ -83,7 +83,9 @@ func (this *Recognizer) GetState() int { } func (this *Recognizer) SetState(v int) { - fmt.Println("SETTING STATE " + strconv.Itoa(v) + " from " + strconv.Itoa(this.state)) + if PortDebug { + fmt.Println("SETTING STATE " + strconv.Itoa(v) + " from " + strconv.Itoa(this.state)) + } this.state = v } diff --git a/runtime/Java/src/org/antlr/v4/runtime/atn/ParserATNSimulator.java b/runtime/Java/src/org/antlr/v4/runtime/atn/ParserATNSimulator.java index 5e92c6187..e9d014a0b 100755 --- a/runtime/Java/src/org/antlr/v4/runtime/atn/ParserATNSimulator.java +++ b/runtime/Java/src/org/antlr/v4/runtime/atn/ParserATNSimulator.java @@ -1462,7 +1462,6 @@ public class ParserATNSimulator extends ATNSimulator { boolean fullCtx, boolean treatEofAsEpsilon) { - console.log("closure"); final int initialDepth = 0; closureCheckingStopState(config, configs, closureBusy, collectPredicates, fullCtx, diff --git a/runtime/JavaScript/src/ArithmeticParser.js b/runtime/JavaScript/src/ArithmeticParser.js index 5af1068e7..69b220f7e 100644 --- a/runtime/JavaScript/src/ArithmeticParser.js +++ b/runtime/JavaScript/src/ArithmeticParser.js @@ -726,11 +726,9 @@ ArithmeticParser.prototype.relop = function() { this.state = 56; _la = this._input.LA(1); if(!((((_la) & ~0x1f) == 0 && ((1 << _la) & ((1 << ArithmeticParser.GT) | (1 << ArithmeticParser.LT) | (1 << ArithmeticParser.EQ))) !== 0))) { - console.log("DEBUG1") this._errHandler.recoverInline(this); } else { - console.log("DEBUG2") this.consume(); } } catch (re) { @@ -820,7 +818,6 @@ ArithmeticParser.prototype.number = function() { do { this.state = 61; this.match(ArithmeticParser.DIGIT); - console.log("Done with match") this.state = 64; this._errHandler.sync(this); _la = this._input.LA(1); diff --git a/runtime/JavaScript/src/antlr4/BufferedTokenStream.js b/runtime/JavaScript/src/antlr4/BufferedTokenStream.js index e1fb948d6..43baa8c37 100644 --- a/runtime/JavaScript/src/antlr4/BufferedTokenStream.js +++ b/runtime/JavaScript/src/antlr4/BufferedTokenStream.js @@ -129,12 +129,16 @@ BufferedTokenStream.prototype.consume = function() { // not yet initialized skipEofCheck = false; } - console.log("consume 1") + if (PORT_DEBUG) { + console.log("consume 1") + } if (!skipEofCheck && this.LA(1) === Token.EOF) { throw "cannot consume EOF"; } if (this.sync(this.index + 1)) { - console.log("consume 2") + if (PORT_DEBUG) { + console.log("consume 2") + } this.index = this.adjustSeekIndex(this.index + 1); } }; @@ -149,7 +153,9 @@ BufferedTokenStream.prototype.sync = function(i) { var n = i - this.tokens.length + 1; // how many more elements we need? if (n > 0) { var fetched = this.fetch(n); - console.log("sync done") + if (PORT_DEBUG) { + console.log("sync done") + } return fetched >= n; } @@ -166,7 +172,9 @@ BufferedTokenStream.prototype.fetch = function(n) { } for (var i = 0; i < n; i++) { var t = this.tokenSource.nextToken(); - console.log("fetch loop") + if (PORT_DEBUG) { + console.log("fetch loop") + } t.tokenIndex = this.tokens.length; this.tokens.push(t); if (t.type === Token.EOF) { @@ -175,7 +183,9 @@ BufferedTokenStream.prototype.fetch = function(n) { } } - console.log("fetch done") + if (PORT_DEBUG) { + console.log("fetch done") + } return n; }; diff --git a/runtime/JavaScript/src/antlr4/CommonTokenFactory.js b/runtime/JavaScript/src/antlr4/CommonTokenFactory.js index 90d5e38aa..468deadbc 100644 --- a/runtime/JavaScript/src/antlr4/CommonTokenFactory.js +++ b/runtime/JavaScript/src/antlr4/CommonTokenFactory.js @@ -74,7 +74,9 @@ CommonTokenFactory.DEFAULT = new CommonTokenFactory(); CommonTokenFactory.prototype.create = function(source, type, text, channel, start, stop, line, column) { - console.log("Token factory creating: " + text) + if (PORT_DEBUG) { + console.log("Token factory creating: " + text) + } var t = new CommonToken(source, type, channel, start, stop); t.line = line; @@ -89,7 +91,9 @@ CommonTokenFactory.prototype.create = function(source, type, text, channel, star CommonTokenFactory.prototype.createThin = function(type, text) { - console.log("Token factory creating: " + text) + if (PORT_DEBUG) { + console.log("Token factory creating: " + text) + } var t = new CommonToken(null, type); t.text = text; diff --git a/runtime/JavaScript/src/antlr4/FileStream.js b/runtime/JavaScript/src/antlr4/FileStream.js index b7d3d8d64..5c510070e 100644 --- a/runtime/JavaScript/src/antlr4/FileStream.js +++ b/runtime/JavaScript/src/antlr4/FileStream.js @@ -42,7 +42,9 @@ function FileStream(fileName) { InputStream.call(this, data); this.fileName = fileName; - console.log(data); + if (PORT_DEBUG) { + console.log(data); + } return this; } diff --git a/runtime/JavaScript/src/antlr4/InputStream.js b/runtime/JavaScript/src/antlr4/InputStream.js index e994195b6..25aa707c3 100644 --- a/runtime/JavaScript/src/antlr4/InputStream.js +++ b/runtime/JavaScript/src/antlr4/InputStream.js @@ -101,7 +101,9 @@ InputStream.prototype.mark = function() { }; InputStream.prototype.release = function(marker) { - console.log("RELEASING") + if (PORT_DEBUG) { + console.log("RELEASING") + } }; // consume() ahead until p==_index; can't just set p=_index as we must diff --git a/runtime/JavaScript/src/antlr4/IntervalSet.js b/runtime/JavaScript/src/antlr4/IntervalSet.js index ffb60f96c..7cb7ce5fd 100644 --- a/runtime/JavaScript/src/antlr4/IntervalSet.js +++ b/runtime/JavaScript/src/antlr4/IntervalSet.js @@ -50,7 +50,9 @@ IntervalSet.prototype.addRange = function(l, h) { }; IntervalSet.prototype.addInterval = function(v) { - console.log("addInterval" + v.toString()) + if (PORT_DEBUG) { + console.log("addInterval" + v.toString()) + } if (this.intervals === null) { this.intervals = []; this.intervals.push(v); @@ -81,9 +83,13 @@ IntervalSet.prototype.addInterval = function(v) { }; IntervalSet.prototype.addSet = function(other) { - console.log("addSet") + if (PORT_DEBUG) { + console.log("addSet") + } if (other.intervals !== null) { - console.log(other.intervals.length) + if (PORT_DEBUG) { + console.log(other.intervals.length) + } for (var k = 0; k < other.intervals.length; k++) { var i = other.intervals[k]; this.addInterval(new Interval(i.start, i.stop)); diff --git a/runtime/JavaScript/src/antlr4/LL1Analyzer.js b/runtime/JavaScript/src/antlr4/LL1Analyzer.js index e42678dc6..65de2c0fc 100644 --- a/runtime/JavaScript/src/antlr4/LL1Analyzer.js +++ b/runtime/JavaScript/src/antlr4/LL1Analyzer.js @@ -110,15 +110,19 @@ LL1Analyzer.prototype.LOOK = function(s, stopState, ctx) { var seeThruPreds = true; // ignore preds; get all lookahead ctx = ctx || null; var lookContext = ctx!==null ? predictionContextFromRuleContext(s.atn, ctx) : null; - console.log("DEBUG 5") - console.log(s.toString()) - console.log(stopState) - console.log(lookContext) - console.log(r.toString()) - console.log(seeThruPreds) - console.log("=====") + if (PORT_DEBUG) { + console.log("DEBUG 5") + console.log(s.toString()) + console.log(stopState) + console.log(lookContext) + console.log(r.toString()) + console.log(seeThruPreds) + console.log("=====") + } this._LOOK(s, stopState, lookContext, r, new Set(), new BitSet(), seeThruPreds, true); - console.log(r.toString()) + if (PORT_DEBUG) { + console.log(r.toString()) + } return r; }; @@ -159,7 +163,9 @@ LL1Analyzer.prototype._LOOK = function(s, stopState , ctx, look, lookBusy, calle } lookBusy.add(c); if (s === stopState) { - console.log("DEBUG 6") + if (PORT_DEBUG) { + console.log("DEBUG 6") + } if (ctx ===null) { look.addOne(Token.EPSILON); return; @@ -177,7 +183,9 @@ LL1Analyzer.prototype._LOOK = function(s, stopState , ctx, look, lookBusy, calle return; } if (ctx !== PredictionContext.EMPTY) { - console.log("DEBUG 7") + if (PORT_DEBUG) { + console.log("DEBUG 7") + } // run thru all possible stack tops in ctx for(var i=0; i 0; diff --git a/runtime/JavaScript/src/antlr4/Recognizer.js b/runtime/JavaScript/src/antlr4/Recognizer.js index 0b8639148..83e3ee586 100644 --- a/runtime/JavaScript/src/antlr4/Recognizer.js +++ b/runtime/JavaScript/src/antlr4/Recognizer.js @@ -164,7 +164,9 @@ Object.defineProperty(Recognizer.prototype, "state", { return this._stateNumber; }, set : function(state) { - console.log("SETTING STATE" + state + " from " + this._stateNumber ) + if (PORT_DEBUG) { + console.log("SETTING STATE" + state + " from " + this._stateNumber ) + } this._stateNumber = state; } }); diff --git a/runtime/JavaScript/src/antlr4/atn/ATN.js b/runtime/JavaScript/src/antlr4/atn/ATN.js index 535f29fb0..0ec6d1a1b 100644 --- a/runtime/JavaScript/src/antlr4/atn/ATN.js +++ b/runtime/JavaScript/src/antlr4/atn/ATN.js @@ -75,11 +75,15 @@ ATN.prototype.nextTokensInContext = function(s, ctx) { // rule. ATN.prototype.nextTokensNoContext = function(s) { if (s.nextTokenWithinRule !== null ) { - console.log("DEBUG 1") + if (PORT_DEBUG) { + console.log("DEBUG 1") + } return s.nextTokenWithinRule; } - console.log("DEBUG 2") - console.log(this.nextTokensInContext(s, null).toString()) + if (PORT_DEBUG) { + console.log("DEBUG 2") + console.log(this.nextTokensInContext(s, null).toString()) + } s.nextTokenWithinRule = this.nextTokensInContext(s, null); s.nextTokenWithinRule.readOnly = true; return s.nextTokenWithinRule; diff --git a/runtime/JavaScript/src/antlr4/atn/LexerATNSimulator.js b/runtime/JavaScript/src/antlr4/atn/LexerATNSimulator.js index 98de83e43..5e79d8704 100644 --- a/runtime/JavaScript/src/antlr4/atn/LexerATNSimulator.js +++ b/runtime/JavaScript/src/antlr4/atn/LexerATNSimulator.js @@ -101,7 +101,7 @@ function LexerATNSimulator(recog, atn, decisionToDFA, sharedContextCache) { LexerATNSimulator.prototype = Object.create(ATNSimulator.prototype); LexerATNSimulator.prototype.constructor = LexerATNSimulator; -LexerATNSimulator.prototype.debug = true; +LexerATNSimulator.prototype.debug = false; LexerATNSimulator.prototype.dfa_debug = false; LexerATNSimulator.MIN_DFA_EDGE = 0; @@ -118,7 +118,9 @@ LexerATNSimulator.prototype.copyState = function(simulator) { LexerATNSimulator.prototype.match = function(input, mode) { - console.log("MATCH") + if (PORT_DEBUG) { + console.log("MATCH") + } this.match_calls += 1; this.mode = mode; @@ -128,15 +130,21 @@ LexerATNSimulator.prototype.match = function(input, mode) { this.prevAccept.reset(); var dfa = this.decisionToDFA[mode]; if (dfa.s0 === null) { - console.log("matchATN") + if (PORT_DEBUG) { + console.log("matchATN") + } return this.matchATN(input); } else { - console.log("execATN") + if (PORT_DEBUG) { + console.log("execATN") + } var res = this.execATN(input, dfa.s0); return res; } } finally { - console.log("FINALLY") + if (PORT_DEBUG) { + console.log("FINALLY") + } input.release(mark); } }; @@ -233,7 +241,9 @@ LexerATNSimulator.prototype.execATN = function(input, ds0) { s = target; // flip; current DFA target becomes new src/from state } - console.log("Done with execATN loop") + if (PORT_DEBUG) { + console.log("Done with execATN loop") + } return this.failOrAccept(this.prevAccept, input, s.configs, t); }; @@ -298,7 +308,9 @@ LexerATNSimulator.prototype.failOrAccept = function(prevAccept, input, reach, t) this.accept(input, lexerActionExecutor, this.startIndex, prevAccept.index, prevAccept.line, prevAccept.column); - console.log("Prevaccept", prevAccept.dfaState.prediction) + if (PORT_DEBUG) { + console.log("Prevaccept", prevAccept.dfaState.prediction) + } return prevAccept.dfaState.prediction; } else { @@ -669,7 +681,9 @@ LexerATNSimulator.prototype.consume = function(input) { }; LexerATNSimulator.prototype.getTokenName = function(tt) { - console.log(tt); + if (PORT_DEBUG) { + console.log(tt); + } if (tt === -1) { return "EOF"; } else { diff --git a/runtime/JavaScript/src/antlr4/atn/ParserATNSimulator.js b/runtime/JavaScript/src/antlr4/atn/ParserATNSimulator.js index 4bed8e4ce..9ba420562 100644 --- a/runtime/JavaScript/src/antlr4/atn/ParserATNSimulator.js +++ b/runtime/JavaScript/src/antlr4/atn/ParserATNSimulator.js @@ -313,7 +313,7 @@ function ParserATNSimulator(parser, atn, decisionToDFA, sharedContextCache) { ParserATNSimulator.prototype = Object.create(ATNSimulator.prototype); ParserATNSimulator.prototype.constructor = ParserATNSimulator; -ParserATNSimulator.prototype.debug = true; +ParserATNSimulator.prototype.debug = false; ParserATNSimulator.prototype.debug_list_atn_decisions = false; ParserATNSimulator.prototype.dfa_debug = false; ParserATNSimulator.prototype.retry_debug = false; @@ -324,7 +324,9 @@ ParserATNSimulator.prototype.reset = function() { ParserATNSimulator.prototype.adaptivePredict = function(input, decision, outerContext) { - console.log("adaptive predict") + if (PORT_DEBUG) { + console.log("adaptive predict") + } if (this.debug || this.debug_list_atn_decisions) { console.log("adaptivePredict decision " + decision + @@ -1254,7 +1256,9 @@ ParserATNSimulator.prototype.closureCheckingStopState = function(config, configs } else { // we have no context info, just chase follow links (if greedy) if (this.debug) { - console.log("DEBUG 1") + if (PORT_DEBUG) { + console.log("DEBUG 1") + } console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex)); } this.closure_(config, configs, closureBusy, collectPredicates, @@ -1280,7 +1284,9 @@ ParserATNSimulator.prototype.closureCheckingStopState = function(config, configs } else { // else if we have no context info, just chase follow links (if greedy) if (this.debug) { - console.log("DEBUG 2") + if (PORT_DEBUG) { + console.log("DEBUG 2") + } console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex)); } } @@ -1290,7 +1296,9 @@ ParserATNSimulator.prototype.closureCheckingStopState = function(config, configs // Do the actual work of walking epsilon edges// ParserATNSimulator.prototype.closure_ = function(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) { - console.log("closure_") + if (PORT_DEBUG) { + console.log("closure_") + } var p = config.state; // optimization if (! p.epsilonOnlyTransitions) { @@ -1303,7 +1311,9 @@ ParserATNSimulator.prototype.closure_ = function(config, configs, closureBusy, c var continueCollecting = collectPredicates && !(t instanceof ActionTransition); var c = this.getEpsilonTarget(config, t, continueCollecting, depth === 0, fullCtx, treatEofAsEpsilon); if (c!==null) { - console.log("DEBUG 1") + if (PORT_DEBUG) { + console.log("DEBUG 1") + } if (!t.isEpsilon && closureBusy.add(c)!==c){ // avoid infinite recursion for EOF* and EOF+ continue; @@ -1311,7 +1321,9 @@ ParserATNSimulator.prototype.closure_ = function(config, configs, closureBusy, c var newDepth = depth; if ( config.state instanceof RuleStopState) { - console.log("DEBUG 2") + if (PORT_DEBUG) { + console.log("DEBUG 2") + } // target fell off end of rule; mark resulting c as having dipped into outer context // We can't get here if incoming config was rule stop and we had context // track how far we dip into outer context. Might @@ -1319,16 +1331,22 @@ ParserATNSimulator.prototype.closure_ = function(config, configs, closureBusy, c // preds if this is > 0. if (closureBusy.add(c)!==c) { - console.log("DEBUG 3") + if (PORT_DEBUG) { + console.log("DEBUG 3") + } // avoid infinite recursion for right-recursive rules continue; } else { - console.log(c.toString()) - console.log(closureBusy.toString()) + if (PORT_DEBUG) { + console.log(c.toString()) + console.log(closureBusy.toString()) + } } if (this._dfa !== null && this._dfa.precedenceDfa) { - console.log("DEBUG 4") + if (PORT_DEBUG) { + console.log("DEBUG 4") + } if (t.outermostPrecedenceReturn === this._dfa.atnStartState.ruleIndex) { c.precedenceFilterSuppressed = true; } @@ -1528,7 +1546,9 @@ ParserATNSimulator.prototype.getConflictingAltsOrUniqueAlt = function(configs) { ParserATNSimulator.prototype.getTokenName = function( t) { - console.log("Get token name") + if (PORT_DEBUG) { + console.log("Get token name") + } if (t===Token.EOF) { return "EOF"; diff --git a/runtime/JavaScript/src/antlr4/error/ErrorStrategy.js b/runtime/JavaScript/src/antlr4/error/ErrorStrategy.js index 667c13de5..845113fcc 100644 --- a/runtime/JavaScript/src/antlr4/error/ErrorStrategy.js +++ b/runtime/JavaScript/src/antlr4/error/ErrorStrategy.js @@ -245,26 +245,35 @@ DefaultErrorStrategy.prototype.sync = function(recognizer) { return; } - console.log("STATE" + recognizer.state) + if (PORT_DEBUG) { + console.log("STATE" + recognizer.state) + } var s = recognizer._interp.atn.states[recognizer.state]; var la = recognizer.getTokenStream().LA(1); - console.log("LA" + la); + if (PORT_DEBUG) { + console.log("LA" + la); + } // try cheaper subset first; might get lucky. seems to shave a wee bit off if (la===Token.EOF || recognizer.atn.nextTokens(s).contains(la)) { - console.log("OK1") + if (PORT_DEBUG) { + console.log("OK1") + } return; } // Return but don't end recovery. only do that upon valid token match if(recognizer.isExpectedToken(la)) { - console.log("OK2") + if (PORT_DEBUG) { + console.log("OK2") + } return; } - console.log("LA" + la) -// console.log(recognizer.GetATN().nextTokens(s, nil)) + if (PORT_DEBUG) { + console.log("LA" + la) + } switch (s.stateType) { case ATNState.BLOCK_START: diff --git a/runtime/JavaScript/src/foo.txt b/runtime/JavaScript/src/foo.txt index 067b749fd..ea2793e5b 100644 --- a/runtime/JavaScript/src/foo.txt +++ b/runtime/JavaScript/src/foo.txt @@ -1 +1 @@ -1 + 2 = 3 + 5 +1 + 2 + 32 + (1 + 2) = 3 + 5 diff --git a/runtime/JavaScript/src/test.js b/runtime/JavaScript/src/test.js index c541ea14e..8d5954162 100644 --- a/runtime/JavaScript/src/test.js +++ b/runtime/JavaScript/src/test.js @@ -1,3 +1,5 @@ +PORT_DEBUG = false + var antlr4 = require("./antlr4/index"), tree = antlr4.tree ArithmeticLexer = require("./ArithmeticLexer").ArithmeticLexer,