Subversion Repositories tendra.SVN

Rev

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 7
Line 26... Line 26...
26
        no liability whatsoever in relation to any use to which
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
27
        it may be put.
28
*/
28
*/
29
 
29
 
30
/*
30
/*
31
    AUTOMATICALLY GENERATED BY lexi VERSION 1.1
31
 *  AUTOMATICALLY GENERATED BY lexi VERSION 1.2
32
*/
32
 */
33
 
33
 
34
 
34
 
35
/* LOOKUP TABLE */
35
/* LOOKUP TABLE */
36
 
36
 
37
static unsigned char lookup_tab [257] = {
37
static unsigned char lookup_tab[257] = {
38
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
38
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
39
    0x0000, 0x0001, 0x0001, 0x0000, 0x0000, 0x0001, 0x0000, 0x0000,
39
    0x0000, 0x0001, 0x0001, 0x0000, 0x0000, 0x0001, 0x0000, 0x0000,
40
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
40
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
41
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
41
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
42
    0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
42
    0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
Line 66... Line 66...
66
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
66
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
67
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
67
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
68
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
68
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
69
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
69
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
70
    0x0000
70
    0x0000
71
} ;
71
};
72
 
72
 
73
#ifndef LEX_EOF
73
#ifndef LEX_EOF
74
#define LEX_EOF			256
74
#define LEX_EOF		256
75
#endif
75
#endif
76
 
76
 
77
#define lookup_char( C )	( ( int ) lookup_tab [ ( C ) ] )
77
#define lookup_char(C)	((int)lookup_tab[(C)])
78
#define is_white( T )		( ( T ) & 0x0001 )
78
#define is_white(T)	((T) & 0x0001)
79
#define is_alpha( T )		( ( T ) & 0x0002 )
79
#define is_alpha(T)	((T) & 0x0002)
80
#define is_digit( T )		( ( T ) & 0x0004 )
80
#define is_digit(T)	((T) & 0x0004)
81
#define is_alphanum( T )	( ( T ) & 0x0008 )
81
#define is_alphanum(T)	((T) & 0x0008)
82
#define is_hexdigit( T )	( ( T ) & 0x0010 )
82
#define is_hexdigit(T)	((T) & 0x0010)
83
 
-
 
84
#ifndef PROTO_Z
-
 
85
#ifdef __STDC__
-
 
86
#define PROTO_Z()		( void )
-
 
87
#else
-
 
88
#define PROTO_Z()		()
-
 
89
#endif
-
 
90
#endif
-
 
91
 
83
 
92
 
84
 
93
/* MAIN PASS ANALYSER */
85
/* MAIN PASS ANALYSER */
94
 
86
 
-
 
