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_comment ( c0 ) ) ;
95
		return(get_comment(c0));
103
	    }
96
	    }
104
	    case ',' : {
97
	    case ',': {
105
		return ( lex_comma ) ;
98
		return(lex_comma);
106
	    }
99
	    }
107
	    case '[' : {
100
	    case '[': {
108
		return ( lex_open ) ;
101
		return(lex_open);
109
	    }
102
	    }
110
	    case ']' : {
103
	    case ']': {
111
		return ( lex_close ) ;
104
		return(lex_close);
112
	    }
105
	    }
113
	    case LEX_EOF : {
106
	    case LEX_EOF: {
114
		return ( lex_eof ) ;
107
		return(lex_eof);
115
	    }
108
	    }
116
	}
109
	}
117
	if ( is_alpha ( t0 ) ) {
110
	if (is_alpha(t0)) {
118
	    return ( get_identifier ( c0 ) ) ;
111
	    return(get_identifier(c0));
119
	} else if ( is_digit ( t0 ) ) {
112
	} else if (is_digit(t0)) {
120
	    return ( get_number ( c0 ) ) ;
113
	    return(get_number(c0));
121
	}
114
	}
122
	return ( unknown_token ( c0 ) ) ;
115
	return(unknown_token(c0));
123
    }
116
    }
124
}
117
}