Coverage for src/pyensae/languages/RFilter.py: 0%

621 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-07-03 02:16 +0200

1# Generated from C:\xadupre\github\pyensae\src\pyensae\languages\RFilter.g4 by ANTLR 4.10.1 

2# encoding: utf-8 

3from antlr4 import * 

4from io import StringIO 

5import sys 

6if sys.version_info[1] > 5: 

7 from typing import TextIO 

8else: 

9 from typing.io import TextIO 

10 

11 

12def serializedATN(): 

13 return [ 

14 4, 1, 70, 147, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 1, 0, 1, 0, 1, 0, 5, 

15 0, 14, 8, 0, 10, 0, 12, 0, 17, 9, 0, 1, 0, 1, 0, 1, 1, 1, 1, 4, 1, 23, 8, 1, 11, 1, 12, 1, 24, 

16 1, 2, 1, 2, 3, 2, 29, 8, 2, 1, 2, 1, 2, 1, 2, 3, 2, 34, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 40, 

17 8, 2, 10, 2, 12, 2, 43, 9, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 50, 8, 2, 10, 2, 12, 2, 53, 

18 9, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 59, 8, 2, 10, 2, 12, 2, 62, 9, 2, 1, 2, 1, 2, 1, 2, 1, 2, 

19 5, 2, 68, 8, 2, 10, 2, 12, 2, 71, 9, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 77, 8, 2, 1, 2, 1, 2, 1, 

20 2, 5, 2, 82, 8, 2, 10, 2, 12, 2, 85, 9, 2, 1, 2, 1, 2, 3, 2, 89, 8, 2, 1, 2, 1, 2, 3, 2, 93, 

21 8, 2, 1, 2, 1, 2, 1, 2, 5, 2, 98, 8, 2, 10, 2, 12, 2, 101, 9, 2, 1, 2, 1, 2, 3, 2, 105, 8, 2, 

22 1, 2, 1, 2, 3, 2, 109, 8, 2, 1, 2, 1, 2, 1, 2, 5, 2, 114, 8, 2, 10, 2, 12, 2, 117, 9, 2, 1, 

23 2, 1, 2, 3, 2, 121, 8, 2, 1, 2, 1, 2, 3, 2, 125, 8, 2, 1, 2, 1, 2, 1, 2, 5, 2, 130, 8, 2, 10, 

24 2, 12, 2, 133, 9, 2, 1, 2, 1, 2, 3, 2, 137, 8, 2, 1, 2, 1, 2, 3, 2, 141, 8, 2, 1, 3, 1, 3, 1, 

25 4, 1, 4, 1, 4, 0, 0, 5, 0, 2, 4, 6, 8, 0, 2, 4, 0, 15, 15, 22, 22, 25, 30, 62, 67, 12, 0, 5, 

26 11, 14, 14, 19, 21, 23, 23, 31, 31, 34, 34, 39, 39, 41, 41, 45, 51, 53, 53, 55, 60, 68, 

27 68, 182, 0, 15, 1, 0, 0, 0, 2, 22, 1, 0, 0, 0, 4, 140, 1, 0, 0, 0, 6, 142, 1, 0, 0, 0, 8, 144, 

28 1, 0, 0, 0, 10, 14, 3, 4, 2, 0, 11, 14, 5, 69, 0, 0, 12, 14, 5, 1, 0, 0, 13, 10, 1, 0, 0, 0, 

29 13, 11, 1, 0, 0, 0, 13, 12, 1, 0, 0, 0, 14, 17, 1, 0, 0, 0, 15, 13, 1, 0, 0, 0, 15, 16, 1, 

30 0, 0, 0, 16, 18, 1, 0, 0, 0, 17, 15, 1, 0, 0, 0, 18, 19, 5, 0, 0, 1, 19, 1, 1, 0, 0, 0, 20, 

31 21, 5, 69, 0, 0, 21, 23, 6, 1, - 

32 1, 0, 22, 20, 1, 0, 0, 0, 23, 24, 1, 0, 0, 0, 24, 22, 1, 0, 

33 0, 0, 24, 25, 1, 0, 0, 0, 25, 3, 1, 0, 0, 0, 26, 28, 3, 8, 4, 0, 27, 29, 3, 2, 1, 0, 28, 27, 

34 1, 0, 0, 0, 28, 29, 1, 0, 0, 0, 29, 141, 1, 0, 0, 0, 30, 141, 3, 6, 3, 0, 31, 33, 5, 12, 0, 

35 0, 32, 34, 3, 2, 1, 0, 33, 32, 1, 0, 0, 0, 33, 34, 1, 0, 0, 0, 34, 35, 1, 0, 0, 0, 35, 41, 

36 6, 2, -1, 0, 36, 40, 3, 4, 2, 0, 37, 40, 5, 69, 0, 0, 38, 40, 5, 1, 0, 0, 39, 36, 1, 0, 0, 

37 0, 39, 37, 1, 0, 0, 0, 39, 38, 1, 0, 0, 0, 40, 43, 1, 0, 0, 0, 41, 39, 1, 0, 0, 0, 41, 42, 

38 1, 0, 0, 0, 42, 44, 1, 0, 0, 0, 43, 41, 1, 0, 0, 0, 44, 45, 6, 2, - 

39 1, 0, 45, 141, 5, 13, 0, 

40 0, 46, 51, 5, 16, 0, 0, 47, 50, 3, 4, 2, 0, 48, 50, 3, 2, 1, 0, 49, 47, 1, 0, 0, 0, 49, 48, 

41 1, 0, 0, 0, 50, 53, 1, 0, 0, 0, 51, 49, 1, 0, 0, 0, 51, 52, 1, 0, 0, 0, 52, 54, 1, 0, 0, 0, 

42 53, 51, 1, 0, 0, 0, 54, 141, 5, 17, 0, 0, 55, 60, 5, 4, 0, 0, 56, 59, 3, 4, 2, 0, 57, 59, 

43 3, 2, 1, 0, 58, 56, 1, 0, 0, 0, 58, 57, 1, 0, 0, 0, 59, 62, 1, 0, 0, 0, 60, 58, 1, 0, 0, 0, 

44 60, 61, 1, 0, 0, 0, 61, 63, 1, 0, 0, 0, 62, 60, 1, 0, 0, 0, 63, 141, 5, 3, 0, 0, 64, 69, 5, 

45 2, 0, 0, 65, 68, 3, 4, 2, 0, 66, 68, 3, 2, 1, 0, 67, 65, 1, 0, 0, 0, 67, 66, 1, 0, 0, 0, 68, 

46 71, 1, 0, 0, 0, 69, 67, 1, 0, 0, 0, 69, 70, 1, 0, 0, 0, 70, 72, 1, 0, 0, 0, 71, 69, 1, 0, 0, 

47 0, 72, 73, 5, 3, 0, 0, 73, 141, 5, 3, 0, 0, 74, 76, 5, 44, 0, 0, 75, 77, 3, 2, 1, 0, 76, 75, 

48 1, 0, 0, 0, 76, 77, 1, 0, 0, 0, 77, 78, 1, 0, 0, 0, 78, 83, 5, 16, 0, 0, 79, 82, 3, 4, 2, 0, 

49 80, 82, 3, 2, 1, 0, 81, 79, 1, 0, 0, 0, 81, 80, 1, 0, 0, 0, 82, 85, 1, 0, 0, 0, 83, 81, 1, 

50 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 86, 1, 0, 0, 0, 85, 83, 1, 0, 0, 0, 86, 88, 5, 17, 0, 0, 87, 

51 89, 3, 2, 1, 0, 88, 87, 1, 0, 0, 0, 88, 89, 1, 0, 0, 0, 89, 141, 1, 0, 0, 0, 90, 92, 5, 33, 

52 0, 0, 91, 93, 3, 2, 1, 0, 92, 91, 1, 0, 0, 0, 92, 93, 1, 0, 0, 0, 93, 94, 1, 0, 0, 0, 94, 99, 

53 5, 16, 0, 0, 95, 98, 3, 4, 2, 0, 96, 98, 3, 2, 1, 0, 97, 95, 1, 0, 0, 0, 97, 96, 1, 0, 0, 0, 

54 98, 101, 1, 0, 0, 0, 99, 97, 1, 0, 0, 0, 99, 100, 1, 0, 0, 0, 100, 102, 1, 0, 0, 0, 101, 

55 99, 1, 0, 0, 0, 102, 104, 5, 17, 0, 0, 103, 105, 3, 2, 1, 0, 104, 103, 1, 0, 0, 0, 104, 

56 105, 1, 0, 0, 0, 105, 141, 1, 0, 0, 0, 106, 108, 5, 32, 0, 0, 107, 109, 3, 2, 1, 0, 108, 

57 107, 1, 0, 0, 0, 108, 109, 1, 0, 0, 0, 109, 110, 1, 0, 0, 0, 110, 115, 5, 16, 0, 0, 111, 

58 114, 3, 4, 2, 0, 112, 114, 3, 2, 1, 0, 113, 111, 1, 0, 0, 0, 113, 112, 1, 0, 0, 0, 114, 

59 117, 1, 0, 0, 0, 115, 113, 1, 0, 0, 0, 115, 116, 1, 0, 0, 0, 116, 118, 1, 0, 0, 0, 117, 

60 115, 1, 0, 0, 0, 118, 120, 5, 17, 0, 0, 119, 121, 3, 2, 1, 0, 120, 119, 1, 0, 0, 0, 120, 

61 121, 1, 0, 0, 0, 121, 141, 1, 0, 0, 0, 122, 124, 5, 35, 0, 0, 123, 125, 3, 2, 1, 0, 124, 

62 123, 1, 0, 0, 0, 124, 125, 1, 0, 0, 0, 125, 126, 1, 0, 0, 0, 126, 131, 5, 16, 0, 0, 127, 

63 130, 3, 4, 2, 0, 128, 130, 3, 2, 1, 0, 129, 127, 1, 0, 0, 0, 129, 128, 1, 0, 0, 0, 130, 

64 133, 1, 0, 0, 0, 131, 129, 1, 0, 0, 0, 131, 132, 1, 0, 0, 0, 132, 134, 1, 0, 0, 0, 133, 

65 131, 1, 0, 0, 0, 134, 136, 5, 17, 0, 0, 135, 137, 3, 2, 1, 0, 136, 135, 1, 0, 0, 0, 136, 

66 137, 1, 0, 0, 0, 137, 141, 1, 0, 0, 0, 138, 139, 5, 36, 0, 0, 139, 141, 6, 2, -1, 0, 140, 

67 26, 1, 0, 0, 0, 140, 30, 1, 0, 0, 0, 140, 31, 1, 0, 0, 0, 140, 46, 1, 0, 0, 0, 140, 55, 1, 

68 0, 0, 0, 140, 64, 1, 0, 0, 0, 140, 74, 1, 0, 0, 0, 140, 90, 1, 0, 0, 0, 140, 106, 1, 0, 0, 

69 0, 140, 122, 1, 0, 0, 0, 140, 138, 1, 0, 0, 0, 141, 5, 1, 0, 0, 0, 142, 143, 7, 0, 0, 0, 

70 143, 7, 1, 0, 0, 0, 144, 145, 7, 1, 0, 0, 145, 9, 1, 0, 0, 0, 30, 13, 15, 24, 28, 33, 39, 

71 41, 49, 51, 58, 60, 67, 69, 76, 81, 83, 88, 92, 97, 99, 104, 108, 113, 115, 120, 124, 

72 129, 131, 136, 140 

73 ] 

