Fix for UBSan build
[platform/upstream/doxygen.git] / src / vhdlscanner.cpp
1
2 #line 3 "<stdout>"
3
4 #define  YY_INT_ALIGNED short int
5
6 /* A lexical scanner generated by flex */
7
8 #define yy_create_buffer vhdlScanYY_create_buffer
9 #define yy_delete_buffer vhdlScanYY_delete_buffer
10 #define yy_flex_debug vhdlScanYY_flex_debug
11 #define yy_init_buffer vhdlScanYY_init_buffer
12 #define yy_flush_buffer vhdlScanYY_flush_buffer
13 #define yy_load_buffer_state vhdlScanYY_load_buffer_state
14 #define yy_switch_to_buffer vhdlScanYY_switch_to_buffer
15 #define yyin vhdlScanYYin
16 #define yyleng vhdlScanYYleng
17 #define yylex vhdlScanYYlex
18 #define yylineno vhdlScanYYlineno
19 #define yyout vhdlScanYYout
20 #define yyrestart vhdlScanYYrestart
21 #define yytext vhdlScanYYtext
22 #define yywrap vhdlScanYYwrap
23 #define yyalloc vhdlScanYYalloc
24 #define yyrealloc vhdlScanYYrealloc
25 #define yyfree vhdlScanYYfree
26
27 #define FLEX_SCANNER
28 #define YY_FLEX_MAJOR_VERSION 2
29 #define YY_FLEX_MINOR_VERSION 5
30 #define YY_FLEX_SUBMINOR_VERSION 35
31 #if YY_FLEX_SUBMINOR_VERSION > 0
32 #define FLEX_BETA
33 #endif
34
35 /* First, we deal with  platform-specific or compiler-specific issues. */
36
37 /* begin standard C headers. */
38 #include <stdio.h>
39 #include <string.h>
40 #include <errno.h>
41 #include <stdlib.h>
42
43 /* end standard C headers. */
44
45 /* flex integer type definitions */
46
47 #ifndef FLEXINT_H
48 #define FLEXINT_H
49
50 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
51
52 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
53
54 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
55  * if you want the limit (max/min) macros for int types. 
56  */
57 #ifndef __STDC_LIMIT_MACROS
58 #define __STDC_LIMIT_MACROS 1
59 #endif
60
61 #include <inttypes.h>
62 typedef int8_t flex_int8_t;
63 typedef uint8_t flex_uint8_t;
64 typedef int16_t flex_int16_t;
65 typedef uint16_t flex_uint16_t;
66 typedef int32_t flex_int32_t;
67 typedef uint32_t flex_uint32_t;
68 typedef uint64_t flex_uint64_t;
69 #else
70 typedef signed char flex_int8_t;
71 typedef short int flex_int16_t;
72 typedef int flex_int32_t;
73 typedef unsigned char flex_uint8_t; 
74 typedef unsigned short int flex_uint16_t;
75 typedef unsigned int flex_uint32_t;
76 #endif /* ! C99 */
77
78 /* Limits of integral types. */
79 #ifndef INT8_MIN
80 #define INT8_MIN               (-128)
81 #endif
82 #ifndef INT16_MIN
83 #define INT16_MIN              (-32767-1)
84 #endif
85 #ifndef INT32_MIN
86 #define INT32_MIN              (-2147483647-1)
87 #endif
88 #ifndef INT8_MAX
89 #define INT8_MAX               (127)
90 #endif
91 #ifndef INT16_MAX
92 #define INT16_MAX              (32767)
93 #endif
94 #ifndef INT32_MAX
95 #define INT32_MAX              (2147483647)
96 #endif
97 #ifndef UINT8_MAX
98 #define UINT8_MAX              (255U)
99 #endif
100 #ifndef UINT16_MAX
101 #define UINT16_MAX             (65535U)
102 #endif
103 #ifndef UINT32_MAX
104 #define UINT32_MAX             (4294967295U)
105 #endif
106
107 #endif /* ! FLEXINT_H */
108
109 #ifdef __cplusplus
110
111 /* The "const" storage-class-modifier is valid. */
112 #define YY_USE_CONST
113
114 #else   /* ! __cplusplus */
115
116 /* C99 requires __STDC__ to be defined as 1. */
117 #if defined (__STDC__)
118
119 #define YY_USE_CONST
120
121 #endif  /* defined (__STDC__) */
122 #endif  /* ! __cplusplus */
123
124 #ifdef YY_USE_CONST
125 #define yyconst const
126 #else
127 #define yyconst
128 #endif
129
130 /* Returned upon end-of-file. */
131 #define YY_NULL 0
132
133 /* Promotes a possibly negative, possibly signed char to an unsigned
134  * integer for use as an array index.  If the signed char is negative,
135  * we want to instead treat it as an 8-bit unsigned char, hence the
136  * double cast.
137  */
138 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
139
140 /* Enter a start condition.  This macro really ought to take a parameter,
141  * but we do it the disgusting crufty way forced on us by the ()-less
142  * definition of BEGIN.
143  */
144 #define BEGIN (yy_start) = 1 + 2 *
145
146 /* Translate the current start state into a value that can be later handed
147  * to BEGIN to return to the state.  The YYSTATE alias is for lex
148  * compatibility.
149  */
150 #define YY_START (((yy_start) - 1) / 2)
151 #define YYSTATE YY_START
152
153 /* Action number for EOF rule of a given start state. */
154 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
155
156 /* Special action meaning "start processing a new file". */
157 #define YY_NEW_FILE vhdlScanYYrestart(vhdlScanYYin  )
158
159 #define YY_END_OF_BUFFER_CHAR 0
160
161 /* Size of default input buffer. */
162 #ifndef YY_BUF_SIZE
163 #define YY_BUF_SIZE 262144
164 #endif
165
166 /* The state buf must be large enough to hold one state per character in the main buffer.
167  */
168 #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
169
170 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
171 #define YY_TYPEDEF_YY_BUFFER_STATE
172 typedef struct yy_buffer_state *YY_BUFFER_STATE;
173 #endif
174
175 #ifndef YY_TYPEDEF_YY_SIZE_T
176 #define YY_TYPEDEF_YY_SIZE_T
177 typedef size_t yy_size_t;
178 #endif
179
180 extern yy_size_t vhdlScanYYleng;
181
182 extern FILE *vhdlScanYYin, *vhdlScanYYout;
183
184 #define EOB_ACT_CONTINUE_SCAN 0
185 #define EOB_ACT_END_OF_FILE 1
186 #define EOB_ACT_LAST_MATCH 2
187
188     #define YY_LESS_LINENO(n)
189     
190 /* Return all but the first "n" matched characters back to the input stream. */
191 #define yyless(n) \
192         do \
193                 { \
194                 /* Undo effects of setting up vhdlScanYYtext. */ \
195         int yyless_macro_arg = (n); \
196         YY_LESS_LINENO(yyless_macro_arg);\
197                 *yy_cp = (yy_hold_char); \
198                 YY_RESTORE_YY_MORE_OFFSET \
199                 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
200                 YY_DO_BEFORE_ACTION; /* set up vhdlScanYYtext again */ \
201                 } \
202         while ( 0 )
203
204 #define unput(c) yyunput( c, (yytext_ptr)  )
205
206 #ifndef YY_STRUCT_YY_BUFFER_STATE
207 #define YY_STRUCT_YY_BUFFER_STATE
208 struct yy_buffer_state
209         {
210         FILE *yy_input_file;
211
212         char *yy_ch_buf;                /* input buffer */
213         char *yy_buf_pos;               /* current position in input buffer */
214
215         /* Size of input buffer in bytes, not including room for EOB
216          * characters.
217          */
218         yy_size_t yy_buf_size;
219
220         /* Number of characters read into yy_ch_buf, not including EOB
221          * characters.
222          */
223         yy_size_t yy_n_chars;
224
225         /* Whether we "own" the buffer - i.e., we know we created it,
226          * and can realloc() it to grow it, and should free() it to
227          * delete it.
228          */
229         int yy_is_our_buffer;
230
231         /* Whether this is an "interactive" input source; if so, and
232          * if we're using stdio for input, then we want to use getc()
233          * instead of fread(), to make sure we stop fetching input after
234          * each newline.
235          */
236         int yy_is_interactive;
237
238         /* Whether we're considered to be at the beginning of a line.
239          * If so, '^' rules will be active on the next match, otherwise
240          * not.
241          */
242         int yy_at_bol;
243
244     int yy_bs_lineno; /**< The line count. */
245     int yy_bs_column; /**< The column count. */
246     
247         /* Whether to try to fill the input buffer when we reach the
248          * end of it.
249          */
250         int yy_fill_buffer;
251
252         int yy_buffer_status;
253
254 #define YY_BUFFER_NEW 0
255 #define YY_BUFFER_NORMAL 1
256         /* When an EOF's been seen but there's still some text to process
257          * then we mark the buffer as YY_EOF_PENDING, to indicate that we
258          * shouldn't try reading from the input source any more.  We might
259          * still have a bunch of tokens to match, though, because of
260          * possible backing-up.
261          *
262          * When we actually see the EOF, we change the status to "new"
263          * (via vhdlScanYYrestart()), so that the user can continue scanning by
264          * just pointing vhdlScanYYin at a new input file.
265          */
266 #define YY_BUFFER_EOF_PENDING 2
267
268         };
269 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
270
271 /* Stack of input buffers. */
272 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
273 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
274 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
275
276 /* We provide macros for accessing buffer states in case in the
277  * future we want to put the buffer states in a more general
278  * "scanner state".
279  *
280  * Returns the top of the stack, or NULL.
281  */
282 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
283                           ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
284                           : NULL)
285
286 /* Same as previous macro, but useful when we know that the buffer stack is not
287  * NULL or when we need an lvalue. For internal use only.
288  */
289 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
290
291 /* yy_hold_char holds the character lost when vhdlScanYYtext is formed. */
292 static char yy_hold_char;
293 static yy_size_t yy_n_chars;            /* number of characters read into yy_ch_buf */
294 yy_size_t vhdlScanYYleng;
295
296 /* Points to current character in buffer. */
297 static char *yy_c_buf_p = (char *) 0;
298 static int yy_init = 0;         /* whether we need to initialize */
299 static int yy_start = 0;        /* start state number */
300
301 /* Flag which is used to allow vhdlScanYYwrap()'s to do buffer switches
302  * instead of setting up a fresh vhdlScanYYin.  A bit of a hack ...
303  */
304 static int yy_did_buffer_switch_on_eof;
305
306 void vhdlScanYYrestart (FILE *input_file  );
307 void vhdlScanYY_switch_to_buffer (YY_BUFFER_STATE new_buffer  );
308 YY_BUFFER_STATE vhdlScanYY_create_buffer (FILE *file,int size  );
309 void vhdlScanYY_delete_buffer (YY_BUFFER_STATE b  );
310 void vhdlScanYY_flush_buffer (YY_BUFFER_STATE b  );
311 void vhdlScanYYpush_buffer_state (YY_BUFFER_STATE new_buffer  );
312 void vhdlScanYYpop_buffer_state (void );
313
314 static void vhdlScanYYensure_buffer_stack (void );
315 static void vhdlScanYY_load_buffer_state (void );
316 static void vhdlScanYY_init_buffer (YY_BUFFER_STATE b,FILE *file  );
317
318 #define YY_FLUSH_BUFFER vhdlScanYY_flush_buffer(YY_CURRENT_BUFFER )
319
320 YY_BUFFER_STATE vhdlScanYY_scan_buffer (char *base,yy_size_t size  );
321 YY_BUFFER_STATE vhdlScanYY_scan_string (yyconst char *yy_str  );
322 YY_BUFFER_STATE vhdlScanYY_scan_bytes (yyconst char *bytes,yy_size_t len  );
323
324 void *vhdlScanYYalloc (yy_size_t  );
325 void *vhdlScanYYrealloc (void *,yy_size_t  );
326 void vhdlScanYYfree (void *  );
327
328 #define yy_new_buffer vhdlScanYY_create_buffer
329
330 #define yy_set_interactive(is_interactive) \
331         { \
332         if ( ! YY_CURRENT_BUFFER ){ \
333         vhdlScanYYensure_buffer_stack (); \
334                 YY_CURRENT_BUFFER_LVALUE =    \
335             vhdlScanYY_create_buffer(vhdlScanYYin,YY_BUF_SIZE ); \
336         } \
337         YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
338         }
339
340 #define yy_set_bol(at_bol) \
341         { \
342         if ( ! YY_CURRENT_BUFFER ){\
343         vhdlScanYYensure_buffer_stack (); \
344                 YY_CURRENT_BUFFER_LVALUE =    \
345             vhdlScanYY_create_buffer(vhdlScanYYin,YY_BUF_SIZE ); \
346         } \
347         YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
348         }
349
350 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
351
352 /* Begin user sect3 */
353
354 #define vhdlScanYYwrap(n) 1
355 #define YY_SKIP_YYWRAP
356
357 typedef unsigned char YY_CHAR;
358
359 FILE *vhdlScanYYin = (FILE *) 0, *vhdlScanYYout = (FILE *) 0;
360
361 typedef int yy_state_type;
362
363 extern int vhdlScanYYlineno;
364
365 int vhdlScanYYlineno = 1;
366
367 extern char *vhdlScanYYtext;
368 #define yytext_ptr vhdlScanYYtext
369
370 static yy_state_type yy_get_previous_state (void );
371 static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
372 static int yy_get_next_buffer (void );
373 static void yy_fatal_error (yyconst char msg[]  );
374
375 /* Done after the current pattern has been matched and before the
376  * corresponding action - sets up vhdlScanYYtext.
377  */
378 #define YY_DO_BEFORE_ACTION \
379         (yytext_ptr) = yy_bp; \
380         vhdlScanYYleng = (yy_size_t) (yy_cp - yy_bp); \
381         (yy_hold_char) = *yy_cp; \
382         *yy_cp = '\0'; \
383         (yy_c_buf_p) = yy_cp;
384
385 #define YY_NUM_RULES 55
386 #define YY_END_OF_BUFFER 56
387 /* This struct is not used in this scanner,
388    but its presence is necessary. */
389 struct yy_trans_info
390         {
391         flex_int32_t yy_verify;
392         flex_int32_t yy_nxt;
393         };
394 static yyconst flex_int16_t yy_acclist[231] =
395     {   0,
396        56,   47,   55,    1,   47,   55,   45,   55,   47,   55,
397        47,   55,   47,   55,    2,   47,   55,    3,   47,   55,
398         4,   47,   55,    5,   47,   55,    7,   47,   55,    8,
399        47,   55,    9,   47,   55,   10,   47,   55,   33,   47,
400        55,   34,   47,   55,   40,   47,   55,   12,   47,   55,
401        13,   47,   55,   16,   47,   55,   18,   47,   55,   17,
402        47,   55,   31,   47,   55,   35,   47,   55,   39,   47,
403        55,   39,   47,   55,   39,   47,   55,   39,   47,   55,
404        39,   47,   55,   39,   47,   55,   39,   47,   55,   37,
405        47,   55,   47,   55,   38,   47,   55,   36,   47,   55,
406
407        47,   55,   32,   47,   55,   50,   55,   50,   55,   50,
408        55,   50,   55,   50,   55,   50,   55,   55,   55,   53,
409        55,   55,   55,   55,   55,   55,   55,   55,   42,   42,
410         6,   46,   52,   19,   40,   11,   22,   14,   21,   20,
411        15,   23,   28,   29,   27,   24,   39,   39,   39,   39,
412        39,   39,   39,   39,   39,   44,   44,   46,   53,   46,
413        52,   53,   54,   41,   46,   46,   51,   40,   40,   40,
414        30,   26,   25,   46,   49,   51,   46,   46,   51,   46,
415        53,   46,   51,   46,   51,   40,   40,   40,   40,   43,
416        49,   46,   49,   51,   46,   49,   51,   46,   51,   46,
417
418        51,   53,   46,   51,   46,   51,16432,   49,   49,   46,
419        49,   51,   53,   46,   51,16432,   46,   51,   53,   46,
420        51,   53,   40,   40,   49,   53,   40,   40, 8240, 8240
421     } ;
422
423 static yyconst flex_int16_t yy_accept[223] =
424     {   0,
425         1,    1,    1,    1,    1,    1,    1,    1,    1,    2,
426         4,    7,    9,   11,   13,   15,   18,   21,   24,   27,
427        30,   33,   36,   39,   42,   45,   48,   51,   54,   57,
428        60,   63,   66,   69,   72,   75,   78,   81,   84,   87,
429        90,   93,   95,   98,  101,  103,  106,  108,  110,  112,
430       114,  116,  118,  119,  120,  122,  123,  124,  125,  126,
431       127,  128,  129,  129,  129,  129,  130,  130,  130,  131,
432       131,  131,  131,  132,  133,  134,  135,  135,  135,  136,
433       136,  136,  136,  136,  136,  136,  136,  136,  136,  137,
434       138,  139,  140,  141,  142,  143,  143,  144,  145,  146,
435
436       147,  148,  149,  149,  149,  149,  150,  151,  152,  153,
437       154,  155,  155,  155,  156,  157,  158,  158,  158,  159,
438       159,  160,  160,  160,  161,  163,  164,  164,  165,  166,
439       168,  168,  169,  169,  169,  170,  170,  170,  170,  170,
440       170,  170,  171,  172,  173,  174,  174,  174,  174,  177,
441       177,  178,  180,  182,  182,  184,  186,  187,  187,  187,
442       187,  188,  188,  188,  188,  189,  189,  190,  190,  191,
443       191,  191,  191,  191,  192,  195,  198,  198,  200,  203,
444       205,  205,  207,  208,  208,  208,  208,  208,  209,  210,
445       213,  213,  214,  216,  217,  220,  223,  223,  223,  223,
446
447       223,  224,  224,  224,  224,  224,  224,  225,  226,  226,
448       227,  227,  227,  227,  228,  228,  229,  229,  229,  230,
449       231,  231
450     } ;
451
452 static yyconst flex_int32_t yy_ec[256] =
453     {   0,
454         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
455         1,    1,    4,    1,    1,    1,    1,    1,    1,    1,
456         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
457         1,    2,    5,    6,    7,    8,    9,   10,   11,   12,
458        13,   14,   15,   16,   17,   18,   19,   20,   20,   20,
459        20,   20,   20,   20,   20,   20,   20,   21,   22,   23,
460        24,   25,   26,   27,   28,   29,   28,   30,   31,   28,
461        32,   32,   32,   32,   32,   32,   32,   32,   33,   32,
462        32,   32,   34,   32,   35,   32,   32,   36,   32,   32,
463        37,   38,   39,   40,   41,   42,   28,   43,   28,   44,
464
465        31,   28,   32,   32,   32,   32,   32,   32,   32,   32,
466        45,   32,   32,   32,   46,   32,   47,   32,   32,   48,
467        32,   32,   49,   50,   49,    8,    1,    1,    1,    1,
468         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
469         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
470         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
471         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
472         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
473         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
474         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
475
476         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
477         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
478         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
479         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
480         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
481         1,    1,    1,    1,    1
482     } ;
483
484 static yyconst flex_int32_t yy_meta[51] =
485     {   0,
486         1,    2,    3,    1,    2,    4,    5,    2,    6,    2,
487         2,    2,    2,    2,    2,    2,    2,    7,    2,    8,
488         9,    2,    2,    2,    2,    2,    2,    8,    8,    8,
489         8,   10,   10,   10,   10,   10,    2,    2,    2,    2,
490         8,    2,    8,    8,   10,   10,   10,   10,   11,    2
491     } ;
492
493 static yyconst flex_int16_t yy_base[252] =
494     {   0,
495         0,    0,   49,   52,   56,   60,   78,   82,  937,  938,
496        85,  101,  104,  120,  169,  938,  218,  938,  938,  922,
497       938,  938,  918,  938,   43,  262,  910,  938,   86,  908,
498        66,  251,  938,   52,  279,    0,    0,  315,  282,    0,
499       938,  362,  938,  938,  385,  938,  938,  269,  915,  917,
500       329,  913,  896,  333,  879,   98,  878,  938,  336,  819,
501       799,  791,  339,  767,    0,  756,    0,    0,  749,    0,
502       744,  743,  938,  748,  938,  938,  406,  726,    0,  423,
503       107,  108,  264,  114,  412,  429,  281,  716,  938,  938,
504       938,  938,  938,  938,  938,  690,  671,  938,  669,  938,
505
506       295,  307,   78,  450,  455,    0,    0,    0,    0,    0,
507         0,    0,    0,    0,  472,    0,  421,  675,  684,  639,
508       636,  507,  300,  352,  632,  938,  640,  938,    0,  595,
509       271,  451,  308,  621,  282,  313,  353,  359,  433,  438,
510       450,  505,  938,  938,  938,   59,  454,  635,  588,  340,
511        80,  473,  608,    0,  618,    0,  587,  509,  523,  514,
512       528,  597,  542,  510,  557,  546,  420,  562,  938,  491,
513       563,  455,  567,  531,  552,    0,  551,  546,  547,  553,
514       524,  488,   59,  564,  287,  447,  584,  486,    0,  470,
515       599,  600,  602,  606,  612,  432,  424,  561,  405,  351,
516
517       449,  293,  599,  492,  604,  202,  494,  218,  622,  635,
518       637,  595,  168,  527,  152,  611,  104,  347,  938,   64,
519       938,  654,  665,  676,  680,  689,  700,  711,  722,  733,
520       740,  742,  748,  751,  759,  770,  781,  791,  802,  813,
521       824,  835,  846,  857,  868,  879,  886,  887,  896,  907,
522       918
523     } ;
524
525 static yyconst flex_int16_t yy_def[252] =
526     {   0,
527       221,    1,  222,  222,  223,  223,  224,  224,  221,  221,
528       221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
529       221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
530       221,  221,  221,  225,  225,   35,   35,   35,   38,   35,
531       221,  221,  221,  221,  226,  221,  221,  221,  221,  221,
532       221,  221,  227,  227,  221,  227,  227,  221,  221,  221,
533       221,  221,  221,  221,   14,  221,   14,   15,  221,   15,
534       221,  221,  221,  228,  221,  221,  221,  221,   26,  221,
535       221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
536       221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
537
538        35,   35,  225,  221,  221,   35,   35,   35,   35,   35,
539        35,   42,   42,   42,  226,  115,  221,  221,  228,  227,
540       221,  227,  227,  229,  221,  221,  221,  221,  228,  230,
541       231,  221,  232,  221,  221,  221,  221,  221,  221,  221,
542       221,  221,  221,  221,  221,  233,  234,  221,  235,  227,
543       229,  236,  228,  237,  238,  239,  221,  221,  231,  221,
544       221,  221,  221,  232,  221,  221,  221,  221,  221,  233,
545       221,  234,  221,  240,  241,  242,  243,  244,  238,  245,
546       246,  238,  221,  221,  247,  248,  221,  249,  250,  241,
547       251,  246,  244,  227,  238,  239,  246,  221,  221,  221,
548
549       221,  247,  221,  248,  221,  221,  221,  249,  251,  246,
550       227,  227,  221,  221,  221,  221,  221,  227,  221,  227,
551         0,  221,  221,  221,  221,  221,  221,  221,  221,  221,
552       221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
553       221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
554       221
555     } ;
556
557 static yyconst flex_int16_t yy_nxt[989] =
558     {   0,
559        10,   11,   12,   13,   10,   14,   10,   10,   15,   16,
560        17,   18,   19,   20,   21,   22,   23,   24,   25,   26,
561        27,   28,   29,   30,   31,   32,   33,   34,   35,   36,
562        34,   34,   37,   38,   39,   40,   41,   42,   43,   44,
563        10,   45,   35,   36,   37,   38,   39,   40,   10,   46,
564        48,   48,   48,   51,   48,   48,   75,   54,   54,   54,
565       198,   54,   54,   54,  169,   49,   76,   50,   52,   55,
566        50,  101,   56,   55,   57,  199,   56,  121,   57,   59,
567        59,   59,  120,   59,   59,   59,   63,   63,   63,   94,
568        95,   60,  103,  153,   61,   60,   62,  101,   61,  171,
569
570        62,   64,   63,   63,   63,   63,   63,   63,   90,   91,
571        92,  121,  104,  104,  124,  105,  105,   64,  221,  104,
572        64,   65,  105,  216,   65,   66,   65,   65,   65,   65,
573        65,   65,   65,   65,   65,   65,   65,   65,   65,   65,
574        65,   65,   65,   65,   65,   65,   65,   67,   67,   67,
575        67,   67,   67,   67,   67,   67,   65,   65,   65,   65,
576        65,   65,   67,   67,   67,   67,   67,   67,   65,   65,
577        68,  214,  219,   68,   68,   68,   68,   69,   68,   68,
578        68,   68,   68,   68,   68,   68,   68,   68,   68,   68,
579        68,   68,   68,   68,   68,   68,   70,   70,   70,   70,
580
581        70,   70,   70,   70,   70,   68,   68,   68,   68,   68,
582        68,   70,   70,   70,   70,   70,   70,   68,   68,   71,
583       183,  207,   71,   71,   71,   71,   71,   71,   71,   71,
584        71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
585        71,   71,   71,   71,   71,   72,   72,   72,   72,   72,
586        72,   72,   72,   72,   71,   71,   71,   71,   71,   71,
587        72,   72,   72,   72,   72,   72,   71,   71,   77,   96,
588        63,   63,   63,   97,   98,   99,  100,  157,  134,   78,
589       134,   79,   80,  135,  104,   64,  104,  105,  158,  105,
590        81,   82,   83,  157,   84,   85,   86,   87,  101,  157,
591
592       221,  167,   88,  221,   81,   82,   84,   85,   86,   87,
593       109,  160,  221,  121,  110,  221,  150,  111,  104,  103,
594       221,  105,  168,  221,  109,  163,  110,  203,  165,  111,
595       117,   63,   63,  203,  122,  122,  122,   63,   63,   63,
596        63,   63,   63,  106,  177,  118,  121,  107,  166,  123,
597       108,  220,   64,  121,  120,   64,  152,  106,  104,  107,
598       121,  105,  108,  112,  104,  153,  112,  105,  112,  112,
599       201,  112,  112,  112,  112,  112,  112,  112,  112,  112,
600       112,  112,  112,  112,  112,  112,  112,  112,  112,  113,
601       113,  113,  113,  113,  113,  113,  113,  113,  112,  114,
602
603       112,  112,  112,  112,  113,  113,  113,  113,  113,  113,
604       112,  112,  116,  116,  116,  116,  116,  116,  116,  116,
605       116,  213,  117,   63,   63,  131,  183,  116,  116,  116,
606       116,  116,  116,  131,  131,  131,  131,  118,  104,  167,
607       136,  105,  133,  104,  137,  196,  105,  138,  131,  131,
608       133,  133,  133,  133,  136,  104,  137,  139,  105,  138,
609       168,  140,  169,  169,  141,  133,  133,  165,  214,  146,
610       161,  139,  183,  140,  147,  120,  141,  146,  146,  146,
611       146,   83,  147,  147,  147,  147,  179,  205,  183,  215,
612       183,  162,  146,  146,  173,  173,  169,  147,  147,  116,
613
614       116,  116,  116,  116,  116,  116,  116,  116,  122,  122,
615       122,   77,  165,  216,  116,  116,  116,  116,  116,  116,
616       121,  180,   78,  123,  142,   80,  183,  163,  185,  157,
617       165,  171,  205,  159,  217,   83,  185,  185,  185,  185,
618       158,  159,  159,  159,  159,   88,  214,  161,  194,  183,
619       166,  185,  185,  120,  183,  120,  159,  159,   83,  195,
620       195,  186,  198,  160,  192,  164,  196,  215,  162,  186,
621       186,  186,  186,  164,  164,  164,  164,  199,  200,  189,
622       200,  167,  170,  201,  186,  186,  172,  187,  164,  164,
623       170,  170,  170,  170,  172,  172,  172,  172,  206,  120,
624
625       206,  194,  183,  207,  194,  170,  170,  211,  121,  172,
626       172,  218,  210,  210,  183,  195,  161,  184,  202,  121,
627       183,  153,  212,  204,  194,  195,  202,  202,  202,  202,
628       216,  204,  204,  204,  204,  210,  176,  183,  211,  174,
629       135,  202,  202,  156,  154,  121,  204,  204,  210,  121,
630       121,  217,  121,  212,   47,   47,   47,   47,   47,   47,
631        47,   47,   47,   47,   47,   53,   53,   53,   53,   53,
632        53,   53,   53,   53,   53,   53,   58,   58,   58,   58,
633        58,   58,   58,   58,   58,   58,   58,  102,  149,  102,
634       115,  148,  145,  115,  144,  115,  115,  115,  115,  115,
635
636       120,  120,  120,  120,  120,  120,  120,  120,  120,  120,
637       120,  129,  129,  143,  129,  129,  129,  129,  129,  129,
638       129,  129,  151,  151,  151,  151,  151,  151,  151,  151,
639       151,  151,  151,  155,  155,  142,  155,  155,  155,  155,
640       155,  155,  155,  155,  159,  132,  159,  159,  164,  164,
641       164,  170,  130,  128,  128,  170,  172,   68,  172,  175,
642       175,   65,  175,  175,  175,  175,  175,  175,  175,  175,
643       178,  178,  178,  178,  178,  178,  178,  178,  178,  178,
644       178,  181,  181,  127,  181,  181,  181,  181,  181,  181,
645       181,  182,  182,  182,  182,  182,  182,  182,  182,  182,
646
647       182,  182,  156,  156,   75,  156,  156,  156,  156,  156,
648       156,  156,  156,  188,  188,   74,  188,  188,  188,  188,
649       188,  188,  188,  188,  190,  190,  190,  190,  190,  190,
650       190,  190,  190,  190,  190,  176,  176,  126,  176,  176,
651       176,  176,  176,  176,  176,  176,  191,  191,  191,  191,
652       191,  191,  191,  191,  191,  191,  191,  193,  193,  193,
653       193,  193,  193,  193,  193,  193,  193,  193,  180,  180,
654       180,  180,  180,  180,  180,  180,  180,  180,  180,  197,
655       197,  197,  197,  197,  197,  197,  197,  197,  197,  197,
656       202,  125,  121,  202,  204,  204,  208,  208,  208,  208,
657
658       208,  208,  208,  208,  208,  208,  208,  189,  189,  121,
659       189,  189,  189,  189,  189,  189,  189,  189,  209,  209,
660       209,  209,  209,  209,  209,  209,  209,  209,  209,  119,
661        75,   74,   93,   89,   74,   73,  221,    9,  221,  221,
662       221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
663       221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
664       221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
665       221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
666       221,  221,  221,  221,  221,  221,  221,  221
667     } ;
668
669 static yyconst flex_int16_t yy_chk[989] =
670     {   0,
671         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
672         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
673         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
674         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
675         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
676         3,    3,    3,    4,    4,    4,   25,    5,    5,    5,
677       183,    6,    6,    6,  146,    3,   25,    3,    4,    5,
678         4,   34,    5,    6,    5,  183,    6,  220,    6,    7,
679         7,    7,  151,    8,    8,    8,   11,   11,   11,   31,
680        31,    7,   34,  151,    7,    8,    7,  103,    8,  146,
681
682         8,   11,   12,   12,   12,   13,   13,   13,   29,   29,
683        29,   56,   81,   82,   56,   81,   82,   12,  103,   84,
684        13,   14,   84,  217,   14,   14,   14,   14,   14,   14,
685        14,   14,   14,   14,   14,   14,   14,   14,   14,   14,
686        14,   14,   14,   14,   14,   14,   14,   14,   14,   14,
687        14,   14,   14,   14,   14,   14,   14,   14,   14,   14,
688        14,   14,   14,   14,   14,   14,   14,   14,   14,   14,
689        15,  215,  213,   15,   15,   15,   15,   15,   15,   15,
690        15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
691        15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
692
693        15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
694        15,   15,   15,   15,   15,   15,   15,   15,   15,   17,
695       208,  206,   17,   17,   17,   17,   17,   17,   17,   17,
696        17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
697        17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
698        17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
699        17,   17,   17,   17,   17,   17,   17,   17,   26,   32,
700        48,   48,   48,   32,   32,   32,   32,  131,   83,   26,
701        83,   26,   26,   83,   35,   48,   87,   35,  131,   87,
702        26,   26,   26,  185,   26,   26,   26,   26,   35,  202,
703
704       101,  135,   26,  101,   26,   26,   26,   26,   26,   26,
705        39,  131,  102,  123,   39,  102,  123,   39,  136,   35,
706        38,  136,  135,   38,   39,  133,   39,  185,  133,   39,
707        51,   51,   51,  202,   54,   54,   54,   59,   59,   59,
708        63,   63,   63,   38,  150,   51,   54,   38,  133,   54,
709        38,  218,   59,  150,  124,   63,  124,   38,  137,   38,
710       218,  137,   38,   42,  138,  124,   42,  138,   42,   42,
711       200,   42,   42,   42,   42,   42,   42,   42,   42,   42,
712        42,   42,   42,   42,   42,   42,   42,   42,   42,   42,
713        42,   42,   42,   42,   42,   42,   42,   42,   42,   42,
714
715        42,   42,   42,   42,   42,   42,   42,   42,   42,   42,
716        42,   42,   45,   45,   45,   45,   45,   45,   45,   45,
717        45,  199,  117,  117,  117,   77,  197,   45,   45,   45,
718        45,   45,   45,   77,   77,   77,   77,  117,  139,  167,
719        85,  139,   80,  140,   85,  196,  140,   85,   77,   77,
720        80,   80,   80,   80,   85,  141,   85,   86,  141,   85,
721       167,   86,  147,  172,   86,   80,   80,  186,  201,  104,
722       132,   86,  190,   86,  105,  152,   86,  104,  104,  104,
723       104,  132,  105,  105,  105,  105,  152,  186,  188,  201,
724       182,  132,  104,  104,  147,  172,  170,  105,  105,  115,
725
726       115,  115,  115,  115,  115,  115,  115,  115,  122,  122,
727       122,  142,  204,  207,  115,  115,  115,  115,  115,  115,
728       122,  152,  142,  122,  142,  142,  181,  164,  158,  159,
729       164,  170,  204,  160,  207,  142,  158,  158,  158,  158,
730       159,  160,  160,  160,  160,  142,  214,  161,  178,  179,
731       164,  158,  158,  177,  175,  180,  160,  160,  161,  178,
732       179,  163,  198,  159,  177,  166,  180,  214,  161,  163,
733       163,  163,  163,  166,  166,  166,  166,  198,  184,  174,
734       184,  168,  171,  184,  163,  163,  173,  165,  166,  166,
735       171,  171,  171,  171,  173,  173,  173,  173,  187,  177,
736
737       187,  191,  192,  187,  193,  171,  171,  194,  212,  173,
738       173,  212,  191,  192,  195,  193,  162,  157,  203,  194,
739       155,  153,  194,  205,  209,  195,  203,  203,  203,  203,
740       216,  205,  205,  205,  205,  209,  149,  210,  211,  148,
741       134,  203,  203,  130,  127,  125,  205,  205,  210,  121,
742       211,  216,  120,  211,  222,  222,  222,  222,  222,  222,
743       222,  222,  222,  222,  222,  223,  223,  223,  223,  223,
744       223,  223,  223,  223,  223,  223,  224,  224,  224,  224,
745       224,  224,  224,  224,  224,  224,  224,  225,  119,  225,
746       226,  118,   99,  226,   97,  226,  226,  226,  226,  226,
747
748       227,  227,  227,  227,  227,  227,  227,  227,  227,  227,
749       227,  228,  228,   96,  228,  228,  228,  228,  228,  228,
750       228,  228,  229,  229,  229,  229,  229,  229,  229,  229,
751       229,  229,  229,  230,  230,   88,  230,  230,  230,  230,
752       230,  230,  230,  230,  231,   78,  231,  231,  232,  232,
753       232,  233,   74,   72,   71,  233,  234,   69,  234,  235,
754       235,   66,  235,  235,  235,  235,  235,  235,  235,  235,
755       236,  236,  236,  236,  236,  236,  236,  236,  236,  236,
756       236,  237,  237,   64,  237,  237,  237,  237,  237,  237,
757       237,  238,  238,  238,  238,  238,  238,  238,  238,  238,
758
759       238,  238,  239,  239,   62,  239,  239,  239,  239,  239,
760       239,  239,  239,  240,  240,   61,  240,  240,  240,  240,
761       240,  240,  240,  240,  241,  241,  241,  241,  241,  241,
762       241,  241,  241,  241,  241,  242,  242,   60,  242,  242,
763       242,  242,  242,  242,  242,  242,  243,  243,  243,  243,
764       243,  243,  243,  243,  243,  243,  243,  244,  244,  244,
765       244,  244,  244,  244,  244,  244,  244,  244,  245,  245,
766       245,  245,  245,  245,  245,  245,  245,  245,  245,  246,
767       246,  246,  246,  246,  246,  246,  246,  246,  246,  246,
768       247,   57,   55,  247,  248,  248,  249,  249,  249,  249,
769
770       249,  249,  249,  249,  249,  249,  249,  250,  250,   53,
771       250,  250,  250,  250,  250,  250,  250,  250,  251,  251,
772       251,  251,  251,  251,  251,  251,  251,  251,  251,   52,
773        50,   49,   30,   27,   23,   20,    9,  221,  221,  221,
774       221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
775       221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
776       221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
777       221,  221,  221,  221,  221,  221,  221,  221,  221,  221,
778       221,  221,  221,  221,  221,  221,  221,  221
779     } ;
780
781 extern int vhdlScanYY_flex_debug;
782 int vhdlScanYY_flex_debug = 0;
783
784 static yy_state_type *yy_state_buf=0, *yy_state_ptr=0;
785 static char *yy_full_match;
786 static int yy_lp;
787 static int yy_looking_for_trail_begin = 0;
788 static int yy_full_lp;
789 static int *yy_full_state;
790 #define YY_TRAILING_MASK 0x2000
791 #define YY_TRAILING_HEAD_MASK 0x4000
792 #define REJECT \
793 { \
794 *yy_cp = (yy_hold_char); /* undo effects of setting up vhdlScanYYtext */ \
795 yy_cp = (yy_full_match); /* restore poss. backed-over text */ \
796 (yy_lp) = (yy_full_lp); /* restore orig. accepting pos. */ \
797 (yy_state_ptr) = (yy_full_state); /* restore orig. state */ \
798 yy_current_state = *(yy_state_ptr); /* restore curr. state */ \
799 ++(yy_lp); \
800 goto find_rule; \
801 }
802
803 #define yymore() yymore_used_but_not_detected
804 #define YY_MORE_ADJ 0
805 #define YY_RESTORE_YY_MORE_OFFSET
806 char *vhdlScanYYtext;
807 #line 1 "vhdlscanner.l"
808 /************** VHDL scanner in LEX format **********
809  *
810  * Version 0.2 Wed Aug 11, 1993
811  *
812  * This scanner is derived from a scanner of the ALLIANCE CAD toolset,
813  * release 1.1. That toolset was written from:
814  *   MASI/CAO-VLSI CAD Team  
815  *   Laboratoire MASI/CAO-VLSI
816  *   Tour 55-65, 2eme etage, Porte 13
817  *   Universite Pierre et Marie Curie (PARIS VI)
818  *   4, place Jussieu 75252 PARIS Cedex 05, FRANCE
819  * The ALLIANCE CAD Toolset can be obtained from ftp site : ftp-masi.ibp.fr    
820  *
821  * This scanner is avail at: ftp.cs.utwente.nl in pub/src/VHDL/Grammar
822  * A corresponding Yacc grammar is available at the same site
823  *
824  * author of this derived scanner version:
825  * Thomas Dettmer
826  * Dortmund University
827  * Dept. of Computer Scienc, LS1
828  * PB 500 500
829  * D-44221 Dortmund (Germany)
830  * Phone: +49-231-755-6464
831  * e-mail: dettmer@ls1.informatik.uni-dortmund.de
832  *
833  *
834  ****************************************************************
835  * 
836  * This file is intended not to be used for commercial purposes
837  * without permission of the University of Dortmund
838  *   
839  * NOTE THAT THERE IS NO WARRANTY FOR CORRECTNES, COMPLETENESS, SUPPORT
840  * OR ANYTHING ELSE.
841  *******************************************************/
842 /******************************************************************************
843  * modified for doxygen by M. Kreis
844  * extended to VHDL 93/2002/2008 
845  ******************************************************************************/
846 #line 40 "vhdlscanner.l"
847
848 #ifndef YYSTYPE
849         typedef int YYSTYPE;
850 #endif
851
852 #include <ctype.h>
853 #include <search.h>
854
855 #include <stdio.h>
856 #include <stdlib.h>
857 #include <assert.h>
858 #include <string.h>
859 #include <ctype.h>
860 #include "commentscan.h"
861 #include "vhdlparser.h"
862 #include "vhdlscanner.h"
863
864 #include "doxygen.h"
865 #include "searchindex.h"
866 #include <ctype.h>
867 #include "scanner.h"
868 #include "vhdldocgen.h"
869 #include "util.h"
870 #include "bufstr.h"
871 #include "message.h"
872 #include "vhdlcode.h"
873 #include <qmap.h>
874 #include "entry.h"
875
876 #define YY_NO_INPUT 1
877
878 extern void vhdlParse(); // defined in vhdlparser.y
879
880 static bool          g_lexInit = FALSE;
881 static ParserInterface *g_thisParser;
882 static VhdlContainer* yycont=NULL;
883 static Entry* current_root;
884 static Entry   gBlock;
885
886 static int yyLineNr =1;
887 static int   g_lastCommentContext;
888 static int              inputPosition;
889 static int startComment;
890 static QCString inputVhdlString;
891 static QFile            inputFile;
892 static QCString         yyFileName;
893 static QList<QCString> qlist;
894 static QCString lastLetter;
895
896 static bool doxComment=FALSE; // doxygen comment ? 
897 static QCString strComment;
898 static int iDocLine=-1;
899 static int* lineIndex=NULL;
900 static int num_chars;
901 static  int prevToken;
902 static int iCodeLen;
903
904 static QMap<QCString, int> keyMap;
905 static QList<Entry>  lineEntry;
906 static bool  checkMultiComment(QCString& qcs,int line);
907 static void handleCommentBlock(const QCString &doc,bool brief);
908 static void mapLibPackage(const Entry* ce);
909 static QList<Entry>* getEntryAtLine(const Entry* ce,int line);
910 static bool addLibUseClause(const QCString &type);
911 static Entry* oldEntry;
912 static bool varr=FALSE;
913 static QCString varName;
914
915 static struct 
916 {
917   QCString doc;
918   bool brief;
919   bool pending;
920   int iDocLine;
921 } str_doc;
922
923 #define YY_NEVER_INTERACTIVE 1
924 #define YY_USER_ACTION num_chars += vhdlScanYYleng;
925
926 #define MAX_KEYWORD_LEN 20
927
928 typedef struct 
929 {
930   char nom[MAX_KEYWORD_LEN];
931   int kval;
932 } el_mc;
933
934 static el_mc tab_mc []=
935 {
936     { "abs",                t_ABS                },
937     { "access",             t_ACCESS             },
938     { "after",              t_AFTER              },
939     { "alias",              t_ALIAS              },
940     { "all",                t_ALL                },
941     { "and",                t_AND                },
942     { "architecture",       t_ARCHITECTURE       },
943     { "array",              t_ARRAY              },
944     { "assert",             t_ASSERT             },
945     { "assume",             t_ASSUME             },
946     { "assume_guarantee",   t_ASSUME_GUARANTEE   },
947     { "attribute",          t_ATTRIBUTE          },
948
949     { "begin",              t_BEGIN              },
950     { "block",              t_BLOCK              },
951     { "body",               t_BODY               },
952     { "buffer",             t_BUFFER             },
953     { "bus",                t_BUS                },
954
955     { "case",               t_CASE               },
956     { "component",          t_COMPONENT          },
957     { "configuration",      t_CONFIGURATION      },
958     { "constant",           t_CONSTANT           },
959     { "context",            t_CONTEXT            },
960     { "cover",              t_COVER              },
961
962     { "default",            t_DEFAULT            },
963     { "disconnect",         t_DISCONNECT         },
964     { "downto",             t_DOWNTO             },
965
966     { "else",               t_ELSE               },
967     { "elsif",              t_ELSIF              },
968     { "end",                t_END                },
969     { "entity",             t_ENTITY             },
970     { "exit",               t_EXIT               },
971
972     { "fairness",           t_FAIRNESS           },
973     { "file",               t_FILE               },
974     { "for",                t_FOR                },
975     { "force",              t_FORCE              },
976     { "function",           t_FUNCTION           },
977
978     { "generate",           t_GENERATE           },
979     { "generic",            t_GENERIC            },
980     { "group",              t_GROUP              },
981     { "guarded",            t_GUARDED            },
982
983     { "if",                 t_IF                 },
984     { "impure",             t_IMPURE             },
985     { "in",                 t_IN                 },
986     { "inertial",           t_INERTIAL           },
987     { "inout",              t_INOUT              },
988     { "is",                 t_IS                 },
989   
990     { "label",              t_LABEL              },
991     { "library",            t_LIBRARY            },
992     { "linkage",            t_LINKAGE            },
993     { "literal",            t_LITERAL            },
994     { "loop",               t_LOOP               },
995
996     { "map",                t_MAP                },
997     { "mod",                t_MOD                },
998
999     { "nand",               t_NAND               },
1000     { "new",                t_NEW                },
1001     { "next",               t_NEXT               },
1002     { "nor",                t_NOR                },
1003     { "not",                t_NOT                },
1004     { "null",               t_NULL               },
1005
1006     { "of",                 t_OF                 },
1007     { "on",                 t_ON                 },
1008     { "open",               t_OPEN               },
1009     { "or",                 t_OR                 },
1010     { "others",             t_OTHERS             },
1011     { "out",                t_OUT                },
1012
1013     { "package",            t_PACKAGE            },
1014     { "parameter",          t_PARAMETER          },
1015     { "port",               t_PORT               },
1016     { "postponed",          t_POSTPONED          },
1017     { "procedure",          t_PROCEDURE          },
1018     { "process",            t_PROCESS            },
1019     { "property",           t_PROPERTY           },
1020     { "protected",          t_PROTECTED          },
1021     { "pure",               t_PURE               },
1022   
1023     { "range",              t_RANGE              },
1024     { "record",             t_RECORD             },
1025     { "register",           t_REGISTER           },
1026     { "reject",             t_REJECT             },
1027     { "release",            t_RELEASE            },
1028     { "restrict",           t_RESTRICT           },
1029     { "restrict_guarantee", t_RESTRICT_GUARANTEE },
1030     { "rem",                t_REM                },
1031     { "report",             t_REPORT             },
1032     { "rol",                t_ROL                },
1033     { "ror",                t_ROR                },
1034     { "return",             t_RETURN             },
1035
1036     { "select",             t_SELECT             },
1037     { "sequence",           t_SEQUENCE           },
1038     { "severity",           t_SEVERITY           },
1039     { "signal",             t_SIGNAL             },
1040     { "shared",             t_SHARED             },
1041     { "sla",                t_SLA                },
1042     { "sll",                t_SLL                },
1043     { "sra",                t_SRA                },
1044     { "srl",                t_SRL                },
1045     { "strong",             t_STRONG             },
1046     { "subtype",            t_SUBTYPE            },
1047
1048     { "then",               t_THEN               },
1049     { "to",                 t_TO                 },
1050     { "transport",          t_TRANSPORT          },
1051     { "type",               t_TYPE               },
1052
1053     { "unaffected",         t_UNAFFECTED         },
1054     { "units",              t_UNITS              },
1055     { "until",              t_UNTIL              },
1056     { "use",                t_USE                },
1057
1058     { "variable",           t_VARIABLE           },
1059     { "vmode",              t_VMODE              },
1060     { "vprop",              t_VPROP              },
1061     { "vunit",              t_VUNIT              },
1062
1063     { "wait",               t_WAIT               },
1064     { "when",               t_WHEN               },
1065     { "while",              t_WHILE              },
1066     { "with",               t_WITH               },
1067
1068     { "xor",                t_XOR                },
1069     { "xnor",               t_XNOR               },
1070     { "zz",                 -1                   } // list end
1071 };
1072
1073    
1074 static int find_keyword(char *s)
1075 {
1076   QCString word(s);
1077   // keyword ?
1078   if (word.length() >  MAX_KEYWORD_LEN) 
1079         return -1;
1080
1081   word=word.lower();
1082   QMap<QCString, int>::Iterator it = keyMap.find(word);
1083   if (it.key())
1084         return it.data();
1085
1086   return -1;
1087 }
1088
1089 // update current line
1090 static void lineCount()
1091 {
1092   for (const char* c=vhdlScanYYtext ; *c ; ++c )
1093   {
1094     yyLineNr += (*c == '\n') ;
1095   }
1096 }
1097
1098
1099 static void startCodeBlock(int index){
1100   int ll=strComment.length();
1101   iCodeLen=inputVhdlString.findRev(strComment.data())+ll;
1102   // fprintf(stderr,"\n startin code..%d %d %d\n",iCodeLen,num_chars,ll);
1103   //assert(false);
1104   gBlock.reset();
1105   int len=strComment.length();
1106   QCString name=strComment.right(len-index);// 
1107   name=VhdlDocGen::getIndexWord(name.data(),1);
1108   if (!name)
1109     gBlock.name="misc"+ VhdlDocGen::getRecordNumber(); 
1110   else
1111     gBlock.name=name;
1112   strComment=strComment.left(index);
1113   gBlock.startLine=yyLineNr+1;
1114   gBlock.bodyLine=yyLineNr+1;
1115   VhdlDocGen::prepareComment(strComment);
1116   gBlock.brief+=strComment;
1117 }
1118 static void makeInlineDoc(int endCode)
1119 {
1120   int len=endCode-iCodeLen;
1121   QCString par=inputVhdlString.mid(iCodeLen,len);
1122   gBlock.doc=par;
1123   gBlock.inbodyDocs=par;
1124   gBlock.section=Entry::VARIABLE_SEC;
1125   gBlock.spec=VhdlDocGen::MISCELLANEOUS;
1126   gBlock.fileName = yyFileName;
1127   gBlock.endBodyLine=yyLineNr-1;
1128   gBlock.lang=SrcLangExt_VHDL;
1129   Entry *temp=new Entry(gBlock);
1130
1131   Entry* compound=getVhdlCompound();
1132
1133   if (compound)
1134   {
1135     compound->addSubEntry(temp);
1136   }
1137   else
1138   {
1139     temp->type="misc"; // global code like library ieee...
1140     current_root->addSubEntry(temp);
1141   }
1142   strComment.resize(0);
1143   gBlock.reset();
1144
1145
1146 }// makeInlineDoc
1147
1148 static bool isConstraintFile(const QCString &fileName,const QCString &ext)
1149 {
1150   return fileName.right(ext.length())==ext;
1151 }
1152
1153 //static void resetScanner(const char* s,MyParserVhdl* parse);
1154
1155 #undef  YY_INPUT
1156 #define YY_INPUT(buf,result,max_size) result=vhdlScanYYread(buf,max_size);
1157
1158
1159 static int vhdlScanYYread(char *buf,int max_size)
1160 {
1161   int c=0;
1162   while ( c < max_size && inputVhdlString.at(inputPosition) )
1163   {
1164         *buf = inputVhdlString.at(inputPosition++) ;
1165         c++; buf++;
1166   }
1167   return c;
1168 }
1169
1170
1171
1172
1173 #line 1174 "<stdout>"
1174
1175 #define INITIAL 0
1176 #define Comment 1
1177 #define Vhdl2008Comment 2
1178 #define EndVhdl2008Comment 3
1179
1180 #ifndef YY_NO_UNISTD_H
1181 /* Special case for "unistd.h", since it is non-ANSI. We include it way
1182  * down here because we want the user's section 1 to have been scanned first.
1183  * The user has a chance to override it with an option.
1184  */
1185 #include <unistd.h>
1186 #endif
1187
1188 #ifndef YY_EXTRA_TYPE
1189 #define YY_EXTRA_TYPE void *
1190 #endif
1191
1192 static int yy_init_globals (void );
1193
1194 /* Accessor methods to globals.
1195    These are made visible to non-reentrant scanners for convenience. */
1196
1197 int vhdlScanYYlex_destroy (void );
1198
1199 int vhdlScanYYget_debug (void );
1200
1201 void vhdlScanYYset_debug (int debug_flag  );
1202
1203 YY_EXTRA_TYPE vhdlScanYYget_extra (void );
1204
1205 void vhdlScanYYset_extra (YY_EXTRA_TYPE user_defined  );
1206
1207 FILE *vhdlScanYYget_in (void );
1208
1209 void vhdlScanYYset_in  (FILE * in_str  );
1210
1211 FILE *vhdlScanYYget_out (void );
1212
1213 void vhdlScanYYset_out  (FILE * out_str  );
1214
1215 yy_size_t vhdlScanYYget_leng (void );
1216
1217 char *vhdlScanYYget_text (void );
1218
1219 int vhdlScanYYget_lineno (void );
1220
1221 void vhdlScanYYset_lineno (int line_number  );
1222
1223 /* Macros after this point can all be overridden by user definitions in
1224  * section 1.
1225  */
1226
1227 #ifndef YY_SKIP_YYWRAP
1228 #ifdef __cplusplus
1229 extern "C" int vhdlScanYYwrap (void );
1230 #else
1231 extern int vhdlScanYYwrap (void );
1232 #endif
1233 #endif
1234
1235     static void yyunput (int c,char *buf_ptr  );
1236     
1237 #ifndef yytext_ptr
1238 static void yy_flex_strncpy (char *,yyconst char *,int );
1239 #endif
1240
1241 #ifdef YY_NEED_STRLEN
1242 static int yy_flex_strlen (yyconst char * );
1243 #endif
1244
1245 #ifndef YY_NO_INPUT
1246
1247 #ifdef __cplusplus
1248 static int yyinput (void );
1249 #else
1250 static int input (void );
1251 #endif
1252
1253 #endif
1254
1255 /* Amount of stuff to slurp up with each read. */
1256 #ifndef YY_READ_BUF_SIZE
1257 #define YY_READ_BUF_SIZE 262144
1258 #endif
1259
1260 /* Copy whatever the last rule matched to the standard output. */
1261 #ifndef ECHO
1262 /* This used to be an fputs(), but since the string might contain NUL's,
1263  * we now use fwrite().
1264  */
1265 #define ECHO fwrite( vhdlScanYYtext, vhdlScanYYleng, 1, vhdlScanYYout )
1266 #endif
1267
1268 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
1269  * is returned in "result".
1270  */
1271 #ifndef YY_INPUT
1272 #define YY_INPUT(buf,result,max_size) \
1273         if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
1274                 { \
1275                 int c = '*'; \
1276                 yy_size_t n; \
1277                 for ( n = 0; n < max_size && \
1278                              (c = getc( vhdlScanYYin )) != EOF && c != '\n'; ++n ) \
1279                         buf[n] = (char) c; \
1280                 if ( c == '\n' ) \
1281                         buf[n++] = (char) c; \
1282                 if ( c == EOF && ferror( vhdlScanYYin ) ) \
1283                         YY_FATAL_ERROR( "input in flex scanner failed" ); \
1284                 result = n; \
1285                 } \
1286         else \
1287                 { \
1288                 errno=0; \
1289                 while ( (result = fread(buf, 1, max_size, vhdlScanYYin))==0 && ferror(vhdlScanYYin)) \
1290                         { \
1291                         if( errno != EINTR) \
1292                                 { \
1293                                 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1294                                 break; \
1295                                 } \
1296                         errno=0; \
1297                         clearerr(vhdlScanYYin); \
1298                         } \
1299                 }\
1300 \
1301
1302 #endif
1303
1304 /* No semi-colon after return; correct usage is to write "yyterminate();" -
1305  * we don't want an extra ';' after the "return" because that will cause
1306  * some compilers to complain about unreachable statements.
1307  */
1308 #ifndef yyterminate
1309 #define yyterminate() return YY_NULL
1310 #endif
1311
1312 /* Number of entries by which start-condition stack grows. */
1313 #ifndef YY_START_STACK_INCR
1314 #define YY_START_STACK_INCR 25
1315 #endif
1316
1317 /* Report a fatal error. */
1318 #ifndef YY_FATAL_ERROR
1319 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
1320 #endif
1321
1322 /* end tables serialization structures and prototypes */
1323
1324 /* Default declaration of generated scanner - a define so the user can
1325  * easily add parameters.
1326  */
1327 #ifndef YY_DECL
1328 #define YY_DECL_IS_OURS 1
1329
1330 extern int vhdlScanYYlex (void);
1331
1332 #define YY_DECL int vhdlScanYYlex (void)
1333 #endif /* !YY_DECL */
1334
1335 /* Code executed at the beginning of each rule, after vhdlScanYYtext and vhdlScanYYleng
1336  * have been set up.
1337  */
1338 #ifndef YY_USER_ACTION
1339 #define YY_USER_ACTION
1340 #endif
1341
1342 /* Code executed at the end of each rule. */
1343 #ifndef YY_BREAK
1344 #define YY_BREAK break;
1345 #endif
1346
1347 #define YY_RULE_SETUP \
1348         if ( vhdlScanYYleng > 0 ) \
1349                 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
1350                                 (vhdlScanYYtext[vhdlScanYYleng - 1] == '\n'); \
1351         YY_USER_ACTION
1352
1353 /** The main scanner function which does all the work.
1354  */
1355 YY_DECL
1356 {
1357         register yy_state_type yy_current_state;
1358         register char *yy_cp, *yy_bp;
1359         register int yy_act;
1360     
1361 #line 399 "vhdlscanner.l"
1362
1363
1364 #line 1365 "<stdout>"
1365
1366         if ( !(yy_init) )
1367                 {
1368                 (yy_init) = 1;
1369
1370 #ifdef YY_USER_INIT
1371                 YY_USER_INIT;
1372 #endif
1373
1374         /* Create the reject buffer large enough to save one state per allowed character. */
1375         if ( ! (yy_state_buf) )
1376             (yy_state_buf) = (yy_state_type *)vhdlScanYYalloc(YY_STATE_BUF_SIZE  );
1377             if ( ! (yy_state_buf) )
1378                 YY_FATAL_ERROR( "out of dynamic memory in vhdlScanYYlex()" );
1379
1380                 if ( ! (yy_start) )
1381                         (yy_start) = 1; /* first start state */
1382
1383                 if ( ! vhdlScanYYin )
1384                         vhdlScanYYin = stdin;
1385
1386                 if ( ! vhdlScanYYout )
1387                         vhdlScanYYout = stdout;
1388
1389                 if ( ! YY_CURRENT_BUFFER ) {
1390                         vhdlScanYYensure_buffer_stack ();
1391                         YY_CURRENT_BUFFER_LVALUE =
1392                                 vhdlScanYY_create_buffer(vhdlScanYYin,YY_BUF_SIZE );
1393                 }
1394
1395                 vhdlScanYY_load_buffer_state( );
1396                 }
1397
1398         while ( 1 )             /* loops until end-of-file is reached */
1399                 {
1400                 yy_cp = (yy_c_buf_p);
1401
1402                 /* Support of vhdlScanYYtext. */
1403                 *yy_cp = (yy_hold_char);
1404
1405                 /* yy_bp points to the position in yy_ch_buf of the start of
1406                  * the current run.
1407                  */
1408                 yy_bp = yy_cp;
1409
1410                 yy_current_state = (yy_start);
1411                 yy_current_state += YY_AT_BOL();
1412
1413                 (yy_state_ptr) = (yy_state_buf);
1414                 *(yy_state_ptr)++ = yy_current_state;
1415
1416 yy_match:
1417                 do
1418                         {
1419                         register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
1420                         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1421                                 {
1422                                 yy_current_state = (int) yy_def[yy_current_state];
1423                                 if ( yy_current_state >= 222 )
1424                                         yy_c = yy_meta[(unsigned int) yy_c];
1425                                 }
1426                         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1427                         *(yy_state_ptr)++ = yy_current_state;
1428                         ++yy_cp;
1429                         }
1430                 while ( yy_base[yy_current_state] != 938 );
1431
1432 yy_find_action:
1433                 yy_current_state = *--(yy_state_ptr);
1434                 (yy_lp) = yy_accept[yy_current_state];
1435 goto find_rule; /* Shut up GCC warning -Wall */
1436 find_rule: /* we branch to this label when backing up */
1437                 for ( ; ; ) /* until we find what rule we matched */
1438                         {
1439                         if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] )
1440                                 {
1441                                 yy_act = yy_acclist[(yy_lp)];
1442                                 if ( yy_act & YY_TRAILING_HEAD_MASK ||
1443                                      (yy_looking_for_trail_begin) )
1444                                         {
1445                                         if ( yy_act == (yy_looking_for_trail_begin) )
1446                                                 {
1447                                                 (yy_looking_for_trail_begin) = 0;
1448                                                 yy_act &= ~YY_TRAILING_HEAD_MASK;
1449                                                 break;
1450                                                 }
1451                                         }
1452                                 else if ( yy_act & YY_TRAILING_MASK )
1453                                         {
1454                                         (yy_looking_for_trail_begin) = yy_act & ~YY_TRAILING_MASK;
1455                                         (yy_looking_for_trail_begin) |= YY_TRAILING_HEAD_MASK;
1456                                         (yy_full_match) = yy_cp;
1457                                         (yy_full_state) = (yy_state_ptr);
1458                                         (yy_full_lp) = (yy_lp);
1459                                         }
1460                                 else
1461                                         {
1462                                         (yy_full_match) = yy_cp;
1463                                         (yy_full_state) = (yy_state_ptr);
1464                                         (yy_full_lp) = (yy_lp);
1465                                         break;
1466                                         }
1467                                 ++(yy_lp);
1468                                 goto find_rule;
1469                                 }
1470                         --yy_cp;
1471                         yy_current_state = *--(yy_state_ptr);
1472                         (yy_lp) = yy_accept[yy_current_state];
1473                         }
1474
1475                 YY_DO_BEFORE_ACTION;
1476
1477 do_action:      /* This label is used only to access EOF actions. */
1478
1479                 switch ( yy_act )
1480         { /* beginning of action switch */
1481 case 1:
1482 YY_RULE_SETUP
1483 #line 401 "vhdlscanner.l"
1484 { /* nothing */ }
1485         YY_BREAK
1486 case 2:
1487 YY_RULE_SETUP
1488 #line 402 "vhdlscanner.l"
1489 { return(t_Ampersand); }
1490         YY_BREAK
1491 case 3:
1492 YY_RULE_SETUP
1493 #line 403 "vhdlscanner.l"
1494 { return(t_Apostrophe); }
1495         YY_BREAK
1496 case 4:
1497 YY_RULE_SETUP
1498 #line 404 "vhdlscanner.l"
1499 { return(t_LeftParen); }
1500         YY_BREAK
1501 case 5:
1502 YY_RULE_SETUP
1503 #line 405 "vhdlscanner.l"
1504 { return(t_RightParen); }
1505         YY_BREAK
1506 case 6:
1507 YY_RULE_SETUP
1508 #line 406 "vhdlscanner.l"
1509 { return(t_DoubleStar); }
1510         YY_BREAK
1511 case 7:
1512 YY_RULE_SETUP
1513 #line 407 "vhdlscanner.l"
1514 { return(t_Star); }
1515         YY_BREAK
1516 case 8:
1517 YY_RULE_SETUP
1518 #line 408 "vhdlscanner.l"
1519 { return(t_Plus); }
1520         YY_BREAK
1521 case 9:
1522 YY_RULE_SETUP
1523 #line 409 "vhdlscanner.l"
1524 { return(t_Comma); }
1525         YY_BREAK
1526 case 10:
1527 YY_RULE_SETUP
1528 #line 410 "vhdlscanner.l"
1529 { return(t_Minus); }
1530         YY_BREAK
1531 case 11:
1532 YY_RULE_SETUP
1533 #line 411 "vhdlscanner.l"
1534 { return(t_VarAsgn); }
1535         YY_BREAK
1536 case 12:
1537 YY_RULE_SETUP
1538 #line 412 "vhdlscanner.l"
1539 { return(t_Colon); }
1540         YY_BREAK
1541 case 13:
1542 YY_RULE_SETUP
1543 #line 413 "vhdlscanner.l"
1544 { return(t_Semicolon); }
1545         YY_BREAK
1546 case 14:
1547 YY_RULE_SETUP
1548 #line 414 "vhdlscanner.l"
1549 { return(t_LESym); }
1550         YY_BREAK
1551 case 15:
1552 YY_RULE_SETUP
1553 #line 415 "vhdlscanner.l"
1554 { return(t_GESym); }
1555         YY_BREAK
1556 case 16:
1557 YY_RULE_SETUP
1558 #line 416 "vhdlscanner.l"
1559 { return(t_LTSym); }
1560         YY_BREAK
1561 case 17:
1562 YY_RULE_SETUP
1563 #line 417 "vhdlscanner.l"
1564 { return(t_GTSym); }
1565         YY_BREAK
1566 case 18:
1567 YY_RULE_SETUP
1568 #line 418 "vhdlscanner.l"
1569 { return(t_EQSym); }
1570         YY_BREAK
1571 case 19:
1572 YY_RULE_SETUP
1573 #line 419 "vhdlscanner.l"
1574 { return(t_NESym); }
1575         YY_BREAK
1576 case 20:
1577 YY_RULE_SETUP
1578 #line 420 "vhdlscanner.l"
1579 { return(t_Arrow); }
1580         YY_BREAK
1581 case 21:
1582 YY_RULE_SETUP
1583 #line 421 "vhdlscanner.l"
1584 { return(t_Box); }
1585         YY_BREAK
1586 case 22:
1587 YY_RULE_SETUP
1588 #line 422 "vhdlscanner.l"
1589 { return(t_SLSL); }
1590         YY_BREAK
1591 case 23:
1592 YY_RULE_SETUP
1593 #line 423 "vhdlscanner.l"
1594 { return(t_SRSR); }
1595         YY_BREAK
1596 case 24:
1597 YY_RULE_SETUP
1598 #line 424 "vhdlscanner.l"
1599 { return(t_QQ); }
1600         YY_BREAK
1601 case 25:
1602 YY_RULE_SETUP
1603 #line 425 "vhdlscanner.l"
1604 { return(t_QGT); }
1605         YY_BREAK
1606 case 26:
1607 YY_RULE_SETUP
1608 #line 426 "vhdlscanner.l"
1609 { return(t_QLT); }
1610         YY_BREAK
1611 case 27:
1612 YY_RULE_SETUP
1613 #line 427 "vhdlscanner.l"
1614 { return(t_QG); }
1615         YY_BREAK
1616 case 28:
1617 YY_RULE_SETUP
1618 #line 428 "vhdlscanner.l"
1619 { return(t_QL); }
1620         YY_BREAK
1621 case 29:
1622 YY_RULE_SETUP
1623 #line 429 "vhdlscanner.l"
1624 { return(t_QEQU); }
1625         YY_BREAK
1626 case 30:
1627 YY_RULE_SETUP
1628 #line 430 "vhdlscanner.l"
1629 { return(t_QNEQU); }
1630         YY_BREAK
1631 case 31:
1632 YY_RULE_SETUP
1633 #line 431 "vhdlscanner.l"
1634 { return(t_Q); }
1635         YY_BREAK
1636 case 32:
1637 YY_RULE_SETUP
1638 #line 432 "vhdlscanner.l"
1639 { return(t_Bar); }
1640         YY_BREAK
1641 case 33:
1642 YY_RULE_SETUP
1643 #line 433 "vhdlscanner.l"
1644 { return(t_Dot); }
1645         YY_BREAK
1646 case 34:
1647 YY_RULE_SETUP
1648 #line 434 "vhdlscanner.l"
1649 { return(t_Slash); }
1650         YY_BREAK
1651 case 35:
1652 YY_RULE_SETUP
1653 #line 435 "vhdlscanner.l"
1654 { return(t_At); }
1655         YY_BREAK
1656 case 36:
1657 YY_RULE_SETUP
1658 #line 436 "vhdlscanner.l"
1659 { return(t_Neg); }
1660         YY_BREAK
1661 case 37:
1662 YY_RULE_SETUP
1663 #line 437 "vhdlscanner.l"
1664 { return(t_LEFTBR); }
1665         YY_BREAK
1666 case 38:
1667 YY_RULE_SETUP
1668 #line 438 "vhdlscanner.l"
1669 { return(t_RIGHTBR); }
1670         YY_BREAK
1671 case 39:
1672 YY_RULE_SETUP
1673 #line 441 "vhdlscanner.l"
1674 {
1675           int itoken=find_keyword(vhdlScanYYtext);
1676         
1677           //    fprintf(stderr,"\n <<<< search tok:  %s %d %d>>>\n",vhdlScanYYtext,itoken,yyLineNr);
1678         
1679           // tokens in vhdlparser.hpp 258..412
1680           if (itoken>200  && itoken<500 && prevToken!=t_END)
1681           {
1682             //          printf("\n <<<< insert tok:  %s %d %d>>>\n",vhdlScanYYtext,itoken,yyLineNr);
1683             lineIndex[itoken]=yyLineNr;
1684           }
1685          
1686          // global members
1687          if (( itoken==t_ARCHITECTURE )  || 
1688              ( itoken==t_ENTITY)         || 
1689              ( itoken==t_PACKAGE )       || 
1690              ( itoken==t_LIBRARY )       ||  
1691              ( itoken==t_USE )           ||  
1692              ( itoken==t_CONFIGURATION ) ||  
1693              ( itoken==t_CONTEXT ) )
1694          {
1695            lineIndex[itoken]=yyLineNr;
1696          }
1697          
1698           prevToken=itoken;
1699         
1700           yycont->qstr=vhdlScanYYtext;
1701           yycont->yyLineNr=yyLineNr;
1702           if (itoken== -1)  
1703           {
1704             yycont->iLine=yyLineNr;
1705             return ( t_LETTER );
1706           }
1707           else 
1708           {
1709             return ( itoken );
1710           }
1711         }
1712         YY_BREAK
1713 case 40:
1714 YY_RULE_SETUP
1715 #line 480 "vhdlscanner.l"
1716 {
1717           yycont->qstr=vhdlScanYYtext;
1718           return ( t_ABSTRLIST );
1719         }
1720         YY_BREAK
1721 case 41:
1722 YY_RULE_SETUP
1723 #line 485 "vhdlscanner.l"
1724 {
1725           QCString q(vhdlScanYYtext);          
1726           yycont->qstr=vhdlScanYYtext; 
1727         
1728           if (q=="'('") // std_logic'('1') ?
1729           {
1730             char c=yy_hold_char;
1731             if (isalpha(c) || isdigit(c))
1732             {
1733               unput('\'');
1734               unput('(');
1735               return(t_Apostrophe);
1736             }
1737             else
1738             {
1739               return ( t_CHARLIST );
1740             }
1741           }
1742           return ( t_CHARLIST );
1743         }
1744         YY_BREAK
1745 case 42:
1746 YY_RULE_SETUP
1747 #line 506 "vhdlscanner.l"
1748 {
1749           yycont->qstr=vhdlScanYYtext;
1750           yycont->iLine=yyLineNr;
1751           return ( t_STRING );
1752         } 
1753         YY_BREAK
1754 case 43:
1755 YY_RULE_SETUP
1756 #line 512 "vhdlscanner.l"
1757 {
1758           yycont->qstr=vhdlScanYYtext;
1759           yycont->iLine=yyLineNr;
1760           return ( t_DIGIT );
1761         }
1762         YY_BREAK
1763 case 44:
1764 YY_RULE_SETUP
1765 #line 518 "vhdlscanner.l"
1766 {
1767           yycont->qstr=vhdlScanYYtext;
1768           yycont->iLine=yyLineNr;
1769           return(t_ToolDir);
1770         }       
1771         YY_BREAK
1772 case 45:
1773 /* rule 45 can match eol */
1774 YY_RULE_SETUP
1775 #line 524 "vhdlscanner.l"
1776 {
1777           yyLineNr++;
1778           yycont->yyLineNr=yyLineNr;
1779         }
1780         YY_BREAK
1781 case 46:
1782 YY_RULE_SETUP
1783 #line 529 "vhdlscanner.l"
1784 {
1785           /* comment */
1786           QCString qcs(vhdlScanYYtext);
1787           //  vhdl comment ?
1788           if (qcs.stripPrefix("--!"))
1789           {
1790             REJECT;
1791           }
1792         }               
1793         YY_BREAK
1794 case 47:
1795 YY_RULE_SETUP
1796 #line 538 "vhdlscanner.l"
1797 { /* unknown characters */ }
1798         YY_BREAK
1799 case 48:
1800 /* rule 48 can match eol */
1801 YY_RULE_SETUP
1802 #line 541 "vhdlscanner.l"
1803 { // multi line comment
1804   if (iDocLine==-1) iDocLine=yyLineNr;
1805   QCString qc(vhdlScanYYtext);
1806   int len=qc.contains('\n')+yyLineNr-1;
1807   if (YY_START!=Comment) // Start of the comment block
1808   {
1809     startComment=yyLineNr;
1810     g_lastCommentContext=YY_START;
1811   }
1812   
1813    if(!checkMultiComment(qc,len))
1814   {
1815     strComment+=vhdlScanYYtext;
1816   }
1817   lineCount();
1818   BEGIN(Comment);
1819 }
1820         YY_BREAK
1821 case 49:
1822 YY_RULE_SETUP
1823 #line 559 "vhdlscanner.l"
1824 {
1825   if (iDocLine==-1) iDocLine=yyLineNr;
1826   strComment+=vhdlScanYYtext;
1827   int index=strComment.find("\\code");
1828   if (index>0)
1829   {
1830     startCodeBlock(index);
1831     doxComment=TRUE;
1832   }
1833   lineCount();
1834   BEGIN(Comment);
1835 }
1836         YY_BREAK
1837 case 50:
1838 /* rule 50 can match eol */
1839 YY_RULE_SETUP
1840 #line 572 "vhdlscanner.l"
1841 {
1842           // found end of comment block
1843           
1844           int index =strComment.find("\\code");
1845           if (index>0)
1846           {
1847             startCodeBlock(index);
1848           }
1849
1850           VhdlDocGen::prepareComment(strComment);
1851
1852
1853           if (index==-1 && !doxComment) 
1854           {
1855             handleCommentBlock(strComment,FALSE);
1856           }
1857           strComment.resize(0);;
1858           unput(*vhdlScanYYtext);
1859           doxComment=FALSE;
1860           BEGIN(g_lastCommentContext);
1861         }
1862         YY_BREAK
1863 case 51:
1864 YY_RULE_SETUP
1865 #line 594 "vhdlscanner.l"
1866 { // one line comment
1867           if (iDocLine==-1) iDocLine=yyLineNr;
1868           QCString qcs(vhdlScanYYtext);
1869
1870           bool isEndCode=qcs.contains("\\endcode");
1871
1872           int index = qcs.find("\\code");
1873           if (isEndCode)
1874           {
1875             int end=inputVhdlString.find(qcs.data(),iCodeLen);
1876             makeInlineDoc(end);
1877           }
1878           else if (index > 0 ) 
1879           {
1880             // assert(false);
1881             strComment=qcs;
1882             startCodeBlock(index);
1883             strComment.resize(0);
1884           }
1885
1886           //printf("--> handleCommentBlock line %d\n",yyLineNr);
1887           if (!isEndCode && index==-1)
1888           {
1889             int j=qcs.find("--!");
1890             qcs=qcs.right(qcs.length()-3-j);
1891
1892             if(!checkMultiComment(qcs,yyLineNr))
1893             {
1894               handleCommentBlock(qcs,TRUE);
1895             }
1896           }//endcode
1897        }
1898         YY_BREAK
1899 case 52:
1900 YY_RULE_SETUP
1901 #line 627 "vhdlscanner.l"
1902 {
1903           strComment+=vhdlScanYYtext;
1904           if (yy_hold_char=='!') // found  comment starting with "/*!"
1905           {
1906             doxComment=TRUE;
1907           }
1908           BEGIN(Vhdl2008Comment); 
1909         }
1910         YY_BREAK
1911 case 53:
1912 /* rule 53 can match eol */
1913 YY_RULE_SETUP
1914 #line 636 "vhdlscanner.l"
1915 {
1916           QCString tt(vhdlScanYYtext);
1917           int len=tt.length();
1918           yyLineNr+=tt.contains('\n');
1919
1920           // delete * from comments 
1921           // /*! 
1922           // *   see vim !
1923           // */
1924
1925           if (vhdlScanYYtext[len-1]=='*' && tt.contains('\n'))
1926           {
1927             QCString ss=tt;
1928             VhdlDocGen::deleteAllChars(ss,' ');
1929             VhdlDocGen::deleteAllChars(ss,'\t');
1930             if (ss.data()  && ss.at(ss.length()-2)=='\n')
1931             {
1932               tt=tt.left(len-1);
1933               len--;
1934             }
1935           }
1936
1937           //       fprintf(stderr,"\n << %s  >>",tt.data());
1938           strComment+=tt;
1939           char c=yy_hold_char;
1940           if (c =='/')
1941           {
1942             unput('*');
1943             BEGIN(EndVhdl2008Comment);
1944           }
1945           else 
1946           {
1947             BEGIN(Vhdl2008Comment);
1948           }
1949         }
1950         YY_BREAK
1951 case 54:
1952 YY_RULE_SETUP
1953 #line 672 "vhdlscanner.l"
1954 {        
1955           if (doxComment)
1956           {  
1957             strComment.stripPrefix("/*!");
1958             strComment= strComment.left(  strComment.length()-1);
1959             handleCommentBlock( strComment,TRUE);
1960           }
1961           doxComment=FALSE;
1962           strComment.resize(0);
1963           BEGIN(INITIAL);
1964         }
1965         YY_BREAK
1966 case 55:
1967 YY_RULE_SETUP
1968 #line 685 "vhdlscanner.l"
1969 ECHO;
1970         YY_BREAK
1971 #line 1972 "<stdout>"
1972                         case YY_STATE_EOF(INITIAL):
1973                         case YY_STATE_EOF(Comment):
1974                         case YY_STATE_EOF(Vhdl2008Comment):
1975                         case YY_STATE_EOF(EndVhdl2008Comment):
1976                                 yyterminate();
1977
1978         case YY_END_OF_BUFFER:
1979                 {
1980                 /* Amount of text matched not including the EOB char. */
1981                 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1982
1983                 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1984                 *yy_cp = (yy_hold_char);
1985                 YY_RESTORE_YY_MORE_OFFSET
1986
1987                 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1988                         {
1989                         /* We're scanning a new file or input source.  It's
1990                          * possible that this happened because the user
1991                          * just pointed vhdlScanYYin at a new source and called
1992                          * vhdlScanYYlex().  If so, then we have to assure
1993                          * consistency between YY_CURRENT_BUFFER and our
1994                          * globals.  Here is the right place to do so, because
1995                          * this is the first action (other than possibly a
1996                          * back-up) that will match for the new input source.
1997                          */
1998                         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1999                         YY_CURRENT_BUFFER_LVALUE->yy_input_file = vhdlScanYYin;
2000                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
2001                         }
2002
2003                 /* Note that here we test for yy_c_buf_p "<=" to the position
2004                  * of the first EOB in the buffer, since yy_c_buf_p will
2005                  * already have been incremented past the NUL character
2006                  * (since all states make transitions on EOB to the
2007                  * end-of-buffer state).  Contrast this with the test
2008                  * in input().
2009                  */
2010                 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
2011                         { /* This was really a NUL. */
2012                         yy_state_type yy_next_state;
2013
2014                         (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
2015
2016                         yy_current_state = yy_get_previous_state(  );
2017
2018                         /* Okay, we're now positioned to make the NUL
2019                          * transition.  We couldn't have
2020                          * yy_get_previous_state() go ahead and do it
2021                          * for us because it doesn't know how to deal
2022                          * with the possibility of jamming (and we don't
2023                          * want to build jamming into it because then it
2024                          * will run more slowly).
2025                          */
2026
2027                         yy_next_state = yy_try_NUL_trans( yy_current_state );
2028
2029                         yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2030
2031                         if ( yy_next_state )
2032                                 {
2033                                 /* Consume the NUL. */
2034                                 yy_cp = ++(yy_c_buf_p);
2035                                 yy_current_state = yy_next_state;
2036                                 goto yy_match;
2037                                 }
2038
2039                         else
2040                                 {
2041                                 yy_cp = (yy_c_buf_p);
2042                                 goto yy_find_action;
2043                                 }
2044                         }
2045
2046                 else switch ( yy_get_next_buffer(  ) )
2047                         {
2048                         case EOB_ACT_END_OF_FILE:
2049                                 {
2050                                 (yy_did_buffer_switch_on_eof) = 0;
2051
2052                                 if ( vhdlScanYYwrap( ) )
2053                                         {
2054                                         /* Note: because we've taken care in
2055                                          * yy_get_next_buffer() to have set up
2056                                          * vhdlScanYYtext, we can now set up
2057                                          * yy_c_buf_p so that if some total
2058                                          * hoser (like flex itself) wants to
2059                                          * call the scanner after we return the
2060                                          * YY_NULL, it'll still work - another
2061                                          * YY_NULL will get returned.
2062                                          */
2063                                         (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
2064
2065                                         yy_act = YY_STATE_EOF(YY_START);
2066                                         goto do_action;
2067                                         }
2068
2069                                 else
2070                                         {
2071                                         if ( ! (yy_did_buffer_switch_on_eof) )
2072                                                 YY_NEW_FILE;
2073                                         }
2074                                 break;
2075                                 }
2076
2077                         case EOB_ACT_CONTINUE_SCAN:
2078                                 (yy_c_buf_p) =
2079                                         (yytext_ptr) + yy_amount_of_matched_text;
2080
2081                                 yy_current_state = yy_get_previous_state(  );
2082
2083                                 yy_cp = (yy_c_buf_p);
2084                                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2085                                 goto yy_match;
2086
2087                         case EOB_ACT_LAST_MATCH:
2088                                 (yy_c_buf_p) =
2089                                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
2090
2091                                 yy_current_state = yy_get_previous_state(  );
2092
2093                                 yy_cp = (yy_c_buf_p);
2094                                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2095                                 goto yy_find_action;
2096                         }
2097                 break;
2098                 }
2099
2100         default:
2101                 YY_FATAL_ERROR(
2102                         "fatal flex scanner internal error--no action found" );
2103         } /* end of action switch */
2104                 } /* end of scanning one token */
2105 } /* end of vhdlScanYYlex */
2106
2107 /* yy_get_next_buffer - try to read in a new buffer
2108  *
2109  * Returns a code representing an action:
2110  *      EOB_ACT_LAST_MATCH -
2111  *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
2112  *      EOB_ACT_END_OF_FILE - end of file
2113  */
2114 static int yy_get_next_buffer (void)
2115 {
2116         register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
2117         register char *source = (yytext_ptr);
2118         register int number_to_move, i;
2119         int ret_val;
2120
2121         if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
2122                 YY_FATAL_ERROR(
2123                 "fatal flex scanner internal error--end of buffer missed" );
2124
2125         if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
2126                 { /* Don't try to fill the buffer, so this is an EOF. */
2127                 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
2128                         {
2129                         /* We matched a single character, the EOB, so
2130                          * treat this as a final EOF.
2131                          */
2132                         return EOB_ACT_END_OF_FILE;
2133                         }
2134
2135                 else
2136                         {
2137                         /* We matched some text prior to the EOB, first
2138                          * process it.
2139                          */
2140                         return EOB_ACT_LAST_MATCH;
2141                         }
2142                 }
2143
2144         /* Try to read more data. */
2145
2146         /* First move last chars to start of buffer. */
2147         number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
2148
2149         for ( i = 0; i < number_to_move; ++i )
2150                 *(dest++) = *(source++);
2151
2152         if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
2153                 /* don't do the read, it's not guaranteed to return an EOF,
2154                  * just force an EOF
2155                  */
2156                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
2157
2158         else
2159                 {
2160                         yy_size_t num_to_read =
2161                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
2162
2163                 while ( num_to_read <= 0 )
2164                         { /* Not enough room in the buffer - grow it. */
2165
2166                         YY_FATAL_ERROR(
2167 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
2168
2169                         }
2170
2171                 if ( num_to_read > YY_READ_BUF_SIZE )
2172                         num_to_read = YY_READ_BUF_SIZE;
2173
2174                 /* Read in more data. */
2175                 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
2176                         (yy_n_chars), num_to_read );
2177
2178                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2179                 }
2180
2181         if ( (yy_n_chars) == 0 )
2182                 {
2183                 if ( number_to_move == YY_MORE_ADJ )
2184                         {
2185                         ret_val = EOB_ACT_END_OF_FILE;
2186                         vhdlScanYYrestart(vhdlScanYYin  );
2187                         }
2188
2189                 else
2190                         {
2191                         ret_val = EOB_ACT_LAST_MATCH;
2192                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
2193                                 YY_BUFFER_EOF_PENDING;
2194                         }
2195                 }
2196
2197         else
2198                 ret_val = EOB_ACT_CONTINUE_SCAN;
2199
2200         if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
2201                 /* Extend the array by 50%, plus the number we really need. */
2202                 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
2203                 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) vhdlScanYYrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
2204                 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
2205                         YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
2206         }
2207
2208         (yy_n_chars) += number_to_move;
2209         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
2210         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
2211
2212         (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
2213
2214         return ret_val;
2215 }
2216
2217 /* yy_get_previous_state - get the state just before the EOB char was reached */
2218
2219     static yy_state_type yy_get_previous_state (void)
2220 {
2221         register yy_state_type yy_current_state;
2222         register char *yy_cp;
2223     
2224         yy_current_state = (yy_start);
2225         yy_current_state += YY_AT_BOL();
2226
2227         (yy_state_ptr) = (yy_state_buf);
2228         *(yy_state_ptr)++ = yy_current_state;
2229
2230         for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
2231                 {
2232                 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
2233                 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2234                         {
2235                         yy_current_state = (int) yy_def[yy_current_state];
2236                         if ( yy_current_state >= 222 )
2237                                 yy_c = yy_meta[(unsigned int) yy_c];
2238                         }
2239                 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2240                 *(yy_state_ptr)++ = yy_current_state;
2241                 }
2242
2243         return yy_current_state;
2244 }
2245
2246 /* yy_try_NUL_trans - try to make a transition on the NUL character
2247  *
2248  * synopsis
2249  *      next_state = yy_try_NUL_trans( current_state );
2250  */
2251     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
2252 {
2253         register int yy_is_jam;
2254     
2255         register YY_CHAR yy_c = 1;
2256         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2257                 {
2258                 yy_current_state = (int) yy_def[yy_current_state];
2259                 if ( yy_current_state >= 222 )
2260                         yy_c = yy_meta[(unsigned int) yy_c];
2261                 }
2262         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2263         yy_is_jam = (yy_current_state == 221);
2264         if ( ! yy_is_jam )
2265                 *(yy_state_ptr)++ = yy_current_state;
2266
2267         return yy_is_jam ? 0 : yy_current_state;
2268 }
2269
2270     static void yyunput (int c, register char * yy_bp )
2271 {
2272         register char *yy_cp;
2273     
2274     yy_cp = (yy_c_buf_p);
2275
2276         /* undo effects of setting up vhdlScanYYtext */
2277         *yy_cp = (yy_hold_char);
2278
2279         if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
2280                 { /* need to shift things up to make room */
2281                 /* +2 for EOB chars. */
2282                 register yy_size_t number_to_move = (yy_n_chars) + 2;
2283                 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
2284                                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
2285                 register char *source =
2286                                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
2287
2288                 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
2289                         *--dest = *--source;
2290
2291                 yy_cp += (int) (dest - source);
2292                 yy_bp += (int) (dest - source);
2293                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
2294                         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
2295
2296                 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
2297                         YY_FATAL_ERROR( "flex scanner push-back overflow" );
2298                 }
2299
2300         *--yy_cp = (char) c;
2301
2302         (yytext_ptr) = yy_bp;
2303         (yy_hold_char) = *yy_cp;
2304         (yy_c_buf_p) = yy_cp;
2305 }
2306
2307 #ifndef YY_NO_INPUT
2308 #ifdef __cplusplus
2309     static int yyinput (void)
2310 #else
2311     static int input  (void)
2312 #endif
2313
2314 {
2315         int c;
2316     
2317         *(yy_c_buf_p) = (yy_hold_char);
2318
2319         if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
2320                 {
2321                 /* yy_c_buf_p now points to the character we want to return.
2322                  * If this occurs *before* the EOB characters, then it's a
2323                  * valid NUL; if not, then we've hit the end of the buffer.
2324                  */
2325                 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
2326                         /* This was really a NUL. */
2327                         *(yy_c_buf_p) = '\0';
2328
2329                 else
2330                         { /* need more input */
2331                         yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
2332                         ++(yy_c_buf_p);
2333
2334                         switch ( yy_get_next_buffer(  ) )
2335                                 {
2336                                 case EOB_ACT_LAST_MATCH:
2337                                         /* This happens because yy_g_n_b()
2338                                          * sees that we've accumulated a
2339                                          * token and flags that we need to
2340                                          * try matching the token before
2341                                          * proceeding.  But for input(),
2342                                          * there's no matching to consider.
2343                                          * So convert the EOB_ACT_LAST_MATCH
2344                                          * to EOB_ACT_END_OF_FILE.
2345                                          */
2346
2347                                         /* Reset buffer status. */
2348                                         vhdlScanYYrestart(vhdlScanYYin );
2349
2350                                         /*FALLTHROUGH*/
2351
2352                                 case EOB_ACT_END_OF_FILE:
2353                                         {
2354                                         if ( vhdlScanYYwrap( ) )
2355                                                 return 0;
2356
2357                                         if ( ! (yy_did_buffer_switch_on_eof) )
2358                                                 YY_NEW_FILE;
2359 #ifdef __cplusplus
2360                                         return yyinput();
2361 #else
2362                                         return input();
2363 #endif
2364                                         }
2365
2366                                 case EOB_ACT_CONTINUE_SCAN:
2367                                         (yy_c_buf_p) = (yytext_ptr) + offset;
2368                                         break;
2369                                 }
2370                         }
2371                 }
2372
2373         c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
2374         *(yy_c_buf_p) = '\0';   /* preserve vhdlScanYYtext */
2375         (yy_hold_char) = *++(yy_c_buf_p);
2376
2377         YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
2378
2379         return c;
2380 }
2381 #endif  /* ifndef YY_NO_INPUT */
2382
2383 /** Immediately switch to a different input stream.
2384  * @param input_file A readable stream.
2385  * 
2386  * @note This function does not reset the start condition to @c INITIAL .
2387  */
2388     void vhdlScanYYrestart  (FILE * input_file )
2389 {
2390     
2391         if ( ! YY_CURRENT_BUFFER ){
2392         vhdlScanYYensure_buffer_stack ();
2393                 YY_CURRENT_BUFFER_LVALUE =
2394             vhdlScanYY_create_buffer(vhdlScanYYin,YY_BUF_SIZE );
2395         }
2396
2397         vhdlScanYY_init_buffer(YY_CURRENT_BUFFER,input_file );
2398         vhdlScanYY_load_buffer_state( );
2399 }
2400
2401 /** Switch to a different input buffer.
2402  * @param new_buffer The new input buffer.
2403  * 
2404  */
2405     void vhdlScanYY_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
2406 {
2407     
2408         /* TODO. We should be able to replace this entire function body
2409          * with
2410          *              vhdlScanYYpop_buffer_state();
2411          *              vhdlScanYYpush_buffer_state(new_buffer);
2412      */
2413         vhdlScanYYensure_buffer_stack ();
2414         if ( YY_CURRENT_BUFFER == new_buffer )
2415                 return;
2416
2417         if ( YY_CURRENT_BUFFER )
2418                 {
2419                 /* Flush out information for old buffer. */
2420                 *(yy_c_buf_p) = (yy_hold_char);
2421                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2422                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2423                 }
2424
2425         YY_CURRENT_BUFFER_LVALUE = new_buffer;
2426         vhdlScanYY_load_buffer_state( );
2427
2428         /* We don't actually know whether we did this switch during
2429          * EOF (vhdlScanYYwrap()) processing, but the only time this flag
2430          * is looked at is after vhdlScanYYwrap() is called, so it's safe
2431          * to go ahead and always set it.
2432          */
2433         (yy_did_buffer_switch_on_eof) = 1;
2434 }
2435
2436 static void vhdlScanYY_load_buffer_state  (void)
2437 {
2438         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2439         (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2440         vhdlScanYYin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2441         (yy_hold_char) = *(yy_c_buf_p);
2442 }
2443
2444 /** Allocate and initialize an input buffer state.
2445  * @param file A readable stream.
2446  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2447  * 
2448  * @return the allocated buffer state.
2449  */
2450     YY_BUFFER_STATE vhdlScanYY_create_buffer  (FILE * file, int  size )
2451 {
2452         YY_BUFFER_STATE b;
2453     
2454         b = (YY_BUFFER_STATE) vhdlScanYYalloc(sizeof( struct yy_buffer_state )  );
2455         if ( ! b )
2456                 YY_FATAL_ERROR( "out of dynamic memory in vhdlScanYY_create_buffer()" );
2457
2458         b->yy_buf_size = size;
2459
2460         /* yy_ch_buf has to be 2 characters longer than the size given because
2461          * we need to put in 2 end-of-buffer characters.
2462          */
2463         b->yy_ch_buf = (char *) vhdlScanYYalloc(b->yy_buf_size + 2  );
2464         if ( ! b->yy_ch_buf )
2465                 YY_FATAL_ERROR( "out of dynamic memory in vhdlScanYY_create_buffer()" );
2466
2467         b->yy_is_our_buffer = 1;
2468
2469         vhdlScanYY_init_buffer(b,file );
2470
2471         return b;
2472 }
2473
2474 /** Destroy the buffer.
2475  * @param b a buffer created with vhdlScanYY_create_buffer()
2476  * 
2477  */
2478     void vhdlScanYY_delete_buffer (YY_BUFFER_STATE  b )
2479 {
2480     
2481         if ( ! b )
2482                 return;
2483
2484         if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2485                 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2486
2487         if ( b->yy_is_our_buffer )
2488                 vhdlScanYYfree((void *) b->yy_ch_buf  );
2489
2490         vhdlScanYYfree((void *) b  );
2491 }
2492
2493 #ifndef __cplusplus
2494 extern int isatty (int );
2495 #endif /* __cplusplus */
2496     
2497 /* Initializes or reinitializes a buffer.
2498  * This function is sometimes called more than once on the same buffer,
2499  * such as during a vhdlScanYYrestart() or at EOF.
2500  */
2501     static void vhdlScanYY_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
2502
2503 {
2504         int oerrno = errno;
2505     
2506         vhdlScanYY_flush_buffer(b );
2507
2508         b->yy_input_file = file;
2509         b->yy_fill_buffer = 1;
2510
2511     /* If b is the current buffer, then vhdlScanYY_init_buffer was _probably_
2512      * called from vhdlScanYYrestart() or through yy_get_next_buffer.
2513      * In that case, we don't want to reset the lineno or column.
2514      */
2515     if (b != YY_CURRENT_BUFFER){
2516         b->yy_bs_lineno = 1;
2517         b->yy_bs_column = 0;
2518     }
2519
2520         b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2521     
2522         errno = oerrno;
2523 }
2524
2525 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2526  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2527  * 
2528  */
2529     void vhdlScanYY_flush_buffer (YY_BUFFER_STATE  b )
2530 {
2531         if ( ! b )
2532                 return;
2533
2534         b->yy_n_chars = 0;
2535
2536         /* We always need two end-of-buffer characters.  The first causes
2537          * a transition to the end-of-buffer state.  The second causes
2538          * a jam in that state.
2539          */
2540         b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2541         b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2542
2543         b->yy_buf_pos = &b->yy_ch_buf[0];
2544
2545         b->yy_at_bol = 1;
2546         b->yy_buffer_status = YY_BUFFER_NEW;
2547
2548         if ( b == YY_CURRENT_BUFFER )
2549                 vhdlScanYY_load_buffer_state( );
2550 }
2551
2552 /** Pushes the new state onto the stack. The new state becomes
2553  *  the current state. This function will allocate the stack
2554  *  if necessary.
2555  *  @param new_buffer The new state.
2556  *  
2557  */
2558 void vhdlScanYYpush_buffer_state (YY_BUFFER_STATE new_buffer )
2559 {
2560         if (new_buffer == NULL)
2561                 return;
2562
2563         vhdlScanYYensure_buffer_stack();
2564
2565         /* This block is copied from vhdlScanYY_switch_to_buffer. */
2566         if ( YY_CURRENT_BUFFER )
2567                 {
2568                 /* Flush out information for old buffer. */
2569                 *(yy_c_buf_p) = (yy_hold_char);
2570                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2571                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2572                 }
2573
2574         /* Only push if top exists. Otherwise, replace top. */
2575         if (YY_CURRENT_BUFFER)
2576                 (yy_buffer_stack_top)++;
2577         YY_CURRENT_BUFFER_LVALUE = new_buffer;
2578
2579         /* copied from vhdlScanYY_switch_to_buffer. */
2580         vhdlScanYY_load_buffer_state( );
2581         (yy_did_buffer_switch_on_eof) = 1;
2582 }
2583
2584 /** Removes and deletes the top of the stack, if present.
2585  *  The next element becomes the new top.
2586  *  
2587  */
2588 void vhdlScanYYpop_buffer_state (void)
2589 {
2590         if (!YY_CURRENT_BUFFER)
2591                 return;
2592
2593         vhdlScanYY_delete_buffer(YY_CURRENT_BUFFER );
2594         YY_CURRENT_BUFFER_LVALUE = NULL;
2595         if ((yy_buffer_stack_top) > 0)
2596                 --(yy_buffer_stack_top);
2597
2598         if (YY_CURRENT_BUFFER) {
2599                 vhdlScanYY_load_buffer_state( );
2600                 (yy_did_buffer_switch_on_eof) = 1;
2601         }
2602 }
2603
2604 /* Allocates the stack if it does not exist.
2605  *  Guarantees space for at least one push.
2606  */
2607 static void vhdlScanYYensure_buffer_stack (void)
2608 {
2609         yy_size_t num_to_alloc;
2610     
2611         if (!(yy_buffer_stack)) {
2612
2613                 /* First allocation is just for 2 elements, since we don't know if this
2614                  * scanner will even need a stack. We use 2 instead of 1 to avoid an
2615                  * immediate realloc on the next call.
2616          */
2617                 num_to_alloc = 1;
2618                 (yy_buffer_stack) = (struct yy_buffer_state**)vhdlScanYYalloc
2619                                                                 (num_to_alloc * sizeof(struct yy_buffer_state*)
2620                                                                 );
2621                 if ( ! (yy_buffer_stack) )
2622                         YY_FATAL_ERROR( "out of dynamic memory in vhdlScanYYensure_buffer_stack()" );
2623                                                                   
2624                 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2625                                 
2626                 (yy_buffer_stack_max) = num_to_alloc;
2627                 (yy_buffer_stack_top) = 0;
2628                 return;
2629         }
2630
2631         if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
2632
2633                 /* Increase the buffer to prepare for a possible push. */
2634                 int grow_size = 8 /* arbitrary grow size */;
2635
2636                 num_to_alloc = (yy_buffer_stack_max) + grow_size;
2637                 (yy_buffer_stack) = (struct yy_buffer_state**)vhdlScanYYrealloc
2638                                                                 ((yy_buffer_stack),
2639                                                                 num_to_alloc * sizeof(struct yy_buffer_state*)
2640                                                                 );
2641                 if ( ! (yy_buffer_stack) )
2642                         YY_FATAL_ERROR( "out of dynamic memory in vhdlScanYYensure_buffer_stack()" );
2643
2644                 /* zero only the new slots.*/
2645                 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2646                 (yy_buffer_stack_max) = num_to_alloc;
2647         }
2648 }
2649
2650 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2651  * @param base the character buffer
2652  * @param size the size in bytes of the character buffer
2653  * 
2654  * @return the newly allocated buffer state object. 
2655  */
2656 YY_BUFFER_STATE vhdlScanYY_scan_buffer  (char * base, yy_size_t  size )
2657 {
2658         YY_BUFFER_STATE b;
2659     
2660         if ( size < 2 ||
2661              base[size-2] != YY_END_OF_BUFFER_CHAR ||
2662              base[size-1] != YY_END_OF_BUFFER_CHAR )
2663                 /* They forgot to leave room for the EOB's. */
2664                 return 0;
2665
2666         b = (YY_BUFFER_STATE) vhdlScanYYalloc(sizeof( struct yy_buffer_state )  );
2667         if ( ! b )
2668                 YY_FATAL_ERROR( "out of dynamic memory in vhdlScanYY_scan_buffer()" );
2669
2670         b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
2671         b->yy_buf_pos = b->yy_ch_buf = base;
2672         b->yy_is_our_buffer = 0;
2673         b->yy_input_file = 0;
2674         b->yy_n_chars = b->yy_buf_size;
2675         b->yy_is_interactive = 0;
2676         b->yy_at_bol = 1;
2677         b->yy_fill_buffer = 0;
2678         b->yy_buffer_status = YY_BUFFER_NEW;
2679
2680         vhdlScanYY_switch_to_buffer(b  );
2681
2682         return b;
2683 }
2684
2685 /** Setup the input buffer state to scan a string. The next call to vhdlScanYYlex() will
2686  * scan from a @e copy of @a str.
2687  * @param yystr a NUL-terminated string to scan
2688  * 
2689  * @return the newly allocated buffer state object.
2690  * @note If you want to scan bytes that may contain NUL values, then use
2691  *       vhdlScanYY_scan_bytes() instead.
2692  */
2693 YY_BUFFER_STATE vhdlScanYY_scan_string (yyconst char * yystr )
2694 {
2695     
2696         return vhdlScanYY_scan_bytes(yystr,strlen(yystr) );
2697 }
2698
2699 /** Setup the input buffer state to scan the given bytes. The next call to vhdlScanYYlex() will
2700  * scan from a @e copy of @a bytes.
2701  * @param bytes the byte buffer to scan
2702  * @param len the number of bytes in the buffer pointed to by @a bytes.
2703  * 
2704  * @return the newly allocated buffer state object.
2705  */
2706 YY_BUFFER_STATE vhdlScanYY_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len )
2707 {
2708         YY_BUFFER_STATE b;
2709         char *buf;
2710         yy_size_t n, i;
2711     
2712         /* Get memory for full buffer, including space for trailing EOB's. */
2713         n = _yybytes_len + 2;
2714         buf = (char *) vhdlScanYYalloc(n  );
2715         if ( ! buf )
2716                 YY_FATAL_ERROR( "out of dynamic memory in vhdlScanYY_scan_bytes()" );
2717
2718         for ( i = 0; i < _yybytes_len; ++i )
2719                 buf[i] = yybytes[i];
2720
2721         buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2722
2723         b = vhdlScanYY_scan_buffer(buf,n );
2724         if ( ! b )
2725                 YY_FATAL_ERROR( "bad buffer in vhdlScanYY_scan_bytes()" );
2726
2727         /* It's okay to grow etc. this buffer, and we should throw it
2728          * away when we're done.
2729          */
2730         b->yy_is_our_buffer = 1;
2731
2732         return b;
2733 }
2734
2735 #ifndef YY_EXIT_FAILURE
2736 #define YY_EXIT_FAILURE 2
2737 #endif
2738
2739 static void yy_fatal_error (yyconst char* msg )
2740 {
2741         (void) fprintf( stderr, "%s\n", msg );
2742         exit( YY_EXIT_FAILURE );
2743 }
2744
2745 /* Redefine yyless() so it works in section 3 code. */
2746
2747 #undef yyless
2748 #define yyless(n) \
2749         do \
2750                 { \
2751                 /* Undo effects of setting up vhdlScanYYtext. */ \
2752         int yyless_macro_arg = (n); \
2753         YY_LESS_LINENO(yyless_macro_arg);\
2754                 vhdlScanYYtext[vhdlScanYYleng] = (yy_hold_char); \
2755                 (yy_c_buf_p) = vhdlScanYYtext + yyless_macro_arg; \
2756                 (yy_hold_char) = *(yy_c_buf_p); \
2757                 *(yy_c_buf_p) = '\0'; \
2758                 vhdlScanYYleng = yyless_macro_arg; \
2759                 } \
2760         while ( 0 )
2761
2762 /* Accessor  methods (get/set functions) to struct members. */
2763
2764 /** Get the current line number.
2765  * 
2766  */
2767 int vhdlScanYYget_lineno  (void)
2768 {
2769         
2770     return vhdlScanYYlineno;
2771 }
2772
2773 /** Get the input stream.
2774  * 
2775  */
2776 FILE *vhdlScanYYget_in  (void)
2777 {
2778         return vhdlScanYYin;
2779 }
2780
2781 /** Get the output stream.
2782  * 
2783  */
2784 FILE *vhdlScanYYget_out  (void)
2785 {
2786         return vhdlScanYYout;
2787 }
2788
2789 /** Get the length of the current token.
2790  * 
2791  */
2792 yy_size_t vhdlScanYYget_leng  (void)
2793 {
2794         return vhdlScanYYleng;
2795 }
2796
2797 /** Get the current token.
2798  * 
2799  */
2800
2801 char *vhdlScanYYget_text  (void)
2802 {
2803         return vhdlScanYYtext;
2804 }
2805
2806 /** Set the current line number.
2807  * @param line_number
2808  * 
2809  */
2810 void vhdlScanYYset_lineno (int  line_number )
2811 {
2812     
2813     vhdlScanYYlineno = line_number;
2814 }
2815
2816 /** Set the input stream. This does not discard the current
2817  * input buffer.
2818  * @param in_str A readable stream.
2819  * 
2820  * @see vhdlScanYY_switch_to_buffer
2821  */
2822 void vhdlScanYYset_in (FILE *  in_str )
2823 {
2824         vhdlScanYYin = in_str ;
2825 }
2826
2827 void vhdlScanYYset_out (FILE *  out_str )
2828 {
2829         vhdlScanYYout = out_str ;
2830 }
2831
2832 int vhdlScanYYget_debug  (void)
2833 {
2834         return vhdlScanYY_flex_debug;
2835 }
2836
2837 void vhdlScanYYset_debug (int  bdebug )
2838 {
2839         vhdlScanYY_flex_debug = bdebug ;
2840 }
2841
2842 static int yy_init_globals (void)
2843 {
2844         /* Initialization is the same as for the non-reentrant scanner.
2845      * This function is called from vhdlScanYYlex_destroy(), so don't allocate here.
2846      */
2847
2848     (yy_buffer_stack) = 0;
2849     (yy_buffer_stack_top) = 0;
2850     (yy_buffer_stack_max) = 0;
2851     (yy_c_buf_p) = (char *) 0;
2852     (yy_init) = 0;
2853     (yy_start) = 0;
2854
2855     (yy_state_buf) = 0;
2856     (yy_state_ptr) = 0;
2857     (yy_full_match) = 0;
2858     (yy_lp) = 0;
2859
2860 /* Defined in main.c */
2861 #ifdef YY_STDINIT
2862     vhdlScanYYin = stdin;
2863     vhdlScanYYout = stdout;
2864 #else
2865     vhdlScanYYin = (FILE *) 0;
2866     vhdlScanYYout = (FILE *) 0;
2867 #endif
2868
2869     /* For future reference: Set errno on error, since we are called by
2870      * vhdlScanYYlex_init()
2871      */
2872     return 0;
2873 }
2874
2875 /* vhdlScanYYlex_destroy is for both reentrant and non-reentrant scanners. */
2876 int vhdlScanYYlex_destroy  (void)
2877 {
2878     
2879     /* Pop the buffer stack, destroying each element. */
2880         while(YY_CURRENT_BUFFER){
2881                 vhdlScanYY_delete_buffer(YY_CURRENT_BUFFER  );
2882                 YY_CURRENT_BUFFER_LVALUE = NULL;
2883                 vhdlScanYYpop_buffer_state();
2884         }
2885
2886         /* Destroy the stack itself. */
2887         vhdlScanYYfree((yy_buffer_stack) );
2888         (yy_buffer_stack) = NULL;
2889
2890     vhdlScanYYfree ( (yy_state_buf) );
2891     (yy_state_buf)  = NULL;
2892
2893     /* Reset the globals. This is important in a non-reentrant scanner so the next time
2894      * vhdlScanYYlex() is called, initialization will occur. */
2895     yy_init_globals( );
2896
2897     return 0;
2898 }
2899
2900 /*
2901  * Internal utility routines.
2902  */
2903
2904 #ifndef yytext_ptr
2905 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2906 {
2907         register int i;
2908         for ( i = 0; i < n; ++i )
2909                 s1[i] = s2[i];
2910 }
2911 #endif
2912
2913 #ifdef YY_NEED_STRLEN
2914 static int yy_flex_strlen (yyconst char * s )
2915 {
2916         register int n;
2917         for ( n = 0; s[n]; ++n )
2918                 ;
2919
2920         return n;
2921 }
2922 #endif
2923
2924 void *vhdlScanYYalloc (yy_size_t  size )
2925 {
2926         return (void *) malloc( size );
2927 }
2928
2929 void *vhdlScanYYrealloc  (void * ptr, yy_size_t  size )
2930 {
2931         /* The cast to (char *) in the following accommodates both
2932          * implementations that use char* generic pointers, and those
2933          * that use void* generic pointers.  It works with the latter
2934          * because both ANSI C and C++ allow castless assignment from
2935          * any pointer type to void*, and deal with argument conversions
2936          * as though doing an assignment.
2937          */
2938         return (void *) realloc( (char *) ptr, size );
2939 }
2940
2941 void vhdlScanYYfree (void * ptr )
2942 {
2943         free( (char *) ptr );   /* see vhdlScanYYrealloc() for (char *) cast */
2944 }
2945
2946 #define YYTABLES_NAME "yytables"
2947
2948 #line 685 "vhdlscanner.l"
2949
2950
2951
2952 static void parserInit()
2953 {
2954   num_chars=0;
2955   lineIndex=(int*)malloc(500*sizeof(int));
2956
2957   if (!g_lexInit) 
2958   {
2959     VhdlDocGen::init();
2960     el_mc oop;
2961     int p=0;
2962     while ((oop=tab_mc[p++]).kval!=-1)
2963     {
2964       QCString q(&oop.nom[0]);
2965       keyMap.insert(q,oop.kval);
2966     }
2967   }
2968 }
2969
2970 void vhdlscanFreeScanner()
2971 {
2972 #if defined(YY_FLEX_SUBMINOR_VERSION)
2973   if (g_lexInit)
2974   {
2975     vhdlScanYYlex_destroy();
2976   }
2977 #endif
2978 }
2979
2980 void VHDLLanguageScanner::resetCodeParserState()
2981 {
2982 }
2983
2984 bool VHDLLanguageScanner::needsPreprocessing(const QCString & /*extension*/)
2985
2986   return TRUE; 
2987 }
2988
2989 void VHDLLanguageScanner::parsePrototype(const char *text)
2990
2991   varName=text;
2992   varr=TRUE;
2993 }
2994
2995 // do parsing
2996 //int VhdlParser::doLex()
2997 //{
2998 //  int token=vhdlScanYYlex();
2999 //  //fprintf(stderr,"\ntoken: %d at line: %d",token,yyLineNr);
3000 //  return token;
3001 //}
3002
3003 void VHDLLanguageScanner::parseInput(const char *fileName,const char *fileBuf,Entry *root)
3004 {
3005   yyFileName=QCString(fileName);
3006
3007   bool xilinx_ucf=isConstraintFile(yyFileName,".ucf");
3008   bool altera_qsf=isConstraintFile(yyFileName,".qsf");
3009
3010   // support XILINX(ucf) and ALTERA (qsf) file
3011
3012   if (xilinx_ucf) 
3013   { 
3014     VhdlDocGen::parseUCF(fileBuf,root,yyFileName,FALSE);  
3015     return; 
3016   }
3017   if (altera_qsf) 
3018   { 
3019     VhdlDocGen::parseUCF(fileBuf,root,yyFileName,TRUE); 
3020     return; 
3021   }
3022
3023   ::parserInit();
3024   yycont=getVhdlCont();
3025   yycont->root=root;
3026   yycont->fileName=fileName;
3027   initVhdlParser();
3028   QCString pPuffer(" ");
3029   pPuffer+=fileBuf;
3030
3031   inputFile.setName(fileName);
3032   if (g_lexInit)
3033   {
3034     vhdlScanYYrestart( vhdlScanYYin );
3035   }
3036   g_lexInit=TRUE;
3037   g_thisParser=this;
3038   inputPosition=0;
3039   inputVhdlString=fileBuf;
3040   yyLineNr=1;
3041   current_root=root;
3042   groupEnterFile(fileName,yyLineNr);
3043   vhdlParse();
3044   Entry* curr=getCurrentVhdlEntry(); // delete last current
3045   delete curr;
3046   curr=0;
3047   free(lineIndex);
3048   inputFile.close();
3049   mapLibPackage(root);
3050 }
3051
3052 void VHDLLanguageScanner::parseCode(CodeOutputInterface &codeOutIntf,
3053     const char *scopeName,
3054     const QCString &input,
3055     bool isExampleBlock,
3056     const char *exampleName,
3057     FileDef *fileDef,
3058     int startLine,
3059     int endLine,
3060     bool inlineFragment,
3061     MemberDef *memberDef,
3062     bool showLineNumbers,
3063     Definition *searchCtx
3064     )
3065 {
3066   ::parseVhdlCode(codeOutIntf,scopeName,input,isExampleBlock,exampleName,
3067                   fileDef,startLine,endLine,inlineFragment,memberDef,
3068                   showLineNumbers,searchCtx);
3069 }
3070
3071 /*
3072  * adds the library|use statements to the next class (entity|package|architecture|package body
3073  * library ieee
3074  * entity xxx
3075  * .....
3076  * library
3077  * package
3078  * enity zzz
3079  * .....
3080  * and so on..
3081  */
3082 static void mapLibPackage(const Entry* ce)
3083 {
3084   Entry *lastComp=0;
3085   while (TRUE)
3086   {
3087     bool found = FALSE;
3088     Entry *rt=0;
3089     //const QList<Entry> *epp=ce->children();
3090     EntryListIterator eli(*ce->children());
3091     EntryListIterator eli1=eli;
3092     for (;(rt=eli.current()),eli1=eli;++eli)
3093     {
3094       if (rt->spec==VhdlDocGen::LIBRARY || rt->spec==VhdlDocGen::USE)
3095         // top level library or use statement
3096       {
3097         Entry *temp=0;
3098         if(!addLibUseClause(rt->name))
3099         {
3100           rt->spec=-1;
3101           rt->section=0;
3102           //  continue;
3103         }
3104
3105         for (;(temp=eli1.current());++eli1) // find next entity
3106         {
3107           if (temp->spec==VhdlDocGen::ENTITY || 
3108               temp->spec==VhdlDocGen::PACKAGE || 
3109               temp->spec==VhdlDocGen::ARCHITECTURE || 
3110               temp->spec==VhdlDocGen::PACKAGE_BODY)
3111           {
3112             Entry *ee=new Entry(*rt); //append a copy to entries sublist
3113             temp->addSubEntry(ee);
3114             found=TRUE;
3115             rt->spec=-1; //nullify entry
3116             rt->section=0;
3117             lastComp=temp;
3118             break;
3119           }
3120         }//for
3121         if (lastComp && rt->spec!=-1)
3122         {
3123           Entry *ee=new Entry(*rt); //append a copy to entries sublist
3124           lastComp->addSubEntry(ee);
3125           found=TRUE;
3126           rt->spec=-1; //nullify entry
3127           rt->section=0;
3128         }
3129       }//if
3130     }//for
3131     if (!found) // nothing left to do
3132     {
3133       return; 
3134     }
3135   }//while
3136 }//MapLib
3137
3138 static bool addLibUseClause(const QCString &type)
3139 {
3140   static bool show=Config_getBool("SHOW_INCLUDE_FILES");
3141   static bool showIEEESTD=Config_getBool("FORCE_LOCAL_INCLUDES");
3142
3143   if (!show)  // all libraries and included packages will not  be shown
3144   {
3145     return FALSE;
3146   }
3147
3148   if (!showIEEESTD) // all standard packages and libraries will not be shown
3149   {  
3150     if (type.lower().stripPrefix("ieee")) return FALSE;
3151     if (type.lower().stripPrefix("std")) return FALSE;
3152   }  
3153   return TRUE;
3154 }
3155
3156 static void handleCommentBlock(const QCString &doc,bool brief)
3157 {
3158   int position=0;
3159
3160   // empty comment  --!
3161   if (doc.isEmpty()) return;
3162
3163   bool needsEntry=FALSE;
3164   Protection protection=Public;
3165   int lineNr = iDocLine;
3166
3167   Entry* current=getCurrentVhdlEntry();
3168
3169   if (oldEntry==current)
3170   {
3171     //printf("\n find pending message  < %s > at line: %d \n ",doc.data(),iDocLine);
3172     str_doc.doc=doc;
3173     str_doc.iDocLine=iDocLine;
3174     str_doc.brief=brief;
3175     str_doc.pending=TRUE;
3176     return;
3177   }
3178
3179   oldEntry=current;
3180
3181   if (brief) 
3182   {
3183     current->briefLine = iDocLine; 
3184   }
3185   else 
3186   {
3187     current->docLine = iDocLine;
3188   }
3189   
3190 //  printf("parseCommentBlock file<%s>\n [%s]\n",yyFileName.data(),doc.data());
3191   while (parseCommentBlock(
3192         g_thisParser,
3193         current,
3194         doc,        // text
3195         yyFileName, // file
3196         lineNr,     // line of block start
3197         brief, 
3198         0,
3199         FALSE,
3200         protection,
3201         position,
3202         needsEntry
3203         )
3204      ) 
3205   {
3206  //printf("parseCommentBlock position=%d [%s]\n",position,doc.data()+position);
3207     if (needsEntry) newVhdlEntry();
3208   }
3209   if (needsEntry)
3210   {
3211     if (varr)
3212     {
3213       varr=FALSE;
3214       current->name=varName;
3215       current->section=Entry::VARIABLEDOC_SEC;
3216       varName="";
3217       strComment.resize(0);
3218     }
3219    
3220     newVhdlEntry();
3221   }
3222   iDocLine=-1;
3223   strComment.resize(0);
3224 }
3225
3226 // returns the vhdl parsed types at line xxx
3227 QList<Entry>* getEntryAtLine(const Entry* ce,int line)
3228 {
3229   EntryListIterator eli(*ce->children());
3230   Entry *rt;
3231   for (;(rt=eli.current());++eli)
3232   {
3233     if (rt->bodyLine==line)
3234     {
3235       lineEntry.insert(0,rt);
3236     } // if
3237
3238     getEntryAtLine(rt,line);
3239   }
3240   return &lineEntry;
3241 }
3242
3243 // token index in vhdlparser.hpp 258..416
3244 int getParsedLine(int object)
3245 {
3246   //assert(object>254 && object <416);
3247   return lineIndex [object];
3248 }
3249
3250 void isVhdlDocPending()
3251 {
3252   if (!str_doc.pending)
3253     return;
3254   str_doc.pending=FALSE;
3255   oldEntry=0; // prevents endless recursion
3256   iDocLine=str_doc.iDocLine;
3257   handleCommentBlock(str_doc.doc,str_doc.brief);
3258   iDocLine=-1;
3259 }
3260
3261 static bool  checkMultiComment(QCString& qcs,int line)
3262 {
3263   QList<Entry> *pTemp=getEntryAtLine(current_root,line);
3264
3265   if (pTemp->isEmpty()) return false;
3266
3267   //int ii=pTemp->count();
3268   qcs.stripPrefix("--!");
3269   while (!pTemp->isEmpty())
3270   {
3271     Entry *e=(Entry*)pTemp->first();
3272     e->briefLine=line;
3273     e->brief+=qcs;
3274     iDocLine=-1;
3275     pTemp->removeFirst();
3276     //ii=pTemp->count();
3277   }
3278   return true; 
3279 }
3280  
3281  
3282