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
 
-
 
83
#ifndef PROTO_Z
-
 
84
#ifdef __STDC__
-
 
85
#define PROTO_Z()		( void )
-
 
86
#else
-
 
87
#define PROTO_Z()		()
-
 
88
#endif
-
 
89
#endif
-
 
90
 
82
 
91
 
83
 
92
/* MAIN PASS ANALYSER */
84
/* MAIN PASS ANALYSER */
93
 
85
 
-
 
86
int
94
int read_token PROTO_Z ()
87
read_token(void)
95
{
88
{
96
    start : {
89
    start: {
97
	int c0 = read_char (), t0 ;
90
	int c0 = read_char(), t0;
98
	t0 = lookup_char ( c0 ) ;
91
	t0 = lookup_char(c0);
99
	if ( is_white ( t0 ) ) goto start ;
92
	if (is_white(t0)) goto start;
100
	switch ( c0 ) {
93
	switch (c0) {
101
	    case '"' : {
94
	    case '"': {
102
		return ( get_string ( c0 ) ) ;
95
		return(get_string(c0));
103
	    }
96
	    }
104
	    case '$' : {
97
	    case '$': {
105
		int c1 = read_char (), t1 ;
98
		int c1 = read_char(), t1;
106
		t1 = lookup_char ( c1 ) ;
99
		t1 = lookup_char(c1);
107
		if ( is_alpha ( t1 ) ) {
100
		if (is_alpha(t1)) {
108
		    return ( get_sid_ident ( c0, c1 ) ) ;
101
		    return(get_sid_ident(c0, c1));
109
		}
102
		}
110
		unread_char ( c1 ) ;
103
		unread_char(c1);
111
		break ;
104
		break;
112
	    }
105
	    }
113
	    case '(' : {
106
	    case '(': {
114
		return ( lex_open ) ;
107
		return(lex_open);
115
	    }
108
	    }
116
	    case ')' : {
109
	    case ')': {
117
		return ( lex_close ) ;
110
		return(lex_close);
118
	    }
111
	    }
119
	    case '+' : {
112
	    case '+': {
120
		return ( lex_plus ) ;
113
		return(lex_plus);
121
	    }
114
	    }
122
	    case '-' : {
115
	    case '-': {
123
		int c1 = read_char () ;
116
		int c1 = read_char();
124
		if ( c1 == '>' ) {
117
		if (c1 == '>') {
125
		    return ( lex_arrow ) ;
118
		    return(lex_arrow);
126
		}
119
		}
127
		unread_char ( c1 ) ;
120
		unread_char(c1);
128
		break ;
121
		break;
129
	    }
122
	    }
130
	    case '/' : {
123
	    case '/': {
131
		int c1 = read_char () ;
124
		int c1 = read_char();
132
		if ( c1 == '*' ) {
125
		if (c1 == '*') {
133
		    return ( get_comment ( c0, c1 ) ) ;
126
		    return(get_comment(c0, c1));
134
		}
127
		}
135
		unread_char ( c1 ) ;
128
		unread_char(c1);
136
		break ;
129
		break;
137
	    }
130
	    }
138
	    case ';' : {
131
	    case ';': {
139
		return ( lex_semicolon ) ;
132
		return(lex_semicolon);
140
	    }
133
	    }
141
	    case '=' : {
134
	    case '=': {
142
		return ( lex_equal ) ;
135
		return(lex_equal);
143
	    }
136
	    }
144
	    case '{' : {
137
	    case '{': {
145
		int c1 = read_char () ;
138
		int c1 = read_char();
146
		if ( c1 == '0' ) {
139
		if (c1 == '0') {
147
		    int c2 = read_char () ;
140
		    int c2 = read_char();
148
		    if ( c2 == '-' ) {
141
		    if (c2 == '-') {
149
			int c3 = read_char () ;
142
			int c3 = read_char();
150
			if ( c3 == '9' ) {
143
			if (c3 == '9') {
151
			    int c4 = read_char () ;
144
			    int c4 = read_char();
152
			    if ( c4 == '}' ) {
145
			    if (c4 == '}') {
153
				return ( lex_digit ) ;
146
				return(lex_digit);
154
			    }
147
			    }
155
			    unread_char ( c4 ) ;
148
			    unread_char(c4);
156
			}
149
			}
157
			unread_char ( c3 ) ;
150
			unread_char(c3);
158
		    }
151
		    }
159
		    unread_char ( c2 ) ;
152
		    unread_char(c2);
160
		} else if ( c1 == 'A' ) {
153
		} else if (c1 == 'A') {
161
		    int c2 = read_char () ;
154
		    int c2 = read_char();
162
		    if ( c2 == '-' ) {
155
		    if (c2 == '-') {
163
			int c3 = read_char () ;
156
			int c3 = read_char();
164
			if ( c3 == 'Z' ) {
157
			if (c3 == 'Z') {
165
			    int c4 = read_char () ;
158
			    int c4 = read_char();
166
			    if ( c4 == '}' ) {
159
			    if (c4 == '}') {
167
				return ( lex_upper ) ;
160
				return(lex_upper);
168
			    }
161
			    }
169
			    unread_char ( c4 ) ;
162
			    unread_char(c4);
170
			}
163
			}
171
			unread_char ( c3 ) ;
164
			unread_char(c3);
172
		    }
165
		    }
173
		    unread_char ( c2 ) ;
166
		    unread_char(c2);
174
		} else if ( c1 == 'a' ) {
167
		} else if (c1 == 'a') {
175
		    int c2 = read_char () ;
168
		    int c2 = read_char();
176
		    if ( c2 == '-' ) {
169
		    if (c2 == '-') {
177
			int c3 = read_char () ;
170
			int c3 = read_char();
178
			if ( c3 == 'z' ) {
171
			if (c3 == 'z') {
179
			    int c4 = read_char () ;
172
			    int c4 = read_char();
180
			    if ( c4 == '}' ) {
173
			    if (c4 == '}') {
181
				return ( lex_lower ) ;
174
				return(lex_lower);
182
			    }
175
			    }
183
			    unread_char ( c4 ) ;
176
			    unread_char(c4);
184
			}
177
			}
185
			unread_char ( c3 ) ;
178
			unread_char(c3);
186
		    }
179
		    }
187
		    unread_char ( c2 ) ;
180
		    unread_char(c2);
188
		}
181
		}
189
		unread_char ( c1 ) ;
182
		unread_char(c1);
190
		return ( lex_open_Hbrace ) ;
183
		return(lex_open_Hbrace);
191
	    }
184
	    }
192
	    case '}' : {
185
	    case '}': {
193
		return ( lex_close_Hbrace ) ;
186
		return(lex_close_Hbrace);
194
	    }
187
	    }
195
	    case LEX_EOF : {
188
	    case LEX_EOF: {
196
		return ( lex_eof ) ;
189
		return(lex_eof);
197
	    }
190
	    }
198
	}
191
	}
199
	if ( is_alpha ( t0 ) ) {
192
	if (is_alpha(t0)) {
200
	    return ( get_identifier ( c0 ) ) ;
193
	    return(get_identifier(c0));
201
	}
194
	}
202
	return ( unknown_token ( c0 ) ) ;
195
	return(unknown_token(c0));
203
    }
196
    }
204
}
197
}