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 |
#ifndef LEX_INCLUDED
|
|
|
32 |
#define LEX_INCLUDED
|
|
|
33 |
|
|
|
34 |
|
|
|
35 |
/*
|
|
|
36 |
LEXICAL ANALYSIS DECLARATIONS
|
|
|
37 |
|
|
|
38 |
The routines in this module are concerned with the lexical analysis
|
|
|
39 |
of the input, including its decomposition into preprocessing tokens
|
|
|
40 |
using the routine read_token.
|
|
|
41 |
*/
|
|
|
42 |
|
|
|
43 |
extern void init_lex PROTO_S ( ( void ) ) ;
|
|
|
44 |
extern void init_char PROTO_S ( ( void ) ) ;
|
|
|
45 |
extern void process_file PROTO_S ( ( void ) ) ;
|
|
|
46 |
extern IDENTIFIER make_keyword PROTO_S ( ( HASHID, int, IDENTIFIER ) ) ;
|
|
|
47 |
extern void init_keywords PROTO_S ( ( void ) ) ;
|
|
|
48 |
extern int read_token PROTO_S ( ( void ) ) ;
|
|
|
49 |
extern int read_string PROTO_S ( ( int, int ) ) ;
|
|
|
50 |
extern int peek_char PROTO_S ( ( int, int * ) ) ;
|
|
|
51 |
extern int skip_to_end PROTO_S ( ( void ) ) ;
|
|
|
52 |
extern unsigned long skip_white PROTO_S ( ( int ) ) ;
|
|
|
53 |
extern void patch_white PROTO_S ( ( unsigned long ) ) ;
|
|
|
54 |
extern int get_digraph PROTO_S ( ( int ) ) ;
|
|
|
55 |
extern int primary_form PROTO_S ( ( int ) ) ;
|
|
|
56 |
extern int is_white_char PROTO_S ( ( unsigned long ) ) ;
|
|
|
57 |
extern int is_alpha_char PROTO_S ( ( unsigned long ) ) ;
|
|
|
58 |
extern int is_legal_char PROTO_S ( ( unsigned long ) ) ;
|
|
|
59 |
extern void set_char_lookup PROTO_S ( ( int, int ) ) ;
|
|
|
60 |
extern void set_character PROTO_S ( ( EXP, EXP ) ) ;
|
|
|
61 |
|
|
|
62 |
|
|
|
63 |
/*
|
|
|
64 |
LEXICAL TOKEN INFORMATION
|
|
|
65 |
|
|
|
66 |
These variables are used by read_token to hold information about the
|
|
|
67 |
current lexical token.
|
|
|
68 |
*/
|
|
|
69 |
|
|
|
70 |
extern BUFFER token_buff ;
|
|
|
71 |
extern HASHID token_hashid ;
|
|
|
72 |
extern CONST char *token_names [] ;
|
|
|
73 |
|
|
|
74 |
|
|
|
75 |
/*
|
|
|
76 |
LEXICAL ANALYSIS OPTIONS
|
|
|
77 |
|
|
|
78 |
These variables are used to configure the lexical analysis routines.
|
|
|
79 |
*/
|
|
|
80 |
|
|
|
81 |
extern int allow_trigraphs ;
|
|
|
82 |
extern int allow_digraphs ;
|
|
|
83 |
extern int allow_unicodes ;
|
|
|
84 |
extern int allow_multibyte ;
|
|
|
85 |
extern int allow_cpp_comments ;
|
|
|
86 |
extern int allow_dos_newline ;
|
|
|
87 |
extern int allow_extra_symbols ;
|
|
|
88 |
extern int allow_iso_keywords ;
|
|
|
89 |
extern int analyse_comments ;
|
|
|
90 |
extern unsigned long max_id_length ;
|
|
|
91 |
|
|
|
92 |
|
|
|
93 |
/*
|
|
|
94 |
TOKEN NAME LOOK-UP
|
|
|
95 |
|
|
|
96 |
The macro token_name is used to look up the name associated with the
|
|
|
97 |
lexical token number T.
|
|
|
98 |
*/
|
|
|
99 |
|
|
|
100 |
#define token_name( T ) ( ustrlit ( token_names [ ( T ) ] ) )
|
|
|
101 |
|
|
|
102 |
|
|
|
103 |
/*
|
|
|
104 |
WHITE-SPACE INDICATORS
|
|
|
105 |
|
|
|
106 |
These macros are used by skip_white to indicate the form of the white-
|
|
|
107 |
space characters skipped.
|
|
|
108 |
*/
|
|
|
109 |
|
|
|
110 |
#define WHITE_SPACE ( ( unsigned long ) 0x01 )
|
|
|
111 |
#define WHITE_NEWLINE ( ( unsigned long ) 0x02 )
|
|
|
112 |
#define WHITE_ESC_NEWLINE ( ( unsigned long ) 0x04 )
|
|
|
113 |
#define WHITE_MASK ( WHITE_SPACE | WHITE_NEWLINE )
|
|
|
114 |
|
|
|
115 |
|
|
|
116 |
#endif
|