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, 0 , 45 ,
33
+ 46 , 1 , 0 , 0 , 0 , 45 , 43 , 1 , 0 , 0 , 0 , 46 , 48 , 1 , 0 , 0 , 0 , 47 , 45 ,
34
+ 1 , 0 , 0 , 0 , 48 , 49 , 5 , 39 , 0 , 0 , 49 , 16 , 1 , 0 , 0 , 0 , 4 , 0 , 30 , 37 ,
35
+ 45 , 1 , 1 , 4 , 0
31
36
]
32
37
38
+
33
39
class XPathLexer (Lexer ):
34
40
35
41
atn = ATNDeserializer ().deserialize (serializedATN ())
36
42
37
- decisionsToDFA = [ DFA (ds , i ) for i , ds in enumerate (atn .decisionToState ) ]
43
+ decisionsToDFA = [DFA (ds , i ) for i , ds in enumerate (atn .decisionToState )]
38
44
39
45
TOKEN_REF = 1
40
46
RULE_REF = 2
@@ -45,43 +51,77 @@ class XPathLexer(Lexer):
45
51
ID = 7
46
52
STRING = 8
47
53
48
- channelNames = [ u"DEFAULT_TOKEN_CHANNEL" , u"HIDDEN" ]
54
+ channelNames = [
55
+ "DEFAULT_TOKEN_CHANNEL" ,
56
+ "HIDDEN" ,
57
+ ]
49
58
50
- modeNames = [ "DEFAULT_MODE" ]
59
+ modeNames = [
60
+ "DEFAULT_MODE" ,
61
+ ]
51
62
52
- literalNames = [ "<INVALID>" ,
53
- "'//'" , "'/'" , "'*'" , "'!'" ]
63
+ literalNames = [
64
+ "<INVALID>" ,
65
+ "'//'" ,
66
+ "'/'" ,
67
+ "'*'" ,
68
+ "'!'" ,
69
+ ]
54
70
55
- symbolicNames = [ "<INVALID>" ,
56
- "TOKEN_REF" , "RULE_REF" , "ANYWHERE" , "ROOT" , "WILDCARD" , "BANG" ,
57
- "ID" , "STRING" ]
71
+ symbolicNames = [
72
+ "<INVALID>" ,
73
+ "TOKEN_REF" ,
74
+ "RULE_REF" ,
75
+ "ANYWHERE" ,
76
+ "ROOT" ,
77
+ "WILDCARD" ,
78
+ "BANG" ,
79
+ "ID" ,
80
+ "STRING" ,
81
+ ]
58
82
59
- ruleNames = [ "ANYWHERE" , "ROOT" , "WILDCARD" , "BANG" , "ID" , "NameChar" ,
60
- "NameStartChar" , "STRING" ]
83
+ ruleNames = [
84
+ "ANYWHERE" ,
85
+ "ROOT" ,
86
+ "WILDCARD" ,
87
+ "BANG" ,
88
+ "ID" ,
89
+ "NameChar" ,
90
+ "NameStartChar" ,
91
+ "STRING" ,
92
+ ]
61
93
62
94
grammarFileName = "XPathLexer.g4"
63
95
64
- def __init__ (self , input = None , output :TextIO = sys .stdout ):
96
+ def __init__ (
97
+ self ,
98
+ input = None ,
99
+ output : typing .TextIO = sys .stdout ,
100
+ ) -> None :
65
101
super ().__init__ (input , output )
66
102
self .checkVersion ("4.13.1" )
67
- self ._interp = LexerATNSimulator (self , self .atn , self .decisionsToDFA , PredictionContextCache ())
103
+ self ._interp = LexerATNSimulator (
104
+ self ,
105
+ self .atn ,
106
+ self .decisionsToDFA ,
107
+ PredictionContextCache (),
108
+ )
68
109
self ._actions = None
69
110
self ._predicates = None
70
111
71
112
72
- def action (self , localctx :RuleContext , ruleIndex :int , actionIndex :int ):
113
+ def action (self , localctx : RuleContext , ruleIndex : int , actionIndex : int ) -> None :
73
114
if self ._actions is None :
74
- actions = dict ()
75
- actions [4 ] = self .ID_action
115
+ actions = {}
116
+ actions [4 ] = self .ID_action
76
117
self ._actions = actions
77
118
action = self ._actions .get (ruleIndex , None )
78
119
if action is not None :
79
120
action (localctx , actionIndex )
80
121
else :
81
- raise Exception ("No registered action for:" + str (ruleIndex ))
82
-
122
+ raise Exception (f"No registered action for: { ruleIndex } " )
83
123
84
- def ID_action (self , localctx :RuleContext , actionIndex :int ):
124
+ def ID_action (self , localctx : RuleContext , actionIndex : int ) -> None :
85
125
if actionIndex == 0 :
86
126
87
127
char = self .text [0 ]
0 commit comments