74 

75 

76class RFilter (Parser): 

77 

78 grammarFileName = "RFilter.g4" 

79 

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

81 

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

83 

84 sharedContextCache = PredictionContextCache() 

85 

86 literalNames = ["<INVALID>", "';'", "'[['", "']'", "'['", "'-'", "'+'", 

87 "'!'", "'&'", "'&&'", "'|'", "'||'", "'{'", "'}'", 

88 "'?'", "'break'", "'('", "')'", "'.'", "','", "'='", 

89 "'...'", "'NULL'", "':'", "'%in%'", "'NA'", "'Inf'", 

90 "'NaN'", "'TRUE'", "'FALSE'", "'next'", "'repeat'", 

91 "'while'", "'for'", "'in'", "'if'", "'else'", "'return'", 

92 "'within'", "'<-'", "'<<-'", "'->'", "'->>'", "':='", 

93 "'function'", "'~'", "'::'", "':::'", "'$'", "'@'", 

94 "'*'", "'/'", "'%'", "'^'", "'%%'", "'>'", "'>='", 

95 "'<'", "'<='", "'=='", "'!='"] 

96 

97 symbolicNames = ["<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 

98 "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 

99 "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 

100 "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 

101 "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 

102 "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 

103 "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 

104 "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 

105 "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 

106 "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 

107 "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 

108 "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 

109 "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 

110 "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 

111 "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 

112 "<INVALID>", "PARENTHESIS", "HEX", "INT", "FLOAT", 

113 "COMPLEX", "STRING", "ID", "USER_OP", "NL", "WS"] 

114 

115 RULE_stream = 0 

116 RULE_eat = 1 

117 RULE_elem = 2 

118 RULE_atom = 3 

119 RULE_op = 4 

120 

121 ruleNames = ["stream", "eat", "elem", "atom", "op"] 

122 

123 EOF = Token.EOF 

124 T__0 = 1 

125 T__1 = 2 

126 T__2 = 3 

127 T__3 = 4 

128 T__4 = 5 

129 T__5 = 6 

130 T__6 = 7 

131 T__7 = 8 

132 T__8 = 9 

133 T__9 = 10 

134 T__10 = 11 

135 T__11 = 12 

136 T__12 = 13 

137 T__13 = 14 

138 T__14 = 15 

139 T__15 = 16 

140 T__16 = 17 

141 T__17 = 18 

142 T__18 = 19 

143 T__19 = 20 

144 T__20 = 21 

145 T__21 = 22 

146 T__22 = 23 

147 T__23 = 24 

148 T__24 = 25 

149 T__25 = 26 

150 T__26 = 27 

151 T__27 = 28 

152 T__28 = 29 

153 T__29 = 30 

154 T__30 = 31 

155 T__31 = 32 

156 T__32 = 33 

157 T__33 = 34 

158 T__34 = 35 

159 T__35 = 36 

160 T__36 = 37 

161 T__37 = 38 

162 T__38 = 39 

163 T__39 = 40 

164 T__40 = 41 

165 T__41 = 42 

166 T__42 = 43 

167 T__43 = 44 

168 T__44 = 45 

169 T__45 = 46 

170 T__46 = 47 

171 T__47 = 48 

172 T__48 = 49 

173 T__49 = 50 

174 T__50 = 51 

175 T__51 = 52 

176 T__52 = 53 

177 T__53 = 54 

178 T__54 = 55 

179 T__55 = 56 

180 T__56 = 57 

181 T__57 = 58 

182 T__58 = 59 

183 T__59 = 60 

184 PARENTHESIS = 61 

185 HEX = 62 

186 INT = 63 

187 FLOAT = 64 

188 COMPLEX = 65 

189 STRING = 66 

190 ID = 67 

191 USER_OP = 68 

192 NL = 69 

193 WS = 70 

194 

195 def __init__(self, input: TokenStream, output: TextIO = sys.stdout): 

196 super().__init__(input, output) 

197 self.checkVersion("4.10.1") 

198 self._interp = ParserATNSimulator( 

199 self, self.atn, self.decisionsToDFA, self.sharedContextCache) 

200 self._predicates = None 

201 

202 curlies = 0 

203 

204 class StreamContext(ParserRuleContext): 

205 __slots__ = 'parser' 

206 

207 def __init__(self, parser, parent: ParserRuleContext = None, invokingState: int = -1): 

208 super().__init__(parent, invokingState) 

209 self.parser = parser 

210 

211 def EOF(self): 

212 return self.getToken(RFilter.EOF, 0) 

213 

214 def elem(self, i: int = None): 

215 if i is None: 

216 return self.getTypedRuleContexts(RFilter.ElemContext) 

217 else: 

218 return self.getTypedRuleContext(RFilter.ElemContext, i) 

219 

220 def NL(self, i: int = None): 

221 if i is None: 

222 return self.getTokens(RFilter.NL) 

223 else: 

224 return self.getToken(RFilter.NL, i) 

225 

226 def getRuleIndex(self): 

227 return RFilter.RULE_stream 

228 

229 def enterRule(self, listener: ParseTreeListener): 

230 if hasattr(listener, "enterStream"): 

231 listener.enterStream(self) 

232 

233 def exitRule(self, listener: ParseTreeListener): 

234 if hasattr(listener, "exitStream"): 

235 listener.exitStream(self) 

236 

237 def stream(self): 

238 

239 localctx = RFilter.StreamContext(self, self._ctx, self.state) 

240 self.enterRule(localctx, 0, self.RULE_stream) 

241 self._la = 0 # Token type 

242 try: 

243 self.enterOuterAlt(localctx, 1) 

244 self.state = 15 

245 self._errHandler.sync(self) 

246 _la = self._input.LA(1) 

