Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
remove spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpython committed Jul 19, 2015
1 parent 91db912 commit 14cbc33
Show file tree
Hide file tree
Showing 4 changed files with 229 additions and 336 deletions.
1 change: 1 addition & 0 deletions _unittests/ut_module/test_flake8.py
Expand Up @@ -63,6 +63,7 @@ def test_flake8(self):
and "W291" not in _ and "pigjar" not in _ and "from antlr4 import *" not in _
and "Parser.py" not in _
and "Lexer.py" not in _
and "Listener.py" not in _
and "4Listener.py" not in _]
lines = [_ for _ in lines if len(_) > 1]
if __name__ == "__main__":
Expand Down
69 changes: 32 additions & 37 deletions src/pyensae/languages/DOTLexer.py
Expand Up @@ -122,8 +122,7 @@ class DOTLexer(Lexer):

atn = ATNDeserializer().deserialize(serializedATN())

decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]

decisionsToDFA = [DFA(ds, i) for i, ds in enumerate(atn.decisionToState)]

T__0 = 1
T__1 = 2
Expand Down Expand Up @@ -153,53 +152,49 @@ class DOTLexer(Lexer):
PREPROC = 26
WS = 27

modeNames = [ u"DEFAULT_MODE" ]
modeNames = [u"DEFAULT_MODE"]

literalNames = [ u"<INVALID>",
"'{'", "'}'", "';'", "'='", "'['", "']'", "','", "'->'", "'--'",
"':'", "'_'" ]
literalNames = [u"<INVALID>",
"'{'", "'}'", "';'", "'='", "'['", "']'", "','", "'->'", "'--'",
"':'", "'_'"]

symbolicNames = [ u"<INVALID>",
"STRICT", "GRAPH", "DIGRAPH", "NODE", "EDGE", "SUBGRAPH", "NUMBER",
"STRING", "HTML_STRING", "TAG", "EntityRef", "ID", "COMMENT",
"LINE_COMMENT", "PREPROC", "WS" ]
symbolicNames = [u"<INVALID>",
"STRICT", "GRAPH", "DIGRAPH", "NODE", "EDGE", "SUBGRAPH", "NUMBER",
"STRING", "HTML_STRING", "TAG", "EntityRef", "ID", "COMMENT",
"LINE_COMMENT", "PREPROC", "WS"]

ruleNames = [ "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6",
"T__7", "T__8", "T__9", "T__10", "STRICT", "GRAPH", "DIGRAPH",
"NODE", "EDGE", "SUBGRAPH", "NUMBER", "DIGIT", "STRING",
"HTML_STRING", "TAG", "EntityRef", "ID", "LETTER", "COMMENT",
"LINE_COMMENT", "PREPROC", "WS" ]
ruleNames = ["T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6",
"T__7", "T__8", "T__9", "T__10", "STRICT", "GRAPH", "DIGRAPH",
"NODE", "EDGE", "SUBGRAPH", "NUMBER", "DIGIT", "STRING",
"HTML_STRING", "TAG", "EntityRef", "ID", "LETTER", "COMMENT",
"LINE_COMMENT", "PREPROC", "WS"]

grammarFileName = "DOT.g4"

def __init__(self, input=None):
super().__init__(input)
self.checkVersion("4.5")
self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache())
self._interp = LexerATNSimulator(
self, self.atn, self.decisionsToDFA, PredictionContextCache())
self._actions = None
self._predicates = None


def action(self, localctx:RuleContext, ruleIndex:int, actionIndex:int):
if self._actions is None:
actions = dict()
actions[25] = self.COMMENT_action
actions[26] = self.LINE_COMMENT_action
self._actions = actions
action = self._actions.get(ruleIndex, None)
if action is not None:
action(localctx, actionIndex)
else:
raise Exception("No registered action for:" + str(ruleIndex))

def COMMENT_action(self, localctx:RuleContext , actionIndex:int):
def action(self, localctx: RuleContext, ruleIndex: int, actionIndex: int):
if self._actions is None:
actions = dict()
actions[25] = self.COMMENT_action
actions[26] = self.LINE_COMMENT_action
self._actions = actions
action = self._actions.get(ruleIndex, None)
if action is not None:
action(localctx, actionIndex)
else:
raise Exception("No registered action for:" + str(ruleIndex))

