1 /** \file 2 * This OBJC source file was generated by $ANTLR version 3.2 Aug 23, 2010 07:48:06 3 * 4 * - From the grammar source file : /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g 5 * - On : 2010-08-23 07:54:47 6 * - for the lexer : SimpleCLexerLexer * 7 * Editing it, at least manually, is not wise. 8 * 9 * ObjC language generator and runtime by Alan Condit, acondit|hereisanat|ipns|dotgoeshere|com. 10 * 11 * 12 */ 13 // [The "BSD licence"] 14 // Copyright (c) 2010 Alan Condit 15 // 16 // All rights reserved. 17 // 18 // Redistribution and use in source and binary forms, with or without 19 // modification, are permitted provided that the following conditions 20 // are met: 21 // 1. Redistributions of source code must retain the above copyright 22 // notice, this list of conditions and the following disclaimer. 23 // 2. Redistributions in binary form must reproduce the above copyright 24 // notice, this list of conditions and the following disclaimer in the 25 // documentation and/or other materials provided with the distribution. 26 // 3. The name of the author may not be used to endorse or promote products 27 // derived from this software without specific prior written permission. 28 // 29 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 30 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 31 // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 32 // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 33 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 34 // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 38 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 40 // $ANTLR 3.2 Aug 23, 2010 07:48:06 /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g 2010-08-23 07:54:47 41 42 /* ----------------------------------------- 43 * Include the ANTLR3 generated header file. 44 */ 45 #import "SimpleCLexer.h" 46 /* ----------------------------------------- */ 47 48 49 /* ============================================================================= */ 50 51 /* ============================================================================= 52 * Start of recognizer 53 */ 54 55 #pragma mark Cyclic DFA implementation start DFA4 56 @implementation DFA4 57 const static NSInteger dfa4_eot[33] = 58 {-1,-1,-1,-1,-1,-1,-1,11,11,11,11,-1,-1,22,-1,-1,-1,11,11,11,11,-1,-1, 59 27,28,11,11,-1,-1,31,32,-1,-1}; 60 const static NSInteger dfa4_eof[33] = 61 {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 62 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; 63 const static unichar dfa4_min[33] = 64 {9,0,0,0,0,0,0,111,110,104,111,0,0,61,0,0,0,114,116,97,105,0,0,48,48, 65 114,100,0,0,48,48,0,0}; 66 const static unichar dfa4_max[33] = 67 {125,0,0,0,0,0,0,111,110,104,111,0,0,61,0,0,0,114,116,97,105,0,0,122, 68 122,114,100,0,0,122,122,0,0}; 69 const static NSInteger dfa4_accept[33] = 70 {-1,1,2,3,4,5,6,-1,-1,-1,-1,11,12,-1,15,16,17,-1,-1,-1,-1,14,13,-1,-1, 71 -1,-1,7,8,-1,-1,9,10}; 72 const static NSInteger dfa4_special[33] = 73 {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 74 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; 75 const static NSInteger dfa4_transition[] = {}; 76 const static NSInteger dfa4_transition0[] = {24}; 77 const static NSInteger dfa4_transition1[] = {26}; 78 const static NSInteger dfa4_transition2[] = {29}; 79 const static NSInteger dfa4_transition3[] = {20}; 80 const static NSInteger dfa4_transition4[] = {25}; 81 const static NSInteger dfa4_transition5[] = {16, 16, -1, -1, 16, -1, -1, 82 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 16, -1, 83 -1, -1, -1, -1, -1, -1, 2, 4, -1, 15, 3, -1, -1, -1, 12, 12, 12, 12, 12, 84 12, 12, 12, 12, 12, -1, 1, 14, 13, -1, -1, -1, 11, 11, 11, 11, 11, 11, 85 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 86 11, 11, -1, -1, -1, -1, 11, -1, 11, 11, 9, 11, 11, 7, 11, 11, 8, 11, 11, 87 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 11, 11, 11, 11, 5, -1, 6}; 88 const static NSInteger dfa4_transition6[] = {21}; 89 const static NSInteger dfa4_transition7[] = {11, 11, 11, 11, 11, 11, 11, 90 11, 11, 11, -1, -1, -1, -1, -1, -1, -1, 11, 11, 11, 11, 11, 11, 11, 11, 91 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 92 -1, -1, -1, -1, 11, -1, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 93 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11}; 94 const static NSInteger dfa4_transition8[] = {18}; 95 const static NSInteger dfa4_transition9[] = {19}; 96 const static NSInteger dfa4_transition10[] = {23}; 97 const static NSInteger dfa4_transition11[] = {17}; 98 const static NSInteger dfa4_transition12[] = {30}; 99 100 101 + () newDFA4WithRecognizer:(ANTLRBaseRecognizer *)aRecognizer 102 { 103 return [[[DFA4 alloc] initWithRecognizer:aRecognizer] retain]; 104 } 105 106 - (id) initWithRecognizer:(ANTLRBaseRecognizer *) theRecognizer 107 { 108 if ((self = [super initWithRecognizer:theRecognizer]) != nil) { 109 decisionNumber = 4; 110 eot = dfa4_eot; 111 eof = dfa4_eof; 112 min = dfa4_min; 113 max = dfa4_max; 114 accept = dfa4_accept; 115 special = dfa4_special; 116 if (!(transition = calloc(33, sizeof(void*)))) { 117 [self release]; 118 return nil; 119 } 120 len = 33; 121 transition[0] = dfa4_transition5; 122 transition[1] = dfa4_transition; 123 transition[2] = dfa4_transition; 124 transition[3] = dfa4_transition; 125 transition[4] = dfa4_transition; 126 transition[5] = dfa4_transition; 127 transition[6] = dfa4_transition; 128 transition[7] = dfa4_transition11; 129 transition[8] = dfa4_transition8; 130 transition[9] = dfa4_transition9; 131 transition[10] = dfa4_transition3; 132 transition[11] = dfa4_transition; 133 transition[12] = dfa4_transition; 134 transition[13] = dfa4_transition6; 135 transition[14] = dfa4_transition; 136 transition[15] = dfa4_transition; 137 transition[16] = dfa4_transition; 138 transition[17] = dfa4_transition10; 139 transition[18] = dfa4_transition0; 140 transition[19] = dfa4_transition4; 141 transition[20] = dfa4_transition1; 142 transition[21] = dfa4_transition; 143 transition[22] = dfa4_transition; 144 transition[23] = dfa4_transition7; 145 transition[24] = dfa4_transition7; 146 transition[25] = dfa4_transition2; 147 transition[26] = dfa4_transition12; 148 transition[27] = dfa4_transition; 149 transition[28] = dfa4_transition; 150 transition[29] = dfa4_transition7; 151 transition[30] = dfa4_transition7; 152 transition[31] = dfa4_transition; 153 transition[32] = dfa4_transition; 154 } 155 return self; 156 } 157 158 - (void) dealloc 159 { 160 free(transition); 161 [super dealloc]; 162 } 163 164 - (NSString *) description 165 { 166 return @"1:1: Tokens : ( T__21 | T__22 | T__23 | T__24 | T__25 | T__26 | K_FOR | K_INT_TYPE | K_CHAR | K_VOID | K_ID | K_INT | K_EQ | K_EQEQ | K_LT | K_PLUS | WS );"; 167 } 168 169 170 @end /* end DFA4 implementation */ 171 172 #pragma mark Cyclic DFA implementation end DFA4 173 174 175 176 /** As per Terence: No returns for lexer rules! 177 #pragma mark Rule return scopes start 178 #pragma mark Rule return scopes end 179 */ 180 @implementation SimpleCLexer // line 330 181 182 + (void) initialize 183 { 184 [ANTLRBaseRecognizer setGrammarFileName:@"/usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g"]; 185 } 186 187 + (NSString *) tokenNameForType:(NSInteger)aTokenType 188 { 189 return [[self getTokenNames] objectAtIndex:aTokenType]; 190 } 191 192 + (SimpleCLexer *)newSimpleCLexer:(id<ANTLRCharStream>)anInput 193 { 194 return [[SimpleCLexer alloc] initWithCharStream:anInput]; 195 } 196 197 - (id) initWithCharStream:(id<ANTLRCharStream>)anInput 198 { 199 if ((self = [super initWithCharStream:anInput State:[ANTLRRecognizerSharedState newANTLRRecognizerSharedStateWithRuleLen:18+1]]) != nil) { 200 201 dfa4 = [DFA4 newDFA4WithRecognizer:self]; 202 } 203 return self; 204 } 205 206 - (void) dealloc 207 { 208 [dfa4 release]; 209 [super dealloc]; 210 } 211 212 /* Start of actions.lexer.methods */ 213 /* start methods() */ 214 215 /* Start of Rules */ 216 // $ANTLR start "T__21" 217 - (void) mT__21 218 { 219 // 220 /* ruleScopeSetUp */ 221 222 @try { 223 NSInteger _type = T__21; 224 NSInteger _channel = ANTLRTokenChannelDefault; 225 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:7:7: ( ';' ) // ruleBlockSingleAlt 226 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:7:9: ';' // alt 227 { 228 [self matchChar:';']; 229 /* element() */ 230 /* elements */ 231 } 232 233 // token+rule list labels 234 235 [state setType:_type]; 236 237 state.channel = _channel; 238 } 239 @finally { 240 // 241 } 242 return; 243 } 244 // $ANTLR end "T__21" 245 246 // $ANTLR start "T__22" 247 - (void) mT__22 248 { 249 // 250 /* ruleScopeSetUp */ 251 252 @try { 253 NSInteger _type = T__22; 254 NSInteger _channel = ANTLRTokenChannelDefault; 255 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:8:7: ( '(' ) // ruleBlockSingleAlt 256 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:8:9: '(' // alt 257 { 258 [self matchChar:'(']; 259 /* element() */ 260 /* elements */ 261 } 262 263 // token+rule list labels 264 265 [state setType:_type]; 266 267 state.channel = _channel; 268 } 269 @finally { 270 // 271 } 272 return; 273 } 274 // $ANTLR end "T__22" 275 276 // $ANTLR start "T__23" 277 - (void) mT__23 278 { 279 // 280 /* ruleScopeSetUp */ 281 282 @try { 283 NSInteger _type = T__23; 284 NSInteger _channel = ANTLRTokenChannelDefault; 285 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:9:7: ( ',' ) // ruleBlockSingleAlt 286 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:9:9: ',' // alt 287 { 288 [self matchChar:',']; 289 /* element() */ 290 /* elements */ 291 } 292 293 // token+rule list labels 294 295 [state setType:_type]; 296 297 state.channel = _channel; 298 } 299 @finally { 300 // 301 } 302 return; 303 } 304 // $ANTLR end "T__23" 305 306 // $ANTLR start "T__24" 307 - (void) mT__24 308 { 309 // 310 /* ruleScopeSetUp */ 311 312 @try { 313 NSInteger _type = T__24; 314 NSInteger _channel = ANTLRTokenChannelDefault; 315 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:10:7: ( ')' ) // ruleBlockSingleAlt 316 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:10:9: ')' // alt 317 { 318 [self matchChar:')']; 319 /* element() */ 320 /* elements */ 321 } 322 323 // token+rule list labels 324 325 [state setType:_type]; 326 327 state.channel = _channel; 328 } 329 @finally { 330 // 331 } 332 return; 333 } 334 // $ANTLR end "T__24" 335 336 // $ANTLR start "T__25" 337 - (void) mT__25 338 { 339 // 340 /* ruleScopeSetUp */ 341 342 @try { 343 NSInteger _type = T__25; 344 NSInteger _channel = ANTLRTokenChannelDefault; 345 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:11:7: ( '{' ) // ruleBlockSingleAlt 346 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:11:9: '{' // alt 347 { 348 [self matchChar:'{']; 349 /* element() */ 350 /* elements */ 351 } 352 353 // token+rule list labels 354 355 [state setType:_type]; 356 357 state.channel = _channel; 358 } 359 @finally { 360 // 361 } 362 return; 363 } 364 // $ANTLR end "T__25" 365 366 // $ANTLR start "T__26" 367 - (void) mT__26 368 { 369 // 370 /* ruleScopeSetUp */ 371 372 @try { 373 NSInteger _type = T__26; 374 NSInteger _channel = ANTLRTokenChannelDefault; 375 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:12:7: ( '}' ) // ruleBlockSingleAlt 376 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:12:9: '}' // alt 377 { 378 [self matchChar:'}']; 379 /* element() */ 380 /* elements */ 381 } 382 383 // token+rule list labels 384 385 [state setType:_type]; 386 387 state.channel = _channel; 388 } 389 @finally { 390 // 391 } 392 return; 393 } 394 // $ANTLR end "T__26" 395 396 // $ANTLR start "K_FOR" 397 - (void) mK_FOR 398 { 399 // 400 /* ruleScopeSetUp */ 401 402 @try { 403 NSInteger _type = K_FOR; 404 NSInteger _channel = ANTLRTokenChannelDefault; 405 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:91:7: ( 'for' ) // ruleBlockSingleAlt 406 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:91:9: 'for' // alt 407 { 408 [self matchString:@"for"]; 409 /* element() */ 410 /* elements */ 411 } 412 413 // token+rule list labels 414 415 [state setType:_type]; 416 417 state.channel = _channel; 418 } 419 @finally { 420 // 421 } 422 return; 423 } 424 // $ANTLR end "K_FOR" 425 426 // $ANTLR start "K_INT_TYPE" 427 - (void) mK_INT_TYPE 428 { 429 // 430 /* ruleScopeSetUp */ 431 432 @try { 433 NSInteger _type = K_INT_TYPE; 434 NSInteger _channel = ANTLRTokenChannelDefault; 435 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:92:12: ( 'int' ) // ruleBlockSingleAlt 436 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:92:14: 'int' // alt 437 { 438 [self matchString:@"int"]; 439 /* element() */ 440 /* elements */ 441 } 442 443 // token+rule list labels 444 445 [state setType:_type]; 446 447 state.channel = _channel; 448 } 449 @finally { 450 // 451 } 452 return; 453 } 454 // $ANTLR end "K_INT_TYPE" 455 456 // $ANTLR start "K_CHAR" 457 - (void) mK_CHAR 458 { 459 // 460 /* ruleScopeSetUp */ 461 462 @try { 463 NSInteger _type = K_CHAR; 464 NSInteger _channel = ANTLRTokenChannelDefault; 465 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:93:7: ( 'char' ) // ruleBlockSingleAlt 466 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:93:9: 'char' // alt 467 { 468 [self matchString:@"char"]; 469 /* element() */ 470 /* elements */ 471 } 472 473 // token+rule list labels 474 475 [state setType:_type]; 476 477 state.channel = _channel; 478 } 479 @finally { 480 // 481 } 482 return; 483 } 484 // $ANTLR end "K_CHAR" 485 486 // $ANTLR start "K_VOID" 487 - (void) mK_VOID 488 { 489 // 490 /* ruleScopeSetUp */ 491 492 @try { 493 NSInteger _type = K_VOID; 494 NSInteger _channel = ANTLRTokenChannelDefault; 495 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:94:7: ( 'void' ) // ruleBlockSingleAlt 496 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:94:9: 'void' // alt 497 { 498 [self matchString:@"void"]; 499 /* element() */ 500 /* elements */ 501 } 502 503 // token+rule list labels 504 505 [state setType:_type]; 506 507 state.channel = _channel; 508 } 509 @finally { 510 // 511 } 512 return; 513 } 514 // $ANTLR end "K_VOID" 515 516 // $ANTLR start "K_ID" 517 - (void) mK_ID 518 { 519 // 520 /* ruleScopeSetUp */ 521 522 @try { 523 NSInteger _type = K_ID; 524 NSInteger _channel = ANTLRTokenChannelDefault; 525 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:96:7: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )* ) // ruleBlockSingleAlt 526 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:96:11: ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )* // alt 527 { 528 if ((([input LA:1] >= 'A') && ([input LA:1] <= 'Z'))||[input LA:1] == '_'||(([input LA:1] >= 'a') && ([input LA:1] <= 'z'))) { 529 [input consume]; 530 531 } else { 532 ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException exceptionWithSet:nil stream:input]; 533 [self recover:mse]; 534 @throw mse;} 535 /* element() */ 536 do { 537 NSInteger alt1=2; 538 NSInteger LA1_0 = [input LA:1]; 539 if ( ((LA1_0>='0' && LA1_0<='9')||(LA1_0>='A' && LA1_0<='Z')||LA1_0=='_'||(LA1_0>='a' && LA1_0<='z')) ) { 540 alt1=1; 541 } 542 543 544 switch (alt1) { 545 case 1 : ; 546 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g: // alt 547 { 548 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'))) { 549 [input consume]; 550 551 } else { 552 ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException exceptionWithSet:nil stream:input]; 553 [self recover:mse]; 554 @throw mse;} 555 /* element() */ 556 /* elements */ 557 } 558 break; 559 560 default : 561 goto loop1; 562 } 563 } while (YES); 564 loop1: ; 565 /* element() */ 566 /* elements */ 567 } 568 569 // token+rule list labels 570 571 [state setType:_type]; 572 573 state.channel = _channel; 574 } 575 @finally { 576 // 577 } 578 return; 579 } 580 // $ANTLR end "K_ID" 581 582 // $ANTLR start "K_INT" 583 - (void) mK_INT 584 { 585 // 586 /* ruleScopeSetUp */ 587 588 @try { 589 NSInteger _type = K_INT; 590 NSInteger _channel = ANTLRTokenChannelDefault; 591 id<ANTLRToken> *int=nil; 592 NSMutableArray *list_int=nil; 593 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:99:7: ( (int+= ( '0' .. '9' ) )+ ) // ruleBlockSingleAlt 594 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:99:9: (int+= ( '0' .. '9' ) )+ // alt 595 { 596 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:99:12: (int+= ( '0' .. '9' ) )+ // positiveClosureBlock 597 NSInteger cnt2=0; 598 do { 599 NSInteger alt2=2; 600 NSInteger LA2_0 = [input LA:1]; 601 if ( ((LA2_0>='0' && LA2_0<='9')) ) { 602 alt2=1; 603 } 604 605 606 switch (alt2) { 607 case 1 : ; 608 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:99:12: int+= ( '0' .. '9' ) // alt 609 { 610 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:99:14: ( '0' .. '9' ) // blockSingleAlt 611 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:99:15: '0' .. '9' // alt 612 { 613 [self matchRangeFromChar:'0' to:'9']; /* element() */ 614 /* elements */ 615 } 616 /* element() */ 617 /* elements */ 618 } 619 break; 620 621 default : 622 if ( cnt2 >= 1 ) 623 goto loop2; 624 ANTLREarlyExitException *eee = [ANTLREarlyExitException exceptionWithStream:input decisionNumber:2]; 625 @throw eee; 626 } 627 cnt2++; 628 } while (YES); 629 loop2: ; 630 /* element() */ 631 NSLog(@"%@", list_int); /* element() */ 632 /* elements */ 633 } 634 635 // token+rule list labels 636 [list_int release]; 637 638 [state setType:_type]; 639 640 state.channel = _channel; 641 } 642 @finally { 643 // 644 } 645 return; 646 } 647 // $ANTLR end "K_INT" 648 649 // $ANTLR start "K_EQ" 650 - (void) mK_EQ 651 { 652 // 653 /* ruleScopeSetUp */ 654 655 @try { 656 NSInteger _type = K_EQ; 657 NSInteger _channel = ANTLRTokenChannelDefault; 658 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:102:8: ( '=' ) // ruleBlockSingleAlt 659 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:102:10: '=' // alt 660 { 661 [self matchChar:'=']; 662 /* element() */ 663 /* elements */ 664 } 665 666 // token+rule list labels 667 668 [state setType:_type]; 669 670 state.channel = _channel; 671 } 672 @finally { 673 // 674 } 675 return; 676 } 677 // $ANTLR end "K_EQ" 678 679 // $ANTLR start "K_EQEQ" 680 - (void) mK_EQEQ 681 { 682 // 683 /* ruleScopeSetUp */ 684 685 @try { 686 NSInteger _type = K_EQEQ; 687 NSInteger _channel = ANTLRTokenChannelDefault; 688 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:103:8: ( '==' ) // ruleBlockSingleAlt 689 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:103:10: '==' // alt 690 { 691 [self matchString:@"=="]; 692 /* element() */ 693 /* elements */ 694 } 695 696 // token+rule list labels 697 698 [state setType:_type]; 699 700 state.channel = _channel; 701 } 702 @finally { 703 // 704 } 705 return; 706 } 707 // $ANTLR end "K_EQEQ" 708 709 // $ANTLR start "K_LT" 710 - (void) mK_LT 711 { 712 // 713 /* ruleScopeSetUp */ 714 715 @try { 716 NSInteger _type = K_LT; 717 NSInteger _channel = ANTLRTokenChannelDefault; 718 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:104:8: ( '<' ) // ruleBlockSingleAlt 719 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:104:10: '<' // alt 720 { 721 [self matchChar:'<']; 722 /* element() */ 723 /* elements */ 724 } 725 726 // token+rule list labels 727 728 [state setType:_type]; 729 730 state.channel = _channel; 731 } 732 @finally { 733 // 734 } 735 return; 736 } 737 // $ANTLR end "K_LT" 738 739 // $ANTLR start "K_PLUS" 740 - (void) mK_PLUS 741 { 742 // 743 /* ruleScopeSetUp */ 744 745 @try { 746 NSInteger _type = K_PLUS; 747 NSInteger _channel = ANTLRTokenChannelDefault; 748 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:105:8: ( '+' ) // ruleBlockSingleAlt 749 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:105:10: '+' // alt 750 { 751 [self matchChar:'+']; 752 /* element() */ 753 /* elements */ 754 } 755 756 // token+rule list labels 757 758 [state setType:_type]; 759 760 state.channel = _channel; 761 } 762 @finally { 763 // 764 } 765 return; 766 } 767 // $ANTLR end "K_PLUS" 768 769 // $ANTLR start "WS" 770 - (void) mWS 771 { 772 // 773 /* ruleScopeSetUp */ 774 775 @try { 776 NSInteger _type = WS; 777 NSInteger _channel = ANTLRTokenChannelDefault; 778 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:107:5: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ ) // ruleBlockSingleAlt 779 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:107:9: ( ' ' | '\\t' | '\\r' | '\\n' )+ // alt 780 { 781 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:107:9: ( ' ' | '\\t' | '\\r' | '\\n' )+ // positiveClosureBlock 782 NSInteger cnt3=0; 783 do { 784 NSInteger alt3=2; 785 NSInteger LA3_0 = [input LA:1]; 786 if ( ((LA3_0>='\t' && LA3_0<='\n')||LA3_0=='\r'||LA3_0==' ') ) { 787 alt3=1; 788 } 789 790 791 switch (alt3) { 792 case 1 : ; 793 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g: // alt 794 { 795 if ((([input LA:1] >= '\t') && ([input LA:1] <= '\n'))||[input LA:1] == '\r'||[input LA:1] == ' ') { 796 [input consume]; 797 798 } else { 799 ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException exceptionWithSet:nil stream:input]; 800 [self recover:mse]; 801 @throw mse;} 802 /* element() */ 803 /* elements */ 804 } 805 break; 806 807 default : 808 if ( cnt3 >= 1 ) 809 goto loop3; 810 ANTLREarlyExitException *eee = [ANTLREarlyExitException exceptionWithStream:input decisionNumber:3]; 811 @throw eee; 812 } 813 cnt3++; 814 } while (YES); 815 loop3: ; 816 /* element() */ 817 state.channel=99; /* element() */ 818 /* elements */ 819 } 820 821 // token+rule list labels 822 823 [state setType:_type]; 824 825 state.channel = _channel; 826 } 827 @finally { 828 // 829 } 830 return; 831 } 832 // $ANTLR end "WS" 833 834 - (void) mTokens 835 { 836 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:8: ( T__21 | T__22 | T__23 | T__24 | T__25 | T__26 | K_FOR | K_INT_TYPE | K_CHAR | K_VOID | K_ID | K_INT | K_EQ | K_EQEQ | K_LT | K_PLUS | WS ) //ruleblock 837 NSInteger alt4=17; 838 alt4 = [dfa4 predict:input]; 839 switch (alt4) { 840 case 1 : ; 841 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:10: T__21 // alt 842 { 843 [self mT__21]; 844 /* element() */ 845 /* elements */ 846 } 847 break; 848 case 2 : ; 849 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:16: T__22 // alt 850 { 851 [self mT__22]; 852 /* element() */ 853 /* elements */ 854 } 855 break; 856 case 3 : ; 857 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:22: T__23 // alt 858 { 859 [self mT__23]; 860 /* element() */ 861 /* elements */ 862 } 863 break; 864 case 4 : ; 865 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:28: T__24 // alt 866 { 867 [self mT__24]; 868 /* element() */ 869 /* elements */ 870 } 871 break; 872 case 5 : ; 873 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:34: T__25 // alt 874 { 875 [self mT__25]; 876 /* element() */ 877 /* elements */ 878 } 879 break; 880 case 6 : ; 881 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:40: T__26 // alt 882 { 883 [self mT__26]; 884 /* element() */ 885 /* elements */ 886 } 887 break; 888 case 7 : ; 889 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:46: K_FOR // alt 890 { 891 [self mK_FOR]; 892 /* element() */ 893 /* elements */ 894 } 895 break; 896 case 8 : ; 897 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:52: K_INT_TYPE // alt 898 { 899 [self mK_INT_TYPE]; 900 /* element() */ 901 /* elements */ 902 } 903 break; 904 case 9 : ; 905 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:63: K_CHAR // alt 906 { 907 [self mK_CHAR]; 908 /* element() */ 909 /* elements */ 910 } 911 break; 912 case 10 : ; 913 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:70: K_VOID // alt 914 { 915 [self mK_VOID]; 916 /* element() */ 917 /* elements */ 918 } 919 break; 920 case 11 : ; 921 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:77: K_ID // alt 922 { 923 [self mK_ID]; 924 /* element() */ 925 /* elements */ 926 } 927 break; 928 case 12 : ; 929 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:82: K_INT // alt 930 { 931 [self mK_INT]; 932 /* element() */ 933 /* elements */ 934 } 935 break; 936 case 13 : ; 937 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:88: K_EQ // alt 938 { 939 [self mK_EQ]; 940 /* element() */ 941 /* elements */ 942 } 943 break; 944 case 14 : ; 945 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:93: K_EQEQ // alt 946 { 947 [self mK_EQEQ]; 948 /* element() */ 949 /* elements */ 950 } 951 break; 952 case 15 : ; 953 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:100: K_LT // alt 954 { 955 [self mK_LT]; 956 /* element() */ 957 /* elements */ 958 } 959 break; 960 case 16 : ; 961 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:105: K_PLUS // alt 962 { 963 [self mK_PLUS]; 964 /* element() */ 965 /* elements */ 966 } 967 break; 968 case 17 : ; 969 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:112: WS // alt 970 { 971 [self mWS]; 972 /* element() */ 973 /* elements */ 974 } 975 break; 976 977 } 978 979 } 980 981 @end /* end of SimpleCLexer implementation line 397 */ 982 983 /* End of code 984 * ============================================================================= 985 */ 986