/** \file * This OBJC source file was generated by $ANTLR version 3.4 * * - From the grammar source file : /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/Lang.g * - On : 2012-02-16 17:58:54 * - for the lexer : LangLexerLexer * * Editing it, at least manually, is not wise. * * ObjC language generator and runtime by Alan Condit, acondit|hereisanat|ipns|dotgoeshere|com. * * */ // $ANTLR 3.4 /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/Lang.g 2012-02-16 17:58:54 /* ----------------------------------------- * Include the ANTLR3 generated header file. */ #import "LangLexer.h" /* ----------------------------------------- */ /* ============================================================================= */ /* ============================================================================= * Start of recognizer */ /** As per Terence: No returns for lexer rules! */ @implementation LangLexer // line 330 + (void) initialize { [BaseRecognizer setGrammarFileName:@"/Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/Lang.g"]; } + (NSString *) tokenNameForType:(NSInteger)aTokenType { return [[self getTokenNames] objectAtIndex:aTokenType]; } + (LangLexer *)newLangLexerWithCharStream:(id)anInput { return [[LangLexer alloc] initWithCharStream:anInput]; } - (id) initWithCharStream:(id)anInput { self = [super initWithCharStream:anInput State:[RecognizerSharedState newRecognizerSharedStateWithRuleLen:7+1]]; 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__10" - (void) mT__10 { // /* ruleScopeSetUp */ /* ruleDeclarations */ @try { NSInteger _type = T__10; NSInteger _channel = TokenChannelDefault; // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/Lang.g:7:7: ( ';' ) // ruleBlockSingleAlt // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/Lang.g:7:9: ';' // alt { [self matchChar:';']; } /* token+rule list labels */ state.type = _type; state.channel = _channel; } @finally { // /* ruleScopeCleanUp */ } return; } /* $ANTLR end "T__10" */ // $ANTLR start "INTTYPE" - (void) mINTTYPE { // /* ruleScopeSetUp */ /* ruleDeclarations */ @try { NSInteger _type = INTTYPE; NSInteger _channel = TokenChannelDefault; // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/Lang.g:18:9: ( 'int' ) // ruleBlockSingleAlt // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/Lang.g:18:11: 'int' // alt { [self matchString:@"int"]; } /* token+rule list labels */ state.type = _type; state.channel = _channel; } @finally { // /* ruleScopeCleanUp */ } return; } /* $ANTLR end "INTTYPE" */ // $ANTLR start "FLOATTYPE" - (void) mFLOATTYPE { // /* ruleScopeSetUp */ /* ruleDeclarations */ @try { NSInteger _type = FLOATTYPE; NSInteger _channel = TokenChannelDefault; // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/Lang.g:19:11: ( 'float' ) // ruleBlockSingleAlt // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/Lang.g:19:13: 'float' // alt { [self matchString:@"float"]; } /* token+rule list labels */ state.type = _type; state.channel = _channel; } @finally { // /* ruleScopeCleanUp */ } return; } /* $ANTLR end "FLOATTYPE" */ // $ANTLR start "ID" - (void) mID { // /* ruleScopeSetUp */ /* ruleDeclarations */ @try { NSInteger _type = ID; NSInteger _channel = TokenChannelDefault; // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/Lang.g:20:4: ( ( 'a' .. 'z' )+ ) // ruleBlockSingleAlt // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/Lang.g:20:6: ( 'a' .. 'z' )+ // alt { // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/Lang.g:20:6: ( '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 : ; // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/Lang.g: // alt { if ((([input LA:1] >= 'a') && ([input LA:1] <= 'z'))) { [input consume]; } else { MismatchedSetException *mse = [MismatchedSetException newException:nil stream:input]; [self recover:mse]; @throw mse; } } break; default : if ( cnt1 >= 1 ) goto loop1; EarlyExitException *eee = [EarlyExitException newException:input decisionNumber:1]; @throw eee; } cnt1++; } while (YES); loop1: ; } /* token+rule list labels */ state.type = _type; state.channel = _channel; } @finally { // /* ruleScopeCleanUp */ } return; } /* $ANTLR end "ID" */ // $ANTLR start "INT" - (void) mINT { // /* ruleScopeSetUp */ /* ruleDeclarations */ @try { NSInteger _type = INT; NSInteger _channel = TokenChannelDefault; // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/Lang.g:21:5: ( ( '0' .. '9' )+ ) // ruleBlockSingleAlt // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/Lang.g:21:7: ( '0' .. '9' )+ // alt { // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/Lang.g:21:7: ( '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 : ; // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/Lang.g: // alt { if ((([input LA:1] >= '0') && ([input LA:1] <= '9'))) { [input consume]; } else { MismatchedSetException *mse = [MismatchedSetException newException:nil stream:input]; [self recover:mse]; @throw mse; } } break; default : if ( cnt2 >= 1 ) goto loop2; EarlyExitException *eee = [EarlyExitException newException:input decisionNumber:2]; @throw eee; } cnt2++; } while (YES); loop2: ; } /* token+rule list labels */ state.type = _type; state.channel = _channel; } @finally { // /* ruleScopeCleanUp */ } return; } /* $ANTLR end "INT" */ // $ANTLR start "WS" - (void) mWS { // /* ruleScopeSetUp */ /* ruleDeclarations */ @try { NSInteger _type = WS; NSInteger _channel = TokenChannelDefault; // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/Lang.g:22:4: ( ( ' ' | '\\n' ) ) // ruleBlockSingleAlt // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/Lang.g:22:6: ( ' ' | '\\n' ) // alt { if ([input LA:1] == '\n'||[input LA:1] == ' ') { [input consume]; } else { MismatchedSetException *mse = [MismatchedSetException newException:nil stream:input]; [self recover:mse]; @throw mse; } _channel=HIDDEN; } /* token+rule list labels */ state.type = _type; state.channel = _channel; } @finally { // /* ruleScopeCleanUp */ } return; } /* $ANTLR end "WS" */ - (void) mTokens { // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/Lang.g:1:8: ( T__10 | INTTYPE | FLOATTYPE | ID | INT | WS ) //ruleblock NSInteger alt3=6; unichar charLA3 = [input LA:1]; switch (charLA3) { case ';': ; { alt3=1; } break; case 'i': ; { NSInteger LA3_2 = [input LA:2]; if ( (LA3_2=='n') ) { NSInteger LA3_7 = [input LA:3]; if ( (LA3_7=='t') ) { NSInteger LA3_9 = [input LA:4]; if ( ((LA3_9 >= 'a' && LA3_9 <= 'z')) ) { alt3=4; } else { alt3 = 2; } } else { alt3 = 4; } } else { alt3 = 4; } } break; case 'f': ; { NSInteger LA3_3 = [input LA:2]; if ( (LA3_3=='l') ) { NSInteger LA3_8 = [input LA:3]; if ( (LA3_8=='o') ) { NSInteger LA3_10 = [input LA:4]; if ( (LA3_10=='a') ) { NSInteger LA3_12 = [input LA:5]; if ( (LA3_12=='t') ) { NSInteger LA3_13 = [input LA:6]; if ( ((LA3_13 >= 'a' && LA3_13 <= 'z')) ) { alt3=4; } else { alt3 = 3; } } else { alt3 = 4; } } else { alt3 = 4; } } else { alt3 = 4; } } else { alt3 = 4; } } break; case 'a': ; case 'b': ; case 'c': ; case 'd': ; case 'e': ; case 'g': ; case 'h': ; case 'j': ; case 'k': ; case 'l': ; case 'm': ; 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': ; { alt3=4; } break; case '0': ; case '1': ; case '2': ; case '3': ; case '4': ; case '5': ; case '6': ; case '7': ; case '8': ; case '9': ; { alt3=5; } break; case '\n': ; case ' ': ; { alt3=6; } break; default: ; NoViableAltException *nvae = [NoViableAltException newException:3 state:0 stream:input]; nvae.c = charLA3; @throw nvae; } switch (alt3) { case 1 : ; // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/Lang.g:1:10: T__10 // alt { [self mT__10]; } break; case 2 : ; // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/Lang.g:1:16: INTTYPE // alt { [self mINTTYPE]; } break; case 3 : ; // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/Lang.g:1:24: FLOATTYPE // alt { [self mFLOATTYPE]; } break; case 4 : ; // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/Lang.g:1:34: ID // alt { [self mID]; } break; case 5 : ; // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/Lang.g:1:37: INT // alt { [self mINT]; } break; case 6 : ; // /Users/acondit/source/antlr/code/antlr3/runtime/ObjC/Framework/examples/treeparser/Lang.g:1:41: WS // alt { [self mWS]; } break; } } @end /* end of LangLexer implementation line 397 */