8 #define yylval vhd_bcomplval
11 #include "bvl_byacc.h"
12 #include "vhd_bcomp.tab.h"
17 upper_case_letter [A-Z]
19 special_character [\#\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\_\|]
21 format_effector [\t\v\r\l\f]
23 lower_case_letter [a-z]
24 other_special_character [\!\$\@\?\[\\\]\^\`\{\}\~]
26 graphic_character ({basic_graphic_character}|{lower_case_letter}|{other_special_character})
27 basic_graphic_character ({upper_case_letter}|{digit}|{special_character}|{space_character})
28 letter ({upper_case_letter}|{lower_case_letter})
29 letter_or_digit ({letter}|{digit})
30 decimal_literal {integer}(\.{integer})?({exponent})?
31 integer {digit}(_?{digit})*
32 exponent ([eE][-+]?{integer})
34 based_integer {extended_digit}(_?{extended_digit})*
35 extended_digit ({digit}|[a-fA-F])
36 base_specifier (B|b|O|o|X|x)
40 /*printf ("Newline\n");*/
44 /*printf ("space\n");*/
47 /*printf ("Ampersand\n");*/
51 /*printf ("Apostrophe\n");*/
55 /*printf ("LeftParen\n");*/
59 /*printf ("RightParen\n");*/
63 /*printf ("DoubleStar\n");*/
67 /*printf ("Star\n");*/
71 /*printf ("Plus\n");*/
75 /*printf ("Comma\n");*/
79 /*printf ("Minus\n");*/
83 /*printf ("VarAsgn\n");*/
87 /*printf ("Colon\n");*/
91 /*printf ("Semicolon\n");*/
95 /*printf ("_LESym\n");*/
99 /*printf ("_GESym\n");*/
103 /*printf ("_LTSym\n");*/
107 /*printf ("_GTSym\n");*/
111 /*printf ("_EQSym\n");*/
115 /*printf ("_NESym\n");*/
119 /*printf ("Arrow\n");*/
123 /*printf ("Box\n");*/
127 /*printf ("Bar\n");*/
131 /*printf ("Bar\n");*/
135 /*printf ("Dot\n");*/
139 /*printf ("Slash\n");*/
143 {letter_or_digit}+("."(_?{letter_or_digit})*)+ {
144 /* printf("pointed name : %s\n",yytext);*/
145 yylval.text = namealloc (yytext);
146 return (Pointed_name);
149 {letter}(_?{letter_or_digit})* {
152 itoken = search (yytext);
153 if (itoken == EMPTYHT)
155 yylval.text = namealloc (yytext);
156 /*printf ("Identifier : %s\n", yytext);*/
161 /*printf ("Key word : %s\n", yytext);*/
165 ({decimal_literal})|({base}#{based_integer}(\.{based_integer})?#({exponent})?)|({base}:{based_integer}(\.{based_integer})?:({exponent})?) {
166 yylval.text = mbkalloc ((unsigned int)strlen(yytext)+1);
167 strcpy (yylval.text, yytext);
168 return (AbstractLit);
170 '({graphic_character}|\"|\%)' {
171 yylval.text = namealloc (yytext);
172 return (CharacterLit);
174 (\"({graphic_character}|(\"\")|\%)*\")|(\%({graphic_character}|(\%\%)|\")*\%) {
175 yylval.text = namealloc (yytext);
178 {base_specifier}((\"{extended_digit}(_?{extended_digit})*\")|(\%{extended_digit}(_?{extended_digit})*\%)) {
179 yylval.text = namealloc (yytext);
180 return (BitStringLit);
189 /* ###--------------------------------------------------------------### */
190 /* function : yywrap */
191 /* description : return 1 */
192 /* called func. : none */
193 /* ###--------------------------------------------------------------### */
200 /* ###--------------------------------------------------------------### */
201 /* function : search */
202 /* description : check that an identifier is a reserved word or not */
203 /* called func. : addht, addhtitem, gethtitem, namealloc */
204 /* ###--------------------------------------------------------------### */
206 static int search (key)
211 static ht *pt_hash = NULL;
216 pt_hash = addht (107);
218 addhtitem (pt_hash, namealloc("abs") , ABS );
219 addhtitem (pt_hash, namealloc("access") , ACCESS );
220 addhtitem (pt_hash, namealloc("after") , AFTER );
221 addhtitem (pt_hash, namealloc("alias") , ALIAS );
222 addhtitem (pt_hash, namealloc("all") , ALL );
223 addhtitem (pt_hash, namealloc("and") , VHD_AND );
224 addhtitem (pt_hash, namealloc("architecture") , ARCHITECTURE );
225 addhtitem (pt_hash, namealloc("array") , ARRAY );
226 addhtitem (pt_hash, namealloc("assert") , ASSERT );
227 addhtitem (pt_hash, namealloc("attribute") , ATTRIBUTE );
229 addhtitem (pt_hash, namealloc("begin") , _BEGIN );
230 addhtitem (pt_hash, namealloc("bit") , BIT );
231 addhtitem (pt_hash, namealloc("bit_vector") , BIT_VECTOR );
232 addhtitem (pt_hash, namealloc("block") , BLOCK );
233 addhtitem (pt_hash, namealloc("body") , BODY );
234 addhtitem (pt_hash, namealloc("buffer") , BUFFER );
235 addhtitem (pt_hash, namealloc("bus") , BUS );
237 addhtitem (pt_hash, namealloc("case") , CASE );
238 addhtitem (pt_hash, namealloc("component") , COMPONENT );
239 addhtitem (pt_hash, namealloc("configuration"), CONFIGURATION);
240 addhtitem (pt_hash, namealloc("constant") , CONSTANT );
242 addhtitem (pt_hash, namealloc("disconnect") , DISCONNECT );
243 addhtitem (pt_hash, namealloc("downto") , DOWNTO );
245 addhtitem (pt_hash, namealloc("event") , EVENT );
246 addhtitem (pt_hash, namealloc("else") , ELSE );
247 addhtitem (pt_hash, namealloc("elsif") , ELSIF );
248 addhtitem (pt_hash, namealloc("end") , _END );
249 addhtitem (pt_hash, namealloc("entity") , ENTITY );
250 addhtitem (pt_hash, namealloc("error") , ERROR );
251 addhtitem (pt_hash, namealloc("exit") , _EXIT );
253 addhtitem (pt_hash, namealloc("file") , _FILE );
254 addhtitem (pt_hash, namealloc("for") , FOR );
255 addhtitem (pt_hash, namealloc("function") , FUNCTION );
257 addhtitem (pt_hash, namealloc("generate") , GENERATE );
258 addhtitem (pt_hash, namealloc("generic") , GENERIC );
259 addhtitem (pt_hash, namealloc("guarded") , GUARDED );
261 addhtitem (pt_hash, namealloc("if") , IF );
262 addhtitem (pt_hash, namealloc("in") , _IN );
263 addhtitem (pt_hash, namealloc("inout") , _INOUT );
264 addhtitem (pt_hash, namealloc("is") , IS );
266 addhtitem (pt_hash, namealloc("label") , _LABEL );
267 addhtitem (pt_hash, namealloc("library") , LIBRARY );
268 addhtitem (pt_hash, namealloc("linkage") , _LINKAGE );
269 addhtitem (pt_hash, namealloc("loop") , T_LOOP );
271 addhtitem (pt_hash, namealloc("map") , MAP );
272 addhtitem (pt_hash, namealloc("mod") , MOD );
273 addhtitem (pt_hash, namealloc("ms") , MS );
274 addhtitem (pt_hash, namealloc("mux_bit") , MUX_BIT );
275 addhtitem (pt_hash, namealloc("mux_vector") , MUX_VECTOR );
277 addhtitem (pt_hash, namealloc("nand") , _NAND );
278 addhtitem (pt_hash, namealloc("natural") , NATURAL );
279 addhtitem (pt_hash, namealloc("new") , NEW );
280 addhtitem (pt_hash, namealloc("next") , _NEXT );
281 addhtitem (pt_hash, namealloc("nor") , _NOR );
282 addhtitem (pt_hash, namealloc("not") , _NOT );
283 addhtitem (pt_hash, namealloc("ns") , NS );
284 addhtitem (pt_hash, namealloc("null") , VHD_NULL );
286 addhtitem (pt_hash, namealloc("of") , OF );
287 addhtitem (pt_hash, namealloc("on") , ON );
288 addhtitem (pt_hash, namealloc("open") , OPEN );
289 addhtitem (pt_hash, namealloc("or") , _OR );
290 addhtitem (pt_hash, namealloc("others") , OTHERS );
291 addhtitem (pt_hash, namealloc("out") , _OUT );
293 addhtitem (pt_hash, namealloc("package") , PACKAGE );
294 addhtitem (pt_hash, namealloc("port") , PORT );
295 addhtitem (pt_hash, namealloc("procedure") , PROCEDURE );
296 addhtitem (pt_hash, namealloc("process") , PROCESS );
297 addhtitem (pt_hash, namealloc("ps") , PS );
299 addhtitem (pt_hash, namealloc("range") , RANGE );
300 addhtitem (pt_hash, namealloc("record") , RECORD );
301 addhtitem (pt_hash, namealloc("reg_bit") , REG_BIT );
302 addhtitem (pt_hash, namealloc("reg_vector") , REG_VECTOR );
303 addhtitem (pt_hash, namealloc("register") , REGISTER );
304 addhtitem (pt_hash, namealloc("rem") , REM );
305 addhtitem (pt_hash, namealloc("report") , REPORT );
306 addhtitem (pt_hash, namealloc("return") , RETURN );
308 addhtitem (pt_hash, namealloc("select") , SELECT );
309 addhtitem (pt_hash, namealloc("severity") , SEVERITY );
310 addhtitem (pt_hash, namealloc("signal") , SIGNAL );
311 addhtitem (pt_hash, namealloc("stable") , _STABLE );
312 addhtitem (pt_hash, namealloc("std_logic") , STD_LOGIC );
313 addhtitem (pt_hash, namealloc("std_logic_vector") , STD_LOGIC_VECTOR );
314 addhtitem (pt_hash, namealloc("subtype") , SUBTYPE );
316 addhtitem (pt_hash, namealloc("then") , THEN );
317 addhtitem (pt_hash, namealloc("to") , TO );
318 addhtitem (pt_hash, namealloc("transport") , TRANSPORT );
319 addhtitem (pt_hash, namealloc("type") , _TYPE );
321 addhtitem (pt_hash, namealloc("units") , UNITS );
322 addhtitem (pt_hash, namealloc("until") , UNTIL );
323 addhtitem (pt_hash, namealloc("us") , US );
324 addhtitem (pt_hash, namealloc("use") , USE );
326 addhtitem (pt_hash, namealloc("variable") , VARIABLE );
328 addhtitem (pt_hash, namealloc("wait") , WAIT );
329 addhtitem (pt_hash, namealloc("warning") , WARNING );
330 addhtitem (pt_hash, namealloc("when") , WHEN );
331 addhtitem (pt_hash, namealloc("while") , WHILE );
332 addhtitem (pt_hash, namealloc("with") , WITH );
333 addhtitem (pt_hash, namealloc("wor_bit") , WOR_BIT );
334 addhtitem (pt_hash, namealloc("wor_vector") , WOR_VECTOR );
336 addhtitem (pt_hash, namealloc("xor") , _XOR );
340 return (gethtitem (pt_hash, namealloc(keyd)));