| /** \file |
| * This OBJC source file was generated by $ANTLR version 3.2 Aug 23, 2010 07:48:06 |
| * |
| * - From the grammar source file : /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g |
| * - On : 2010-08-23 07:54:47 |
| * - for the lexer : SimpleCLexerLexer * |
| * 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 23, 2010 07:48:06 /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g 2010-08-23 07:54:47 |
| |
| /* ----------------------------------------- |
| * Include the ANTLR3 generated header file. |
| */ |
| #import "SimpleCLexer.h" |
| /* ----------------------------------------- */ |
| |
| |
| /* ============================================================================= */ |
| |
| /* ============================================================================= |
| * Start of recognizer |
| */ |
| |
| #pragma mark Cyclic DFA implementation start DFA4 |
| @implementation DFA4 |
| const static NSInteger dfa4_eot[33] = |
| {-1,-1,-1,-1,-1,-1,-1,11,11,11,11,-1,-1,22,-1,-1,-1,11,11,11,11,-1,-1, |
| 27,28,11,11,-1,-1,31,32,-1,-1}; |
| const static NSInteger dfa4_eof[33] = |
| {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, |
| -1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; |
| const static unichar dfa4_min[33] = |
| {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, |
| 114,100,0,0,48,48,0,0}; |
| const static unichar dfa4_max[33] = |
| {125,0,0,0,0,0,0,111,110,104,111,0,0,61,0,0,0,114,116,97,105,0,0,122, |
| 122,114,100,0,0,122,122,0,0}; |
| const static NSInteger dfa4_accept[33] = |
| {-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, |
| -1,-1,7,8,-1,-1,9,10}; |
| const static NSInteger dfa4_special[33] = |
| {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, |
| -1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; |
| const static NSInteger dfa4_transition[] = {}; |
| const static NSInteger dfa4_transition0[] = {24}; |
| const static NSInteger dfa4_transition1[] = {26}; |
| const static NSInteger dfa4_transition2[] = {29}; |
| const static NSInteger dfa4_transition3[] = {20}; |
| const static NSInteger dfa4_transition4[] = {25}; |
| const static NSInteger dfa4_transition5[] = {16, 16, -1, -1, 16, -1, -1, |
| -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 16, -1, |
| -1, -1, -1, -1, -1, -1, 2, 4, -1, 15, 3, -1, -1, -1, 12, 12, 12, 12, 12, |
| 12, 12, 12, 12, 12, -1, 1, 14, 13, -1, -1, -1, 11, 11, 11, 11, 11, 11, |
| 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, |
| 11, 11, -1, -1, -1, -1, 11, -1, 11, 11, 9, 11, 11, 7, 11, 11, 8, 11, 11, |
| 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 11, 11, 11, 11, 5, -1, 6}; |
| const static NSInteger dfa4_transition6[] = {21}; |
| const static NSInteger dfa4_transition7[] = {11, 11, 11, 11, 11, 11, 11, |
| 11, 11, 11, -1, -1, -1, -1, -1, -1, -1, 11, 11, 11, 11, 11, 11, 11, 11, |
| 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, |
| -1, -1, -1, -1, 11, -1, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, |
| 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11}; |
| const static NSInteger dfa4_transition8[] = {18}; |
| const static NSInteger dfa4_transition9[] = {19}; |
| const static NSInteger dfa4_transition10[] = {23}; |
| const static NSInteger dfa4_transition11[] = {17}; |
| const static NSInteger dfa4_transition12[] = {30}; |
| |
| |
| + () newDFA4WithRecognizer:(ANTLRBaseRecognizer *)aRecognizer |
| { |
| return [[[DFA4 alloc] initWithRecognizer:aRecognizer] retain]; |
| } |
| |
| - (id) initWithRecognizer:(ANTLRBaseRecognizer *) theRecognizer |
| { |
| if ((self = [super initWithRecognizer:theRecognizer]) != nil) { |
| decisionNumber = 4; |
| eot = dfa4_eot; |
| eof = dfa4_eof; |
| min = dfa4_min; |
| max = dfa4_max; |
| accept = dfa4_accept; |
| special = dfa4_special; |
| if (!(transition = calloc(33, sizeof(void*)))) { |
| [self release]; |
| return nil; |
| } |
| len = 33; |
| transition[0] = dfa4_transition5; |
| transition[1] = dfa4_transition; |
| transition[2] = dfa4_transition; |
| transition[3] = dfa4_transition; |
| transition[4] = dfa4_transition; |
| transition[5] = dfa4_transition; |
| transition[6] = dfa4_transition; |
| transition[7] = dfa4_transition11; |
| transition[8] = dfa4_transition8; |
| transition[9] = dfa4_transition9; |
| transition[10] = dfa4_transition3; |
| transition[11] = dfa4_transition; |
| transition[12] = dfa4_transition; |
| transition[13] = dfa4_transition6; |
| transition[14] = dfa4_transition; |
| transition[15] = dfa4_transition; |
| transition[16] = dfa4_transition; |
| transition[17] = dfa4_transition10; |
| transition[18] = dfa4_transition0; |
| transition[19] = dfa4_transition4; |
| transition[20] = dfa4_transition1; |
| transition[21] = dfa4_transition; |
| transition[22] = dfa4_transition; |
| transition[23] = dfa4_transition7; |
| transition[24] = dfa4_transition7; |
| transition[25] = dfa4_transition2; |
| transition[26] = dfa4_transition12; |
| transition[27] = dfa4_transition; |
| transition[28] = dfa4_transition; |
| transition[29] = dfa4_transition7; |
| transition[30] = dfa4_transition7; |
| transition[31] = dfa4_transition; |
| transition[32] = dfa4_transition; |
| } |
| return self; |
| } |
| |
| - (void) dealloc |
| { |
| free(transition); |
| [super dealloc]; |
| } |
| |
| - (NSString *) description |
| { |
| 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 );"; |
| } |
| |
| |
| @end /* end DFA4 implementation */ |
| |
| #pragma mark Cyclic DFA implementation end DFA4 |
| |
| |
| |
| /** As per Terence: No returns for lexer rules! |
| #pragma mark Rule return scopes start |
| #pragma mark Rule return scopes end |
| */ |
| @implementation SimpleCLexer // line 330 |
| |
| + (void) initialize |
| { |
| [ANTLRBaseRecognizer setGrammarFileName:@"/usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g"]; |
| } |
| |
| + (NSString *) tokenNameForType:(NSInteger)aTokenType |
| { |
| return [[self getTokenNames] objectAtIndex:aTokenType]; |
| } |
| |
| + (SimpleCLexer *)newSimpleCLexer:(id<ANTLRCharStream>)anInput |
| { |
| return [[SimpleCLexer alloc] initWithCharStream:anInput]; |
| } |
| |
| - (id) initWithCharStream:(id<ANTLRCharStream>)anInput |
| { |
| if ((self = [super initWithCharStream:anInput State:[ANTLRRecognizerSharedState newANTLRRecognizerSharedStateWithRuleLen:18+1]]) != nil) { |
| |
| dfa4 = [DFA4 newDFA4WithRecognizer:self]; |
| } |
| return self; |
| } |
| |
| - (void) dealloc |
| { |
| [dfa4 release]; |
| [super dealloc]; |
| } |
| |
| /* Start of actions.lexer.methods */ |
| /* start methods() */ |
| |
| /* Start of Rules */ |
| // $ANTLR start "T__21" |
| - (void) mT__21 |
| { |
| // |
| /* ruleScopeSetUp */ |
| |
| @try { |
| NSInteger _type = T__21; |
| NSInteger _channel = ANTLRTokenChannelDefault; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:7:7: ( ';' ) // ruleBlockSingleAlt |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:7:9: ';' // alt |
| { |
| [self matchChar:';']; |
| /* element() */ |
| /* elements */ |
| } |
| |
| // token+rule list labels |
| |
| [state setType:_type]; |
| |
| state.channel = _channel; |
| } |
| @finally { |
| // |
| } |
| return; |
| } |
| // $ANTLR end "T__21" |
| |
| // $ANTLR start "T__22" |
| - (void) mT__22 |
| { |
| // |
| /* ruleScopeSetUp */ |
| |
| @try { |
| NSInteger _type = T__22; |
| NSInteger _channel = ANTLRTokenChannelDefault; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:8:7: ( '(' ) // ruleBlockSingleAlt |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:8:9: '(' // alt |
| { |
| [self matchChar:'(']; |
| /* element() */ |
| /* elements */ |
| } |
| |
| // token+rule list labels |
| |
| [state setType:_type]; |
| |
| state.channel = _channel; |
| } |
| @finally { |
| // |
| } |
| return; |
| } |
| // $ANTLR end "T__22" |
| |
| // $ANTLR start "T__23" |
| - (void) mT__23 |
| { |
| // |
| /* ruleScopeSetUp */ |
| |
| @try { |
| NSInteger _type = T__23; |
| NSInteger _channel = ANTLRTokenChannelDefault; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:9:7: ( ',' ) // ruleBlockSingleAlt |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:9:9: ',' // alt |
| { |
| [self matchChar:',']; |
| /* element() */ |
| /* elements */ |
| } |
| |
| // token+rule list labels |
| |
| [state setType:_type]; |
| |
| state.channel = _channel; |
| } |
| @finally { |
| // |
| } |
| return; |
| } |
| // $ANTLR end "T__23" |
| |
| // $ANTLR start "T__24" |
| - (void) mT__24 |
| { |
| // |
| /* ruleScopeSetUp */ |
| |
| @try { |
| NSInteger _type = T__24; |
| NSInteger _channel = ANTLRTokenChannelDefault; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:10:7: ( ')' ) // ruleBlockSingleAlt |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:10:9: ')' // alt |
| { |
| [self matchChar:')']; |
| /* element() */ |
| /* elements */ |
| } |
| |
| // token+rule list labels |
| |
| [state setType:_type]; |
| |
| state.channel = _channel; |
| } |
| @finally { |
| // |
| } |
| return; |
| } |
| // $ANTLR end "T__24" |
| |
| // $ANTLR start "T__25" |
| - (void) mT__25 |
| { |
| // |
| /* ruleScopeSetUp */ |
| |
| @try { |
| NSInteger _type = T__25; |
| NSInteger _channel = ANTLRTokenChannelDefault; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:11:7: ( '{' ) // ruleBlockSingleAlt |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:11:9: '{' // alt |
| { |
| [self matchChar:'{']; |
| /* element() */ |
| /* elements */ |
| } |
| |
| // token+rule list labels |
| |
| [state setType:_type]; |
| |
| state.channel = _channel; |
| } |
| @finally { |
| // |
| } |
| return; |
| } |
| // $ANTLR end "T__25" |
| |
| // $ANTLR start "T__26" |
| - (void) mT__26 |
| { |
| // |
| /* ruleScopeSetUp */ |
| |
| @try { |
| NSInteger _type = T__26; |
| NSInteger _channel = ANTLRTokenChannelDefault; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:12:7: ( '}' ) // ruleBlockSingleAlt |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:12:9: '}' // alt |
| { |
| [self matchChar:'}']; |
| /* element() */ |
| /* elements */ |
| } |
| |
| // token+rule list labels |
| |
| [state setType:_type]; |
| |
| state.channel = _channel; |
| } |
| @finally { |
| // |
| } |
| return; |
| } |
| // $ANTLR end "T__26" |
| |
| // $ANTLR start "K_FOR" |
| - (void) mK_FOR |
| { |
| // |
| /* ruleScopeSetUp */ |
| |
| @try { |
| NSInteger _type = K_FOR; |
| NSInteger _channel = ANTLRTokenChannelDefault; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:91:7: ( 'for' ) // ruleBlockSingleAlt |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:91:9: 'for' // alt |
| { |
| [self matchString:@"for"]; |
| /* element() */ |
| /* elements */ |
| } |
| |
| // token+rule list labels |
| |
| [state setType:_type]; |
| |
| state.channel = _channel; |
| } |
| @finally { |
| // |
| } |
| return; |
| } |
| // $ANTLR end "K_FOR" |
| |
| // $ANTLR start "K_INT_TYPE" |
| - (void) mK_INT_TYPE |
| { |
| // |
| /* ruleScopeSetUp */ |
| |
| @try { |
| NSInteger _type = K_INT_TYPE; |
| NSInteger _channel = ANTLRTokenChannelDefault; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:92:12: ( 'int' ) // ruleBlockSingleAlt |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:92:14: 'int' // alt |
| { |
| [self matchString:@"int"]; |
| /* element() */ |
| /* elements */ |
| } |
| |
| // token+rule list labels |
| |
| [state setType:_type]; |
| |
| state.channel = _channel; |
| } |
| @finally { |
| // |
| } |
| return; |
| } |
| // $ANTLR end "K_INT_TYPE" |
| |
| // $ANTLR start "K_CHAR" |
| - (void) mK_CHAR |
| { |
| // |
| /* ruleScopeSetUp */ |
| |
| @try { |
| NSInteger _type = K_CHAR; |
| NSInteger _channel = ANTLRTokenChannelDefault; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:93:7: ( 'char' ) // ruleBlockSingleAlt |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:93:9: 'char' // alt |
| { |
| [self matchString:@"char"]; |
| /* element() */ |
| /* elements */ |
| } |
| |
| // token+rule list labels |
| |
| [state setType:_type]; |
| |
| state.channel = _channel; |
| } |
| @finally { |
| // |
| } |
| return; |
| } |
| // $ANTLR end "K_CHAR" |
| |
| // $ANTLR start "K_VOID" |
| - (void) mK_VOID |
| { |
| // |
| /* ruleScopeSetUp */ |
| |
| @try { |
| NSInteger _type = K_VOID; |
| NSInteger _channel = ANTLRTokenChannelDefault; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:94:7: ( 'void' ) // ruleBlockSingleAlt |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:94:9: 'void' // alt |
| { |
| [self matchString:@"void"]; |
| /* element() */ |
| /* elements */ |
| } |
| |
| // token+rule list labels |
| |
| [state setType:_type]; |
| |
| state.channel = _channel; |
| } |
| @finally { |
| // |
| } |
| return; |
| } |
| // $ANTLR end "K_VOID" |
| |
| // $ANTLR start "K_ID" |
| - (void) mK_ID |
| { |
| // |
| /* ruleScopeSetUp */ |
| |
| @try { |
| NSInteger _type = K_ID; |
| NSInteger _channel = ANTLRTokenChannelDefault; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:96:7: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )* ) // ruleBlockSingleAlt |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:96:11: ( '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 : ; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.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 "K_ID" |
| |
| // $ANTLR start "K_INT" |
| - (void) mK_INT |
| { |
| // |
| /* ruleScopeSetUp */ |
| |
| @try { |
| NSInteger _type = K_INT; |
| NSInteger _channel = ANTLRTokenChannelDefault; |
| id<ANTLRToken> *int=nil; |
| NSMutableArray *list_int=nil; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:99:7: ( (int+= ( '0' .. '9' ) )+ ) // ruleBlockSingleAlt |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:99:9: (int+= ( '0' .. '9' ) )+ // alt |
| { |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:99:12: (int+= ( '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 : ; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:99:12: int+= ( '0' .. '9' ) // alt |
| { |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:99:14: ( '0' .. '9' ) // blockSingleAlt |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:99:15: '0' .. '9' // alt |
| { |
| [self matchRangeFromChar:'0' to:'9']; /* element() */ |
| /* elements */ |
| } |
| /* element() */ |
| /* elements */ |
| } |
| break; |
| |
| default : |
| if ( cnt2 >= 1 ) |
| goto loop2; |
| ANTLREarlyExitException *eee = [ANTLREarlyExitException exceptionWithStream:input decisionNumber:2]; |
| @throw eee; |
| } |
| cnt2++; |
| } while (YES); |
| loop2: ; |
| /* element() */ |
| NSLog(@"%@", list_int); /* element() */ |
| /* elements */ |
| } |
| |
| // token+rule list labels |
| [list_int release]; |
| |
| [state setType:_type]; |
| |
| state.channel = _channel; |
| } |
| @finally { |
| // |
| } |
| return; |
| } |
| // $ANTLR end "K_INT" |
| |
| // $ANTLR start "K_EQ" |
| - (void) mK_EQ |
| { |
| // |
| /* ruleScopeSetUp */ |
| |
| @try { |
| NSInteger _type = K_EQ; |
| NSInteger _channel = ANTLRTokenChannelDefault; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:102:8: ( '=' ) // ruleBlockSingleAlt |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:102:10: '=' // alt |
| { |
| [self matchChar:'=']; |
| /* element() */ |
| /* elements */ |
| } |
| |
| // token+rule list labels |
| |
| [state setType:_type]; |
| |
| state.channel = _channel; |
| } |
| @finally { |
| // |
| } |
| return; |
| } |
| // $ANTLR end "K_EQ" |
| |
| // $ANTLR start "K_EQEQ" |
| - (void) mK_EQEQ |
| { |
| // |
| /* ruleScopeSetUp */ |
| |
| @try { |
| NSInteger _type = K_EQEQ; |
| NSInteger _channel = ANTLRTokenChannelDefault; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:103:8: ( '==' ) // ruleBlockSingleAlt |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:103:10: '==' // alt |
| { |
| [self matchString:@"=="]; |
| /* element() */ |
| /* elements */ |
| } |
| |
| // token+rule list labels |
| |
| [state setType:_type]; |
| |
| state.channel = _channel; |
| } |
| @finally { |
| // |
| } |
| return; |
| } |
| // $ANTLR end "K_EQEQ" |
| |
| // $ANTLR start "K_LT" |
| - (void) mK_LT |
| { |
| // |
| /* ruleScopeSetUp */ |
| |
| @try { |
| NSInteger _type = K_LT; |
| NSInteger _channel = ANTLRTokenChannelDefault; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:104:8: ( '<' ) // ruleBlockSingleAlt |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:104:10: '<' // alt |
| { |
| [self matchChar:'<']; |
| /* element() */ |
| /* elements */ |
| } |
| |
| // token+rule list labels |
| |
| [state setType:_type]; |
| |
| state.channel = _channel; |
| } |
| @finally { |
| // |
| } |
| return; |
| } |
| // $ANTLR end "K_LT" |
| |
| // $ANTLR start "K_PLUS" |
| - (void) mK_PLUS |
| { |
| // |
| /* ruleScopeSetUp */ |
| |
| @try { |
| NSInteger _type = K_PLUS; |
| NSInteger _channel = ANTLRTokenChannelDefault; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:105:8: ( '+' ) // ruleBlockSingleAlt |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:105:10: '+' // alt |
| { |
| [self matchChar:'+']; |
| /* element() */ |
| /* elements */ |
| } |
| |
| // token+rule list labels |
| |
| [state setType:_type]; |
| |
| state.channel = _channel; |
| } |
| @finally { |
| // |
| } |
| return; |
| } |
| // $ANTLR end "K_PLUS" |
| |
| // $ANTLR start "WS" |
| - (void) mWS |
| { |
| // |
| /* ruleScopeSetUp */ |
| |
| @try { |
| NSInteger _type = WS; |
| NSInteger _channel = ANTLRTokenChannelDefault; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:107:5: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ ) // ruleBlockSingleAlt |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:107:9: ( ' ' | '\\t' | '\\r' | '\\n' )+ // alt |
| { |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:107: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 : ; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.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() */ |
| state.channel=99; /* element() */ |
| /* elements */ |
| } |
| |
| // token+rule list labels |
| |
| [state setType:_type]; |
| |
| state.channel = _channel; |
| } |
| @finally { |
| // |
| } |
| return; |
| } |
| // $ANTLR end "WS" |
| |
| - (void) mTokens |
| { |
| // /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 |
| NSInteger alt4=17; |
| alt4 = [dfa4 predict:input]; |
| switch (alt4) { |
| case 1 : ; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:10: T__21 // alt |
| { |
| [self mT__21]; |
| /* element() */ |
| /* elements */ |
| } |
| break; |
| case 2 : ; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:16: T__22 // alt |
| { |
| [self mT__22]; |
| /* element() */ |
| /* elements */ |
| } |
| break; |
| case 3 : ; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:22: T__23 // alt |
| { |
| [self mT__23]; |
| /* element() */ |
| /* elements */ |
| } |
| break; |
| case 4 : ; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:28: T__24 // alt |
| { |
| [self mT__24]; |
| /* element() */ |
| /* elements */ |
| } |
| break; |
| case 5 : ; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:34: T__25 // alt |
| { |
| [self mT__25]; |
| /* element() */ |
| /* elements */ |
| } |
| break; |
| case 6 : ; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:40: T__26 // alt |
| { |
| [self mT__26]; |
| /* element() */ |
| /* elements */ |
| } |
| break; |
| case 7 : ; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:46: K_FOR // alt |
| { |
| [self mK_FOR]; |
| /* element() */ |
| /* elements */ |
| } |
| break; |
| case 8 : ; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:52: K_INT_TYPE // alt |
| { |
| [self mK_INT_TYPE]; |
| /* element() */ |
| /* elements */ |
| } |
| break; |
| case 9 : ; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:63: K_CHAR // alt |
| { |
| [self mK_CHAR]; |
| /* element() */ |
| /* elements */ |
| } |
| break; |
| case 10 : ; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:70: K_VOID // alt |
| { |
| [self mK_VOID]; |
| /* element() */ |
| /* elements */ |
| } |
| break; |
| case 11 : ; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:77: K_ID // alt |
| { |
| [self mK_ID]; |
| /* element() */ |
| /* elements */ |
| } |
| break; |
| case 12 : ; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:82: K_INT // alt |
| { |
| [self mK_INT]; |
| /* element() */ |
| /* elements */ |
| } |
| break; |
| case 13 : ; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:88: K_EQ // alt |
| { |
| [self mK_EQ]; |
| /* element() */ |
| /* elements */ |
| } |
| break; |
| case 14 : ; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:93: K_EQEQ // alt |
| { |
| [self mK_EQEQ]; |
| /* element() */ |
| /* elements */ |
| } |
| break; |
| case 15 : ; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:100: K_LT // alt |
| { |
| [self mK_LT]; |
| /* element() */ |
| /* elements */ |
| } |
| break; |
| case 16 : ; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:105: K_PLUS // alt |
| { |
| [self mK_PLUS]; |
| /* element() */ |
| /* elements */ |
| } |
| break; |
| case 17 : ; |
| // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleC.g:1:112: WS // alt |
| { |
| [self mWS]; |
| /* element() */ |
| /* elements */ |
| } |
| break; |
| |
| } |
| |
| } |
| |
| @end /* end of SimpleCLexer implementation line 397 */ |
| |
| /* End of code |
| * ============================================================================= |
| */ |