247 while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << RFilter.T__0) | (1 << RFilter.T__1) | (1 << RFilter.T__3) | (1 << RFilter.T__4) | (1 << RFilter.T__5) | (1 << RFilter.T__6) | (1 << RFilter.T__7) | (1 << RFilter.T__8) | (1 << RFilter.T__9) | (1 << RFilter.T__10) | (1 << RFilter.T__11) | (1 << RFilter.T__13) | (1 << RFilter.T__14) | (1 << RFilter.T__15) | (1 << RFilter.T__18) | (1 << RFilter.T__19) | (1 << RFilter.T__20) | (1 << RFilter.T__21) | (1 << RFilter.T__22) | (1 << RFilter.T__24) | (1 << RFilter.T__25) | (1 << RFilter.T__26) | (1 << RFilter.T__27) | (1 << RFilter.T__28) | (1 << RFilter.T__29) | (1 << RFilter.T__30) | (1 << RFilter.T__31) | (1 << RFilter.T__32) | (1 << RFilter.T__33) | (1 << RFilter.T__34) | (1 << RFilter.T__35) | (1 << RFilter.T__38) | (1 << RFilter.T__40) | (1 << RFilter.T__43) | (1 << RFilter.T__44) | (1 << RFilter.T__45) | (1 << RFilter.T__46) | (1 << RFilter.T__47) | (1 << RFilter.T__48) | (1 << RFilter.T__49) | (1 << RFilter.T__50) | (1 << RFilter.T__52) | (1 << RFilter.T__54) | (1 << RFilter.T__55) | (1 << RFilter.T__56) | (1 << RFilter.T__57) | (1 << RFilter.T__58) | (1 << RFilter.T__59) | (1 << RFilter.HEX) | (1 << RFilter.INT))) != 0) or ((((_la - 64)) & ~0x3f) == 0 and ((1 << (_la - 64)) & ((1 << (RFilter.FLOAT - 64)) | (1 << (RFilter.COMPLEX - 64)) | (1 << (RFilter.STRING - 64)) | (1 << (RFilter.ID - 64)) | (1 << (RFilter.USER_OP - 64)) | (1 << (RFilter.NL - 64)))) != 0): 

248 self.state = 13 

249 self._errHandler.sync(self) 

250 token = self._input.LA(1) 

251 if token in [RFilter.T__1, RFilter.T__3, RFilter.T__4, RFilter.T__5, RFilter.T__6, RFilter.T__7, RFilter.T__8, RFilter.T__9, RFilter.T__10, RFilter.T__11, RFilter.T__13, RFilter.T__14, RFilter.T__15, RFilter.T__18, RFilter.T__19, RFilter.T__20, RFilter.T__21, RFilter.T__22, RFilter.T__24, RFilter.T__25, RFilter.T__26, RFilter.T__27, RFilter.T__28, RFilter.T__29, RFilter.T__30, RFilter.T__31, RFilter.T__32, RFilter.T__33, RFilter.T__34, RFilter.T__35, RFilter.T__38, RFilter.T__40, RFilter.T__43, RFilter.T__44, RFilter.T__45, RFilter.T__46, RFilter.T__47, RFilter.T__48, RFilter.T__49, RFilter.T__50, RFilter.T__52, RFilter.T__54, RFilter.T__55, RFilter.T__56, RFilter.T__57, RFilter.T__58, RFilter.T__59, RFilter.HEX, RFilter.INT, RFilter.FLOAT, RFilter.COMPLEX, RFilter.STRING, RFilter.ID, RFilter.USER_OP]: 

252 self.state = 10 

253 self.elem() 

254 pass 

255 elif token in [RFilter.NL]: 

256 self.state = 11 

257 self.match(RFilter.NL) 

258 pass 

259 elif token in [RFilter.T__0]: 

260 self.state = 12 

261 self.match(RFilter.T__0) 

262 pass 

263 else: 

264 raise NoViableAltException(self) 

265 

266 self.state = 17 

267 self._errHandler.sync(self) 

268 _la = self._input.LA(1) 

269 

270 self.state = 18 

271 self.match(RFilter.EOF) 

272 except RecognitionException as re: 

273 localctx.exception = re 

274 self._errHandler.reportError(self, re) 

275 self._errHandler.recover(self, re) 

276 finally: 

277 self.exitRule() 

278 return localctx 

279 

280 class EatContext(ParserRuleContext): 

281 __slots__ = 'parser' 

282 

283 def __init__(self, parser, parent: ParserRuleContext = None, invokingState: int = -1): 

284 super().__init__(parent, invokingState) 

285 self.parser = parser 

286 self._NL = None # Token 

287 

288 def NL(self, i: int = None): 

289 if i is None: 

290 return self.getTokens(RFilter.NL) 

291 else: 

292 return self.getToken(RFilter.NL, i) 

293 

294 def getRuleIndex(self): 

295 return RFilter.RULE_eat 

296 

297 def enterRule(self, listener: ParseTreeListener): 

298 if hasattr(listener, "enterEat"): 

299 listener.enterEat(self) 

300 

301 def exitRule(self, listener: ParseTreeListener): 

302 if hasattr(listener, "exitEat"): 

303 listener.exitEat(self) 

304 

305 def eat(self): 

306 

307 localctx = RFilter.EatContext(self, self._ctx, self.state) 

308 self.enterRule(localctx, 2, self.RULE_eat) 

309 try: 

310 self.enterOuterAlt(localctx, 1) 

311 self.state = 22 

312 self._errHandler.sync(self) 

313 _alt = 1 

314 while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER: 

315 if _alt == 1: 

316 self.state = 20 

317 localctx._NL = self.match(RFilter.NL) 

318 localctx._NL.setChannel(Token.HIDDEN_CHANNEL) 

319 

320 else: 

321 raise NoViableAltException(self) 

322 self.state = 24 

323 self._errHandler.sync(self) 

324 _alt = self._interp.adaptivePredict(self._input, 2, self._ctx) 

325 

326 except RecognitionException as re: 

327 localctx.exception = re 

328 self._errHandler.reportError(self, re) 

329 self._errHandler.recover(self, re) 

330 finally: 

331 self.exitRule() 

332 return localctx 

333 

334 class ElemContext(ParserRuleContext): 

335 __slots__ = 'parser' 

336 

337 def __init__(self, parser, parent: ParserRuleContext = None, invokingState: int = -1): 

338 super().__init__(parent, invokingState) 

339 self.parser = parser 

340 

341 def op(self): 

342 return self.getTypedRuleContext(RFilter.OpContext, 0) 

343 

344 def eat(self, i: int = None): 

345 if i is None: 

346 return self.getTypedRuleContexts(RFilter.EatContext) 

347 else: 

348 return self.getTypedRuleContext(RFilter.EatContext, i) 

349 

350 def atom(self): 

351 return self.getTypedRuleContext(RFilter.AtomContext, 0) 

352 

353 def elem(self, i: int = None): 

354 if i is None: 

355 return self.getTypedRuleContexts(RFilter.ElemContext) 

356 else: 

357 return self.getTypedRuleContext(RFilter.ElemContext, i) 

358 

359 def NL(self, i: int = None): 

360 if i is None: 

361 return self.getTokens(RFilter.NL) 

362 else: 

363 return self.getToken(RFilter.NL, i) 

364 

365 def getRuleIndex(self): 

366 return RFilter.RULE_elem 

367 

368 def enterRule(self, listener: ParseTreeListener): 

369 if hasattr(listener, "enterElem"): 

370 listener.enterElem(self) 

371 

372 def exitRule(self, listener: ParseTreeListener): 

373 if hasattr(listener, "exitElem"): 

374 listener.exitElem(self) 

375 

376 def elem(self): 

377 

378 localctx = RFilter.ElemContext(self, self._ctx, self.state) 

379 self.enterRule(localctx, 4, self.RULE_elem) 

380 self._la = 0 # Token type 

381 try: 

382 self.state = 140 

383 self._errHandler.sync(self) 

384 token = self._input.LA(1) 

385 if token in [RFilter.T__4, RFilter.T__5, RFilter.T__6, RFilter.T__7, RFilter.T__8, RFilter.T__9, RFilter.T__10, RFilter.T__13, RFilter.T__18, RFilter.T__19, RFilter.T__20, RFilter.T__22, RFilter.T__30, RFilter.T__33, RFilter.T__38, RFilter.T__40, RFilter.T__44, RFilter.T__45, RFilter.T__46, RFilter.T__47, RFilter.T__48, RFilter.T__49, RFilter.T__50, RFilter.T__52, RFilter.T__54, RFilter.T__55, RFilter.T__56, RFilter.T__57, RFilter.T__58, RFilter.T__59, RFilter.USER_OP]: 

386 self.enterOuterAlt(localctx, 1) 

387 self.state = 26 

388 self.op() 

389 self.state = 28 

390 self._errHandler.sync(self) 

