Coverage for src/pyensae/languages/CSharpPreprocessorParser.py: 0%
750 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-07-03 02:16 +0200
« prev ^ index » next coverage.py v7.2.7, created at 2023-07-03 02:16 +0200
1# Generated from \CSharpPreprocessorParser.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
12def serializedATN():
13 return [
14 4, 1, 198, 123, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
15 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
16 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 3, 0, 38, 8, 0, 1, 0, 1, 0, 3, 0, 42, 8, 0, 1,
17 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 3, 0, 59,
18 8, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 3, 0, 66, 8, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
19 0, 3, 0, 76, 8, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
20 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 96, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1,
21 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 118, 8, 2, 10, 2, 12,
22 2, 121, 9, 2, 1, 2, 0, 1, 4, 3, 0, 2, 4, 0, 1, 1, 1, 196, 196, 143, 0, 75, 1, 0, 0, 0, 2, 77,
23 1, 0, 0, 0, 4, 95, 1, 0, 0, 0, 6, 7, 5, 183, 0, 0, 7, 8, 5, 195, 0, 0, 8, 9, 3, 2, 1, 0, 9, 10,
24 6, 0, -1, 0, 10, 76, 1, 0, 0, 0, 11, 12, 5, 184, 0, 0, 12, 13, 5, 195, 0, 0, 13, 14, 3, 2,
25 1, 0, 14, 15, 6, 0, -1, 0, 15, 76, 1, 0, 0, 0, 16, 17, 5, 52, 0, 0, 17, 18, 3, 4, 2, 0, 18,
26 19, 3, 2, 1, 0, 19, 20, 6, 0, -
27 1, 0, 20, 76, 1, 0, 0, 0, 21, 22, 5, 185, 0, 0, 22, 23, 3,
28 4, 2, 0, 23, 24, 3, 2, 1, 0, 24, 25, 6, 0, -
29 1, 0, 25, 76, 1, 0, 0, 0, 26, 27, 5, 36, 0, 0,
30 27, 28, 3, 2, 1, 0, 28, 29, 6, 0, -
31 1, 0, 29, 76, 1, 0, 0, 0, 30, 31, 5, 186, 0, 0, 31, 32,
32 3, 2, 1, 0, 32, 33, 6, 0, -
33 1, 0, 33, 76, 1, 0, 0, 0, 34, 41, 5, 187, 0, 0, 35, 37, 5, 182,
34 0, 0, 36, 38, 5, 91, 0, 0, 37, 36, 1, 0, 0, 0, 37, 38, 1, 0, 0, 0, 38, 42, 1, 0, 0, 0, 39,
35 42, 5, 30, 0, 0, 40, 42, 5, 194, 0, 0, 41, 35, 1, 0, 0, 0, 41, 39, 1, 0, 0, 0, 41, 40, 1,
36 0, 0, 0, 42, 43, 1, 0, 0, 0, 43, 44, 3, 2, 1, 0, 44, 45, 6, 0, -
37 1, 0, 45, 76, 1, 0, 0, 0, 46,
38 47, 5, 188, 0, 0, 47, 48, 5, 197, 0, 0, 48, 49, 3, 2, 1, 0, 49, 50, 6, 0, -1, 0, 50, 76,
39 1, 0, 0, 0, 51, 52, 5, 189, 0, 0, 52, 53, 5, 197, 0, 0, 53, 54, 3, 2, 1, 0, 54, 55, 6, 0,
40 -1, 0, 55, 76, 1, 0, 0, 0, 56, 58, 5, 190, 0, 0, 57, 59, 5, 197, 0, 0, 58, 57, 1, 0, 0, 0,
41 58, 59, 1, 0, 0, 0, 59, 60, 1, 0, 0, 0, 60, 61, 3, 2, 1, 0, 61, 62, 6, 0, -1, 0, 62, 76, 1,
42 0, 0, 0, 63, 65, 5, 191, 0, 0, 64, 66, 5, 197, 0, 0, 65, 64, 1, 0, 0, 0, 65, 66, 1, 0, 0,
43 0, 66, 67, 1, 0, 0, 0, 67, 68, 3, 2, 1, 0, 68, 69, 6, 0, -
44 1, 0, 69, 76, 1, 0, 0, 0, 70, 71,
45 5, 192, 0, 0, 71, 72, 5, 197, 0, 0, 72, 73, 3, 2, 1, 0, 73, 74, 6, 0, -1, 0, 74, 76, 1, 0,
46 0, 0, 75, 6, 1, 0, 0, 0, 75, 11, 1, 0, 0, 0, 75, 16, 1, 0, 0, 0, 75, 21, 1, 0, 0, 0, 75, 26,
47 1, 0, 0, 0, 75, 30, 1, 0, 0, 0, 75, 34, 1, 0, 0, 0, 75, 46, 1, 0, 0, 0, 75, 51, 1, 0, 0, 0,
48 75, 56, 1, 0, 0, 0, 75, 63, 1, 0, 0, 0, 75, 70, 1, 0, 0, 0, 76, 1, 1, 0, 0, 0, 77, 78, 7, 0,
49 0, 0, 78, 3, 1, 0, 0, 0, 79, 80, 6, 2, -
50 1, 0, 80, 81, 5, 96, 0, 0, 81, 96, 6, 2, -1, 0, 82,
51 83, 5, 42, 0, 0, 83, 96, 6, 2, -
52 1, 0, 84, 85, 5, 195, 0, 0, 85, 96, 6, 2, -1, 0, 86, 87,
53 5, 129, 0, 0, 87, 88, 3, 4, 2, 0, 88, 89, 5, 130, 0, 0, 89, 90, 6, 2, -1, 0, 90, 96, 1, 0,
54 0, 0, 91, 92, 5, 143, 0, 0, 92, 93, 3, 4, 2, 5, 93, 94, 6, 2, -
55 1, 0, 94, 96, 1, 0, 0, 0, 95,
56 79, 1, 0, 0, 0, 95, 82, 1, 0, 0, 0, 95, 84, 1, 0, 0, 0, 95, 86, 1, 0, 0, 0, 95, 91, 1, 0, 0,
57 0, 96, 119, 1, 0, 0, 0, 97, 98, 10, 4, 0, 0, 98, 99, 5, 156, 0, 0, 99, 100, 3, 4, 2, 5, 100,
58 101, 6, 2, -1, 0, 101, 118, 1, 0, 0, 0, 102, 103, 10, 3, 0, 0, 103, 104, 5, 157, 0, 0,
59 104, 105, 3, 4, 2, 4, 105, 106, 6, 2, -
60 1, 0, 106, 118, 1, 0, 0, 0, 107, 108, 10, 2, 0,
61 0, 108, 109, 5, 153, 0, 0, 109, 110, 3, 4, 2, 3, 110, 111, 6, 2, -1, 0, 111, 118, 1, 0,
62 0, 0, 112, 113, 10, 1, 0, 0, 113, 114, 5, 154, 0, 0, 114, 115, 3, 4, 2, 2, 115, 116, 6,
63 2, -1, 0, 116, 118, 1, 0, 0, 0, 117, 97, 1, 0, 0, 0, 117, 102, 1, 0, 0, 0, 117, 107, 1,
64 0, 0, 0, 117, 112, 1, 0, 0, 0, 118, 121, 1, 0, 0, 0, 119, 117, 1, 0, 0, 0, 119, 120, 1,
65 0, 0, 0, 120, 5, 1, 0, 0, 0, 121, 119, 1, 0, 0, 0, 8, 37, 41, 58, 65, 75, 95, 117, 119
66 ]
69class CSharpPreprocessorParser (Parser):
71 grammarFileName = "CSharpPreprocessorParser.g4"
73 atn = ATNDeserializer().deserialize(serializedATN())
75 decisionsToDFA = [DFA(ds, i) for i, ds in enumerate(atn.decisionToState)]
77 sharedContextCache = PredictionContextCache()
79 literalNames = ["<INVALID>", "'\\u00EF\\u00BB\\u00BF'", "<INVALID>",
80 "'/***/'", "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
81 "'#'", "'abstract'", "'add'", "'alias'", "'__arglist'",
82 "'as'", "'ascending'", "'async'", "'await'", "'base'",
83 "'bool'", "'break'", "'by'", "'byte'", "'case'", "'catch'",
84 "'char'", "'checked'", "'class'", "'const'", "'continue'",
85 "'decimal'", "'default'", "'delegate'", "'descending'",
86 "'do'", "'double'", "'dynamic'", "'else'", "'enum'",
87 "'equals'", "'event'", "'explicit'", "'extern'", "'False'",
88 "'finally'", "'fixed'", "'float'", "'for'", "'foreach'",
89 "'from'", "'get'", "'goto'", "'group'", "'if'", "'implicit'",
90 "'in'", "'int'", "'interface'", "'internal'", "'into'",
91 "'is'", "'join'", "'let'", "'lock'", "'long'", "'nameof'",
92 "'namespace'", "'new'", "'null'", "'object'", "'on'",
93 "'operator'", "'orderby'", "'out'", "'override'", "'params'",
94 "'partial'", "'private'", "'protected'", "'public'",
95 "'readonly'", "'ref'", "'remove'", "'return'", "'sbyte'",
96 "'sealed'", "'select'", "'set'", "'short'", "'sizeof'",
97 "'stackalloc'", "'static'", "'string'", "'struct'",
98 "'switch'", "'this'", "'throw'", "'true'", "'try'",
99 "'typeof'", "'uint'", "'ulong'", "'unchecked'", "'unmanaged'",
100 "'unsafe'", "'ushort'", "'using'", "'var'", "'virtual'",
101 "'void'", "'volatile'", "'when'", "'where'", "'while'",
102 "'yield'", "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
103 "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
104 "<INVALID>", "<INVALID>", "<INVALID>", "'{'", "'}'",
105 "'['", "']'", "'('", "')'", "'.'", "','", "':'", "';'",
106 "'+'", "'-'", "'*'", "'/'", "'%'", "'&'", "'|'", "'^'",
107 "'!'", "'~'", "'='", "'<'", "'>'", "'?'", "'::'", "'??'",
108 "'++'", "'--'", "'&&'", "'||'", "'->'", "'=='", "'!='",
109 "'<='", "'>='", "'+='", "'-='", "'*='", "'/='", "'%='",
110 "'&='", "'|='", "'^='", "'<<'", "'<<='", "'??='", "'..'",
111 "'{{'", "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
112 "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
113 "<INVALID>", "<INVALID>", "'define'", "'undef'", "'elif'",
114 "'endif'", "'line'", "<INVALID>", "<INVALID>", "<INVALID>",
115 "<INVALID>", "<INVALID>", "<INVALID>", "'hidden'",
116 "<INVALID>", "<INVALID>", "<INVALID>", "'}}'"]
118 symbolicNames = ["<INVALID>", "BYTE_ORDER_MARK", "SINGLE_LINE_DOC_COMMENT",
119 "EMPTY_DELIMITED_DOC_COMMENT", "DELIMITED_DOC_COMMENT",
120 "SINGLE_LINE_COMMENT", "DELIMITED_COMMENT", "WHITESPACES",
121 "SHARP", "ABSTRACT", "ADD", "ALIAS", "ARGLIST", "AS",
122 "ASCENDING", "ASYNC", "AWAIT", "BASE", "BOOL", "BREAK",
123 "BY", "BYTE", "CASE", "CATCH", "CHAR", "CHECKED",
124 "CLASS", "CONST", "CONTINUE", "DECIMAL", "DEFAULT",
125 "DELEGATE", "DESCENDING", "DO", "DOUBLE", "DYNAMIC",
126 "ELSE", "ENUM", "EQUALS", "EVENT", "EXPLICIT", "EXTERN",
127 "False", "FINALLY", "FIXED", "FLOAT", "FOR", "FOREACH",
128 "FROM", "GET", "GOTO", "GROUP", "IF", "IMPLICIT",
129 "IN", "INT", "INTERFACE", "INTERNAL", "INTO", "IS",
130 "JOIN", "LET", "LOCK", "LONG", "NAMEOF", "NAMESPACE",
131 "NEW", "NULL_", "OBJECT", "ON", "OPERATOR", "ORDERBY",
132 "OUT", "OVERRIDE", "PARAMS", "PARTIAL", "PRIVATE",
133 "PROTECTED", "PUBLIC", "READONLY", "REF", "REMOVE",
134 "RETURN", "SBYTE", "SEALED", "SELECT", "SET", "SHORT",
135 "SIZEOF", "STACKALLOC", "STATIC", "STRING", "STRUCT",
136 "SWITCH", "THIS", "THROW", "TRUE", "TRY", "TYPEOF",
137 "UINT", "ULONG", "UNCHECKED", "UNMANAGED", "UNSAFE",
138 "USHORT", "USING", "VAR", "VIRTUAL", "VOID", "VOLATILE",
139 "WHEN", "WHERE", "WHILE", "YIELD", "IDENTIFIER", "LITERAL_ACCESS",
140 "INTEGER_LITERAL", "HEX_INTEGER_LITERAL", "BIN_INTEGER_LITERAL",
141 "REAL_LITERAL", "CHARACTER_LITERAL", "REGULAR_STRING",
142 "VERBATIUM_STRING", "INTERPOLATED_REGULAR_STRING_START",
143 "INTERPOLATED_VERBATIUM_STRING_START", "OPEN_BRACE",
144 "CLOSE_BRACE", "OPEN_BRACKET", "CLOSE_BRACKET", "OPEN_PARENS",
145 "CLOSE_PARENS", "DOT", "COMMA", "COLON", "SEMICOLON",
146 "PLUS", "MINUS", "STAR", "DIV", "PERCENT", "AMP",
147 "BITWISE_OR", "CARET", "BANG", "TILDE", "ASSIGNMENT",
148 "LT", "GT", "INTERR", "DOUBLE_COLON", "OP_COALESCING",
149 "OP_INC", "OP_DEC", "OP_AND", "OP_OR", "OP_PTR", "OP_EQ",
150 "OP_NE", "OP_LE", "OP_GE", "OP_ADD_ASSIGNMENT", "OP_SUB_ASSIGNMENT",
151 "OP_MULT_ASSIGNMENT", "OP_DIV_ASSIGNMENT", "OP_MOD_ASSIGNMENT",
152 "OP_AND_ASSIGNMENT", "OP_OR_ASSIGNMENT", "OP_XOR_ASSIGNMENT",
153 "OP_LEFT_SHIFT", "OP_LEFT_SHIFT_ASSIGNMENT", "OP_COALESCING_ASSIGNMENT",
154 "OP_RANGE", "DOUBLE_CURLY_INSIDE", "OPEN_BRACE_INSIDE",
155 "REGULAR_CHAR_INSIDE", "VERBATIUM_DOUBLE_QUOTE_INSIDE",
156 "DOUBLE_QUOTE_INSIDE", "REGULAR_STRING_INSIDE", "VERBATIUM_INSIDE_STRING",
157 "CLOSE_BRACE_INSIDE", "FORMAT_STRING", "DIRECTIVE_WHITESPACES",
158 "DIGITS", "DEFINE", "UNDEF", "ELIF", "ENDIF", "LINE",
159 "ERROR", "WARNING", "REGION", "ENDREGION", "PRAGMA",
160 "NULLABLE", "DIRECTIVE_HIDDEN", "CONDITIONAL_SYMBOL",
161 "DIRECTIVE_NEW_LINE", "TEXT", "DOUBLE_CURLY_CLOSE_INSIDE"]
163 RULE_preprocessor_directive = 0
164 RULE_directive_new_line_or_sharp = 1
165 RULE_preprocessor_expression = 2
167 ruleNames = ["preprocessor_directive", "directive_new_line_or_sharp",
168 "preprocessor_expression"]
170 EOF = Token.EOF
171 BYTE_ORDER_MARK = 1
172 SINGLE_LINE_DOC_COMMENT = 2
173 EMPTY_DELIMITED_DOC_COMMENT = 3
174 DELIMITED_DOC_COMMENT = 4
175 SINGLE_LINE_COMMENT = 5
176 DELIMITED_COMMENT = 6
177 WHITESPACES = 7
178 SHARP = 8
179 ABSTRACT = 9
180 ADD = 10
181 ALIAS = 11
182 ARGLIST = 12
183 AS = 13
184 ASCENDING = 14
185 ASYNC = 15
186 AWAIT = 16
187 BASE = 17
188 BOOL = 18
189 BREAK = 19
190 BY = 20
191 BYTE = 21
192 CASE = 22
193 CATCH = 23
194 CHAR = 24
195 CHECKED = 25
196 CLASS = 26
197 CONST = 27
198 CONTINUE = 28
199 DECIMAL = 29
200 DEFAULT = 30
201 DELEGATE = 31
202 DESCENDING = 32
203 DO = 33
204 DOUBLE = 34
205 DYNAMIC = 35
206 ELSE = 36
207 ENUM = 37
208 EQUALS = 38
209 EVENT = 39
210 EXPLICIT = 40
211 EXTERN = 41
212 FALSE = 42
213 FINALLY = 43
214 FIXED = 44
215 FLOAT = 45
216 FOR = 46
217 FOREACH = 47
218 FROM = 48
219 GET = 49
220 GOTO = 50
221 GROUP = 51
222 IF = 52
223 IMPLICIT = 53
224 IN = 54
225 INT = 55
226 INTERFACE = 56
227 INTERNAL = 57
228 INTO = 58
229 IS = 59
230 JOIN = 60
231 LET = 61
232 LOCK = 62
233 LONG = 63
234 NAMEOF = 64
235 NAMESPACE = 65
236 NEW = 66
237 NULL_ = 67
238 OBJECT = 68
239 ON = 69
240 OPERATOR = 70
241 ORDERBY = 71
242 OUT = 72
243 OVERRIDE = 73
244 PARAMS = 74
245 PARTIAL = 75
246 PRIVATE = 76
247 PROTECTED = 77
248 PUBLIC = 78
249 READONLY = 79
250 REF = 80
251 REMOVE = 81
252 RETURN = 82
253 SBYTE = 83
254 SEALED = 84
255 SELECT = 85
256 SET = 86
257 SHORT = 87
258 SIZEOF = 88
259 STACKALLOC = 89
260 STATIC = 90
261 STRING = 91
262 STRUCT = 92
263 SWITCH = 93
264 THIS = 94
265 THROW = 95
266 TRUE = 96
267 TRY = 97
268 TYPEOF = 98
269 UINT = 99
270 ULONG = 100
271 UNCHECKED = 101
272 UNMANAGED = 102
273 UNSAFE = 103
274 USHORT = 104
275 USING = 105
276 VAR = 106
277 VIRTUAL = 107
278 VOID = 108
279 VOLATILE = 109
280 WHEN = 110
281 WHERE = 111
282 WHILE = 112
283 YIELD = 113
284 IDENTIFIER = 114
285 LITERAL_ACCESS = 115
286 INTEGER_LITERAL = 116
287 HEX_INTEGER_LITERAL = 117
288 BIN_INTEGER_LITERAL = 118
289 REAL_LITERAL = 119
290 CHARACTER_LITERAL = 120
291 REGULAR_STRING = 121
292 VERBATIUM_STRING = 122
293 INTERPOLATED_REGULAR_STRING_START = 123
294 INTERPOLATED_VERBATIUM_STRING_START = 124
295 OPEN_BRACE = 125
296 CLOSE_BRACE = 126
297 OPEN_BRACKET = 127
298 CLOSE_BRACKET = 128
299 OPEN_PARENS = 129
300 CLOSE_PARENS = 130
301 DOT = 131
302 COMMA = 132
303 COLON = 133
304 SEMICOLON = 134
305 PLUS = 135
306 MINUS = 136
307 STAR = 137
308 DIV = 138
309 PERCENT = 139
310 AMP = 140
311 BITWISE_OR = 141
312 CARET = 142
313 BANG = 143
314 TILDE = 144
315 ASSIGNMENT = 145
316 LT = 146
317 GT = 147
318 INTERR = 148
319 DOUBLE_COLON = 149
320 OP_COALESCING = 150
321 OP_INC = 151
322 OP_DEC = 152
323 OP_AND = 153
324 OP_OR = 154
325 OP_PTR = 155
326 OP_EQ = 156
327 OP_NE = 157
328 OP_LE = 158
329 OP_GE = 159
330 OP_ADD_ASSIGNMENT = 160
331 OP_SUB_ASSIGNMENT = 161
332 OP_MULT_ASSIGNMENT = 162
333 OP_DIV_ASSIGNMENT = 163
334 OP_MOD_ASSIGNMENT = 164
335 OP_AND_ASSIGNMENT = 165
336 OP_OR_ASSIGNMENT = 166
337 OP_XOR_ASSIGNMENT = 167
338 OP_LEFT_SHIFT = 168
339 OP_LEFT_SHIFT_ASSIGNMENT = 169
340 OP_COALESCING_ASSIGNMENT = 170
341 OP_RANGE = 171
342 DOUBLE_CURLY_INSIDE = 172
343 OPEN_BRACE_INSIDE = 173
344 REGULAR_CHAR_INSIDE = 174
345 VERBATIUM_DOUBLE_QUOTE_INSIDE = 175
346 DOUBLE_QUOTE_INSIDE = 176
347 REGULAR_STRING_INSIDE = 177
348 VERBATIUM_INSIDE_STRING = 178
349 CLOSE_BRACE_INSIDE = 179
350 FORMAT_STRING = 180
351 DIRECTIVE_WHITESPACES = 181
352 DIGITS = 182
353 DEFINE = 183
354 UNDEF = 184
355 ELIF = 185
356 ENDIF = 186
357 LINE = 187
358 ERROR = 188
359 WARNING = 189
360 REGION = 190
361 ENDREGION = 191
362 PRAGMA = 192
363 NULLABLE = 193
364 DIRECTIVE_HIDDEN = 194
365 CONDITIONAL_SYMBOL = 195
366 DIRECTIVE_NEW_LINE = 196
367 TEXT = 197
368 DOUBLE_CURLY_CLOSE_INSIDE = 198
370 def __init__(self, input: TokenStream, output: TextIO = sys.stdout):
371 super().__init__(input, output)
372 self.checkVersion("4.10.1")
373 self._interp = ParserATNSimulator(
374 self, self.atn, self.decisionsToDFA, self.sharedContextCache)
375 self._predicates = None
377 conditions = [True]
378 ConditionalSymbols = {"DEBUG"}
380 def allConditions(self):
381 for condition in CSharpPreprocessorParser.conditions:
382 if not condition:
383 return False
384 return True
386 class Preprocessor_directiveContext(ParserRuleContext):
387 __slots__ = 'parser'
389 def __init__(self, parser, parent: ParserRuleContext = None, invokingState: int = -1):
390 super().__init__(parent, invokingState)
391 self.parser = parser
392 self.value = None
394 def getRuleIndex(self):
395 return CSharpPreprocessorParser.RULE_preprocessor_directive
397 def copyFrom(self, ctx: ParserRuleContext):
398 super().copyFrom(ctx)
399 self.value = ctx.value
401 class PreprocessorDiagnosticContext(Preprocessor_directiveContext):
403 # actually a CSharpPreprocessorParser.Preprocessor_directiveContext
404 def __init__(self, parser, ctx: ParserRuleContext):
405 super().__init__(parser)
406 self.copyFrom(ctx)
408 def ERROR(self):
409 return self.getToken(CSharpPreprocessorParser.ERROR, 0)
411 def TEXT(self):
412 return self.getToken(CSharpPreprocessorParser.TEXT, 0)
414 def directive_new_line_or_sharp(self):
415 return self.getTypedRuleContext(CSharpPreprocessorParser.Directive_new_line_or_sharpContext, 0)
417 def WARNING(self):
418 return self.getToken(CSharpPreprocessorParser.WARNING, 0)
420 def enterRule(self, listener: ParseTreeListener):
421 if hasattr(listener, "enterPreprocessorDiagnostic"):
422 listener.enterPreprocessorDiagnostic(self)
424 def exitRule(self, listener: ParseTreeListener):
425 if hasattr(listener, "exitPreprocessorDiagnostic"):
426 listener.exitPreprocessorDiagnostic(self)
428 class PreprocessorRegionContext(Preprocessor_directiveContext):
430 # actually a CSharpPreprocessorParser.Preprocessor_directiveContext
431 def __init__(self, parser, ctx: ParserRuleContext):
432 super().__init__(parser)
433 self.copyFrom(ctx)
435 def REGION(self):
436 return self.getToken(CSharpPreprocessorParser.REGION, 0)
438 def directive_new_line_or_sharp(self):
439 return self.getTypedRuleContext(CSharpPreprocessorParser.Directive_new_line_or_sharpContext, 0)
441 def TEXT(self):
442 return self.getToken(CSharpPreprocessorParser.TEXT, 0)
444 def ENDREGION(self):
445 return self.getToken(CSharpPreprocessorParser.ENDREGION, 0)
447 def enterRule(self, listener: ParseTreeListener):
448 if hasattr(listener, "enterPreprocessorRegion"):
449 listener.enterPreprocessorRegion(self)
451 def exitRule(self, listener: ParseTreeListener):
452 if hasattr(listener, "exitPreprocessorRegion"):
453 listener.exitPreprocessorRegion(self)
455 class PreprocessorDeclarationContext(Preprocessor_directiveContext):
457 # actually a CSharpPreprocessorParser.Preprocessor_directiveContext
458 def __init__(self, parser, ctx: ParserRuleContext):
459 super().__init__(parser)
460 self._CONDITIONAL_SYMBOL = None # Token
461 self.copyFrom(ctx)
463 def DEFINE(self):
464 return self.getToken(CSharpPreprocessorParser.DEFINE, 0)
466 def CONDITIONAL_SYMBOL(self):
467 return self.getToken(CSharpPreprocessorParser.CONDITIONAL_SYMBOL, 0)
469 def directive_new_line_or_sharp(self):
470 return self.getTypedRuleContext(CSharpPreprocessorParser.Directive_new_line_or_sharpContext, 0)
472 def UNDEF(self):
473 return self.getToken(CSharpPreprocessorParser.UNDEF, 0)
475 def enterRule(self, listener: ParseTreeListener):
476 if hasattr(listener, "enterPreprocessorDeclaration"):
477 listener.enterPreprocessorDeclaration(self)
479 def exitRule(self, listener: ParseTreeListener):
480 if hasattr(listener, "exitPreprocessorDeclaration"):
481 listener.exitPreprocessorDeclaration(self)
483 class PreprocessorConditionalContext(Preprocessor_directiveContext):
485 # actually a CSharpPreprocessorParser.Preprocessor_directiveContext
486 def __init__(self, parser, ctx: ParserRuleContext):
487 super().__init__(parser)
488 self.expr = None # Preprocessor_expressionContext
489 self.copyFrom(ctx)
491 def IF(self):
492 return self.getToken(CSharpPreprocessorParser.IF, 0)
494 def directive_new_line_or_sharp(self):
495 return self.getTypedRuleContext(CSharpPreprocessorParser.Directive_new_line_or_sharpContext, 0)
497 def preprocessor_expression(self):
498 return self.getTypedRuleContext(CSharpPreprocessorParser.Preprocessor_expressionContext, 0)
500 def ELIF(self):
501 return self.getToken(CSharpPreprocessorParser.ELIF, 0)
503 def ELSE(self):
504 return self.getToken(CSharpPreprocessorParser.ELSE, 0)
506 def ENDIF(self):
507 return self.getToken(CSharpPreprocessorParser.ENDIF, 0)
509 def enterRule(self, listener: ParseTreeListener):
510 if hasattr(listener, "enterPreprocessorConditional"):
511 listener.enterPreprocessorConditional(self)
513 def exitRule(self, listener: ParseTreeListener):
514 if hasattr(listener, "exitPreprocessorConditional"):
515 listener.exitPreprocessorConditional(self)
517 class PreprocessorPragmaContext(Preprocessor_directiveContext):
519 # actually a CSharpPreprocessorParser.Preprocessor_directiveContext
520 def __init__(self, parser, ctx: ParserRuleContext):
521 super().__init__(parser)
522 self.copyFrom(ctx)
524 def PRAGMA(self):
525 return self.getToken(CSharpPreprocessorParser.PRAGMA, 0)
527 def TEXT(self):
528 return self.getToken(CSharpPreprocessorParser.TEXT, 0)
530 def directive_new_line_or_sharp(self):
531 return self.getTypedRuleContext(CSharpPreprocessorParser.Directive_new_line_or_sharpContext, 0)
533 def enterRule(self, listener: ParseTreeListener):
534 if hasattr(listener, "enterPreprocessorPragma"):
535 listener.enterPreprocessorPragma(self)
537 def exitRule(self, listener: ParseTreeListener):
538 if hasattr(listener, "exitPreprocessorPragma"):
539 listener.exitPreprocessorPragma(self)
541 class PreprocessorLineContext(Preprocessor_directiveContext):
543 # actually a CSharpPreprocessorParser.Preprocessor_directiveContext
544 def __init__(self, parser, ctx: ParserRuleContext):
545 super().__init__(parser)
546 self.copyFrom(ctx)
548 def LINE(self):
549 return self.getToken(CSharpPreprocessorParser.LINE, 0)
551 def directive_new_line_or_sharp(self):
552 return self.getTypedRuleContext(CSharpPreprocessorParser.Directive_new_line_or_sharpContext, 0)
554 def DIGITS(self):
555 return self.getToken(CSharpPreprocessorParser.DIGITS, 0)
557 def DEFAULT(self):
558 return self.getToken(CSharpPreprocessorParser.DEFAULT, 0)
560 def DIRECTIVE_HIDDEN(self):
561 return self.getToken(CSharpPreprocessorParser.DIRECTIVE_HIDDEN, 0)
563 def STRING(self):
564 return self.getToken(CSharpPreprocessorParser.STRING, 0)
566 def enterRule(self, listener: ParseTreeListener):
567 if hasattr(listener, "enterPreprocessorLine"):
568 listener.enterPreprocessorLine(self)
570 def exitRule(self, listener: ParseTreeListener):
571 if hasattr(listener, "exitPreprocessorLine"):
572 listener.exitPreprocessorLine(self)
574 def preprocessor_directive(self):
576 localctx = CSharpPreprocessorParser.Preprocessor_directiveContext(
577 self, self._ctx, self.state)
578 self.enterRule(localctx, 0, self.RULE_preprocessor_directive)
579 self._la = 0 # Token type
580 try:
581 self.state = 75
582 self._errHandler.sync(self)
583 token = self._input.LA(1)
584 if token in [CSharpPreprocessorParser.DEFINE]:
585 localctx = CSharpPreprocessorParser.PreprocessorDeclarationContext(
586 self, localctx)
587 self.enterOuterAlt(localctx, 1)
588 self.state = 6
589 self.match(CSharpPreprocessorParser.DEFINE)
590 self.state = 7
591 localctx._CONDITIONAL_SYMBOL = self.match(
592 CSharpPreprocessorParser.CONDITIONAL_SYMBOL)
593 self.state = 8
594 self.directive_new_line_or_sharp()
595 ConditionalSymbols.add(
596 (None if localctx._CONDITIONAL_SYMBOL is None else localctx._CONDITIONAL_SYMBOL.text))
597 localctx.value = allConditions()
598 pass
599 elif token in [CSharpPreprocessorParser.UNDEF]:
600 localctx = CSharpPreprocessorParser.PreprocessorDeclarationContext(
601 self, localctx)
602 self.enterOuterAlt(localctx, 2)
603 self.state = 11
604 self.match(CSharpPreprocessorParser.UNDEF)
605 self.state = 12
606 localctx._CONDITIONAL_SYMBOL = self.match(
607 CSharpPreprocessorParser.CONDITIONAL_SYMBOL)
608 self.state = 13
609 self.directive_new_line_or_sharp()
610 ConditionalSymbols.remove(
611 (None if localctx._CONDITIONAL_SYMBOL is None else localctx._CONDITIONAL_SYMBOL.text))
612 localctx.value = allConditions()
613 pass
614 elif token in [CSharpPreprocessorParser.IF]:
615 localctx = CSharpPreprocessorParser.PreprocessorConditionalContext(
616 self, localctx)
617 self.enterOuterAlt(localctx, 3)
618 self.state = 16
619 self.match(CSharpPreprocessorParser.IF)
620 self.state = 17
621 localctx.expr = self.preprocessor_expression(0)
622 self.state = 18
623 self.directive_new_line_or_sharp()
624 # conditions.push(localctx.expr.value.equals("true"))
625 localctx.value = localctx.expr.value.equals(
626 "true") and self.allConditions()
627 pass
628 elif token in [CSharpPreprocessorParser.ELIF]:
629 localctx = CSharpPreprocessorParser.PreprocessorConditionalContext(
630 self, localctx)
631 self.enterOuterAlt(localctx, 4)
632 self.state = 21
633 self.match(CSharpPreprocessorParser.ELIF)
634 self.state = 22
635 localctx.expr = self.preprocessor_expression(0)
636 self.state = 23
637 self.directive_new_line_or_sharp()
638 if not conditions.peek():
639 conditions.pop()
640 localctx.value = localctx.expr.value.equals(
641 "true") and allConditions()
642 # conditions.push(localctx.expr.value.equals("true")) else localctx.value = False
643 pass
644 elif token in [CSharpPreprocessorParser.ELSE]:
645 localctx = CSharpPreprocessorParser.PreprocessorConditionalContext(
646 self, localctx)
647 self.enterOuterAlt(localctx, 5)
648 self.state = 26
649 self.match(CSharpPreprocessorParser.ELSE)
650 self.state = 27
651 self.directive_new_line_or_sharp()
652 if not conditions.peek():
653 conditions.pop()
654 localctx.value = true and allConditions()
655 # conditions.push(true)
656 else:
657 localctx.value = False
658 pass
659 elif token in [CSharpPreprocessorParser.ENDIF]:
660 localctx = CSharpPreprocessorParser.PreprocessorConditionalContext(
661 self, localctx)
662 self.enterOuterAlt(localctx, 6)
663 self.state = 30
664 self.match(CSharpPreprocessorParser.ENDIF)
665 self.state = 31
666 self.directive_new_line_or_sharp()
667 conditions.pop()
668 localctx.value = conditions.peek()
669 pass
670 elif token in [CSharpPreprocessorParser.LINE]:
671 localctx = CSharpPreprocessorParser.PreprocessorLineContext(
672 self, localctx)
673 self.enterOuterAlt(localctx, 7)
674 self.state = 34
675 self.match(CSharpPreprocessorParser.LINE)
676 self.state = 41
677 self._errHandler.sync(self)
678 token = self._input.LA(1)
679 if token in [CSharpPreprocessorParser.DIGITS]:
680 self.state = 35
681 self.match(CSharpPreprocessorParser.DIGITS)
682 self.state = 37
683 self._errHandler.sync(self)
684 _la = self._input.LA(1)
685 if _la == CSharpPreprocessorParser.STRING:
686 self.state = 36
687 self.match(CSharpPreprocessorParser.STRING)
689 pass
690 elif token in [CSharpPreprocessorParser.DEFAULT]:
691 self.state = 39
692 self.match(CSharpPreprocessorParser.DEFAULT)
693 pass
694 elif token in [CSharpPreprocessorParser.DIRECTIVE_HIDDEN]:
695 self.state = 40
696 self.match(CSharpPreprocessorParser.DIRECTIVE_HIDDEN)
697 pass
698 else:
699 raise NoViableAltException(self)
701 self.state = 43
702 self.directive_new_line_or_sharp()
703 localctx.value = allConditions()
704 pass
705 elif token in [CSharpPreprocessorParser.ERROR]:
706 localctx = CSharpPreprocessorParser.PreprocessorDiagnosticContext(
707 self, localctx)
708 self.enterOuterAlt(localctx, 8)
709 self.state = 46
710 self.match(CSharpPreprocessorParser.ERROR)
711 self.state = 47
712 self.match(CSharpPreprocessorParser.TEXT)
713 self.state = 48
714 self.directive_new_line_or_sharp()
715 localctx.value = allConditions()
716 pass
717 elif token in [CSharpPreprocessorParser.WARNING]:
718 localctx = CSharpPreprocessorParser.PreprocessorDiagnosticContext(
719 self, localctx)
720 self.enterOuterAlt(localctx, 9)
721 self.state = 51
722 self.match(CSharpPreprocessorParser.WARNING)
723 self.state = 52
724 self.match(CSharpPreprocessorParser.TEXT)
725 self.state = 53
726 self.directive_new_line_or_sharp()
727 localctx.value = allConditions()
728 pass
729 elif token in [CSharpPreprocessorParser.REGION]:
730 localctx = CSharpPreprocessorParser.PreprocessorRegionContext(
731 self, localctx)
732 self.enterOuterAlt(localctx, 10)
733 self.state = 56
734 self.match(CSharpPreprocessorParser.REGION)
735 self.state = 58
736 self._errHandler.sync(self)
737 _la = self._input.LA(1)
738 if _la == CSharpPreprocessorParser.TEXT:
739 self.state = 57
740 self.match(CSharpPreprocessorParser.TEXT)
742 self.state = 60
743 self.directive_new_line_or_sharp()
744 localctx.value = allConditions()
745 pass
746 elif token in [CSharpPreprocessorParser.ENDREGION]:
747 localctx = CSharpPreprocessorParser.PreprocessorRegionContext(
748 self, localctx)
749 self.enterOuterAlt(localctx, 11)
750 self.state = 63
751 self.match(CSharpPreprocessorParser.ENDREGION)
752 self.state = 65
753 self._errHandler.sync(self)
754 _la = self._input.LA(1)
755 if _la == CSharpPreprocessorParser.TEXT:
756 self.state = 64
757 self.match(CSharpPreprocessorParser.TEXT)
759 self.state = 67
760 self.directive_new_line_or_sharp()
761 localctx.value = allConditions()
762 pass
763 elif token in [CSharpPreprocessorParser.PRAGMA]:
764 localctx = CSharpPreprocessorParser.PreprocessorPragmaContext(
765 self, localctx)
766 self.enterOuterAlt(localctx, 12)
767 self.state = 70
768 self.match(CSharpPreprocessorParser.PRAGMA)
769 self.state = 71
770 self.match(CSharpPreprocessorParser.TEXT)
771 self.state = 72
772 self.directive_new_line_or_sharp()
773 localctx.value = allConditions()
774 pass
775 else:
776 raise NoViableAltException(self)
778 except RecognitionException as re:
779 localctx.exception = re
780 self._errHandler.reportError(self, re)
781 self._errHandler.recover(self, re)
782 finally:
783 self.exitRule()
784 return localctx
786 class Directive_new_line_or_sharpContext(ParserRuleContext):
787 __slots__ = 'parser'
789 def __init__(self, parser, parent: ParserRuleContext = None, invokingState: int = -1):
790 super().__init__(parent, invokingState)
791 self.parser = parser
793 def DIRECTIVE_NEW_LINE(self):
794 return self.getToken(CSharpPreprocessorParser.DIRECTIVE_NEW_LINE, 0)
796 def EOF(self):
797 return self.getToken(CSharpPreprocessorParser.EOF, 0)
799 def getRuleIndex(self):
800 return CSharpPreprocessorParser.RULE_directive_new_line_or_sharp
802 def enterRule(self, listener: ParseTreeListener):
803 if hasattr(listener, "enterDirective_new_line_or_sharp"):
804 listener.enterDirective_new_line_or_sharp(self)
806 def exitRule(self, listener: ParseTreeListener):
807 if hasattr(listener, "exitDirective_new_line_or_sharp"):
808 listener.exitDirective_new_line_or_sharp(self)
810 def directive_new_line_or_sharp(self):
812 localctx = CSharpPreprocessorParser.Directive_new_line_or_sharpContext(
813 self, self._ctx, self.state)
814 self.enterRule(localctx, 2, self.RULE_directive_new_line_or_sharp)
815 self._la = 0 # Token type
816 try:
817 self.enterOuterAlt(localctx, 1)
818 self.state = 77
819 _la = self._input.LA(1)
820 if not (_la == CSharpPreprocessorParser.EOF or _la == CSharpPreprocessorParser.DIRECTIVE_NEW_LINE):
821 self._errHandler.recoverInline(self)
822 else:
823 self._errHandler.reportMatch(self)
824 self.consume()
825 except RecognitionException as re:
826 localctx.exception = re
827 self._errHandler.reportError(self, re)
828 self._errHandler.recover(self, re)
829 finally:
830 self.exitRule()
831 return localctx
833 class Preprocessor_expressionContext(ParserRuleContext):
834 __slots__ = 'parser'
836 def __init__(self, parser, parent: ParserRuleContext = None, invokingState: int = -1):
837 super().__init__(parent, invokingState)
838 self.parser = parser
839 self.value = None
840 self.expr1 = None # Preprocessor_expressionContext
841 self._CONDITIONAL_SYMBOL = None # Token
842 self.expr = None # Preprocessor_expressionContext
843 self.expr2 = None # Preprocessor_expressionContext
845 def TRUE(self):
846 return self.getToken(CSharpPreprocessorParser.TRUE, 0)
848 def FALSE(self):
849 return self.getToken(CSharpPreprocessorParser.FALSE, 0)
851 def CONDITIONAL_SYMBOL(self):
852 return self.getToken(CSharpPreprocessorParser.CONDITIONAL_SYMBOL, 0)
854 def OPEN_PARENS(self):
855 return self.getToken(CSharpPreprocessorParser.OPEN_PARENS, 0)
857 def CLOSE_PARENS(self):
858 return self.getToken(CSharpPreprocessorParser.CLOSE_PARENS, 0)
860 def preprocessor_expression(self, i: int = None):
861 if i is None:
862 return self.getTypedRuleContexts(CSharpPreprocessorParser.Preprocessor_expressionContext)
863 else:
864 return self.getTypedRuleContext(CSharpPreprocessorParser.Preprocessor_expressionContext, i)
866 def BANG(self):
867 return self.getToken(CSharpPreprocessorParser.BANG, 0)
869 def OP_EQ(self):
870 return self.getToken(CSharpPreprocessorParser.OP_EQ, 0)
872 def OP_NE(self):
873 return self.getToken(CSharpPreprocessorParser.OP_NE, 0)
875 def OP_AND(self):
876 return self.getToken(CSharpPreprocessorParser.OP_AND, 0)
878 def OP_OR(self):
879 return self.getToken(CSharpPreprocessorParser.OP_OR, 0)
881 def getRuleIndex(self):
882 return CSharpPreprocessorParser.RULE_preprocessor_expression
884 def enterRule(self, listener: ParseTreeListener):
885 if hasattr(listener, "enterPreprocessor_expression"):
886 listener.enterPreprocessor_expression(self)
888 def exitRule(self, listener: ParseTreeListener):
889 if hasattr(listener, "exitPreprocessor_expression"):
890 listener.exitPreprocessor_expression(self)
892 def preprocessor_expression(self, _p: int = 0):
893 _parentctx = self._ctx
894 _parentState = self.state
895 localctx = CSharpPreprocessorParser.Preprocessor_expressionContext(
896 self, self._ctx, _parentState)
897 _prevctx = localctx
898 _startState = 4
899 self.enterRecursionRule(
900 localctx, 4, self.RULE_preprocessor_expression, _p)
901 try:
902 self.enterOuterAlt(localctx, 1)
903 self.state = 95
904 self._errHandler.sync(self)
905 token = self._input.LA(1)
906 if token in [CSharpPreprocessorParser.TRUE]:
907 self.state = 80
908 self.match(CSharpPreprocessorParser.TRUE)
909 localctx.value = "true"
910 pass
911 elif token in [CSharpPreprocessorParser.FALSE]:
912 self.state = 82
913 self.match(CSharpPreprocessorParser.FALSE)
914 localctx.value = "False"
915 pass
916 elif token in [CSharpPreprocessorParser.CONDITIONAL_SYMBOL]:
917 self.state = 84
918 localctx._CONDITIONAL_SYMBOL = self.match(
919 CSharpPreprocessorParser.CONDITIONAL_SYMBOL)
920 localctx.value = ConditionalSymbols.contains(
921 None if localctx._CONDITIONAL_SYMBOL is None else localctx._CONDITIONAL_SYMBOL.text)
922 pass
923 elif token in [CSharpPreprocessorParser.OPEN_PARENS]:
924 self.state = 86
925 self.match(CSharpPreprocessorParser.OPEN_PARENS)
926 self.state = 87
927 localctx.expr = self.preprocessor_expression(0)
928 self.state = 88
929 self.match(CSharpPreprocessorParser.CLOSE_PARENS)
930 localctx.value = localctx.expr.value
931 pass
932 elif token in [CSharpPreprocessorParser.BANG]:
933 self.state = 91
934 self.match(CSharpPreprocessorParser.BANG)
935 self.state = 92
936 localctx.expr = self.preprocessor_expression(5)
937 localctx.value = localctx.expr.value.equals("true")
938 pass
939 else:
940 raise NoViableAltException(self)
942 self._ctx.stop = self._input.LT(-1)
943 self.state = 119
944 self._errHandler.sync(self)
945 _alt = self._interp.adaptivePredict(self._input, 7, self._ctx)
946 while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER:
947 if _alt == 1:
948 if self._parseListeners is not None:
949 self.triggerExitRuleEvent()
950 _prevctx = localctx
951 self.state = 117
952 self._errHandler.sync(self)
953 la_ = self._interp.adaptivePredict(
954 self._input, 6, self._ctx)
955 if la_ == 1:
956 localctx = CSharpPreprocessorParser.Preprocessor_expressionContext(
957 self, _parentctx, _parentState)
958 localctx.expr1 = _prevctx
959 self.pushNewRecursionContext(
960 localctx, _startState, self.RULE_preprocessor_expression)
961 self.state = 97
962 if not self.precpred(self._ctx, 4):
963 from antlr4.error.Errors import FailedPredicateException
964 raise FailedPredicateException(
965 self, "self.precpred(self._ctx, 4)")
966 self.state = 98
967 self.match(CSharpPreprocessorParser.OP_EQ)
968 self.state = 99
969 localctx.expr2 = self.preprocessor_expression(5)
970 localctx.value = localctx.expr1.value == localctx.expr2.value
971 pass
973 elif la_ == 2:
974 localctx = CSharpPreprocessorParser.Preprocessor_expressionContext(
975 self, _parentctx, _parentState)
976 localctx.expr1 = _prevctx
977 self.pushNewRecursionContext(
978 localctx, _startState, self.RULE_preprocessor_expression)
979 self.state = 102
980 if not self.precpred(self._ctx, 3):
981 from antlr4.error.Errors import FailedPredicateException
982 raise FailedPredicateException(
983 self, "self.precpred(self._ctx, 3)")
984 self.state = 103
985 self.match(CSharpPreprocessorParser.OP_NE)
986 self.state = 104
987 localctx.expr2 = self.preprocessor_expression(4)
988 localctx.value = localctx.expr1.value != localctx.expr2.value
989 pass
991 elif la_ == 3:
992 localctx = CSharpPreprocessorParser.Preprocessor_expressionContext(
993 self, _parentctx, _parentState)
994 localctx.expr1 = _prevctx
995 self.pushNewRecursionContext(
996 localctx, _startState, self.RULE_preprocessor_expression)
997 self.state = 107
998 if not self.precpred(self._ctx, 2):
999 from antlr4.error.Errors import FailedPredicateException
1000 raise FailedPredicateException(
1001 self, "self.precpred(self._ctx, 2)")
1002 self.state = 108
1003 self.match(CSharpPreprocessorParser.OP_AND)
1004 self.state = 109
1005 localctx.expr2 = self.preprocessor_expression(3)
1006 localctx.value = localctx.expr1.value.equals(
1007 "true") and localctx.expr2.value.equals("true")
1008 pass
1010 elif la_ == 4:
1011 localctx = CSharpPreprocessorParser.Preprocessor_expressionContext(
1012 self, _parentctx, _parentState)
1013 localctx.expr1 = _prevctx
1014 self.pushNewRecursionContext(
1015 localctx, _startState, self.RULE_preprocessor_expression)
1016 self.state = 112
1017 if not self.precpred(self._ctx, 1):
1018 from antlr4.error.Errors import FailedPredicateException
1019 raise FailedPredicateException(
1020 self, "self.precpred(self._ctx, 1)")
1021 self.state = 113
1022 self.match(CSharpPreprocessorParser.OP_OR)
1023 self.state = 114
1024 localctx.expr2 = self.preprocessor_expression(2)
1025 localctx.value = localctx.expr1.value.equals(
1026 "true") or localctx.expr2.value.equals("true")
1027 pass
1029 self.state = 121
1030 self._errHandler.sync(self)
1031 _alt = self._interp.adaptivePredict(self._input, 7, self._ctx)
1033 except RecognitionException as re:
1034 localctx.exception = re
1035 self._errHandler.reportError(self, re)
1036 self._errHandler.recover(self, re)
1037 finally:
1038 self.unrollRecursionContexts(_parentctx)
1039 return localctx
1041 def sempred(self, localctx: RuleContext, ruleIndex: int, predIndex: int):
1042 if self._predicates == None:
1043 self._predicates = dict()
1044 self._predicates[2] = self.preprocessor_expression_sempred
1045 pred = self._predicates.get(ruleIndex, None)
1046 if pred is None:
1047 raise Exception("No predicate with index:" + str(ruleIndex))
1048 else:
1049 return pred(localctx, predIndex)
1051 def preprocessor_expression_sempred(self, localctx: Preprocessor_expressionContext, predIndex: int):
1052 if predIndex == 0:
1053 return self.precpred(self._ctx, 4)
1055 if predIndex == 1:
1056 return self.precpred(self._ctx, 3)
1058 if predIndex == 2:
1059 return self.precpred(self._ctx, 2)
1061 if predIndex == 3:
1062 return self.precpred(self._ctx, 1)