fix broken API calls

This commit is contained in:
Eric Vergnaud 2019-01-01 15:04:20 +01:00
parent 3ad118f87e
commit 90854967ca
9 changed files with 17 additions and 188 deletions

View File

@ -18,161 +18,6 @@ stages:
matrix:
include:
- os: linux
compiler: clang
jdk: openjdk7
env:
- TARGET=cpp
- CXX=g++-5
- GROUP=LEXER
stage: main-test
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7
packages:
- g++-5
- uuid-dev
- clang-3.7
- os: linux
compiler: clang
jdk: openjdk7
env:
- TARGET=cpp
- CXX=g++-5
- GROUP=PARSER
stage: main-test
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7
packages:
- g++-5
- uuid-dev
- clang-3.7
- os: linux
compiler: clang
jdk: openjdk7
env:
- TARGET=cpp
- CXX=g++-5
- GROUP=RECURSION
stage: main-test
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7
packages:
- g++-5
- uuid-dev
- clang-3.7
- os: osx
compiler: clang
osx_image: xcode10.1
env:
- TARGET=cpp
- GROUP=LEXER
stage: extended-test
- os: osx
compiler: clang
osx_image: xcode10.1
env:
- TARGET=cpp
- GROUP=PARSER
stage: extended-test
- os: osx
compiler: clang
osx_image: xcode10.1
env:
- TARGET=cpp
- GROUP=RECURSION
stage: extended-test
- os: osx
compiler: clang
osx_image: xcode10.1
env:
- TARGET=swift
- GROUP=LEXER
stage: main-test
- os: osx
compiler: clang
osx_image: xcode10.1
env:
- TARGET=swift
- GROUP=PARSER
stage: main-test
- os: osx
compiler: clang
osx_image: xcode10.1
env:
- TARGET=swift
- GROUP=RECURSION
stage: main-test
- os: linux
dist: xenial
compiler: clang
env:
- TARGET=swift
- GROUP=ALL
stage: extended-test
- os: osx
osx_image: xcode10.1
env:
- TARGET=dotnet
- GROUP=LEXER
stage: extended-test
- os: osx
osx_image: xcode10.1
env:
- TARGET=dotnet
- GROUP=PARSER
stage: extended-test
- os: osx
osx_image: xcode10.1
env:
- TARGET=dotnet
- GROUP=RECURSION
stage: extended-test
- os: linux
jdk: openjdk7
env: TARGET=java
stage: extended-test
- os: linux
jdk: openjdk8
env: TARGET=java
stage: extended-test
- os: linux
jdk: oraclejdk8
env: TARGET=java
stage: smoke-test
- os: linux
jdk: openjdk7
env: TARGET=csharp
stage: main-test
- os: linux
jdk: oraclejdk8
dist: trusty
env:
- TARGET=dotnet
- GROUP=LEXER
stage: extended-test
- os: linux
jdk: openjdk8
dist: trusty
env:
- TARGET=dotnet
- GROUP=PARSER
stage: extended-test
- os: linux
jdk: oraclejdk8
dist: trusty
env:
- TARGET=dotnet
- GROUP=RECURSION
stage: extended-test
- os: linux
jdk: openjdk7
env: TARGET=python2
@ -187,16 +32,6 @@ matrix:
packages:
- python3.6
stage: main-test
- os: linux
dist: trusty
jdk: openjdk8
env: TARGET=javascript
stage: main-test
- os: linux
dist: trusty
jdk: openjdk8
env: TARGET=go
stage: main-test
before_install:
- f="./.travis/before-install-$TRAVIS_OS_NAME-$TARGET.sh"; ! [ -x "$f" ] || "$f"

View File

@ -285,7 +285,7 @@ class BufferedTokenStream(TokenStream):
elif stop is None or stop >= len(self.tokens):
stop = len(self.tokens) - 1
if start < 0 or stop < 0 or stop<start:
return ""
return u""
with StringIO() as buf:
for i in xrange(start, stop+1):
t = self.tokens[i]

View File