87
int
95
int read_token PROTO_Z ()
88
read_token(void)
96
{
89
{
97
    start : {
90
    start: {
98
	int c0 = read_char (), t0 ;
91
	int c0 = read_char(), t0;
99
	t0 = lookup_char ( c0 ) ;
92
	t0 = lookup_char(c0);
100
	if ( is_white ( t0 ) ) goto start ;
93
	if (is_white(t0)) goto start;
101
	switch ( c0 ) {
94
	switch (c0) {
102
	    case '!' : {
95
	    case '!': {
103
		return ( lex_exclaim ) ;
96
		return(lex_exclaim);
104
	    }
97
	    }
105
	    case '"' : {
98
	    case '"': {
106
		return ( get_string ( c0 ) ) ;
99
		return(get_string(c0));
107
	    }
100
	    }
108
	    case '#' : {
101
	    case '#': {
109
		return ( lex_hash ) ;
102
		return(lex_hash);
110
	    }
103
	    }
111
	    case '%' : {
104
	    case '%': {
112
		return ( lex_rem ) ;
105
		return(lex_rem);
113
	    }
106
	    }
114
	    case '&' : {
107
	    case '&': {
115
		return ( lex_and ) ;
108
		return(lex_and);
116
	    }
109
	    }
117
	    case '(' : {
110
	    case '(': {
118
		return ( lex_open_Hround ) ;
111
		return(lex_open_Hround);
119
	    }
112
	    }
120
	    case ')' : {
113
	    case ')': {
121
		return ( lex_close_Hround ) ;
114
		return(lex_close_Hround);
122
	    }
115
	    }
123
	    case '*' : {
116
	    case '*': {
124
		return ( lex_star ) ;
117
		return(lex_star);
125
	    }
118
	    }
126
	    case '+' : {
119
	    case '+': {
127
		return ( lex_plus ) ;
120
		return(lex_plus);
128
	    }
121
	    }
129
	    case ',' : {
122
	    case ',': {
130
		return ( lex_comma ) ;
123
		return(lex_comma);
131
	    }
124
	    }
132
	    case '-' : {
125
	    case '-': {
133
		int c1 = read_char () ;
126
		int c1 = read_char();
134
		if ( c1 == '>' ) {
127
		if (c1 == '>') {
135
		    return ( lex_arrow ) ;
128
		    return(lex_arrow);
136
		}
129
		}
137
		unread_char ( c1 ) ;
130
		unread_char(c1);
138
		return ( lex_minus ) ;
131
		return(lex_minus);
139
	    }
132
	    }
140
	    case '.' : {
133
	    case '.': {
141
		return ( lex_dot ) ;
134
		return(lex_dot);
142
	    }
135
	    }
143
	    case '/' : {
136
	    case '/': {
144
		int c1 = read_char () ;
137
		int c1 = read_char();
145
		if ( c1 == '*' ) {
138
		if (c1 == '*') {
146
		    return ( get_comment ( c0, c1 ) ) ;
139
		    return(get_comment(c0, c1));
147
		}
140
		}
148
		unread_char ( c1 ) ;
141
		unread_char(c1);
149
		return ( lex_div ) ;
142
		return(lex_div);
150
	    }
143
	    }
151
	    case '0' : {
144
	    case '0': {
152
		int c1 = read_char () ;
145
		int c1 = read_char();
153
		if ( c1 == 'X' ) {
146
		if (c1 == 'X') {
154
		    int c2 = read_char (), t2 ;
147
		    int c2 = read_char(), t2;
155
		    t2 = lookup_char ( c2 ) ;
148
		    t2 = lookup_char(c2);
156
		    if ( is_hexdigit ( t2 ) ) {
149
		    if (is_hexdigit(t2)) {
157
			return ( get_hex ( c0, c1, c2 ) ) ;
150
			return(get_hex(c0, c1, c2));
158
		    }
151
		    }
159
		    unread_char ( c2 ) ;
152
		    unread_char(c2);
160
		} else if ( c1 == 'x' ) {
153
		} else if (c1 == 'x') {
161
		    int c2 = read_char (), t2 ;
154
		    int c2 = read_char(), t2;
162
		    t2 = lookup_char ( c2 ) ;
155
		    t2 = lookup_char(c2);
163
		    if ( is_hexdigit ( t2 ) ) {
156
		    if (is_hexdigit(t2)) {
164
			return ( get_hex ( c0, c1, c2 ) ) ;
157
			return(get_hex(c0, c1, c2));
165
		    }
158
		    }
166
		    unread_char ( c2 ) ;
159
		    unread_char(c2);
167
		}
160
		}
168
		unread_char ( c1 ) ;
161
		unread_char(c1);
169
		break ;
162
		break;
170
	    }
163
	    }
171
	    case ':' : {
164
	    case ':': {
172
		int c1 = read_char () ;
165
		int c1 = read_char();
173
		if ( c1 == ':' ) {
166
		if (c1 == ':') {
174
		    return ( lex_colon_Hcolon ) ;
167
		    return(lex_colon_Hcolon);
175
		}
168
		}
176
		unread_char ( c1 ) ;
169
		unread_char(c1);
177
		return ( lex_colon ) ;
170
		return(lex_colon);
178
	    }
171
	    }
179
	    case ';' : {
172
	    case ';': {
180
		return ( lex_semicolon ) ;
173
		return(lex_semicolon);
181
	    }
174
	    }
182
	    case '<' : {
175
	    case '<': {
183
		int c1 = read_char () ;
176
		int c1 = read_char();
184
		if ( c1 == '<' ) {
177
		if (c1 == '<') {
185
		    return ( lex_lshift ) ;
178
		    return(lex_lshift);
186
		}
179
		}
187
		unread_char ( c1 ) ;
180
		unread_char(c1);
188
		break ;
181
		break;
189
	    }
182
	    }
190
	    case '=' : {
183
	    case '=': {
191
		return ( lex_equal ) ;
184
		return(lex_equal);
192
	    }
185
	    }
193
	    case '>' : {
186
	    case '>': {
194
		int c1 = read_char () ;
187
		int c1 = read_char();
195
		if ( c1 == '>' ) {
188
		if (c1 == '>') {
196
		    return ( lex_rshift ) ;
189
		    return(lex_rshift);
197
		}
190
		}
198
		unread_char ( c1 ) ;
191
		unread_char(c1);
199
		break ;
192
		break;
200
	    }
193
	    }
201
	    case '?' : {
194
	    case '?': {
202
		return ( lex_question ) ;
195
		return(lex_question);
203
	    }
196
	    }
204
	    case '[' : {
197
	    case '[': {
205
		return ( lex_open_Hsquare ) ;
198
		return(lex_open_Hsquare);
206
	    }
199
	    }
207
	    case ']' : {
200
	    case ']': {
208
		return ( lex_close_Hsquare ) ;
201
		return(lex_close_Hsquare);
209
	    }
202
	    }
210
	    case '^' : {
203
	    case '^': {
211
		return ( lex_xor ) ;
204
		return(lex_xor);
212
	    }
205
	    }
213
	    case '{' : {
206
	    case '{': {
214
		return ( lex_open_Hbrace ) ;
207
		return(lex_open_Hbrace);
215
	    }
208
	    }
216
	    case '|' : {
209
	    case '|': {
217
		return ( lex_or ) ;
210
		return(lex_or);
218
	    }
211
	    }
219
	    case '}' : {
212
	    case '}': {
220
		return ( lex_close_Hbrace ) ;
213
		return(lex_close_Hbrace);
221
	    }
214
	    }
222
	    case '~' : {
215
	    case '~': {
223
		return ( lex_compl ) ;
216
		return(lex_compl);
224
	    }
217
	    }
225
	    case LEX_EOF : {
218
	    case LEX_EOF: {
226
		return ( lex_eof ) ;
219
		return(lex_eof);
227
	    }
220
	    }
228
	}
221
	}
229
	if ( is_alpha ( t0 ) ) {
222
	if (is_alpha(t0)) {
230
	    return ( get_identifier ( c0 ) ) ;
223
	    return(get_identifier(c0));
231
	} else if ( is_digit ( t0 ) ) {
224
	} else if (is_digit(t0)) {
232
	    return ( get_number ( c0 ) ) ;
225
	    return(get_number(c0));
233
	}
226
	}
234
	return ( unknown_token ( c0 ) ) ;
227
	return(unknown_token(c0));
235
    }
228
    }
236
}
229
}