def COMMENT_action(self, localctx: RuleContext, actionIndex: int):
if actionIndex == 0:
skip();

skip()

def LINE_COMMENT_action(self, localctx:RuleContext , actionIndex:int):
def LINE_COMMENT_action(self, localctx: RuleContext, actionIndex: int):
if actionIndex == 1:
skip();



skip()
21 changes: 4 additions & 17 deletions src/pyensae/languages/DOTListener.py
@@ -1,7 +1,10 @@
# Generated from java-escape by ANTLR 4.5
from antlr4 import *

# This class defines a complete listener for a parse tree produced by DOTParser.
# This class defines a complete listener for a parse tree produced by
# DOTParser.


class DOTListener(ParseTreeListener):

# Enter a parse tree produced by DOTParser#graph.
Expand All @@ -12,7 +15,6 @@ def enterGraph(self, ctx):
def exitGraph(self, ctx):
pass


# Enter a parse tree produced by DOTParser#stmt_list.
def enterStmt_list(self, ctx):
pass
Expand All @@ -21,7 +23,6 @@ def enterStmt_list(self, ctx):
def exitStmt_list(self, ctx):
pass


# Enter a parse tree produced by DOTParser#stmt.
def enterStmt(self, ctx):
pass
Expand All @@ -30,7 +31,6 @@ def enterStmt(self, ctx):
def exitStmt(self, ctx):
pass


# Enter a parse tree produced by DOTParser#attr_stmt.
def enterAttr_stmt(self, ctx):
pass
Expand All @@ -39,7 +39,6 @@ def enterAttr_stmt(self, ctx):
def exitAttr_stmt(self, ctx):
pass


# Enter a parse tree produced by DOTParser#attr_list.
def enterAttr_list(self, ctx):
pass
Expand All @@ -48,7 +47,6 @@ def enterAttr_list(self, ctx):
def exitAttr_list(self, ctx):
pass


# Enter a parse tree produced by DOTParser#a_list.
def enterA_list(self, ctx):
pass
Expand All @@ -57,7 +55,6 @@ def enterA_list(self, ctx):
def exitA_list(self, ctx):
pass


# Enter a parse tree produced by DOTParser#edge_stmt.
def enterEdge_stmt(self, ctx):
pass
Expand All @@ -66,7 +63,6 @@ def enterEdge_stmt(self, ctx):
def exitEdge_stmt(self, ctx):
pass


# Enter a parse tree produced by DOTParser#edgeRHS.
def enterEdgeRHS(self, ctx):
pass
Expand All @@ -75,7 +71,6 @@ def enterEdgeRHS(self, ctx):
def exitEdgeRHS(self, ctx):
pass


# Enter a parse tree produced by DOTParser#edgeop.
def enterEdgeop(self, ctx):
pass
Expand All @@ -84,7 +79,6 @@ def enterEdgeop(self, ctx):
def exitEdgeop(self, ctx):
pass


# Enter a parse tree produced by DOTParser#node_stmt.
def enterNode_stmt(self, ctx):
pass
Expand All @@ -93,7 +87,6 @@ def enterNode_stmt(self, ctx):
def exitNode_stmt(self, ctx):
pass


# Enter a parse tree produced by DOTParser#node_id.
def enterNode_id(self, ctx):
pass
Expand All @@ -102,7 +95,6 @@ def enterNode_id(self, ctx):
def exitNode_id(self, ctx):
pass


# Enter a parse tree produced by DOTParser#port.
def enterPort(self, ctx):
pass
Expand All @@ -111,7 +103,6 @@ def enterPort(self, ctx):
def exitPort(self, ctx):
pass


# Enter a parse tree produced by DOTParser#subgraph.
def enterSubgraph(self, ctx):
pass
Expand All @@ -120,7 +111,6 @@ def enterSubgraph(self, ctx):
def exitSubgraph(self, ctx):
pass


# Enter a parse tree produced by DOTParser#compass_pt.
def enterCompass_pt(self, ctx):
pass
Expand All @@ -129,13 +119,10 @@ def enterCompass_pt(self, ctx):
def exitCompass_pt(self, ctx):
pass


# Enter a parse tree produced by DOTParser#gid.
def enterGid(self, ctx):
pass

# Exit a parse tree produced by DOTParser#gid.
def exitGid(self, ctx):
pass


0 comments on commit 14cbc33

Please sign in to comment.