@ -1603,17 +1603,15 @@ class ParserATNSimulator(ATNSimulator):
def reportAttemptingFullContext(self, dfa, conflictingAlts, configs, startIndex, stopIndex):
if ParserATNSimulator.debug or ParserATNSimulator.retry_debug:
interval = range(startIndex, stopIndex + 1)
print("reportAttemptingFullContext decision=" + str(dfa.decision) + ":" + str(configs) +
", input=" + self.parser.getTokenStream().getText(interval))
", input=" + self.parser.getTokenStream().getText(startIndex, stopIndex + 1))
if self.parser is not None:
self.parser.getErrorListenerDispatch().reportAttemptingFullContext(self.parser, dfa, startIndex, stopIndex, conflictingAlts, configs)
def reportContextSensitivity(self, dfa, prediction, configs, startIndex, stopIndex):
if ParserATNSimulator.debug or ParserATNSimulator.retry_debug:
interval = range(startIndex, stopIndex + 1)
print("reportContextSensitivity decision=" + str(dfa.decision) + ":" + str(configs) +
", input=" + self.parser.getTokenStream().getText(interval))
", input=" + self.parser.getTokenStream().getText(startIndex, stopIndex + 1))
if self.parser is not None:
self.parser.getErrorListenerDispatch().reportContextSensitivity(self.parser, dfa, startIndex, stopIndex, prediction, configs)
@ -1637,9 +1635,8 @@ class ParserATNSimulator(ATNSimulator):
# }
# i++;
# }
interval = range(startIndex, stopIndex + 1)
print("reportAmbiguity " + str(ambigAlts) + ":" + str(configs) +
", input=" + self.parser.getTokenStream().getText(interval))
print("reportAmbiguity " + str(ambigAlts) + ":" + str(configs) +
", input=" + self.parser.getTokenStream().getText(startIndex, stopIndex + 1))
if self.parser is not None:
self.parser.getErrorListenerDispatch().reportAmbiguity(self.parser, dfa, startIndex, stopIndex, exact, ambigAlts, configs)

View File

@ -45,7 +45,7 @@ class DiagnosticErrorListener(ErrorListener):
buf.write(u": ambigAlts=")
buf.write(str_set(self.getConflictingAlts(ambigAlts, configs)))
buf.write(u", input='")
buf.write(recognizer.getTokenStream().getText((startIndex, stopIndex)))
buf.write(recognizer.getTokenStream().getText(startIndex, stopIndex))
buf.write(u"'")
recognizer.notifyErrorListeners(buf.getvalue())
@ -56,7 +56,7 @@ class DiagnosticErrorListener(ErrorListener):
buf.write(u"reportAttemptingFullContext d=")
buf.write(self.getDecisionDescription(recognizer, dfa))
buf.write(u", input='")
buf.write(recognizer.getTokenStream().getText((startIndex, stopIndex)))
buf.write(recognizer.getTokenStream().getText(startIndex, stopIndex))
buf.write(u"'")
recognizer.notifyErrorListeners(buf.getvalue())
@ -66,7 +66,7 @@ class DiagnosticErrorListener(ErrorListener):
buf.write(u"reportContextSensitivity d=")
buf.write(self.getDecisionDescription(recognizer, dfa))
buf.write(u", input='")
buf.write(recognizer.getTokenStream().getText((startIndex, stopIndex)))
buf.write(recognizer.getTokenStream().getText(startIndex, stopIndex))
buf.write(u"'")
recognizer.notifyErrorListeners(buf.getvalue())

View File

@ -238,7 +238,7 @@ class DefaultErrorStrategy(ErrorStrategy):
if e.startToken.type==Token.EOF:
input = "<EOF>"
else:
input = tokens.getText((e.startToken, e.offendingToken))
input = tokens.getText(e.startToken, e.offendingToken)
else:
input = "<unknown input>"
msg = "no viable alternative at input " + self.escapeWSAndQuote(input)

View File

@ -83,7 +83,7 @@ class LexerNoViableAltException(RecognitionException):
def __unicode__(self):
symbol = ""
if self.startIndex >= 0 and self.startIndex < self.input.size():
symbol = self.input.getText((self.startIndex,self.startIndex))
symbol = self.input.getText(self.startIndex,self.startIndex)
# TODO symbol = Utils.escapeWhitespace(symbol, false);
return u"LexerNoViableAltException" + symbol

