Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – tendra.SVN – Blame – /branches/tendra5/src/utilities/lexi/lexer.h – Rev 2

Subversion Repositories tendra.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
2
    		 Crown Copyright (c) 1997
3
 
4
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
12
 
13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
15
 
16
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
19
 
20
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
22
        these conditions;
23
 
24
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
28
*/
29
 
30
/*
31
    AUTOMATICALLY GENERATED BY lexi VERSION 1.1
32
*/
33
 
34
 
35
/* LOOKUP TABLE */
36
 
37
static unsigned char lookup_tab [257] = {
38
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
39
    0x0000, 0x0001, 0x0001, 0x0000, 0x0000, 0x0001, 0x0000, 0x0000,
40
    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,
43
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
44
    0x000c, 0x000c, 0x000c, 0x000c, 0x000c, 0x000c, 0x000c, 0x000c,
45
    0x000c, 0x000c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
46
    0x0000, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a,
47
    0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a,
48
    0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a,
49
    0x000a, 0x000a, 0x000a, 0x0000, 0x0000, 0x0000, 0x0000, 0x000a,
50
    0x0000, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a,
51
    0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a,
52
    0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a,
53
    0x000a, 0x000a, 0x000a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
54
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
55
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
56
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
57
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
58
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
59
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
60
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
61
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
62
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
63
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
64
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
65
    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,
68
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
69
    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
70
    0x0000
71
} ;
72
 
73
#ifndef LEX_EOF
74
#define LEX_EOF			256
75
#endif
76
 
77
#define lookup_char( C )	( ( int ) lookup_tab [ ( C ) ] )
78
#define is_white( T )		( ( T ) & 0x0001 )
79
#define is_alpha( T )		( ( T ) & 0x0002 )
80
#define is_digit( T )		( ( T ) & 0x0004 )
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
 
91
 
92
/* MAIN PASS ANALYSER */
93
 
94
int read_token PROTO_Z ()
95
{
96
    start : {
97
	int c0 = read_char (), t0 ;
98
	t0 = lookup_char ( c0 ) ;
99
	if ( is_white ( t0 ) ) goto start ;
100
	switch ( c0 ) {
101
	    case '"' : {
102
		return ( get_string ( c0 ) ) ;
103
	    }
104
	    case '$' : {
105
		int c1 = read_char (), t1 ;
106
		t1 = lookup_char ( c1 ) ;
107
		if ( is_alpha ( t1 ) ) {
108
		    return ( get_sid_ident ( c0, c1 ) ) ;
109
		}
110
		unread_char ( c1 ) ;
111
		break ;
112
	    }
113
	    case '(' : {
114
		return ( lex_open ) ;
115
	    }
116
	    case ')' : {
117
		return ( lex_close ) ;
118
	    }
119
	    case '+' : {
120
		return ( lex_plus ) ;
121
	    }
122
	    case '-' : {
123
		int c1 = read_char () ;
124
		if ( c1 == '>' ) {
125
		    return ( lex_arrow ) ;
126
		}
127
		unread_char ( c1 ) ;
128
		break ;
129
	    }
130
	    case '/' : {
131
		int c1 = read_char () ;
132
		if ( c1 == '*' ) {
133
		    return ( get_comment ( c0, c1 ) ) ;
134
		}
135
		unread_char ( c1 ) ;
136
		break ;
137
	    }
138
	    case ';' : {
139
		return ( lex_semicolon ) ;
140
	    }
141
	    case '=' : {
142
		return ( lex_equal ) ;
143
	    }
144
	    case '{' : {
145
		int c1 = read_char () ;
146
		if ( c1 == '0' ) {
147
		    int c2 = read_char () ;
148
		    if ( c2 == '-' ) {
149
			int c3 = read_char () ;
150
			if ( c3 == '9' ) {
151
			    int c4 = read_char () ;
152
			    if ( c4 == '}' ) {
153
				return ( lex_digit ) ;
154
			    }
155
			    unread_char ( c4 ) ;
156
			}
157
			unread_char ( c3 ) ;
158
		    }
159
		    unread_char ( c2 ) ;
160
		} else if ( c1 == 'A' ) {
161
		    int c2 = read_char () ;
162
		    if ( c2 == '-' ) {
163
			int c3 = read_char () ;
164
			if ( c3 == 'Z' ) {
165
			    int c4 = read_char () ;
166
			    if ( c4 == '}' ) {
167
				return ( lex_upper ) ;
168
			    }
169
			    unread_char ( c4 ) ;
170
			}
171
			unread_char ( c3 ) ;
172
		    }
173
		    unread_char ( c2 ) ;
174
		} else if ( c1 == 'a' ) {
175
		    int c2 = read_char () ;
176
		    if ( c2 == '-' ) {
177
			int c3 = read_char () ;
178
			if ( c3 == 'z' ) {
179
			    int c4 = read_char () ;
180
			    if ( c4 == '}' ) {
181
				return ( lex_lower ) ;
182
			    }
183
			    unread_char ( c4 ) ;
184
			}
185
			unread_char ( c3 ) ;
186
		    }
187
		    unread_char ( c2 ) ;
188
		}
189
		unread_char ( c1 ) ;
190
		return ( lex_open_Hbrace ) ;
191
	    }
192
	    case '}' : {
193
		return ( lex_close_Hbrace ) ;
194
	    }
195
	    case LEX_EOF : {
196
		return ( lex_eof ) ;
197
	    }
198
	}
199
	if ( is_alpha ( t0 ) ) {
200
	    return ( get_identifier ( c0 ) ) ;
201
	}
202
	return ( unknown_token ( c0 ) ) ;
203
    }
204
}