looks like i had python2 and 3 swapped. java, python3, c# pass. python2, js each have same single test failing: testCharSetWithQuote1
This commit is contained in:
parent
99ad09ece1
commit
5d2d75d2e3
|
@ -3,11 +3,10 @@ __author__ = 'jszheng'
|
|||
import optparse
|
||||
import sys
|
||||
import os
|
||||
|
||||
import importlib
|
||||
from antlr4 import *
|
||||
|
||||
|
||||
|
||||
# this is a python version of TestRig
|
||||
def beautify_lisp_string(in_string):
|
||||
indent_size = 3
|
||||
|
|
|
@ -39,11 +39,9 @@
|
|||
# {@link Token#HIDDEN_CHANNEL}, use a filtering token stream such a
|
||||
# {@link CommonTokenStream}.</p>
|
||||
from io import StringIO
|
||||
|
||||
from antlr4.Token import Token
|
||||
from antlr4.error.Errors import IllegalStateException
|
||||
|
||||
|
||||
# need forward declaration
|
||||
Lexer = None
|
||||
|
||||
|
@ -87,14 +85,14 @@ class BufferedTokenStream(TokenStream):
|
|||
# {@link #tokens} is trivial with this field.</li>
|
||||
# <ul>
|
||||
self.fetchedEOF = False
|
||||
|
||||
|
||||
def mark(self):
|
||||
return 0
|
||||
|
||||
|
||||
def release(self, marker:int):
|
||||
# no resources to release
|
||||
pass
|
||||
|
||||
|
||||
def reset(self):
|
||||
self.seek(0)
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
# Copyright (c) 2012 Sam Harwell
|
||||
# Copyright (c) 2014 Eric Vergnaud
|
||||
# All rights reserved.
|
||||
#
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
|
@ -16,7 +16,7 @@
|
|||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
|
@ -27,16 +27,15 @@
|
|||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
#
|
||||
|
||||
#
|
||||
# This is an InputStream that is loaded from a file all at once
|
||||
# when you construct the object.
|
||||
#
|
||||
#
|
||||
|
||||
import codecs
|
||||
import unittest
|
||||
|
||||
from antlr4.InputStream import InputStream
|
||||
|
||||
|
||||
|
@ -57,4 +56,4 @@ class TestFileStream(unittest.TestCase):
|
|||
|
||||
def testStream(self):
|
||||
stream = FileStream(__file__)
|
||||
self.assertTrue(stream.size>0)
|
||||
self.assertTrue(stream.size>0)
|
|
@ -1,9 +1,7 @@
|
|||
from io import StringIO
|
||||
import unittest
|
||||
|
||||
from antlr4.Token import Token
|
||||
|
||||
|
||||
# need forward declarations
|
||||
IntervalSet = None
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
from antlr4.IntervalSet import IntervalSet
|
||||
from antlr4.Token import Token
|
||||
from antlr4.PredictionContext import PredictionContext, SingletonPredictionContext, PredictionContextFromRuleContext
|
||||
from antlr4.RuleContext import RuleContext
|
||||
from antlr4.atn.ATN import ATN
|
||||
from antlr4.atn.ATNConfig import ATNConfig
|
||||
from antlr4.atn.ATNState import ATNState, RuleStopState
|
||||
|
@ -38,7 +39,7 @@ from antlr4.atn.Transition import WildcardTransition, NotSetTransition, Abstract
|
|||
|
||||
|
||||
class LL1Analyzer (object):
|
||||
|
||||
|
||||
#* Special value added to the lookahead sets to indicate that we hit
|
||||
# a predicate during analysis if {@code seeThruPreds==false}.
|
||||
#/
|
||||
|
|
|
@ -34,14 +34,13 @@
|
|||
# of speed.
|
||||
#/
|
||||
from io import StringIO
|
||||
|
||||
from antlr4.CommonTokenFactory import CommonTokenFactory
|
||||
from antlr4.atn.LexerATNSimulator import LexerATNSimulator
|
||||
from antlr4.InputStream import InputStream
|
||||
from antlr4.Recognizer import Recognizer
|
||||
from antlr4.Token import Token
|
||||
from antlr4.error.Errors import IllegalStateException, LexerNoViableAltException, RecognitionException
|
||||
|
||||
|
||||
class TokenSource(object):
|
||||
|
||||
pass
|
||||
|
@ -65,7 +64,7 @@ class Lexer(Recognizer, TokenSource):
|
|||
self._tokenFactorySourcePair = (self, input)
|
||||
|
||||
self._interp = None # child classes must populate this
|
||||
|
||||
|
||||
# The goal of all lexer rules/methods is to create a token object.
|
||||
# self is an instance variable as multiple rules may collaborate to
|
||||
# create a single token. nextToken will return self object after
|
||||
|
|
|
@ -38,10 +38,9 @@ from antlr4.Token import Token
|
|||
from antlr4.Lexer import Lexer
|
||||
from antlr4.atn.ATNDeserializer import ATNDeserializer
|
||||
from antlr4.atn.ATNDeserializationOptions import ATNDeserializationOptions
|
||||
from antlr4.error.Errors import UnsupportedOperationException
|
||||
from antlr4.error.Errors import UnsupportedOperationException, RecognitionException
|
||||
from antlr4.tree.ParseTreePatternMatcher import ParseTreePatternMatcher
|
||||
from antlr4.tree.Tree import ParseTreeListener
|
||||
|
||||
from antlr4.tree.Tree import ParseTreeListener, TerminalNode, ErrorNode
|
||||
|
||||
class TraceListener(ParseTreeListener):
|
||||
|
||||
|
@ -163,7 +162,7 @@ class Parser (Recognizer):
|
|||
# @throws RecognitionException if the current input symbol did not match
|
||||
# a wildcard and the error strategy could not recover from the mismatched
|
||||
# symbol
|
||||
|
||||
|
||||
def matchWildcard(self):
|
||||
t = self.getCurrentToken()
|
||||
if t.type > 0:
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#/
|
||||
from io import StringIO
|
||||
|
||||
from antlr4.RuleContext import RuleContext
|
||||
from antlr4.atn.ATN import ATN
|
||||
from antlr4.atn.ATNState import ATNState
|
||||
|
@ -71,7 +70,7 @@ class PredictionContext(object):
|
|||
# }
|
||||
# </pre>
|
||||
#/
|
||||
|
||||
|
||||
def __init__(self, cachedHashCode:int):
|
||||
self.cachedHashCode = cachedHashCode
|
||||
|
||||
|
|
|
@ -50,11 +50,9 @@
|
|||
# @see ParserRuleContext
|
||||
#/
|
||||
from io import StringIO
|
||||
|
||||
from antlr4.tree.Tree import RuleNode, INVALID_INTERVAL, ParseTreeVisitor
|
||||
from antlr4.tree.Trees import Trees
|
||||
|
||||
|
||||
# need forward declarations
|
||||
RuleContext = None
|
||||
Parser = None
|
||||
|
|
|
@ -1 +1,20 @@
|
|||
|
||||
from antlr4.Token import Token
|
||||
from antlr4.InputStream import InputStream
|
||||
from antlr4.FileStream import FileStream
|
||||
from antlr4.BufferedTokenStream import TokenStream
|
||||
from antlr4.CommonTokenStream import CommonTokenStream
|
||||
from antlr4.Lexer import Lexer
|
||||
from antlr4.Parser import Parser
|
||||
from antlr4.dfa.DFA import DFA
|
||||
from antlr4.atn.ATN import ATN
|
||||
from antlr4.atn.ATNDeserializer import ATNDeserializer
|
||||
from antlr4.atn.LexerATNSimulator import LexerATNSimulator
|
||||
from antlr4.atn.ParserATNSimulator import ParserATNSimulator
|
||||
from antlr4.atn.PredictionMode import PredictionMode
|
||||
from antlr4.PredictionContext import PredictionContextCache
|
||||
from antlr4.ParserRuleContext import ParserRuleContext
|
||||
from antlr4.tree.Tree import ParseTreeListener, ParseTreeVisitor, ParseTreeWalker, TerminalNode, ErrorNode, RuleNode
|
||||
from antlr4.error.Errors import RecognitionException, IllegalStateException, NoViableAltException
|
||||
from antlr4.error.ErrorStrategy import BailErrorStrategy
|
||||
from antlr4.error.DiagnosticErrorListener import DiagnosticErrorListener
|
||||
from antlr4.Utils import str_list
|
|
@ -37,11 +37,11 @@
|
|||
# an ATN state.
|
||||
#/
|
||||
from io import StringIO
|
||||
|
||||
from antlr4.PredictionContext import PredictionContext
|
||||
from antlr4.atn.ATNState import ATNState, DecisionState
|
||||
from antlr4.atn.LexerActionExecutor import LexerActionExecutor
|
||||
from antlr4.atn.SemanticContext import SemanticContext
|
||||
|
||||
|
||||
# need a forward declaration
|
||||
ATNConfig = None
|
||||
|
||||
|
|
|
@ -34,8 +34,7 @@
|
|||
# graph-structured stack.
|
||||
#/
|
||||
from io import StringIO
|
||||
|
||||
from antlr4.PredictionContext import merge
|
||||
from antlr4.PredictionContext import PredictionContext, merge
|
||||
from antlr4.Utils import str_list
|
||||
from antlr4.atn.ATN import ATN
|
||||
from antlr4.atn.ATNConfig import ATNConfig
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#/
|
||||
from uuid import UUID
|
||||
|
||||
from io import StringIO
|
||||
from antlr4.Token import Token
|
||||
from antlr4.atn.ATN import ATN
|
||||
from antlr4.atn.ATNType import ATNType
|
||||
|
@ -37,7 +37,6 @@ from antlr4.atn.Transition import *
|
|||
from antlr4.atn.LexerAction import *
|
||||
from antlr4.atn.ATNDeserializationOptions import ATNDeserializationOptions
|
||||
|
||||
|
||||
# This is the earliest supported serialized UUID.
|
||||
BASE_SERIALIZED_UUID = UUID("AADB8D7E-AEEF-4415-AD2B-8204D6CF042E")
|
||||
|
||||
|
@ -165,8 +164,8 @@ class ATNDeserializer (object):
|
|||
for i in range(0, numPrecedenceStates):
|
||||
stateNumber = self.readInt()
|
||||
atn.states[stateNumber].isPrecedenceRule = True
|
||||
|
||||
def readRules(self, atn:ATN):
|
||||
|
||||
def readRules(self, atn:ATN):
|
||||
nrules = self.readInt()
|
||||
if atn.grammarType == ATNType.LEXER:
|
||||
atn.ruleToTokenType = [0] * nrules
|
||||
|
|
|
@ -257,7 +257,6 @@
|
|||
# the input.</p>
|
||||
#
|
||||
import sys
|
||||
|
||||
from antlr4 import DFA
|
||||
from antlr4.PredictionContext import PredictionContextCache, PredictionContext, SingletonPredictionContext, \
|
||||
PredictionContextFromRuleContext
|
||||
|
@ -273,7 +272,7 @@ from antlr4.atn.ATNConfigSet import ATNConfigSet
|
|||
from antlr4.atn.ATNSimulator import ATNSimulator
|
||||
from antlr4.atn.ATNState import StarLoopEntryState, DecisionState, RuleStopState, ATNState
|
||||
from antlr4.atn.PredictionMode import PredictionMode
|
||||
from antlr4.atn.SemanticContext import SemanticContext, andContext, orContext
|
||||
from antlr4.atn.SemanticContext import SemanticContext, AND, andContext, orContext
|
||||
from antlr4.atn.Transition import Transition, RuleTransition, ActionTransition, PrecedencePredicateTransition, \
|
||||
PredicateTransition, AtomTransition, SetTransition, NotSetTransition
|
||||
from antlr4.dfa.DFAState import DFAState, PredPrediction
|
||||
|
@ -322,7 +321,7 @@ class ParserATNSimulator(ATNSimulator):
|
|||
self._input = input
|
||||
self._startIndex = input.index
|
||||
self._outerContext = outerContext
|
||||
|
||||
|
||||
dfa = self.decisionToDFA[decision]
|
||||
self._dfa = dfa
|
||||
m = input.mark()
|
||||
|
@ -708,7 +707,7 @@ class ParserATNSimulator(ATNSimulator):
|
|||
# For full-context reach operations, separate handling is required to
|
||||
# ensure that the alternative matching the longest overall sequence is
|
||||
# chosen when multiple such configurations can match the input.
|
||||
|
||||
|
||||
skippedStopStates = None
|
||||
|
||||
# First figure out where we can reach on input t
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
# {@link SemanticContext} within the scope of this outer class.</p>
|
||||
#
|
||||
from io import StringIO
|
||||
|
||||
from antlr4.Recognizer import Recognizer
|
||||
from antlr4.RuleContext import RuleContext
|
||||
|
||||
|
@ -359,4 +358,4 @@ class OR (SemanticContext):
|
|||
return buf.getvalue()
|
||||
|
||||
|
||||
SemanticContext.NONE = Predicate()
|
||||
SemanticContext.NONE = Predicate()
|
|
@ -31,7 +31,6 @@
|
|||
|
||||
# A DFA walker that knows how to dump them to serialized strings.#/
|
||||
from io import StringIO
|
||||
|
||||
from antlr4 import DFA
|
||||
from antlr4.Utils import str_list
|
||||
from antlr4.dfa.DFAState import DFAState
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
# Map a predicate to a predicted alternative.#/
|
||||
from io import StringIO
|
||||
|
||||
from antlr4.atn.ATNConfigSet import ATNConfigSet
|
||||
from antlr4.atn.SemanticContext import SemanticContext
|
||||
|
||||
|
||||
|
|
|
@ -50,12 +50,10 @@
|
|||
# </ul>
|
||||
|
||||
from io import StringIO
|
||||
|
||||
from antlr4 import Parser, DFA
|
||||
from antlr4.atn.ATNConfigSet import ATNConfigSet
|
||||
from antlr4.error.ErrorListener import ErrorListener
|
||||
|
||||
|
||||
class DiagnosticErrorListener(ErrorListener):
|
||||
|
||||
def __init__(self, exactOnly:bool=True):
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
import sys
|
||||
from antlr4.IntervalSet import IntervalSet
|
||||
|
||||
from antlr4.Token import Token
|
||||
|
@ -722,4 +723,4 @@ class BailErrorStrategy(DefaultErrorStrategy):
|
|||
def sync(self, recognizer:Parser):
|
||||
pass
|
||||
|
||||
del Parser
|
||||
del Parser
|
|
@ -60,7 +60,8 @@ class CancellationException(IllegalStateException):
|
|||
# and what kind of problem occurred.
|
||||
|
||||
from antlr4.InputStream import InputStream
|
||||
|
||||
from antlr4.ParserRuleContext import ParserRuleContext
|
||||
from antlr4.Recognizer import Recognizer
|
||||
|
||||
class RecognitionException(Exception):
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
# Represents the result of matching a {@link ParseTree} against a tree pattern.
|
||||
#
|
||||
from io import StringIO
|
||||
|
||||
from antlr4.tree.ParseTreePattern import ParseTreePattern
|
||||
from antlr4.tree.Tree import ParseTree
|
||||
|
||||
|
|
|
@ -32,12 +32,10 @@
|
|||
|
||||
# A set of utility routines useful for all kinds of ANTLR trees.#
|
||||
from io import StringIO
|
||||
|
||||
from antlr4.Token import Token
|
||||
from antlr4.Utils import escapeWhitespace
|
||||
from antlr4.tree.Tree import RuleNode, ErrorNode, TerminalNode, Tree, ParseTree
|
||||
|
||||
|
||||
# need forward declaration
|
||||
Parser = None
|
||||
|
||||
|
|
|
@ -42,8 +42,7 @@
|
|||
# <p>
|
||||
# Whitespace is not allowed.</p>
|
||||
#
|
||||
from io import StringIO
|
||||
|
||||
from xmlrpc.client import boolean
|
||||
from antlr4 import CommonTokenStream, DFA, PredictionContextCache, Lexer, LexerATNSimulator, ParserRuleContext, TerminalNode
|
||||
from antlr4.InputStream import InputStream
|
||||
from antlr4.Parser import Parser
|
||||
|
@ -55,6 +54,7 @@ from antlr4.tree.Tree import ParseTree
|
|||
from antlr4.tree.Trees import Trees
|
||||
from antlr4.atn.ATNDeserializer import ATNDeserializer
|
||||
|
||||
from io import StringIO
|
||||
|
||||
def serializedATN():
|
||||
with StringIO() as buf:
|
||||
|
@ -344,4 +344,4 @@ class XPathWildcardElement(XPathElement):
|
|||
if self.invert:
|
||||
return list() # !* is weird but valid (empty)
|
||||
else:
|
||||
return Trees.getChildren(t)
|
||||
return Trees.getChildren(t)
|
Loading…
Reference in New Issue