View File

@ -1607,17 +1607,15 @@ class ParserATNSimulator(ATNSimulator):
def reportAttemptingFullContext(self, dfa:DFA, conflictingAlts:set, configs:ATNConfigSet, startIndex:int, stopIndex:int):
if ParserATNSimulator.debug or ParserATNSimulator.retry_debug:
interval = (startIndex, stopIndex + 1)
print("reportAttemptingFullContext decision=" + str(dfa.decision) + ":" + str(configs) +
", input=" + self.parser.getTokenStream().getText(interval))
", input=" + self.parser.getTokenStream().getText(startIndex, stopIndex))
if self.parser is not None:
self.parser.getErrorListenerDispatch().reportAttemptingFullContext(self.parser, dfa, startIndex, stopIndex, conflictingAlts, configs)
def reportContextSensitivity(self, dfa:DFA, prediction:int, configs:ATNConfigSet, startIndex:int, stopIndex:int):
if ParserATNSimulator.debug or ParserATNSimulator.retry_debug:
interval = (startIndex, stopIndex + 1)
print("reportContextSensitivity decision=" + str(dfa.decision) + ":" + str(configs) +
", input=" + self.parser.getTokenStream().getText(interval))
", input=" + self.parser.getTokenStream().getText(startIndex, stopIndex))
if self.parser is not None:
self.parser.getErrorListenerDispatch().reportContextSensitivity(self.parser, dfa, startIndex, stopIndex, prediction, configs)
@ -1641,9 +1639,8 @@ class ParserATNSimulator(ATNSimulator):
# }
# i++;
# }
interval = (startIndex, stopIndex + 1)
print("reportAmbiguity " + str(ambigAlts) + ":" + str(configs) +
", input=" + self.parser.getTokenStream().getText(interval))
", input=" + self.parser.getTokenStream().getText(startIndex, stopIndex))
if self.parser is not None:
self.parser.getErrorListenerDispatch().reportAmbiguity(self.parser, dfa, startIndex, stopIndex, exact, ambigAlts, configs)

View File

@ -46,7 +46,7 @@ class DiagnosticErrorListener(ErrorListener):
buf.write(": ambigAlts=")
buf.write(str(self.getConflictingAlts(ambigAlts, configs)))
buf.write(", input='")
buf.write(recognizer.getTokenStream().getText((startIndex, stopIndex)))
buf.write(recognizer.getTokenStream().getText(startIndex, stopIndex))
buf.write("'")
recognizer.notifyErrorListeners(buf.getvalue())
@ -57,7 +57,7 @@ class DiagnosticErrorListener(ErrorListener):
buf.write("reportAttemptingFullContext d=")
buf.write(self.getDecisionDescription(recognizer, dfa))
buf.write(", input='")
buf.write(recognizer.getTokenStream().getText((startIndex, stopIndex)))
buf.write(recognizer.getTokenStream().getText(startIndex, stopIndex))
buf.write("'")
recognizer.notifyErrorListeners(buf.getvalue())
@ -67,7 +67,7 @@ class DiagnosticErrorListener(ErrorListener):
buf.write("reportContextSensitivity d=")
buf.write(self.getDecisionDescription(recognizer, dfa))
buf.write(", input='")
buf.write(recognizer.getTokenStream().getText((startIndex, stopIndex)))
buf.write(recognizer.getTokenStream().getText(startIndex, stopIndex))
buf.write("'")
recognizer.notifyErrorListeners(buf.getvalue())

View File

@ -243,7 +243,7 @@ class DefaultErrorStrategy(ErrorStrategy):
if e.startToken.type==Token.EOF:
input = "<EOF>"
else:
input = tokens.getText((e.startToken, e.offendingToken))
input = tokens.getText(e.startToken, e.offendingToken)
else:
input = "<unknown input>"
msg = "no viable alternative at input " + self.escapeWSAndQuote(input)