/** \file * This OBJC source file was generated by $ANTLR version 3.2 Aug 24, 2010 10:45:57 * * - From the grammar source file : Combined.g * - On : 2010-08-24 13:53:42 * - for the lexer : CombinedLexerLexer * * Editing it, at least manually, is not wise. * * ObjC language generator and runtime by Alan Condit, acondit|hereisanat|ipns|dotgoeshere|com. * * */ // [The "BSD licence"] // Copyright (c) 2010 Alan Condit // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // 3. The name of the author may not be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ANTLR 3.2 Aug 24, 2010 10:45:57 Combined.g 2010-08-24 13:53:42 /* ----------------------------------------- * Include the ANTLR3 generated header file. */ #import "CombinedLexer.h" /* ----------------------------------------- */ /* ============================================================================= */ /* ============================================================================= * Start of recognizer */ /** As per Terence: No returns for lexer rules! */ @implementation CombinedLexer // line 330 + (void) initialize { [ANTLRBaseRecognizer setGrammarFileName:@"Combined.g"]; } + (NSString *) tokenNameForType:(NSInteger)aTokenType { return [[self getTokenNames] objectAtIndex:aTokenType]; } + (CombinedLexer *)newCombinedLexerWithCharStream:(id)anInput { return [[CombinedLexer alloc] initWithCharStream:anInput]; } - (id) initWithCharStream:(id)anInput { if ((self = [super initWithCharStream:anInput State:[ANTLRRecognizerSharedState newANTLRRecognizerSharedStateWithRuleLen:4+1]]) != nil) { } return self; } - (void) dealloc { [super dealloc]; } /* Start of actions.lexer.methods */ /* start methods() */ /* Start of Rules */ // $ANTLR start "ID" - (void) mID { // /* ruleScopeSetUp */ @try { NSInteger _type = ID; NSInteger _channel = ANTLRTokenChannelDefault; // Combined.g:14:5: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )* ) // ruleBlockSingleAlt // Combined.g:14:9: ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )* // alt { if ((([input LA:1] >= 'A') && ([input LA:1] <= 'Z'))||[input LA:1] == '_'||(([input LA:1] >= 'a') && ([input LA:1] <= 'z'))) { [input consume]; } else { ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException exceptionWithSet:nil stream:input]; [self recover:mse]; @throw mse;} /* element() */ do { NSInteger alt1=2; NSInteger LA1_0 = [input LA:1]; if ( ((LA1_0>='0' && LA1_0<='9')||(LA1_0>='A' && LA1_0<='Z')||LA1_0=='_'||(LA1_0>='a' && LA1_0<='z')) ) { alt1=1; } switch (alt1) { case 1 : ; // Combined.g: // alt { 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'))) { [input consume]; } else { ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException exceptionWithSet:nil stream:input]; [self recover:mse]; @throw mse;} /* element() */ /* elements */ } break; default : goto loop1; } } while (YES); loop1: ; /* element() */ /* elements */ } // token+rule list labels [state setType:_type]; state.channel = _channel; } @finally { // } return; } // $ANTLR end "ID" // $ANTLR start "INT" - (void) mINT { // /* ruleScopeSetUp */ @try { NSInteger _type = INT; NSInteger _channel = ANTLRTokenChannelDefault; // Combined.g:17:5: ( ( '0' .. '9' )+ ) // ruleBlockSingleAlt // Combined.g:17:9: ( '0' .. '9' )+ // alt { // Combined.g:17: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 : ; // Combined.g:17:10: '0' .. '9' // alt { [self matchRangeFromChar:'0' to:'9']; /* element() */ /* elements */ } break; default : if ( cnt2 >= 1 ) goto loop2; ANTLREarlyExitException *eee = [ANTLREarlyExitException exceptionWithStream:input decisionNumber:2]; @throw eee; } cnt2++; } while (YES); loop2: ; /* element() */ /* elements */ } // token+rule list labels [state setType:_type]; state.channel = _channel; } @finally { // } return; } // $ANTLR end "INT" // $ANTLR start "WS" - (void) mWS { // /* ruleScopeSetUp */ @try { NSInteger _type = WS; NSInteger _channel = ANTLRTokenChannelDefault; // Combined.g:20:5: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ ) // ruleBlockSingleAlt // Combined.g:20:9: ( ' ' | '\\t' | '\\r' | '\\n' )+ // alt { // Combined.g:20:9: ( ' ' | '\\t' | '\\r' | '\\n' )+ // positiveClosureBlock NSInteger cnt3=0; do { NSInteger alt3=2; NSInteger LA3_0 = [input LA:1]; if ( ((LA3_0>='\t' && LA3_0<='\n')||LA3_0=='\r'||LA3_0==' ') ) { alt3=1; } switch (alt3) { case 1 : ; // Combined.g: // alt { if ((([input LA:1] >= '\t') && ([input LA:1] <= '\n'))||[input LA:1] == '\r'||[input LA:1] == ' ') { [input consume]; } else { ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException exceptionWithSet:nil stream:input]; [self recover:mse]; @throw mse;} /* element() */ /* elements */ } break; default : if ( cnt3 >= 1 ) goto loop3; ANTLREarlyExitException *eee = [ANTLREarlyExitException exceptionWithStream:input decisionNumber:3]; @throw eee; } cnt3++; } while (YES); loop3: ; /* element() */ _channel=99; /* element() */ /* elements */ } // token+rule list labels [state setType:_type]; state.channel = _channel; } @finally { // } return; } // $ANTLR end "WS" - (void) mTokens { // Combined.g:1:8: ( ID | INT | WS ) //ruleblock NSInteger alt4=3; switch ([input LA:1]) { case 'A': ; case 'B': ; case 'C': ; case 'D': ; case 'E': ; case 'F': ; case 'G': ; case 'H': ; case 'I': ; 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': ; case '_': ; case 'a': ; case 'b': ; case 'c': ; case 'd': ; case 'e': ; case 'f': ; case 'g': ; case 'h': ; case 'i': ; 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': ; { alt4=1; } break; case '0': ; case '1': ; case '2': ; case '3': ; case '4': ; case '5': ; case '6': ; case '7': ; case '8': ; case '9': ; { alt4=2; } break; case '\t': ; case '\n': ; case '\r': ; case ' ': ; { alt4=3; } break; default: ; ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newANTLRNoViableAltException:4 state:0 stream:input]; @throw nvae; } switch (alt4) { case 1 : ; // Combined.g:1:10: ID // alt { [self mID]; /* element() */ /* elements */ } break; case 2 : ; // Combined.g:1:13: INT // alt { [self mINT]; /* element() */ /* elements */ } break; case 3 : ; // Combined.g:1:17: WS // alt { [self mWS]; /* element() */ /* elements */ } break; } } @end /* end of CombinedLexer implementation line 397 */ /* End of code * ============================================================================= */