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/tendra4/src/utilities/sid/c-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
/*** c-lexer.h --- SID C lexical analyser.
32
 *
33
 ** Author: Steve Folkes <smf@hermes.mod.uk>
34
 *
35
 *** Commentary:
36
 *
37
 * See the file "c-lexer.c" for details.
38
 *
39
 *** Change Log:
40
 * $Log: c-lexer.h,v $
41
 * Revision 1.1.1.1  1998/01/17  15:57:42  release
42
 * First version to be checked into rolling release.
43
 *
44
 * Revision 1.2  1994/12/15  09:55:58  smf
45
 * Brought into line with OSSG C Coding Standards Document, as per
46
 * "CR94_178.sid+tld-update".
47
 *
48
 * Revision 1.1.1.1  1994/07/25  16:04:14  smf
49
 * Initial import of SID 1.8 non shared files.
50
 *
51
**/
52
 
53
/****************************************************************************/
54
 
55
#ifndef H_C_LEXER
56
#define H_C_LEXER
57
 
58
#include "os-interface.h"
59
#include "c-code.h"
60
#include "dstring.h"
61
#include "istream.h"
62
 
63
/**** Note:
64
 *
65
 * It is important that any changes to this enumerated type declaration are
66
 * reflected in the "c-parser.sid" file.
67
**/
68
 
69
#ifdef FS_NO_ENUM
70
typedef int CTokenT, *CTokenP;
71
#define C_TOK_BLT_PREFIXES		(0)
72
#define C_TOK_BLT_MAPS			(1)
73
#define C_TOK_BLT_ASSIGNMENTS		(2)
74
#define C_TOK_BLT_TERMINALS		(3)
75
#define C_TOK_BLT_HEADER		(4)
76
#define C_TOK_BLT_ACTIONS		(5)
77
#define C_TOK_BLT_TRAILER		(6)
78
#define C_TOK_BLT_RESULT_ASSIGN		(7)
79
#define C_TOK_SID_IDENTIFIER		(8)
80
#define C_TOK_C_IDENTIFIER		(9)
81
#define C_TOK_SEPARATOR			(10)
82
#define C_TOK_TYPEMARK			(11)
83
#define C_TOK_TERMINATOR		(12)
84
#define C_TOK_BEGIN_ACTION		(13)
85
#define C_TOK_DEFINE			(14)
86
#define C_TOK_END_ACTION		(15)
87
#define C_TOK_CODE			(16)
88
#define C_TOK_ARROW			(17)
89
#define C_TOK_OPEN_TUPLE		(18)
90
#define C_TOK_CLOSE_TUPLE		(19)
91
#define C_TOK_BLT_PARAM_ASSIGN		(20)
92
#define C_TOK_REFERENCE			(21)
93
#define C_TOK_EOF			(22)
94
#define C_TOK_ERROR			(23)
95
#else
96
typedef enum {
97
    C_TOK_BLT_PREFIXES,
98
    C_TOK_BLT_MAPS,
99
    C_TOK_BLT_ASSIGNMENTS,
100
    C_TOK_BLT_TERMINALS,
101
    C_TOK_BLT_HEADER,
102
    C_TOK_BLT_ACTIONS,
103
    C_TOK_BLT_TRAILER,
104
    C_TOK_BLT_RESULT_ASSIGN,
105
    C_TOK_SID_IDENTIFIER,
106
    C_TOK_C_IDENTIFIER,
107
    C_TOK_SEPARATOR,
108
    C_TOK_TYPEMARK,
109
    C_TOK_TERMINATOR,
110
    C_TOK_BEGIN_ACTION,
111
    C_TOK_DEFINE,
112
    C_TOK_END_ACTION,
113
    C_TOK_CODE,
114
    C_TOK_ARROW,
115
    C_TOK_OPEN_TUPLE,
116
    C_TOK_CLOSE_TUPLE,
117
    C_TOK_BLT_PARAM_ASSIGN,
118
    C_TOK_REFERENCE,
119
    C_TOK_EOF,
120
    C_TOK_ERROR
121
} CTokenT, *CTokenP;
122
#endif /* defined (FS_NO_ENUM) */
123
 
124
typedef struct CLexT {
125
    CTokenT			t;
126
    union {
127
	NStringT		string;
128
	CCodeP			code;
129
    } u;
130
} CLexT, *CLexP;
131
 
132
typedef struct CLexerStreamT {
133
    IStreamT			istream;
134
    CLexT			token;
135
    CTokenT			saved_terminal;
136
} CLexerStreamT, *CLexerStreamP;
137
 
138
/*--------------------------------------------------------------------------*/
139
 
140
extern void			c_lexer_init
141
	PROTO_S ((CLexerStreamP, IStreamP));
142
extern void			c_lexer_close
143
	PROTO_S ((CLexerStreamP));
144
extern CStringP			c_lexer_stream_name
145
	PROTO_S ((CLexerStreamP));
146
extern unsigned			c_lexer_stream_line
147
	PROTO_S ((CLexerStreamP));
148
extern CTokenT			c_lexer_get_terminal
149
	PROTO_S ((CLexerStreamP));
150
extern void			c_lexer_next_token
151
	PROTO_S ((CLexerStreamP));
152
extern NStringP			c_lexer_string_value
153
	PROTO_S ((CLexerStreamP));
154
extern CCodeP			c_lexer_code_value
155
	PROTO_S ((CLexerStreamP));
156
extern void			c_lexer_save_terminal
157
	PROTO_S ((CLexerStreamP, CTokenT));
158
extern void			c_lexer_restore_terminal
159
	PROTO_S ((CLexerStreamP));
160
 
161
/*--------------------------------------------------------------------------*/
162
 
163
#ifdef FS_FAST
164
#define c_lexer_close(s) (istream_close (&((s)->istream)))
165
#define c_lexer_stream_name(s) (istream_name (&((s)->istream)))
166
#define c_lexer_stream_line(s) (istream_line (&((s)->istream)))
167
#define c_lexer_get_terminal(s) ((s)->token.t)
168
#define c_lexer_string_value(s) (&((s)->token.u.string))
169
#define c_lexer_code_value(s) ((s)->token.u.code)
170
#endif /* defined (FS_FAST) */
171
 
172
#endif /* !defined (H_C_LEXER) */
173
 
174
/*
175
 * Local variables(smf):
176
 * eval: (include::add-path-entry "../os-interface" "../library")
177
 * eval: (include::add-path-entry "../transforms" "../output")
178
 * eval: (include::add-path-entry "../c-output" "../generated")
179
 * end:
180
**/