391 la_ = self._interp.adaptivePredict(self._input, 3, self._ctx) 

392 if la_ == 1: 

393 self.state = 27 

394 self.eat() 

395 

396 pass 

397 elif token in [RFilter.T__14, RFilter.T__21, RFilter.T__24, RFilter.T__25, RFilter.T__26, RFilter.T__27, RFilter.T__28, RFilter.T__29, RFilter.HEX, RFilter.INT, RFilter.FLOAT, RFilter.COMPLEX, RFilter.STRING, RFilter.ID]: 

398 self.enterOuterAlt(localctx, 2) 

399 self.state = 30 

400 self.atom() 

401 pass 

402 elif token in [RFilter.T__11]: 

403 self.enterOuterAlt(localctx, 3) 

404 self.state = 31 

405 self.match(RFilter.T__11) 

406 self.state = 33 

407 self._errHandler.sync(self) 

408 la_ = self._interp.adaptivePredict(self._input, 4, self._ctx) 

409 if la_ == 1: 

410 self.state = 32 

411 self.eat() 

412 

413 curlies += 1 

414 self.state = 41 

415 self._errHandler.sync(self) 

416 _la = self._input.LA(1) 

417 while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << RFilter.T__0) | (1 << RFilter.T__1) | (1 << RFilter.T__3) | (1 << RFilter.T__4) | (1 << RFilter.T__5) | (1 << RFilter.T__6) | (1 << RFilter.T__7) | (1 << RFilter.T__8) | (1 << RFilter.T__9) | (1 << RFilter.T__10) | (1 << RFilter.T__11) | (1 << RFilter.T__13) | (1 << RFilter.T__14) | (1 << RFilter.T__15) | (1 << RFilter.T__18) | (1 << RFilter.T__19) | (1 << RFilter.T__20) | (1 << RFilter.T__21) | (1 << RFilter.T__22) | (1 << RFilter.T__24) | (1 << RFilter.T__25) | (1 << RFilter.T__26) | (1 << RFilter.T__27) | (1 << RFilter.T__28) | (1 << RFilter.T__29) | (1 << RFilter.T__30) | (1 << RFilter.T__31) | (1 << RFilter.T__32) | (1 << RFilter.T__33) | (1 << RFilter.T__34) | (1 << RFilter.T__35) | (1 << RFilter.T__38) | (1 << RFilter.T__40) | (1 << RFilter.T__43) | (1 << RFilter.T__44) | (1 << RFilter.T__45) | (1 << RFilter.T__46) | (1 << RFilter.T__47) | (1 << RFilter.T__48) | (1 << RFilter.T__49) | (1 << RFilter.T__50) | (1 << RFilter.T__52) | (1 << RFilter.T__54) | (1 << RFilter.T__55) | (1 << RFilter.T__56) | (1 << RFilter.T__57) | (1 << RFilter.T__58) | (1 << RFilter.T__59) | (1 << RFilter.HEX) | (1 << RFilter.INT))) != 0) or ((((_la - 64)) & ~0x3f) == 0 and ((1 << (_la - 64)) & ((1 << (RFilter.FLOAT - 64)) | (1 << (RFilter.COMPLEX - 64)) | (1 << (RFilter.STRING - 64)) | (1 << (RFilter.ID - 64)) | (1 << (RFilter.USER_OP - 64)) | (1 << (RFilter.NL - 64)))) != 0): 

418 self.state = 39 

419 self._errHandler.sync(self) 

420 token = self._input.LA(1) 

421 if token in [RFilter.T__1, RFilter.T__3, RFilter.T__4, RFilter.T__5, RFilter.T__6, RFilter.T__7, RFilter.T__8, RFilter.T__9, RFilter.T__10, RFilter.T__11, RFilter.T__13, RFilter.T__14, RFilter.T__15, RFilter.T__18, RFilter.T__19, RFilter.T__20, RFilter.T__21, RFilter.T__22, RFilter.T__24, RFilter.T__25, RFilter.T__26, RFilter.T__27, RFilter.T__28, RFilter.T__29, RFilter.T__30, RFilter.T__31, RFilter.T__32, RFilter.T__33, RFilter.T__34, RFilter.T__35, RFilter.T__38, RFilter.T__40, RFilter.T__43, RFilter.T__44, RFilter.T__45, RFilter.T__46, RFilter.T__47, RFilter.T__48, RFilter.T__49, RFilter.T__50, RFilter.T__52, RFilter.T__54, RFilter.T__55, RFilter.T__56, RFilter.T__57, RFilter.T__58, RFilter.T__59, RFilter.HEX, RFilter.INT, RFilter.FLOAT, RFilter.COMPLEX, RFilter.STRING, RFilter.ID, RFilter.USER_OP]: 

422 self.state = 36 

423 self.elem() 

424 pass 

425 elif token in [RFilter.NL]: 

426 self.state = 37 

427 self.match(RFilter.NL) 

428 pass 

429 elif token in [RFilter.T__0]: 

430 self.state = 38 

431 self.match(RFilter.T__0) 

432 pass 

433 else: 

434 raise NoViableAltException(self) 

435 

436 self.state = 43 

437 self._errHandler.sync(self) 

438 _la = self._input.LA(1) 

439 

440 curlies -= 1 

441 self.state = 45 

442 self.match(RFilter.T__12) 

443 pass 

444 elif token in [RFilter.T__15]: 

445 self.enterOuterAlt(localctx, 4) 

446 self.state = 46 

447 self.match(RFilter.T__15) 

448 self.state = 51 

449 self._errHandler.sync(self) 

450 _la = self._input.LA(1) 

451 while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << RFilter.T__1) | (1 << RFilter.T__3) | (1 << RFilter.T__4) | (1 << RFilter.T__5) | (1 << RFilter.T__6) | (1 << RFilter.T__7) | (1 << RFilter.T__8) | (1 << RFilter.T__9) | (1 << RFilter.T__10) | (1 << RFilter.T__11) | (1 << RFilter.T__13) | (1 << RFilter.T__14) | (1 << RFilter.T__15) | (1 << RFilter.T__18) | (1 << RFilter.T__19) | (1 << RFilter.T__20) | (1 << RFilter.T__21) | (1 << RFilter.T__22) | (1 << RFilter.T__24) | (1 << RFilter.T__25) | (1 << RFilter.T__26) | (1 << RFilter.T__27) | (1 << RFilter.T__28) | (1 << RFilter.T__29) | (1 << RFilter.T__30) | (1 << RFilter.T__31) | (1 << RFilter.T__32) | (1 << RFilter.T__33) | (1 << RFilter.T__34) | (1 << RFilter.T__35) | (1 << RFilter.T__38) | (1 << RFilter.T__40) | (1 << RFilter.T__43) | (1 << RFilter.T__44) | (1 << RFilter.T__45) | (1 << RFilter.T__46) | (1 << RFilter.T__47) | (1 << RFilter.T__48) | (1 << RFilter.T__49) | (1 << RFilter.T__50) | (1 << RFilter.T__52) | (1 << RFilter.T__54) | (1 << RFilter.T__55) | (1 << RFilter.T__56) | (1 << RFilter.T__57) | (1 << RFilter.T__58) | (1 << RFilter.T__59) | (1 << RFilter.HEX) | (1 << RFilter.INT))) != 0) or ((((_la - 64)) & ~0x3f) == 0 and ((1 << (_la - 64)) & ((1 << (RFilter.FLOAT - 64)) | (1 << (RFilter.COMPLEX - 64)) | (1 << (RFilter.STRING - 64)) | (1 << (RFilter.ID - 64)) | (1 << (RFilter.USER_OP - 64)) | (1 << (RFilter.NL - 64)))) != 0): 

452 self.state = 49 

453 self._errHandler.sync(self) 

454 token = self._input.LA(1) 

455 if token in [RFilter.T__1, RFilter.T__3, RFilter.T__4, RFilter.T__5, RFilter.T__6, RFilter.T__7, RFilter.T__8, RFilter.T__9, RFilter.T__10, RFilter.T__11, RFilter.T__13, RFilter.T__14, RFilter.T__15, RFilter.T__18, RFilter.T__19, RFilter.T__20, RFilter.T__21, RFilter.T__22, RFilter.T__24, RFilter.T__25, RFilter.T__26, RFilter.T__27, RFilter.T__28, RFilter.T__29, RFilter.T__30, RFilter.T__31, RFilter.T__32, RFilter.T__33, RFilter.T__34, RFilter.T__35, RFilter.T__38, RFilter.T__40, RFilter.T__43, RFilter.T__44, RFilter.T__45, RFilter.T__46, RFilter.T__47, RFilter.T__48, RFilter.T__49, RFilter.T__50, RFilter.T__52, RFilter.T__54, RFilter.T__55, RFilter.T__56, RFilter.T__57, RFilter.T__58, RFilter.T__59, RFilter.HEX, RFilter.INT, RFilter.FLOAT, RFilter.COMPLEX, RFilter.STRING, RFilter.ID, RFilter.USER_OP]: 

