1/** \file 2 * This OBJC source file was generated by $ANTLR version 3.4 3 * 4 * - From the grammar source file : /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/hoistedPredicates/T.g 5 * - On : 2012-02-16 17:34:26 6 * - for the lexer : TLexerLexer 7 * 8 * Editing it, at least manually, is not wise. 9 * 10 * ObjC language generator and runtime by Alan Condit, acondit|hereisanat|ipns|dotgoeshere|com. 11 * 12 * 13*/ 14// $ANTLR 3.4 /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/hoistedPredicates/T.g 2012-02-16 17:34:26 15 16 17/* ----------------------------------------- 18 * Include the ANTLR3 generated header file. 19 */ 20#import "TLexer.h" 21/* ----------------------------------------- */ 22 23 24/* ============================================================================= */ 25/* ============================================================================= 26 * Start of recognizer 27 */ 28 29/** As per Terence: No returns for lexer rules! */ 30@implementation TLexer // line 330 31 32+ (void) initialize 33{ 34 [BaseRecognizer setGrammarFileName:@"/Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/hoistedPredicates/T.g"]; 35} 36 37+ (NSString *) tokenNameForType:(NSInteger)aTokenType 38{ 39 return [[self getTokenNames] objectAtIndex:aTokenType]; 40} 41 42+ (TLexer *)newTLexerWithCharStream:(id<CharStream>)anInput 43{ 44 return [[TLexer alloc] initWithCharStream:anInput]; 45} 46 47- (id) initWithCharStream:(id<CharStream>)anInput 48{ 49 self = [super initWithCharStream:anInput State:[RecognizerSharedState newRecognizerSharedStateWithRuleLen:5+1]]; 50 if ( self != nil ) { 51 } 52 return self; 53} 54 55- (void) dealloc 56{ 57 [super dealloc]; 58} 59 60/* ObjC Start of actions.lexer.methods */ 61/* ObjC end of actions.lexer.methods */ 62/* ObjC start methods() */ 63/* ObjC end methods() */ 64 65/* Start of Rules */ 66// $ANTLR start "T__7" 67- (void) mT__7 68{ 69 // 70 /* ruleScopeSetUp */ 71 72 /* ruleDeclarations */ 73 74 @try { 75 NSInteger _type = T__7; 76 NSInteger _channel = TokenChannelDefault; 77 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/hoistedPredicates/T.g:7:6: ( 'enum' ) // ruleBlockSingleAlt 78 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/hoistedPredicates/T.g:7:8: 'enum' // alt 79 { 80 81 82 [self matchString:@"enum"]; 83 84 85 86 } 87 88 /* token+rule list labels */ 89 90 state.type = _type; 91 state.channel = _channel; 92 } 93 @finally { 94 // 95 /* ruleScopeCleanUp */ 96 97 } 98 return; 99} 100/* $ANTLR end "T__7" */ 101// $ANTLR start "ID" 102- (void) mID 103{ 104 // 105 /* ruleScopeSetUp */ 106 107 /* ruleDeclarations */ 108 109 @try { 110 NSInteger _type = ID; 111 NSInteger _channel = TokenChannelDefault; 112 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/hoistedPredicates/T.g:37:5: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )* ) // ruleBlockSingleAlt 113 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/hoistedPredicates/T.g:37:9: ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )* // alt 114 { 115 116 if ((([input LA:1] >= 'A') && ([input LA:1] <= 'Z'))||[input LA:1] == '_'||(([input LA:1] >= 'a') && ([input LA:1] <= 'z'))) { 117 [input consume]; 118 } else { 119 MismatchedSetException *mse = [MismatchedSetException newException:nil stream:input]; 120 [self recover:mse]; 121 @throw mse; 122 } 123 124 125 126 do { 127 NSInteger alt1=2; 128 NSInteger LA1_0 = [input LA:1]; 129 if ( ((LA1_0 >= '0' && LA1_0 <= '9')||(LA1_0 >= 'A' && LA1_0 <= 'Z')||LA1_0=='_'||(LA1_0 >= 'a' && LA1_0 <= 'z')) ) { 130 alt1=1; 131 } 132 133 134 switch (alt1) { 135 case 1 : ; 136 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/hoistedPredicates/T.g: // alt 137 { 138 139 if ((([input LA:1] >= '0') && ([input LA:1] <= '9'))||(([input LA:1] >= 'A') && ([input LA:1] <= 'Z'))||[input LA:1] == '_'||(([input LA:1] >= 'a') && ([input LA:1] <= 'z'))) { 140 [input consume]; 141 } else { 142 MismatchedSetException *mse = [MismatchedSetException newException:nil stream:input]; 143 [self recover:mse]; 144 @throw mse; 145 } 146 147 148 } 149 break; 150 151 default : 152 goto loop1; 153 } 154 } while (YES); 155 loop1: ; 156 157 158 } 159 160 /* token+rule list labels */ 161 162 state.type = _type; 163 state.channel = _channel; 164 } 165 @finally { 166 // 167 /* ruleScopeCleanUp */ 168 169 } 170 return; 171} 172/* $ANTLR end "ID" */ 173// $ANTLR start "INT" 174- (void) mINT 175{ 176 // 177 /* ruleScopeSetUp */ 178 179 /* ruleDeclarations */ 180 181 @try { 182 NSInteger _type = INT; 183 NSInteger _channel = TokenChannelDefault; 184 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/hoistedPredicates/T.g:40:5: ( ( '0' .. '9' )+ ) // ruleBlockSingleAlt 185 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/hoistedPredicates/T.g:40:7: ( '0' .. '9' )+ // alt 186 { 187 188 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/hoistedPredicates/T.g:40:7: ( '0' .. '9' )+ // positiveClosureBlock 189 NSInteger cnt2 = 0; 190 do { 191 NSInteger alt2 = 2; 192 NSInteger LA2_0 = [input LA:1]; 193 if ( ((LA2_0 >= '0' && LA2_0 <= '9')) ) { 194 alt2=1; 195 } 196 197 198 switch (alt2) { 199 case 1 : ; 200 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/hoistedPredicates/T.g: // alt 201 { 202 203 if ((([input LA:1] >= '0') && ([input LA:1] <= '9'))) { 204 [input consume]; 205 } else { 206 MismatchedSetException *mse = [MismatchedSetException newException:nil stream:input]; 207 [self recover:mse]; 208 @throw mse; 209 } 210 211 212 } 213 break; 214 215 default : 216 if ( cnt2 >= 1 ) 217 goto loop2; 218 EarlyExitException *eee = 219 [EarlyExitException newException:input decisionNumber:2]; 220 @throw eee; 221 } 222 cnt2++; 223 } while (YES); 224 loop2: ; 225 226 227 } 228 229 /* token+rule list labels */ 230 231 state.type = _type; 232 state.channel = _channel; 233 } 234 @finally { 235 // 236 /* ruleScopeCleanUp */ 237 238 } 239 return; 240} 241/* $ANTLR end "INT" */ 242// $ANTLR start "WS" 243- (void) mWS 244{ 245 // 246 /* ruleScopeSetUp */ 247 248 /* ruleDeclarations */ 249 250 @try { 251 NSInteger _type = WS; 252 NSInteger _channel = TokenChannelDefault; 253 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/hoistedPredicates/T.g:43:5: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ ) // ruleBlockSingleAlt 254 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/hoistedPredicates/T.g:43:9: ( ' ' | '\\t' | '\\r' | '\\n' )+ // alt 255 { 256 257 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/hoistedPredicates/T.g:43:9: ( ' ' | '\\t' | '\\r' | '\\n' )+ // positiveClosureBlock 258 NSInteger cnt3 = 0; 259 do { 260 NSInteger alt3 = 2; 261 NSInteger LA3_0 = [input LA:1]; 262 if ( ((LA3_0 >= '\t' && LA3_0 <= '\n')||LA3_0=='\r'||LA3_0==' ') ) { 263 alt3=1; 264 } 265 266 267 switch (alt3) { 268 case 1 : ; 269 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/hoistedPredicates/T.g: // alt 270 { 271 272 if ((([input LA:1] >= '\t') && ([input LA:1] <= '\n'))||[input LA:1] == '\r'||[input LA:1] == ' ') { 273 [input consume]; 274 } else { 275 MismatchedSetException *mse = [MismatchedSetException newException:nil stream:input]; 276 [self recover:mse]; 277 @throw mse; 278 } 279 280 281 } 282 break; 283 284 default : 285 if ( cnt3 >= 1 ) 286 goto loop3; 287 EarlyExitException *eee = 288 [EarlyExitException newException:input decisionNumber:3]; 289 @throw eee; 290 } 291 cnt3++; 292 } while (YES); 293 loop3: ; 294 295 296 297 _channel=99; 298 299 300 } 301 302 /* token+rule list labels */ 303 304 state.type = _type; 305 state.channel = _channel; 306 } 307 @finally { 308 // 309 /* ruleScopeCleanUp */ 310 311 } 312 return; 313} 314/* $ANTLR end "WS" */ 315- (void) mTokens 316{ 317 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/hoistedPredicates/T.g:1:8: ( T__7 | ID | INT | WS ) //ruleblock 318 NSInteger alt4=4; 319 unichar charLA4 = [input LA:1]; 320 switch (charLA4) { 321 case 'e': ; 322 { 323 NSInteger LA4_1 = [input LA:2]; 324 325 if ( (LA4_1=='n') ) { 326 NSInteger LA4_5 = [input LA:3]; 327 328 if ( (LA4_5=='u') ) { 329 NSInteger LA4_6 = [input LA:4]; 330 331 if ( (LA4_6=='m') ) { 332 NSInteger LA4_7 = [input LA:5]; 333 334 if ( ((LA4_7 >= '0' && LA4_7 <= '9')||(LA4_7 >= 'A' && LA4_7 <= 'Z')||LA4_7=='_'||(LA4_7 >= 'a' && LA4_7 <= 'z')) ) { 335 alt4=2; 336 } 337 else { 338 alt4 = 1; 339 } 340 } 341 else { 342 alt4 = 2; 343 } 344 } 345 else { 346 alt4 = 2; 347 } 348 } 349 else { 350 alt4 = 2; 351 } 352 } 353 break; 354 case 'A': ; 355 case 'B': ; 356 case 'C': ; 357 case 'D': ; 358 case 'E': ; 359 case 'F': ; 360 case 'G': ; 361 case 'H': ; 362 case 'I': ; 363 case 'J': ; 364 case 'K': ; 365 case 'L': ; 366 case 'M': ; 367 case 'N': ; 368 case 'O': ; 369 case 'P': ; 370 case 'Q': ; 371 case 'R': ; 372 case 'S': ; 373 case 'T': ; 374 case 'U': ; 375 case 'V': ; 376 case 'W': ; 377 case 'X': ; 378 case 'Y': ; 379 case 'Z': ; 380 case '_': ; 381 case 'a': ; 382 case 'b': ; 383 case 'c': ; 384 case 'd': ; 385 case 'f': ; 386 case 'g': ; 387 case 'h': ; 388 case 'i': ; 389 case 'j': ; 390 case 'k': ; 391 case 'l': ; 392 case 'm': ; 393 case 'n': ; 394 case 'o': ; 395 case 'p': ; 396 case 'q': ; 397 case 'r': ; 398 case 's': ; 399 case 't': ; 400 case 'u': ; 401 case 'v': ; 402 case 'w': ; 403 case 'x': ; 404 case 'y': ; 405 case 'z': ; 406 { 407 alt4=2; 408 } 409 break; 410 case '0': ; 411 case '1': ; 412 case '2': ; 413 case '3': ; 414 case '4': ; 415 case '5': ; 416 case '6': ; 417 case '7': ; 418 case '8': ; 419 case '9': ; 420 { 421 alt4=3; 422 } 423 break; 424 case '\t': ; 425 case '\n': ; 426 case '\r': ; 427 case ' ': ; 428 { 429 alt4=4; 430 } 431 break; 432 433 default: ; 434 NoViableAltException *nvae = [NoViableAltException newException:4 state:0 stream:input]; 435 nvae.c = charLA4; 436 @throw nvae; 437 438 } 439 440 switch (alt4) { 441 case 1 : ; 442 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/hoistedPredicates/T.g:1:10: T__7 // alt 443 { 444 445 446 [self mT__7]; 447 448 449 450 } 451 break; 452 case 2 : ; 453 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/hoistedPredicates/T.g:1:15: ID // alt 454 { 455 456 457 [self mID]; 458 459 460 461 } 462 break; 463 case 3 : ; 464 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/hoistedPredicates/T.g:1:18: INT // alt 465 { 466 467 468 [self mINT]; 469 470 471 472 } 473 break; 474 case 4 : ; 475 // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/hoistedPredicates/T.g:1:22: WS // alt 476 { 477 478 479 [self mWS]; 480 481 482 483 } 484 break; 485 486 } 487 488} 489 490@end /* end of TLexer implementation line 397 */