/** \file * This OBJC source file was generated by $ANTLR version ${project.version} ${buildNumber} * * - From the grammar source file : SymbolTable.g * - On : 2011-05-06 15:04:43 * - for the lexer : SymbolTableLexerLexer * * Editing it, at least manually, is not wise. * * ObjC language generator and runtime by Alan Condit, acondit|hereisanat|ipns|dotgoeshere|com. * * */ // $ANTLR ${project.version} ${buildNumber} SymbolTable.g 2011-05-06 15:04:43 /* ----------------------------------------- * Include the ANTLR3 generated header file. */ #import "SymbolTableLexer.h" /* ----------------------------------------- */ /* ============================================================================= */ /* ============================================================================= * Start of recognizer */ /** As per Terence: No returns for lexer rules! */ @implementation SymbolTableLexer // line 330 + (void) initialize { [ANTLRBaseRecognizer setGrammarFileName:@"SymbolTable.g"]; } + (NSString *) tokenNameForType:(NSInteger)aTokenType { return [[self getTokenNames] objectAtIndex:aTokenType]; } + (SymbolTableLexer *)newSymbolTableLexerWithCharStream:(id)anInput { return [[SymbolTableLexer alloc] initWithCharStream:anInput]; } - (id) initWithCharStream:(id)anInput { self = [super initWithCharStream:anInput State:[[ANTLRRecognizerSharedState newANTLRRecognizerSharedStateWithRuleLen:12+1] retain]]; if ( self != nil ) { } return self; } - (void) dealloc { [super dealloc]; } /* ObjC Start of actions.lexer.methods */ /* ObjC end of actions.lexer.methods */ /* ObjC start methods() */ /* ObjC end methods() */ /* Start of Rules */ // $ANTLR start "T__7" - (void) mT__7 { // /* my ruleScopeSetUp */ /* Terence's stuff */ @try { NSInteger _type = T__7; NSInteger _channel = ANTLRTokenChannelDefault; // SymbolTable.g:7:6: ( '(' ) // ruleBlockSingleAlt // SymbolTable.g:7:8: '(' // alt { [self matchChar:'(']; } // token+rule list labels state.type = _type; state.channel = _channel; } @finally { // /* Terence's stuff */ } return; } /* $ANTLR end "T__7" */ // $ANTLR start "T__8" - (void) mT__8 { // /* my ruleScopeSetUp */ /* Terence's stuff */ @try { NSInteger _type = T__8; NSInteger _channel = ANTLRTokenChannelDefault; // SymbolTable.g:8:6: ( ')' ) // ruleBlockSingleAlt // SymbolTable.g:8:8: ')' // alt { [self matchChar:')']; } // token+rule list labels state.type = _type; state.channel = _channel; } @finally { // /* Terence's stuff */ } return; } /* $ANTLR end "T__8" */ // $ANTLR start "T__9" - (void) mT__9 { // /* my ruleScopeSetUp */ /* Terence's stuff */ @try { NSInteger _type = T__9; NSInteger _channel = ANTLRTokenChannelDefault; // SymbolTable.g:9:6: ( ';' ) // ruleBlockSingleAlt // SymbolTable.g:9:8: ';' // alt { [self matchChar:';']; } // token+rule list labels state.type = _type; state.channel = _channel; } @finally { // /* Terence's stuff */ } return; } /* $ANTLR end "T__9" */ // $ANTLR start "T__10" - (void) mT__10 { // /* my ruleScopeSetUp */ /* Terence's stuff */ @try { NSInteger _type = T__10; NSInteger _channel = ANTLRTokenChannelDefault; // SymbolTable.g:10:7: ( '=' ) // ruleBlockSingleAlt // SymbolTable.g:10:9: '=' // alt { [self matchChar:'=']; } // token+rule list labels state.type = _type; state.channel = _channel; } @finally { // /* Terence's stuff */ } return; } /* $ANTLR end "T__10" */ // $ANTLR start "T__11" - (void) mT__11 { // /* my ruleScopeSetUp */ /* Terence's stuff */ @try { NSInteger _type = T__11; NSInteger _channel = ANTLRTokenChannelDefault; // SymbolTable.g:11:7: ( 'int' ) // ruleBlockSingleAlt // SymbolTable.g:11:9: 'int' // alt { [self matchString:@"int"]; } // token+rule list labels state.type = _type; state.channel = _channel; } @finally { // /* Terence's stuff */ } return; } /* $ANTLR end "T__11" */ // $ANTLR start "T__12" - (void) mT__12 { // /* my ruleScopeSetUp */ /* Terence's stuff */ @try { NSInteger _type = T__12; NSInteger _channel = ANTLRTokenChannelDefault; // SymbolTable.g:12:7: ( 'method' ) // ruleBlockSingleAlt // SymbolTable.g:12:9: 'method' // alt { [self matchString:@"method"]; } // token+rule list labels state.type = _type; state.channel = _channel; } @finally { // /* Terence's stuff */ } return; } /* $ANTLR end "T__12" */ // $ANTLR start "T__13" - (void) mT__13 { // /* my ruleScopeSetUp */ /* Terence's stuff */ @try { NSInteger _type = T__13; NSInteger _channel = ANTLRTokenChannelDefault; // SymbolTable.g:13:7: ( '{' ) // ruleBlockSingleAlt // SymbolTable.g:13:9: '{' // alt { [self matchChar:'{']; } // token+rule list labels state.type = _type; state.channel = _channel; } @finally { // /* Terence's stuff */ } return; } /* $ANTLR end "T__13" */ // $ANTLR start "T__14" - (void) mT__14 { // /* my ruleScopeSetUp */ /* Terence's stuff */ @try { NSInteger _type = T__14; NSInteger _channel = ANTLRTokenChannelDefault; // SymbolTable.g:14:7: ( '}' ) // ruleBlockSingleAlt // SymbolTable.g:14:9: '}' // alt { [self matchChar:'}']; } // token+rule list labels state.type = _type; state.channel = _channel; } @finally { // /* Terence's stuff */ } return; } /* $ANTLR end "T__14" */ // $ANTLR start "ID" - (void) mID { // /* my ruleScopeSetUp */ /* Terence's stuff */ @try { NSInteger _type = ID; NSInteger _channel = ANTLRTokenChannelDefault; // SymbolTable.g:68:5: ( ( 'a' .. 'z' )+ ) // ruleBlockSingleAlt // SymbolTable.g:68:9: ( 'a' .. 'z' )+ // alt { // SymbolTable.g:68:9: ( 'a' .. 'z' )+ // positiveClosureBlock NSInteger cnt1 = 0; do { NSInteger alt1 = 2; NSInteger LA1_0 = [input LA:1]; if ( ((LA1_0 >= 'a' && LA1_0 <= 'z')) ) { alt1=1; } switch (alt1) { case 1 : ; // SymbolTable.g: // alt { if ((([input LA:1] >= 'a') && ([input LA:1] <= 'z'))) { [input consume]; } else { ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException newException:nil stream:input]; [self recover:mse]; @throw mse; } } break; default : if ( cnt1 >= 1 ) goto loop1; ANTLREarlyExitException *eee = [ANTLREarlyExitException newException:input decisionNumber:1]; @throw eee; } cnt1++; } while (YES); loop1: ; } // token+rule list labels state.type = _type; state.channel = _channel; } @finally { // /* Terence's stuff */ } return; } /* $ANTLR end "ID" */ // $ANTLR start "INT" - (void) mINT { // /* my ruleScopeSetUp */ /* Terence's stuff */ @try { NSInteger _type = INT; NSInteger _channel = ANTLRTokenChannelDefault; // SymbolTable.g:71:5: ( ( '0' .. '9' )+ ) // ruleBlockSingleAlt // SymbolTable.g:71:9: ( '0' .. '9' )+ // alt { // SymbolTable.g:71:9: ( '0' .. '9' )+ // positiveClosureBlock NSInteger cnt2 = 0; do { NSInteger alt2 = 2; NSInteger LA2_0 = [input LA:1]; if ( ((LA2_0 >= '0' && LA2_0 <= '9')) ) { alt2=1; } switch (alt2) { case 1 : ; // SymbolTable.g: // alt { if ((([input LA:1] >= '0') && ([input LA:1] <= '9'))) { [input consume]; } else { ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException newException:nil stream:input]; [self recover:mse]; @throw mse; } } break; default : if ( cnt2 >= 1 ) goto loop2; ANTLREarlyExitException *eee = [ANTLREarlyExitException newException:input decisionNumber:2]; @throw eee; } cnt2++; } while (YES); loop2: ; } // token+rule list labels state.type = _type; state.channel = _channel; } @finally { // /* Terence's stuff */ } return; } /* $ANTLR end "INT" */ // $ANTLR start "WS" - (void) mWS { // /* my ruleScopeSetUp */ /* Terence's stuff */ @try { NSInteger _type = WS; NSInteger _channel = ANTLRTokenChannelDefault; // SymbolTable.g:74:5: ( ( ' ' | '\\n' | '\\r' )+ ) // ruleBlockSingleAlt // SymbolTable.g:74:9: ( ' ' | '\\n' | '\\r' )+ // alt { // SymbolTable.g:74:9: ( ' ' | '\\n' | '\\r' )+ // positiveClosureBlock NSInteger cnt3 = 0; do { NSInteger alt3 = 2; NSInteger LA3_0 = [input LA:1]; if ( (LA3_0=='\n'||LA3_0=='\r'||LA3_0==' ') ) { alt3=1; } switch (alt3) { case 1 : ; // SymbolTable.g: // alt { if ([input LA:1] == '\n'||[input LA:1] == '\r'||[input LA:1] == ' ') { [input consume]; } else { ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException newException:nil stream:input]; [self recover:mse]; @throw mse; } } break; default : if ( cnt3 >= 1 ) goto loop3; ANTLREarlyExitException *eee = [ANTLREarlyExitException newException:input decisionNumber:3]; @throw eee; } cnt3++; } while (YES); loop3: ; _channel=HIDDEN; } // token+rule list labels state.type = _type; state.channel = _channel; } @finally { // /* Terence's stuff */ } return; } /* $ANTLR end "WS" */ - (void) mTokens { // SymbolTable.g:1:8: ( T__7 | T__8 | T__9 | T__10 | T__11 | T__12 | T__13 | T__14 | ID | INT | WS ) //ruleblock NSInteger alt4=11; unichar charLA4 = [input LA:1]; switch (charLA4) { case '(': ; { alt4=1; } break; case ')': ; { alt4=2; } break; case ';': ; { alt4=3; } break; case '=': ; { alt4=4; } break; case 'i': ; { NSInteger LA4_5 = [input LA:2]; if ( (LA4_5=='n') ) { NSInteger LA4_12 = [input LA:3]; if ( (LA4_12=='t') ) { NSInteger LA4_14 = [input LA:4]; if ( ((LA4_14 >= 'a' && LA4_14 <= 'z')) ) { alt4=9; } else { alt4 = 5; } } else { alt4 = 9; } } else { alt4 = 9; } } break; case 'm': ; { NSInteger LA4_6 = [input LA:2]; if ( (LA4_6=='e') ) { NSInteger LA4_13 = [input LA:3]; if ( (LA4_13=='t') ) { NSInteger LA4_15 = [input LA:4]; if ( (LA4_15=='h') ) { NSInteger LA4_17 = [input LA:5]; if ( (LA4_17=='o') ) { NSInteger LA4_18 = [input LA:6]; if ( (LA4_18=='d') ) { NSInteger LA4_19 = [input LA:7]; if ( ((LA4_19 >= 'a' && LA4_19 <= 'z')) ) { alt4=9; } else { alt4 = 6; } } else { alt4 = 9; } } else { alt4 = 9; } } else { alt4 = 9; } } else { alt4 = 9; } } else { alt4 = 9; } } break; case '{': ; { alt4=7; } break; case '}': ; { alt4=8; } break; case 'a': ; case 'b': ; case 'c': ; case 'd': ; case 'e': ; case 'f': ; case 'g': ; case 'h': ; case 'j': ; case 'k': ; case 'l': ; case 'n': ; case 'o': ; case 'p': ; case 'q': ; case 'r': ; case 's': ; case 't': ; case 'u': ; case 'v': ; case 'w': ; case 'x': ; case 'y': ; case 'z': ; { alt4=9; } break; case '0': ; case '1': ; case '2': ; case '3': ; case '4': ; case '5': ; case '6': ; case '7': ; case '8': ; case '9': ; { alt4=10; } break; case '\n': ; case '\r': ; case ' ': ; { alt4=11; } break; default: ; ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newException:4 state:0 stream:input]; nvae.c = charLA4; @throw nvae; } switch (alt4) { case 1 : ; // SymbolTable.g:1:10: T__7 // alt { [self mT__7]; } break; case 2 : ; // SymbolTable.g:1:15: T__8 // alt { [self mT__8]; } break; case 3 : ; // SymbolTable.g:1:20: T__9 // alt { [self mT__9]; } break; case 4 : ; // SymbolTable.g:1:25: T__10 // alt { [self mT__10]; } break; case 5 : ; // SymbolTable.g:1:31: T__11 // alt { [self mT__11]; } break; case 6 : ; // SymbolTable.g:1:37: T__12 // alt { [self mT__12]; } break; case 7 : ; // SymbolTable.g:1:43: T__13 // alt { [self mT__13]; } break; case 8 : ; // SymbolTable.g:1:49: T__14 // alt { [self mT__14]; } break; case 9 : ; // SymbolTable.g:1:55: ID // alt { [self mID]; } break; case 10 : ; // SymbolTable.g:1:58: INT // alt { [self mINT]; } break; case 11 : ; // SymbolTable.g:1:62: WS // alt { [self mWS]; } break; } } @end /* end of SymbolTableLexer implementation line 397 */