456 self.state = 47 

457 self.elem() 

458 pass 

459 elif token in [RFilter.NL]: 

460 self.state = 48 

461 self.eat() 

462 pass 

463 else: 

464 raise NoViableAltException(self) 

465 

466 self.state = 53 

467 self._errHandler.sync(self) 

468 _la = self._input.LA(1) 

469 

470 self.state = 54 

471 self.match(RFilter.T__16) 

472 pass 

473 elif token in [RFilter.T__3]: 

474 self.enterOuterAlt(localctx, 5) 

475 self.state = 55 

476 self.match(RFilter.T__3) 

477 self.state = 60 

478 self._errHandler.sync(self) 

479 _la = self._input.LA(1) 

480 while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << RFilter.T__1) | (1 << RFilter.T__3) | (1 << RFilter.T__4) | (1 << RFilter.T__5) | (1 << RFilter.T__6) | (1 << RFilter.T__7) | (1 << RFilter.T__8) | (1 << RFilter.T__9) | (1 << RFilter.T__10) | (1 << RFilter.T__11) | (1 << RFilter.T__13) | (1 << RFilter.T__14) | (1 << RFilter.T__15) | (1 << RFilter.T__18) | (1 << RFilter.T__19) | (1 << RFilter.T__20) | (1 << RFilter.T__21) | (1 << RFilter.T__22) | (1 << RFilter.T__24) | (1 << RFilter.T__25) | (1 << RFilter.T__26) | (1 << RFilter.T__27) | (1 << RFilter.T__28) | (1 << RFilter.T__29) | (1 << RFilter.T__30) | (1 << RFilter.T__31) | (1 << RFilter.T__32) | (1 << RFilter.T__33) | (1 << RFilter.T__34) | (1 << RFilter.T__35) | (1 << RFilter.T__38) | (1 << RFilter.T__40) | (1 << RFilter.T__43) | (1 << RFilter.T__44) | (1 << RFilter.T__45) | (1 << RFilter.T__46) | (1 << RFilter.T__47) | (1 << RFilter.T__48) | (1 << RFilter.T__49) | (1 << RFilter.T__50) | (1 << RFilter.T__52) | (1 << RFilter.T__54) | (1 << RFilter.T__55) | (1 << RFilter.T__56) | (1 << RFilter.T__57) | (1 << RFilter.T__58) | (1 << RFilter.T__59) | (1 << RFilter.HEX) | (1 << RFilter.INT))) != 0) or ((((_la - 64)) & ~0x3f) == 0 and ((1 << (_la - 64)) & ((1 << (RFilter.FLOAT - 64)) | (1 << (RFilter.COMPLEX - 64)) | (1 << (RFilter.STRING - 64)) | (1 << (RFilter.ID - 64)) | (1 << (RFilter.USER_OP - 64)) | (1 << (RFilter.NL - 64)))) != 0): 

481 self.state = 58 

482 self._errHandler.sync(self) 

483 token = self._input.LA(1) 

484 if token in [RFilter.T__1, RFilter.T__3, RFilter.T__4, RFilter.T__5, RFilter.T__6, RFilter.T__7, RFilter.T__8, RFilter.T__9, RFilter.T__10, RFilter.T__11, RFilter.T__13, RFilter.T__14, RFilter.T__15, RFilter.T__18, RFilter.T__19, RFilter.T__20, RFilter.T__21, RFilter.T__22, RFilter.T__24, RFilter.T__25, RFilter.T__26, RFilter.T__27, RFilter.T__28, RFilter.T__29, RFilter.T__30, RFilter.T__31, RFilter.T__32, RFilter.T__33, RFilter.T__34, RFilter.T__35, RFilter.T__38, RFilter.T__40, RFilter.T__43, RFilter.T__44, RFilter.T__45, RFilter.T__46, RFilter.T__47, RFilter.T__48, RFilter.T__49, RFilter.T__50, RFilter.T__52, RFilter.T__54, RFilter.T__55, RFilter.T__56, RFilter.T__57, RFilter.T__58, RFilter.T__59, RFilter.HEX, RFilter.INT, RFilter.FLOAT, RFilter.COMPLEX, RFilter.STRING, RFilter.ID, RFilter.USER_OP]: 

485 self.state = 56 

486 self.elem() 

487 pass 

488 elif token in [RFilter.NL]: 

489 self.state = 57 

490 self.eat() 

491 pass 

492 else: 

493 raise NoViableAltException(self) 

494 

495 self.state = 62 

496 self._errHandler.sync(self) 

497 _la = self._input.LA(1) 

498 

499 self.state = 63 

500 self.match(RFilter.T__2) 

501 pass 

502 elif token in [RFilter.T__1]: 

503 self.enterOuterAlt(localctx, 6) 

504 self.state = 64 

505 self.match(RFilter.T__1) 

506 self.state = 69 

507 self._errHandler.sync(self) 

508 _la = self._input.LA(1) 

509 while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << RFilter.T__1) | (1 << RFilter.T__3) | (1 << RFilter.T__4) | (1 << RFilter.T__5) | (1 << RFilter.T__6) | (1 << RFilter.T__7) | (1 << RFilter.T__8) | (1 << RFilter.T__9) | (1 << RFilter.T__10) | (1 << RFilter.T__11) | (1 << RFilter.T__13) | (1 << RFilter.T__14) | (1 << RFilter.T__15) | (1 << RFilter.T__18) | (1 << RFilter.T__19) | (1 << RFilter.T__20) | (1 << RFilter.T__21) | (1 << RFilter.T__22) | (1 << RFilter.T__24) | (1 << RFilter.T__25) | (1 << RFilter.T__26) | (1 << RFilter.T__27) | (1 << RFilter.T__28) | (1 << RFilter.T__29) | (1 << RFilter.T__30) | (1 << RFilter.T__31) | (1 << RFilter.T__32) | (1 << RFilter.T__33) | (1 << RFilter.T__34) | (1 << RFilter.T__35) | (1 << RFilter.T__38) | (1 << RFilter.T__40) | (1 << RFilter.T__43) | (1 << RFilter.T__44) | (1 << RFilter.T__45) | (1 << RFilter.T__46) | (1 << RFilter.T__47) | (1 << RFilter.T__48) | (1 << RFilter.T__49) | (1 << RFilter.T__50) | (1 << RFilter.T__52) | (1 << RFilter.T__54) | (1 << RFilter.T__55) | (1 << RFilter.T__56) | (1 << RFilter.T__57) | (1 << RFilter.T__58) | (1 << RFilter.T__59) | (1 << RFilter.HEX) | (1 << RFilter.INT))) != 0) or ((((_la - 64)) & ~0x3f) == 0 and ((1 << (_la - 64)) & ((1 << (RFilter.FLOAT - 64)) | (1 << (RFilter.COMPLEX - 64)) | (1 << (RFilter.STRING - 64)) | (1 << (RFilter.ID - 64)) | (1 << (RFilter.USER_OP - 64)) | (1 << (RFilter.NL - 64)))) != 0): 

510 self.state = 67 

511 self._errHandler.sync(self) 

512 token = self._input.LA(1) 

513 if token in [RFilter.T__1, RFilter.T__3, RFilter.T__4, RFilter.T__5, RFilter.T__6, RFilter.T__7, RFilter.T__8, RFilter.T__9, RFilter.T__10, RFilter.T__11, RFilter.T__13, RFilter.T__14, RFilter.T__15, RFilter.T__18, RFilter.T__19, RFilter.T__20, RFilter.T__21, RFilter.T__22, RFilter.T__24, RFilter.T__25, RFilter.T__26, RFilter.T__27, RFilter.T__28, RFilter.T__29, RFilter.T__30, RFilter.T__31, RFilter.T__32, RFilter.T__33, RFilter.T__34, RFilter.T__35, RFilter.T__38, RFilter.T__40, RFilter.T__43, RFilter.T__44, RFilter.T__45, RFilter.T__46, RFilter.T__47, RFilter.T__48, RFilter.T__49, RFilter.T__50, RFilter.T__52, RFilter.T__54, RFilter.T__55, RFilter.T__56, RFilter.T__57, RFilter.T__58, RFilter.T__59, RFilter.HEX, RFilter.INT, RFilter.FLOAT, RFilter.COMPLEX, RFilter.STRING, RFilter.ID, RFilter.USER_OP]: 

514 self.state = 65 

515 self.elem() 

516 pass 

517 elif token in [RFilter.NL]: 

