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 ( lex_exclaim ) ;
95
		return(lex_exclaim);
103
	    }
96
	    }
104
	    case '"' : {
97
	    case '"': {
105
		return ( get_string ( c0 ) ) ;
98
		return(get_string(c0));
106
	    }
99
	    }
107
	    case '#' : {
100
	    case '#': {
108
		return ( get_comment ( c0 ) ) ;
101
		return(get_comment(c0));
109
	    }
102
	    }
110
	    case '$' : {
103
	    case '$': {
111
		int c1 = read_char (), t1 ;
104
		int c1 = read_char(), t1;
112
		t1 = lookup_char ( c1 ) ;
105
		t1 = lookup_char(c1);
113
		if ( is_alpha ( t1 ) ) {
106
		if (is_alpha(t1)) {
114
		    return ( get_variable ( c0, c1 ) ) ;
107
		    return(get_variable(c0, c1));
115
		}
108
		}
116
		unread_char ( c1 ) ;
109
		unread_char(c1);
117
		break ;
110
		break;
118
	    }
111
	    }
119
	    case '%' : {
112
	    case '%': {
120
		int c1 = read_char () ;
113
		int c1 = read_char();
121
		if ( c1 == '%' ) {
114
		if (c1 == '%') {
122
		    return ( get_text ( c0, c1 ) ) ;
115
		    return(get_text(c0, c1));
123
		}
116
		}
124
		unread_char ( c1 ) ;
117
		unread_char(c1);
125
		break ;
118
		break;
126
	    }
119
	    }
127
	    case '(' : {
120
	    case '(': {
128
		return ( lex_open_Hround ) ;
121
		return(lex_open_Hround);
129
	    }
122
	    }
130
	    case ')' : {
123
	    case ')': {
131
		return ( lex_close_Hround ) ;
124
		return(lex_close_Hround);
132
	    }
125
	    }
133
	    case '*' : {
126
	    case '*': {
134
		return ( lex_star ) ;
127
		return(lex_star);
135
	    }
128
	    }
136
	    case '+' : {
129
	    case '+': {
137
		int c1 = read_char (), t1 ;
130
		int c1 = read_char(), t1;
138
		t1 = lookup_char ( c1 ) ;
131
		t1 = lookup_char(c1);
139
		if ( is_alpha ( t1 ) ) {
132
		if (is_alpha(t1)) {
140
		    return ( get_command ( c0, c1 ) ) ;
133
		    return(get_command(c0, c1));
141
		}
134
		}
142
		unread_char ( c1 ) ;
135
		unread_char(c1);
143
		break ;
136
		break;
144
	    }
137
	    }
145
	    case ',' : {
138
	    case ',': {
146
		return ( lex_comma ) ;
139
		return(lex_comma);
147
	    }
140
	    }
148
	    case '-' : {
141
	    case '-': {
149
		return ( lex_minus ) ;
142
		return(lex_minus);
150
	    }
143
	    }
151
	    case '.' : {
144
	    case '.': {
152
		int c1 = read_char () ;
145
		int c1 = read_char();
153
		if ( c1 == '.' ) {
146
		if (c1 == '.') {
154
		    int c2 = read_char () ;
147
		    int c2 = read_char();
155
		    if ( c2 == '.' ) {
148
		    if (c2 == '.') {
156
			return ( lex_ellipsis ) ;
149
			return(lex_ellipsis);
157
		    }
150
		    }
158
		    unread_char ( c2 ) ;
151
		    unread_char(c2);
159
		    return ( lex_dot_Hdot ) ;
152
		    return(lex_dot_Hdot);
160
		}
153
		}
161
		unread_char ( c1 ) ;
154
		unread_char(c1);
162
		return ( lex_dot ) ;
155
		return(lex_dot);
163
	    }
156
	    }
164
	    case '/' : {
157
	    case '/': {
165
		int c1 = read_char () ;
158
		int c1 = read_char();
166
		if ( c1 == '*' ) {
159
		if (c1 == '*') {
167
		    return ( get_c_comment ( c0, c1 ) ) ;
160
		    return(get_c_comment(c0, c1));
168
		}
161
		}
169
		unread_char ( c1 ) ;
162
		unread_char(c1);
170
		break ;
163
		break;
171
	    }
164
	    }
172
	    case ':' : {
165
	    case ':': {
173
		int c1 = read_char () ;
166
		int c1 = read_char();
174
		if ( c1 == '=' ) {
167
		if (c1 == '=') {
175
		    return ( lex_assign ) ;
168
		    return(lex_assign);
176
		}
169
		}
177
		unread_char ( c1 ) ;
170
		unread_char(c1);
178
		return ( lex_colon ) ;
171
		return(lex_colon);
179
	    }
172
	    }
180
	    case ';' : {
173
	    case ';': {
181
		return ( lex_semicolon ) ;
174
		return(lex_semicolon);
182
	    }
175
	    }
183
	    case '=' : {
176
	    case '=': {
184
		return ( lex_equal ) ;
177
		return(lex_equal);
185
	    }
178
	    }
186
	    case '?' : {
179
	    case '?': {
187
		return ( lex_question ) ;
180
		return(lex_question);
188
	    }
181
	    }
189
	    case '[' : {
182
	    case '[': {
190
		return ( lex_open_Hsquare ) ;
183
		return(lex_open_Hsquare);
191
	    }
184
	    }
192
	    case ']' : {
185
	    case ']': {
193
		return ( lex_close_Hsquare ) ;
186
		return(lex_close_Hsquare);
194
	    }
187
	    }
195
	    case '{' : {
188
	    case '{': {
196
		return ( lex_open_Hbrace ) ;
189
		return(lex_open_Hbrace);
197
	    }
190
	    }
198
	    case '|' : {
191
	    case '|': {
199
		return ( lex_or ) ;
192
		return(lex_or);
200
	    }
193
	    }
201
	    case '}' : {
194
	    case '}': {
202
		return ( lex_close_Hbrace ) ;
195
		return(lex_close_Hbrace);
203
	    }
196
	    }
204
	    case '~' : {
197
	    case '~': {
205
		int c1 = read_char (), t1 ;
198
		int c1 = read_char(), t1;
206
		t1 = lookup_char ( c1 ) ;
199
		t1 = lookup_char(c1);
207
		if ( is_alpha ( t1 ) ) {
200
		if (is_alpha(t1)) {
208
		    return ( get_local ( c0, c1 ) ) ;
201
		    return(get_local(c0, c1));
209
		}
202
		}
210
		unread_char ( c1 ) ;
203
		unread_char(c1);
211
		break ;
204
		break;
212
	    }
205
	    }
213
	    case LEX_EOF : {
206
	    case LEX_EOF: {
214
		return ( lex_eof ) ;
207
		return(lex_eof);
215
	    }
208
	    }
216
	}
209
	}
217
	if ( is_alpha ( t0 ) ) {
210
	if (is_alpha(t0)) {
218
	    return ( get_global ( c0 ) ) ;
211
	    return(get_global(c0));
219
	} else if ( is_digit ( t0 ) ) {
212
	} else if (is_digit(t0)) {
220
	    return ( get_number ( c0 ) ) ;
213
	    return(get_number(c0));
221
	}
214
	}
222
	return ( unknown_token ( c0 ) ) ;
215
	return(unknown_token(c0));
223
    }
216
    }
224
}
217
}