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 |
/*
|
|
|
32 |
LEXICAL ANALYSER FOR TSPEC
|
|
|
33 |
|
|
|
34 |
This file describes the lexical analyser used by tspec.
|
|
|
35 |
*/
|
|
|
36 |
|
|
|
37 |
/* Character groups */
|
|
|
38 |
GROUP white = " \t\n\r" ;
|
|
|
39 |
GROUP alpha = {A-Z} + {a-z} + "_" ;
|
|
|
40 |
GROUP digit = {0-9} ;
|
|
|
41 |
GROUP alphanum = "[alpha][digit]" ;
|
|
|
42 |
|
|
|
43 |
/* Simple symbols */
|
|
|
44 |
TOKEN "!" -> $exclaim ;
|
|
|
45 |
TOKEN "(" -> $open-round ;
|
|
|
46 |
TOKEN ")" -> $close-round ;
|
|
|
47 |
TOKEN "*" -> $star ;
|
|
|
48 |
TOKEN "," -> $comma ;
|
|
|
49 |
TOKEN "-" -> $minus ;
|
|
|
50 |
TOKEN "." -> $dot ;
|
|
|
51 |
TOKEN ".." -> $dot-dot ;
|
|
|
52 |
TOKEN "..." -> $ellipsis ;
|
|
|
53 |
TOKEN ":" -> $colon ;
|
|
|
54 |
TOKEN ":=" -> $assign ;
|
|
|
55 |
TOKEN ";" -> $semicolon ;
|
|
|
56 |
TOKEN "=" -> $equal ;
|
|
|
57 |
TOKEN "?" -> $question ;
|
|
|
58 |
TOKEN "\e" -> $eof ;
|
|
|
59 |
TOKEN "\[" -> $open-square ;
|
|
|
60 |
TOKEN "]" -> $close-square ;
|
|
|
61 |
TOKEN "{" -> $open-brace ;
|
|
|
62 |
TOKEN "}" -> $close-brace ;
|
|
|
63 |
TOKEN "|" -> $or ;
|
|
|
64 |
|
|
|
65 |
/* Comments, strings and identifiers */
|
|
|
66 |
TOKEN "#" -> get_comment () ;
|
|
|
67 |
TOKEN "/*" -> get_c_comment () ;
|
|
|
68 |
TOKEN "%%" -> get_text () ;
|
|
|
69 |
TOKEN "\"" -> get_string () ;
|
|
|
70 |
TOKEN "[alpha]" -> get_global () ;
|
|
|
71 |
TOKEN "~[alpha]" -> get_local () ;
|
|
|
72 |
TOKEN "+[alpha]" -> get_command () ;
|
|
|
73 |
TOKEN "$[alpha]" -> get_variable () ;
|
|
|
74 |
TOKEN "[digit]" -> get_number () ;
|
|
|
75 |
|
|
|
76 |
/* Keywords */
|
|
|
77 |
KEYWORD "arith" -> $arith ;
|
|
|
78 |
KEYWORD "char" -> $char ;
|
|
|
79 |
KEYWORD "const" -> $const ;
|
|
|
80 |
KEYWORD "double" -> $double ;
|
|
|
81 |
KEYWORD "enum" -> $enum ;
|
|
|
82 |
KEYWORD "extern" -> $extern ;
|
|
|
83 |
KEYWORD "float" -> $float ;
|
|
|
84 |
KEYWORD "int" -> $int ;
|
|
|
85 |
KEYWORD "long" -> $long ;
|
|
|
86 |
KEYWORD "lvalue" -> $lvalue ;
|
|
|
87 |
KEYWORD "scalar" -> $scalar ;
|
|
|
88 |
KEYWORD "short" -> $short ;
|
|
|
89 |
KEYWORD "signed" -> $signed ;
|
|
|
90 |
KEYWORD "struct" -> $struct ;
|
|
|
91 |
KEYWORD "union" -> $union ;
|
|
|
92 |
KEYWORD "unsigned" -> $unsigned ;
|
|
|
93 |
KEYWORD "void" -> $void ;
|
|
|
94 |
KEYWORD "volatile" -> $volatile ;
|
|
|
95 |
KEYWORD "weak" -> $weak ;
|
|
|
96 |
KEYWORD "+BASE_API" -> $base-api ;
|
|
|
97 |
KEYWORD "+CONST" -> $constant ;
|
|
|
98 |
KEYWORD "+DEFINE" -> $define ;
|
6 |
7u83 |
99 |
KEYWORD "+DEFMIN" -> $defmin ;
|
2 |
7u83 |
100 |
KEYWORD "+ELSE" -> $else ;
|
|
|
101 |
KEYWORD "+ENDIF" -> $endif ;
|
|
|
102 |
KEYWORD "+ENUM" -> $enumerate ;
|
|
|
103 |
KEYWORD "+EXP" -> $exp ;
|
|
|
104 |
KEYWORD "+FIELD" -> $field ;
|
|
|
105 |
KEYWORD "+FUNC" -> $func ;
|
|
|
106 |
KEYWORD "+IF" -> $if ;
|
|
|
107 |
KEYWORD "+IFDEF" -> $ifdef ;
|
|
|
108 |
KEYWORD "+IFNDEF" -> $ifndef ;
|
|
|
109 |
KEYWORD "+IMPLEMENT" -> $implement ;
|
|
|
110 |
KEYWORD "+INFO" -> $info ;
|
|
|
111 |
KEYWORD "+MACRO" -> $macro ;
|
|
|
112 |
KEYWORD "+NAT" -> $nat ;
|
|
|
113 |
KEYWORD "+SET" -> $set ;
|
|
|
114 |
KEYWORD "+STATEMENT" -> $statement ;
|
|
|
115 |
KEYWORD "+SUBSET" -> $subset ;
|
|
|
116 |
KEYWORD "+TOKEN" -> $token ;
|
|
|
117 |
KEYWORD "+TYPE" -> $type ;
|
|
|
118 |
KEYWORD "+TYPEDEF" -> $typedef ;
|
|
|
119 |
KEYWORD "+USE" -> $use ;
|
|
|
120 |
KEYWORD "~building_libs" -> $building ;
|
|
|
121 |
KEYWORD "~promote" -> $promote ;
|
|
|
122 |
KEYWORD "~protect" -> $protect ;
|
|
|
123 |
KEYWORD "~special" -> $special ;
|