518 self.state = 66 

519 self.eat() 

520 pass 

521 else: 

522 raise NoViableAltException(self) 

523 

524 self.state = 71 

525 self._errHandler.sync(self) 

526 _la = self._input.LA(1) 

527 

528 self.state = 72 

529 self.match(RFilter.T__2) 

530 self.state = 73 

531 self.match(RFilter.T__2) 

532 pass 

533 elif token in [RFilter.T__43]: 

534 self.enterOuterAlt(localctx, 7) 

535 self.state = 74 

536 self.match(RFilter.T__43) 

537 self.state = 76 

538 self._errHandler.sync(self) 

539 _la = self._input.LA(1) 

540 if _la == RFilter.NL: 

541 self.state = 75 

542 self.eat() 

543 

544 self.state = 78 

545 self.match(RFilter.T__15) 

546 self.state = 83 

547 self._errHandler.sync(self) 

548 _la = self._input.LA(1) 

549 while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << RFilter.T__1) | (1 << RFilter.T__3) | (1 << RFilter.T__4) | (1 << RFilter.T__5) | (1 << RFilter.T__6) | (1 << RFilter.T__7) | (1 << RFilter.T__8) | (1 << RFilter.T__9) | (1 << RFilter.T__10) | (1 << RFilter.T__11) | (1 << RFilter.T__13) | (1 << RFilter.T__14) | (1 << RFilter.T__15) | (1 << RFilter.T__18) | (1 << RFilter.T__19) | (1 << RFilter.T__20) | (1 << RFilter.T__21) | (1 << RFilter.T__22) | (1 << RFilter.T__24) | (1 << RFilter.T__25) | (1 << RFilter.T__26) | (1 << RFilter.T__27) | (1 << RFilter.T__28) | (1 << RFilter.T__29) | (1 << RFilter.T__30) | (1 << RFilter.T__31) | (1 << RFilter.T__32) | (1 << RFilter.T__33) | (1 << RFilter.T__34) | (1 << RFilter.T__35) | (1 << RFilter.T__38) | (1 << RFilter.T__40) | (1 << RFilter.T__43) | (1 << RFilter.T__44) | (1 << RFilter.T__45) | (1 << RFilter.T__46) | (1 << RFilter.T__47) | (1 << RFilter.T__48) | (1 << RFilter.T__49) | (1 << RFilter.T__50) | (1 << RFilter.T__52) | (1 << RFilter.T__54) | (1 << RFilter.T__55) | (1 << RFilter.T__56) | (1 << RFilter.T__57) | (1 << RFilter.T__58) | (1 << RFilter.T__59) | (1 << RFilter.HEX) | (1 << RFilter.INT))) != 0) or ((((_la - 64)) & ~0x3f) == 0 and ((1 << (_la - 64)) & ((1 << (RFilter.FLOAT - 64)) | (1 << (RFilter.COMPLEX - 64)) | (1 << (RFilter.STRING - 64)) | (1 << (RFilter.ID - 64)) | (1 << (RFilter.USER_OP - 64)) | (1 << (RFilter.NL - 64)))) != 0): 

550 self.state = 81 

551 self._errHandler.sync(self) 

552 token = self._input.LA(1) 

553 if token in [RFilter.T__1, RFilter.T__3, RFilter.T__4, RFilter.T__5, RFilter.T__6, RFilter.T__7, RFilter.T__8, RFilter.T__9, RFilter.T__10, RFilter.T__11, RFilter.T__13, RFilter.T__14, RFilter.T__15, RFilter.T__18, RFilter.T__19, RFilter.T__20, RFilter.T__21, RFilter.T__22, RFilter.T__24, RFilter.T__25, RFilter.T__26, RFilter.T__27, RFilter.T__28, RFilter.T__29, RFilter.T__30, RFilter.T__31, RFilter.T__32, RFilter.T__33, RFilter.T__34, RFilter.T__35, RFilter.T__38, RFilter.T__40, RFilter.T__43, RFilter.T__44, RFilter.T__45, RFilter.T__46, RFilter.T__47, RFilter.T__48, RFilter.T__49, RFilter.T__50, RFilter.T__52, RFilter.T__54, RFilter.T__55, RFilter.T__56, RFilter.T__57, RFilter.T__58, RFilter.T__59, RFilter.HEX, RFilter.INT, RFilter.FLOAT, RFilter.COMPLEX, RFilter.STRING, RFilter.ID, RFilter.USER_OP]: 

554 self.state = 79 

555 self.elem() 

556 pass 

557 elif token in [RFilter.NL]: 

558 self.state = 80 

559 self.eat() 

560 pass 

561 else: 

562 raise NoViableAltException(self) 

563 

564 self.state = 85 

565 self._errHandler.sync(self) 

566 _la = self._input.LA(1) 

567 

568 self.state = 86 

569 self.match(RFilter.T__16) 

570 self.state = 88 

571 self._errHandler.sync(self) 

572 la_ = self._interp.adaptivePredict(self._input, 16, self._ctx) 

573 if la_ == 1: 

574 self.state = 87 

575 self.eat() 

576 

577 pass 

578 elif token in [RFilter.T__32]: 

579 self.enterOuterAlt(localctx, 8) 

580 self.state = 90 

581 self.match(RFilter.T__32) 

582 self.state = 92 

583 self._errHandler.sync(self) 

584 _la = self._input.LA(1) 

585 if _la == RFilter.NL: 

586 self.state = 91 

587 self.eat() 

588 

589 self.state = 94 

590 self.match(RFilter.T__15) 

591 self.state = 99 

592 self._errHandler.sync(self) 

593 _la = self._input.LA(1) 

594 while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << RFilter.T__1) | (1 << RFilter.T__3) | (1 << RFilter.T__4) | (1 << RFilter.T__5) | (1 << RFilter.T__6) | (1 << RFilter.T__7) | (1 << RFilter.T__8) | (1 << RFilter.T__9) | (1 << RFilter.T__10) | (1 << RFilter.T__11) | (1 << RFilter.T__13) | (1 << RFilter.T__14) | (1 << RFilter.T__15) | (1 << RFilter.T__18) | (1 << RFilter.T__19) | (1 << RFilter.T__20) | (1 << RFilter.T__21) | (1 << RFilter.T__22) | (1 << RFilter.T__24) | (1 << RFilter.T__25) | (1 << RFilter.T__26) | (1 << RFilter.T__27) | (1 << RFilter.T__28) | (1 << RFilter.T__29) | (1 << RFilter.T__30) | (1 << RFilter.T__31) | (1 << RFilter.T__32) | (1 << RFilter.T__33) | (1 << RFilter.T__34) | (1 << RFilter.T__35) | (1 << RFilter.T__38) | (1 << RFilter.T__40) | (1 << RFilter.T__43) | (1 << RFilter.T__44) | (1 << RFilter.T__45) | (1 << RFilter.T__46) | (1 << RFilter.T__47) | (1 << RFilter.T__48) | (1 << RFilter.T__49) | (1 << RFilter.T__50) | (1 << RFilter.T__52) | (1 << RFilter.T__54) | (1 << RFilter.T__55) | (1 << RFilter.T__56) | (1 << RFilter.T__57) | (1 << RFilter.T__58) | (1 << RFilter.T__59) | (1 << RFilter.HEX) | (1 << RFilter.INT))) != 0) or ((((_la - 64)) & ~0x3f) == 0 and ((1 << (_la - 64)) & ((1 << (RFilter.FLOAT - 64)) | (1 << (RFilter.COMPLEX - 64)) | (1 << (RFilter.STRING - 64)) | (1 << (RFilter.ID - 64)) | (1 << (RFilter.USER_OP - 64)) | (1 << (RFilter.NL - 64)))) != 0): 

595 self.state = 97 

596 self._errHandler.sync(self) 

597 token = self._input.LA(1) 

598 if token in [RFilter.T__1, RFilter.T__3, RFilter.T__4, RFilter.T__5, RFilter.T__6, RFilter.T__7, RFilter.T__8, RFilter.T__9, RFilter.T__10, RFilter.T__11, RFilter.T__13, RFilter.T__14, RFilter.T__15, RFilter.T__18, RFilter.T__19, RFilter.T__20, RFilter.T__21, RFilter.T__22, RFilter.T__24, RFilter.T__25, RFilter.T__26, RFilter.T__27, RFilter.T__28, RFilter.T__29, RFilter.T__30, RFilter.T__31, RFilter.T__32, RFilter.T__33, RFilter.T__34, RFilter.T__35, RFilter.T__38, RFilter.T__40, RFilter.T__43, RFilter.T__44, RFilter.T__45, RFilter.T__46, RFilter.T__47, RFilter.T__48, RFilter.T__49, RFilter.T__50, RFilter.T__52, RFilter.T__54, RFilter.T__55, RFilter.T__56, RFilter.T__57, RFilter.T__58, RFilter.T__59, RFilter.HEX, RFilter.INT, RFilter.FLOAT, RFilter.COMPLEX, RFilter.STRING, RFilter.ID, RFilter.USER_OP]: 

