• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// $ANTLR 3.0 Test.gl 2007-08-04 15:59:43
2
3#import "TestLexer.h"
4
5/** As per Terence: No returns for lexer rules!
6#pragma mark Rule return scopes start
7#pragma mark Rule return scopes end
8*/
9@implementation TestLexer
10
11- (id) initWithCharStream:(id<ANTLRCharStream>)anInput
12{
13	if ((self = [super initWithCharStream:anInput]) != nil) {
14	}
15	return self;
16}
17
18- (void) dealloc
19{
20	[super dealloc];
21}
22
23+ (NSString *) tokenNameForType:(NSInteger)aTokenType
24{
25    return nil;
26}
27
28- (NSString *) grammarFileName
29{
30	return @"Test.gl";
31}
32
33
34- (void) mID
35{
36    @try {
37        ruleNestingLevel++;
38        int _type = TestLexer_ID;
39        // Test.gl:8:6: ( LETTER ( LETTER | DIGIT )* ) // ruleBlockSingleAlt
40        // Test.gl:8:6: LETTER ( LETTER | DIGIT )* // alt
41        {
42        [self mLETTER];
43
44
45        do {
46            int alt1=2;
47            {
48            	int LA1_0 = [input LA:1];
49            	if ( (LA1_0>='0' && LA1_0<='9')||(LA1_0>='A' && LA1_0<='Z')||(LA1_0>='a' && LA1_0<='z') ) {
50            		alt1 = 1;
51            	}
52
53            }
54            switch (alt1) {
55        	case 1 :
56        	    // Test.gl: // alt
57        	    {
58        	    if (([input LA:1]>='0' && [input LA:1]<='9')||([input LA:1]>='A' && [input LA:1]<='Z')||([input LA:1]>='a' && [input LA:1]<='z')) {
59        	    	[input consume];
60
61        	    } else {
62        	    	ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException exceptionWithSet:nil stream:input];
63        	    	[self recover:mse];	@throw mse;
64        	    }
65
66
67        	    }
68        	    break;
69
70        	default :
71        	    goto loop1;
72            }
73        } while (YES); loop1: ;
74
75
76        }
77
78        self->_tokenType = _type;
79    }
80    @finally {
81        ruleNestingLevel--;
82        // rule cleanup
83        // token+rule list labels
84
85    }
86    return;
87}
88// $ANTLR end ID
89
90
91- (void) mDIGIT
92{
93    @try {
94        ruleNestingLevel++;
95        // Test.gl:11:18: ( '0' .. '9' ) // ruleBlockSingleAlt
96        // Test.gl:11:18: '0' .. '9' // alt
97        {
98        [self matchRangeFromChar:'0' to:'9'];
99
100        }
101
102    }
103    @finally {
104        ruleNestingLevel--;
105        // rule cleanup
106        // token+rule list labels
107
108    }
109    return;
110}
111// $ANTLR end DIGIT
112
113
114- (void) mLETTER
115{
116    @try {
117        ruleNestingLevel++;
118        // Test.gl:15:4: ( 'a' .. 'z' | 'A' .. 'Z' ) // ruleBlockSingleAlt
119        // Test.gl: // alt
120        {
121        if (([input LA:1]>='A' && [input LA:1]<='Z')||([input LA:1]>='a' && [input LA:1]<='z')) {
122        	[input consume];
123
124        } else {
125        	ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException exceptionWithSet:nil stream:input];
126        	[self recover:mse];	@throw mse;
127        }
128
129
130        }
131
132    }
133    @finally {
134        ruleNestingLevel--;
135        // rule cleanup
136        // token+rule list labels
137
138    }
139    return;
140}
141// $ANTLR end LETTER
142
143- (void) mTokens
144{
145    // Test.gl:1:10: ( ID ) // ruleBlockSingleAlt
146    // Test.gl:1:10: ID // alt
147    {
148    [self mID];
149
150
151
152    }
153
154
155}
156
157@end