599 self.state = 95 

600 self.elem() 

601 pass 

602 elif token in [RFilter.NL]: 

603 self.state = 96 

604 self.eat() 

605 pass 

606 else: 

607 raise NoViableAltException(self) 

608 

609 self.state = 101 

610 self._errHandler.sync(self) 

611 _la = self._input.LA(1) 

612 

613 self.state = 102 

614 self.match(RFilter.T__16) 

615 self.state = 104 

616 self._errHandler.sync(self) 

617 la_ = self._interp.adaptivePredict(self._input, 20, self._ctx) 

618 if la_ == 1: 

619 self.state = 103 

620 self.eat() 

621 

622 pass 

623 elif token in [RFilter.T__31]: 

624 self.enterOuterAlt(localctx, 9) 

625 self.state = 106 

626 self.match(RFilter.T__31) 

627 self.state = 108 

628 self._errHandler.sync(self) 

629 _la = self._input.LA(1) 

630 if _la == RFilter.NL: 

631 self.state = 107 

632 self.eat() 

633 

634 self.state = 110 

635 self.match(RFilter.T__15) 

636 self.state = 115 

637 self._errHandler.sync(self) 

638 _la = self._input.LA(1) 

639 while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << RFilter.T__1) | (1 << RFilter.T__3) | (1 << RFilter.T__4) | (1 << RFilter.T__5) | (1 << RFilter.T__6) | (1 << RFilter.T__7) | (1 << RFilter.T__8) | (1 << RFilter.T__9) | (1 << RFilter.T__10) | (1 << RFilter.T__11) | (1 << RFilter.T__13) | (1 << RFilter.T__14) | (1 << RFilter.T__15) | (1 << RFilter.T__18) | (1 << RFilter.T__19) | (1 << RFilter.T__20) | (1 << RFilter.T__21) | (1 << RFilter.T__22) | (1 << RFilter.T__24) | (1 << RFilter.T__25) | (1 << RFilter.T__26) | (1 << RFilter.T__27) | (1 << RFilter.T__28) | (1 << RFilter.T__29) | (1 << RFilter.T__30) | (1 << RFilter.T__31) | (1 << RFilter.T__32) | (1 << RFilter.T__33) | (1 << RFilter.T__34) | (1 << RFilter.T__35) | (1 << RFilter.T__38) | (1 << RFilter.T__40) | (1 << RFilter.T__43) | (1 << RFilter.T__44) | (1 << RFilter.T__45) | (1 << RFilter.T__46) | (1 << RFilter.T__47) | (1 << RFilter.T__48) | (1 << RFilter.T__49) | (1 << RFilter.T__50) | (1 << RFilter.T__52) | (1 << RFilter.T__54) | (1 << RFilter.T__55) | (1 << RFilter.T__56) | (1 << RFilter.T__57) | (1 << RFilter.T__58) | (1 << RFilter.T__59) | (1 << RFilter.HEX) | (1 << RFilter.INT))) != 0) or ((((_la - 64)) & ~0x3f) == 0 and ((1 << (_la - 64)) & ((1 << (RFilter.FLOAT - 64)) | (1 << (RFilter.COMPLEX - 64)) | (1 << (RFilter.STRING - 64)) | (1 << (RFilter.ID - 64)) | (1 << (RFilter.USER_OP - 64)) | (1 << (RFilter.NL - 64)))) != 0): 

640 self.state = 113 

641 self._errHandler.sync(self) 

642 token = self._input.LA(1) 

643 if token in [RFilter.T__1, RFilter.T__3, RFilter.T__4, RFilter.T__5, RFilter.T__6, RFilter.T__7, RFilter.T__8, RFilter.T__9, RFilter.T__10, RFilter.T__11, RFilter.T__13, RFilter.T__14, RFilter.T__15, RFilter.T__18, RFilter.T__19, RFilter.T__20, RFilter.T__21, RFilter.T__22, RFilter.T__24, RFilter.T__25, RFilter.T__26, RFilter.T__27, RFilter.T__28, RFilter.T__29, RFilter.T__30, RFilter.T__31, RFilter.T__32, RFilter.T__33, RFilter.T__34, RFilter.T__35, RFilter.T__38, RFilter.T__40, RFilter.T__43, RFilter.T__44, RFilter.T__45, RFilter.T__46, RFilter.T__47, RFilter.T__48, RFilter.T__49, RFilter.T__50, RFilter.T__52, RFilter.T__54, RFilter.T__55, RFilter.T__56, RFilter.T__57, RFilter.T__58, RFilter.T__59, RFilter.HEX, RFilter.INT, RFilter.FLOAT, RFilter.COMPLEX, RFilter.STRING, RFilter.ID, RFilter.USER_OP]: 

644 self.state = 111 

645 self.elem() 

646 pass 

647 elif token in [RFilter.NL]: 

648 self.state = 112 

649 self.eat() 

650 pass 

651 else: 

652 raise NoViableAltException(self) 

653 

654 self.state = 117 

655 self._errHandler.sync(self) 

656 _la = self._input.LA(1) 

657 

658 self.state = 118 

659 self.match(RFilter.T__16) 

660 self.state = 120 

661 self._errHandler.sync(self) 

662 la_ = self._interp.adaptivePredict(self._input, 24, self._ctx) 

663 if la_ == 1: 

664 self.state = 119 

665 self.eat() 

666 

667 pass 

668 elif token in [RFilter.T__34]: 

669 self.enterOuterAlt(localctx, 10) 

670 self.state = 122 

671 self.match(RFilter.T__34) 

672 self.state = 124 

673 self._errHandler.sync(self) 

674 _la = self._input.LA(1) 

675 if _la == RFilter.NL: 

676 self.state = 123 

677 self.eat() 

678 

679 self.state = 126 

680 self.match(RFilter.T__15) 

681 self.state = 131 

682 self._errHandler.sync(self) 

683 _la = self._input.LA(1) 

684 while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << RFilter.T__1) | (1 << RFilter.T__3) | (1 << RFilter.T__4) | (1 << RFilter.T__5) | (1 << RFilter.T__6) | (1 << RFilter.T__7) | (1 << RFilter.T__8) | (1 << RFilter.T__9) | (1 << RFilter.T__10) | (1 << RFilter.T__11) | (1 << RFilter.T__13) | (1 << RFilter.T__14) | (1 << RFilter.T__15) | (1 << RFilter.T__18) | (1 << RFilter.T__19) | (1 << RFilter.T__20) | (1 << RFilter.T__21) | (1 << RFilter.T__22) | (1 << RFilter.T__24) | (1 << RFilter.T__25) | (1 << RFilter.T__26) | (1 << RFilter.T__27) | (1 << RFilter.T__28) | (1 << RFilter.T__29) | (1 << RFilter.T__30) | (1 << RFilter.T__31) | (1 << RFilter.T__32) | (1 << RFilter.T__33) | (1 << RFilter.T__34) | (1 << RFilter.T__35) | (1 << RFilter.T__38) | (1 << RFilter.T__40) | (1 << RFilter.T__43) | (1 << RFilter.T__44) | (1 << RFilter.T__45) | (1 << RFilter.T__46) | (1 << RFilter.T__47) | (1 << RFilter.T__48) | (1 << RFilter.T__49) | (1 << RFilter.T__50) | (1 << RFilter.T__52) | (1 << RFilter.T__54) | (1 << RFilter.T__55) | (1 << RFilter.T__56) | (1 << RFilter.T__57) | (1 << RFilter.T__58) | (1 << RFilter.T__59) | (1 << RFilter.HEX) | (1 << RFilter.INT))) != 0) or ((((_la - 64)) & ~0x3f) == 0 and ((1 << (_la - 64)) & ((1 << (RFilter.FLOAT - 64)) | (1 << (RFilter.COMPLEX - 64)) | (1 << (RFilter.STRING - 64)) | (1 << (RFilter.ID - 64)) | (1 << (RFilter.USER_OP - 64)) | (1 << (RFilter.NL - 64)))) != 0): 

685 self.state = 129 

686 self._errHandler.sync(self) 

687 token = self._input.LA(1) 

688 if token in [RFilter.T__1, RFilter.T__3, RFilter.T__4, RFilter.T__5, RFilter.T__6, RFilter.T__7, RFilter.T__8, RFilter.T__9, RFilter.T__10, RFilter.T__11, RFilter.T__13, RFilter.T__14, RFilter.T__15, RFilter.T__18, RFilter.T__19, RFilter.T__20, RFilter.T__21, RFilter.T__22, RFilter.T__24, RFilter.T__25, RFilter.T__26, RFilter.T__27, RFilter.T__28, RFilter.T__29, RFilter.T__30, RFilter.T__31, RFilter.T__32, RFilter.T__33, RFilter.T__34, RFilter.T__35, RFilter.T__38, RFilter.T__40, RFilter.T__43, RFilter.T__44, RFilter.T__45, RFilter.T__46, RFilter.T__47, RFilter.T__48, RFilter.T__49, RFilter.T__50, RFilter.T__52, RFilter.T__54, RFilter.T__55, RFilter.T__56, RFilter.T__57, RFilter.T__58, RFilter.T__59, RFilter.HEX, RFilter.INT, RFilter.FLOAT, RFilter.COMPLEX, RFilter.STRING, RFilter.ID, RFilter.USER_OP]: 

689 self.state = 127 

690 self.elem() 

691 pass 

692 elif token in [RFilter.NL]: 

693 self.state = 128 

694 self.eat() 

695 pass 

696 else: 

697 raise NoViableAltException(self) 

698 

699 self.state = 133 

700 self._errHandler.sync(self) 

701 _la = self._input.LA(1) 

702 

703 self.state = 134 

704 self.match(RFilter.T__16) 

705 self.state = 136 

706 self._errHandler.sync(self) 

707 la_ = self._interp.adaptivePredict(self._input, 28, self._ctx) 

708 if la_ == 1: 

709 self.state = 135 

710 self.eat() 

711 

712 pass 

713 elif token in [RFilter.T__35]: 

714 self.enterOuterAlt(localctx, 11) 

715 self.state = 138 

716 self.match(RFilter.T__35) 

717 

718 # ``inside a compound expression, a newline before else is discarded, 

719 # whereas at the outermost level, the newline terminates the if 

720 # construction and a subsequent else causes a syntax error.'' 

721 # /* 

722 # Works here 

723 # if (1 == 0) {print(1)} else {print(2)} 

724 # 

725 # and correctly gets error here: 

726 # 

727 # if (1 == 0) {print(1)} 

728 # else {print(2)} 

729 # 

730 # this works too: 

731 # 

732 # if (1 == 0) { 

733 # if (2 == 0) print(1) 

734 # else print(2) 

735 # } 

736 # */ 

737 tok = _input.LT(-2) 

738 if curlies > 0 and tok.getType() == NL: 

739 tok.setChannel(Token.HIDDEN_CHANNEL) 

740 pass 

741 else: 

742 raise NoViableAltException(self) 

743 

744 except RecognitionException as re: 

745 localctx.exception = re 

746 self._errHandler.reportError(self, re) 

747 self._errHandler.recover(self, re) 

748 finally: 

749 self.exitRule() 

750 return localctx 

751 

752 class AtomContext(ParserRuleContext): 

753 __slots__ = 'parser' 

754 

755 def __init__(self, parser, parent: ParserRuleContext = None, invokingState: int = -1): 

756 super().__init__(parent, invokingState) 

757 self.parser = parser 

758 

759 def ID(self): 

760 return self.getToken(RFilter.ID, 0) 

761 

762 def STRING(self): 

763 return self.getToken(RFilter.STRING, 0) 

764 

765 def HEX(self): 

766 return self.getToken(RFilter.HEX, 0) 

767 

768 def INT(self): 

769 return self.getToken(RFilter.INT, 0) 

770 

771 def FLOAT(self): 

772 return self.getToken(RFilter.FLOAT, 0) 

773 

774 def COMPLEX(self): 

775 return self.getToken(RFilter.COMPLEX, 0) 

776 

777 def getRuleIndex(self): 

778 return RFilter.RULE_atom 

779 

780 def enterRule(self, listener: ParseTreeListener): 

781 if hasattr(listener, "enterAtom"): 

782 listener.enterAtom(self) 

783 

784 def exitRule(self, listener: ParseTreeListener): 

785 if hasattr(listener, "exitAtom"): 

786 listener.exitAtom(self) 

787 

788 def atom(self): 

789 

790 localctx = RFilter.AtomContext(self, self._ctx, self.state) 

791 self.enterRule(localctx, 6, self.RULE_atom) 

792 self._la = 0 # Token type 

793 try: 

794 self.enterOuterAlt(localctx, 1) 

795 self.state = 142 

796 _la = self._input.LA(1) 

797 if not (((((_la - 15)) & ~0x3f) == 0 and ((1 << (_la - 15)) & ((1 << (RFilter.T__14 - 15)) | (1 << (RFilter.T__21 - 15)) | (1 << (RFilter.T__24 - 15)) | (1 << (RFilter.T__25 - 15)) | (1 << (RFilter.T__26 - 15)) | (1 << (RFilter.T__27 - 15)) | (1 << (RFilter.T__28 - 15)) | (1 << (RFilter.T__29 - 15)) | (1 << (RFilter.HEX - 15)) | (1 << (RFilter.INT - 15)) | (1 << (RFilter.FLOAT - 15)) | (1 << (RFilter.COMPLEX - 15)) | (1 << (RFilter.STRING - 15)) | (1 << (RFilter.ID - 15)))) != 0)): 

798 self._errHandler.recoverInline(self) 

799 else: 

800 self._errHandler.reportMatch(self) 

801 self.consume() 

802 except RecognitionException as re: 

803 localctx.exception = re 

804 self._errHandler.reportError(self, re) 

805 self._errHandler.recover(self, re) 

806 finally: 

807 self.exitRule() 

808 return localctx 

809 

810 class OpContext(ParserRuleContext): 

811 __slots__ = 'parser' 

812 

813 def __init__(self, parser, parent: ParserRuleContext = None, invokingState: int = -1): 

814 super().__init__(parent, invokingState) 

815 self.parser = parser 

816 

817 def USER_OP(self): 

818 return self.getToken(RFilter.USER_OP, 0) 

819 

820 def getRuleIndex(self): 

821 return RFilter.RULE_op 

822 

823 def enterRule(self, listener: ParseTreeListener): 

824 if hasattr(listener, "enterOp"): 

825 listener.enterOp(self) 

826 

827 def exitRule(self, listener: ParseTreeListener): 

828 if hasattr(listener, "exitOp"): 

829 listener.exitOp(self) 

830 

831 def op(self): 

832 

833 localctx = RFilter.OpContext(self, self._ctx, self.state) 

834 self.enterRule(localctx, 8, self.RULE_op) 

835 self._la = 0 # Token type 

836 try: 

837 self.enterOuterAlt(localctx, 1) 

838 self.state = 144 

839 _la = self._input.LA(1) 

840 if not (((((_la - 5)) & ~0x3f) == 0 and ((1 << (_la - 5)) & ((1 << (RFilter.T__4 - 5)) | (1 << (RFilter.T__5 - 5)) | (1 << (RFilter.T__6 - 5)) | (1 << (RFilter.T__7 - 5)) | (1 << (RFilter.T__8 - 5)) | (1 << (RFilter.T__9 - 5)) | (1 << (RFilter.T__10 - 5)) | (1 << (RFilter.T__13 - 5)) | (1 << (RFilter.T__18 - 5)) | (1 << (RFilter.T__19 - 5)) | (1 << (RFilter.T__20 - 5)) | (1 << (RFilter.T__22 - 5)) | (1 << (RFilter.T__30 - 5)) | (1 << (RFilter.T__33 - 5)) | (1 << (RFilter.T__38 - 5)) | (1 << (RFilter.T__40 - 5)) | (1 << (RFilter.T__44 - 5)) | (1 << (RFilter.T__45 - 5)) | (1 << (RFilter.T__46 - 5)) | (1 << (RFilter.T__47 - 5)) | (1 << (RFilter.T__48 - 5)) | (1 << (RFilter.T__49 - 5)) | (1 << (RFilter.T__50 - 5)) | (1 << (RFilter.T__52 - 5)) | (1 << (RFilter.T__54 - 5)) | (1 << (RFilter.T__55 - 5)) | (1 << (RFilter.T__56 - 5)) | (1 << (RFilter.T__57 - 5)) | (1 << (RFilter.T__58 - 5)) | (1 << (RFilter.T__59 - 5)) | (1 << (RFilter.USER_OP - 5)))) != 0)): 

841 self._errHandler.recoverInline(self) 

842 else: 

843 self._errHandler.reportMatch(self) 

844 self.consume() 

845 except RecognitionException as re: 

846 localctx.exception = re 

847 self._errHandler.reportError(self, re) 

848 self._errHandler.recover(self, re) 

849 finally: 

850 self.exitRule() 

851 return localctx