Fix for UBSan build
[platform/upstream/doxygen.git] / src / tclscanner.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 tclscanYY_create_buffer
9 #define yy_delete_buffer tclscanYY_delete_buffer
10 #define yy_flex_debug tclscanYY_flex_debug
11 #define yy_init_buffer tclscanYY_init_buffer
12 #define yy_flush_buffer tclscanYY_flush_buffer
13 #define yy_load_buffer_state tclscanYY_load_buffer_state
14 #define yy_switch_to_buffer tclscanYY_switch_to_buffer
15 #define yyin tclscanYYin
16 #define yyleng tclscanYYleng
17 #define yylex tclscanYYlex
18 #define yylineno tclscanYYlineno
19 #define yyout tclscanYYout
20 #define yyrestart tclscanYYrestart
21 #define yytext tclscanYYtext
22 #define yywrap tclscanYYwrap
23 #define yyalloc tclscanYYalloc
24 #define yyrealloc tclscanYYrealloc
25 #define yyfree tclscanYYfree
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 tclscanYYrestart(tclscanYYin  )
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 tclscanYYleng;
181
182 extern FILE *tclscanYYin, *tclscanYYout;
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     /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
189      *       access to the local variable yy_act. Since yyless() is a macro, it would break
190      *       existing scanners that call yyless() from OUTSIDE tclscanYYlex. 
191      *       One obvious solution it to make yy_act a global. I tried that, and saw
192      *       a 5% performance hit in a non-tclscanYYlineno scanner, because yy_act is
193      *       normally declared as a register variable-- so it is not worth it.
194      */
195     #define  YY_LESS_LINENO(n) \
196             do { \
197                 yy_size_t yyl;\
198                 for ( yyl = n; yyl < tclscanYYleng; ++yyl )\
199                     if ( tclscanYYtext[yyl] == '\n' )\
200                         --tclscanYYlineno;\
201             }while(0)
202     
203 /* Return all but the first "n" matched characters back to the input stream. */
204 #define yyless(n) \
205         do \
206                 { \
207                 /* Undo effects of setting up tclscanYYtext. */ \
208         int yyless_macro_arg = (n); \
209         YY_LESS_LINENO(yyless_macro_arg);\
210                 *yy_cp = (yy_hold_char); \
211                 YY_RESTORE_YY_MORE_OFFSET \
212                 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
213                 YY_DO_BEFORE_ACTION; /* set up tclscanYYtext again */ \
214                 } \
215         while ( 0 )
216
217 #define unput(c) yyunput( c, (yytext_ptr)  )
218
219 #ifndef YY_STRUCT_YY_BUFFER_STATE
220 #define YY_STRUCT_YY_BUFFER_STATE
221 struct yy_buffer_state
222         {
223         FILE *yy_input_file;
224
225         char *yy_ch_buf;                /* input buffer */
226         char *yy_buf_pos;               /* current position in input buffer */
227
228         /* Size of input buffer in bytes, not including room for EOB
229          * characters.
230          */
231         yy_size_t yy_buf_size;
232
233         /* Number of characters read into yy_ch_buf, not including EOB
234          * characters.
235          */
236         yy_size_t yy_n_chars;
237
238         /* Whether we "own" the buffer - i.e., we know we created it,
239          * and can realloc() it to grow it, and should free() it to
240          * delete it.
241          */
242         int yy_is_our_buffer;
243
244         /* Whether this is an "interactive" input source; if so, and
245          * if we're using stdio for input, then we want to use getc()
246          * instead of fread(), to make sure we stop fetching input after
247          * each newline.
248          */
249         int yy_is_interactive;
250
251         /* Whether we're considered to be at the beginning of a line.
252          * If so, '^' rules will be active on the next match, otherwise
253          * not.
254          */
255         int yy_at_bol;
256
257     int yy_bs_lineno; /**< The line count. */
258     int yy_bs_column; /**< The column count. */
259     
260         /* Whether to try to fill the input buffer when we reach the
261          * end of it.
262          */
263         int yy_fill_buffer;
264
265         int yy_buffer_status;
266
267 #define YY_BUFFER_NEW 0
268 #define YY_BUFFER_NORMAL 1
269         /* When an EOF's been seen but there's still some text to process
270          * then we mark the buffer as YY_EOF_PENDING, to indicate that we
271          * shouldn't try reading from the input source any more.  We might
272          * still have a bunch of tokens to match, though, because of
273          * possible backing-up.
274          *
275          * When we actually see the EOF, we change the status to "new"
276          * (via tclscanYYrestart()), so that the user can continue scanning by
277          * just pointing tclscanYYin at a new input file.
278          */
279 #define YY_BUFFER_EOF_PENDING 2
280
281         };
282 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
283
284 /* Stack of input buffers. */
285 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
286 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
287 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
288
289 /* We provide macros for accessing buffer states in case in the
290  * future we want to put the buffer states in a more general
291  * "scanner state".
292  *
293  * Returns the top of the stack, or NULL.
294  */
295 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
296                           ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
297                           : NULL)
298
299 /* Same as previous macro, but useful when we know that the buffer stack is not
300  * NULL or when we need an lvalue. For internal use only.
301  */
302 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
303
304 /* yy_hold_char holds the character lost when tclscanYYtext is formed. */
305 static char yy_hold_char;
306 static yy_size_t yy_n_chars;            /* number of characters read into yy_ch_buf */
307 yy_size_t tclscanYYleng;
308
309 /* Points to current character in buffer. */
310 static char *yy_c_buf_p = (char *) 0;
311 static int yy_init = 0;         /* whether we need to initialize */
312 static int yy_start = 0;        /* start state number */
313
314 /* Flag which is used to allow tclscanYYwrap()'s to do buffer switches
315  * instead of setting up a fresh tclscanYYin.  A bit of a hack ...
316  */
317 static int yy_did_buffer_switch_on_eof;
318
319 void tclscanYYrestart (FILE *input_file  );
320 void tclscanYY_switch_to_buffer (YY_BUFFER_STATE new_buffer  );
321 YY_BUFFER_STATE tclscanYY_create_buffer (FILE *file,int size  );
322 void tclscanYY_delete_buffer (YY_BUFFER_STATE b  );
323 void tclscanYY_flush_buffer (YY_BUFFER_STATE b  );
324 void tclscanYYpush_buffer_state (YY_BUFFER_STATE new_buffer  );
325 void tclscanYYpop_buffer_state (void );
326
327 static void tclscanYYensure_buffer_stack (void );
328 static void tclscanYY_load_buffer_state (void );
329 static void tclscanYY_init_buffer (YY_BUFFER_STATE b,FILE *file  );
330
331 #define YY_FLUSH_BUFFER tclscanYY_flush_buffer(YY_CURRENT_BUFFER )
332
333 YY_BUFFER_STATE tclscanYY_scan_buffer (char *base,yy_size_t size  );
334 YY_BUFFER_STATE tclscanYY_scan_string (yyconst char *yy_str  );
335 YY_BUFFER_STATE tclscanYY_scan_bytes (yyconst char *bytes,yy_size_t len  );
336
337 void *tclscanYYalloc (yy_size_t  );
338 void *tclscanYYrealloc (void *,yy_size_t  );
339 void tclscanYYfree (void *  );
340
341 #define yy_new_buffer tclscanYY_create_buffer
342
343 #define yy_set_interactive(is_interactive) \
344         { \
345         if ( ! YY_CURRENT_BUFFER ){ \
346         tclscanYYensure_buffer_stack (); \
347                 YY_CURRENT_BUFFER_LVALUE =    \
348             tclscanYY_create_buffer(tclscanYYin,YY_BUF_SIZE ); \
349         } \
350         YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
351         }
352
353 #define yy_set_bol(at_bol) \
354         { \
355         if ( ! YY_CURRENT_BUFFER ){\
356         tclscanYYensure_buffer_stack (); \
357                 YY_CURRENT_BUFFER_LVALUE =    \
358             tclscanYY_create_buffer(tclscanYYin,YY_BUF_SIZE ); \
359         } \
360         YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
361         }
362
363 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
364
365 /* Begin user sect3 */
366
367 #define tclscanYYwrap(n) 1
368 #define YY_SKIP_YYWRAP
369
370 typedef unsigned char YY_CHAR;
371
372 FILE *tclscanYYin = (FILE *) 0, *tclscanYYout = (FILE *) 0;
373
374 typedef int yy_state_type;
375
376 extern int tclscanYYlineno;
377
378 int tclscanYYlineno = 1;
379
380 extern char *tclscanYYtext;
381 #define yytext_ptr tclscanYYtext
382
383 static yy_state_type yy_get_previous_state (void );
384 static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
385 static int yy_get_next_buffer (void );
386 static void yy_fatal_error (yyconst char msg[]  );
387
388 /* Done after the current pattern has been matched and before the
389  * corresponding action - sets up tclscanYYtext.
390  */
391 #define YY_DO_BEFORE_ACTION \
392         (yytext_ptr) = yy_bp; \
393         (yytext_ptr) -= (yy_more_len); \
394         tclscanYYleng = (yy_size_t) (yy_cp - (yytext_ptr)); \
395         (yy_hold_char) = *yy_cp; \
396         *yy_cp = '\0'; \
397         (yy_c_buf_p) = yy_cp;
398
399 #define YY_NUM_RULES 55
400 #define YY_END_OF_BUFFER 56
401 /* This struct is not used in this scanner,
402    but its presence is necessary. */
403 struct yy_trans_info
404         {
405         flex_int32_t yy_verify;
406         flex_int32_t yy_nxt;
407         };
408 static yyconst flex_int16_t yy_accept[179] =
409     {   0,
410         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
411         5,    5,    0,    0,    0,    0,    0,    0,   26,   26,
412         0,    0,   56,   55,    1,    4,    3,    3,    2,    4,
413        40,   37,   36,   34,   35,   40,   40,   54,   50,   52,
414        53,   49,   48,   51,   46,   54,   47,   44,   45,   15,
415         5,   14,   15,   55,   23,   24,   55,   55,   17,   18,
416        55,   55,   20,   21,   55,   29,   26,   29,   25,   29,
417        55,   31,   32,   55,    3,    0,   37,   36,   34,   35,
418         0,    0,    0,    0,   39,    0,   42,   43,   41,    5,
419         0,   12,   13,    0,    0,    0,    0,   23,   24,    0,
420
421        22,    0,   17,   18,    0,    0,   20,   21,    0,    0,
422        25,   26,    0,    0,   31,   32,    0,   30,   33,    0,
423         0,    0,    8,   13,    0,    0,    0,    0,   11,    0,
424         0,    0,   28,   25,    0,   38,    0,    6,   13,    0,
425         7,    0,    0,    0,    0,   27,    6,    0,    0,    0,
426         0,    0,    0,    0,    0,   12,    0,    0,    0,    9,
427         9,    0,    0,    0,    0,    0,    0,    0,   16,    0,
428        12,    0,   10,   10,    0,    0,   19,    0
429     } ;
430
431 static yyconst flex_int32_t yy_ec[256] =
432     {   0,
433         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
434         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
435         1,    1,    1,    1,    1,    4,    1,    1,    1,    1,
436         1,    5,    1,    6,    7,    1,    1,    1,    1,    1,
437         1,    8,    1,    1,    1,    1,    1,    1,    1,    1,
438         1,    1,    1,    1,    1,    1,    1,    1,    9,   10,
439         1,    1,    1,   11,   12,   13,   14,   15,   16,    1,
440         1,    1,   17,    1,    1,    1,   18,   19,   20,    1,
441         1,   21,    1,   22,    1,   23,    1,    1,    1,    1,
442        24,   25,   26,    1,    1,    1,   27,   28,   29,   30,
443
444        31,    1,    1,    1,   32,    1,    1,    1,   33,   34,
445        35,    1,    1,   36,    1,   37,    1,   38,    1,    1,
446         1,    1,   39,    1,   40,    1,    1,    1,    1,    1,
447         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
448         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
449         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
450         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
451         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
452         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
453         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
454
455         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
456         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
457         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
458         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
459         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
460         1,    1,    1,    1,    1
461     } ;
462
463 static yyconst flex_int32_t yy_meta[41] =
464     {   0,
465         1,    2,    3,    1,    2,    2,    4,    1,    2,    1,
466         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
467         1,    1,    1,    2,    5,    2,    1,    1,    1,    1,
468         1,    1,    1,    1,    1,    1,    1,    1,    2,    2
469     } ;
470
471 static yyconst flex_int16_t yy_base[204] =
472     {   0,
473         0,    0,  126,  112,    0,    8,   32,   70,  108,  147,
474        14,   22,   19,   27,   35,   42,   44,   51,   57,   63,
475        73,   77,  107,  615,  615,  615,   80,   91,  615,  100,
476       615,  116,  615,  615,   99,   96,   89,  615,  615,  615,
477       615,  615,  615,  615,  615,    3,  615,  615,  615,  615,
478        38,  615,  119,   83,  615,  132,  134,   87,  615,  124,
479       151,  136,  615,  139,  157,   88,  161,  615,   84,    4,
480       142,  615,  166,  171,  175,   81,    0,  615,  615,  183,
481        75,  187,   59,   60,  615,   16,  615,  615,  615,   48,
482       194,  615,  198,  200,  223,  259,  206,  615,  210,  213,
483
484       615,  202,  615,  217,  225,  229,  615,  236,  239,    8,
485         0,  245,  241,  250,  615,  254,  256,  615,  615,    0,
486       261,  264,  615,  268,  273,  287,  291,  297,  615,  299,
487       301,  304,  615,  306,  311,  615,  320,  615,  334,  336,
488       615,  338,  344,  340,  347,  615,  615,  363,  368,  370,
489       353,  379,  383,  386,  397,  213,  394,  399,  414,  615,
490       278,  408,  420,  434,  423,  439,  441,  451,  615,  455,
491       294,  457,  615,  325,  460,  462,  615,  615,  493,  498,
492       503,  508,  513,  518,  523,  528,  533,  538,  543,  547,
493       549,  554,  559,  564,  569,  574,  579,  584,  589,  594,
494
495       599,  604,  609
496     } ;
497
498 static yyconst flex_int16_t yy_def[204] =
499     {   0,
500       179,  179,  180,  180,  181,  181,  182,  182,  183,  183,
501       184,  184,  185,  185,  186,  186,  187,  187,  188,  188,
502       189,  189,  178,  178,  178,  178,  178,  178,  178,  178,
503       178,  178,  178,  178,  178,  190,  178,  178,  178,  178,
504       178,  178,  178,  178,  178,  191,  178,  178,  178,  178,
505       178,  178,  192,  193,  178,  193,  193,  194,  178,  194,
506       194,  195,  178,  195,  195,  196,  196,  178,  196,  196,
507       197,  178,  197,  197,  178,  178,   32,  178,  178,  178,
508       178,  178,  178,  178,  178,  178,  178,  178,  178,  178,
509       192,  178,  192,  198,  192,  192,  193,  178,  193,  193,
510
511       178,  194,  178,  194,  194,  195,  178,  195,  195,  196,
512       196,  196,  199,  197,  178,  197,  197,  178,  178,  200,
513       192,  198,  178,  198,  201,  198,  192,  192,  178,  194,
514       195,  199,  178,  199,  199,  178,  201,  178,  201,  201,
515       178,  192,  192,  194,  195,  178,  178,  192,  192,  194,
516       195,  192,  192,  194,  195,  202,  192,  194,  195,  178,
517       202,  192,  194,  195,  192,  194,  195,  192,  178,  195,
518       203,  195,  178,  203,  195,  195,  178,    0,  178,  178,
519       178,  178,  178,  178,  178,  178,  178,  178,  178,  178,
520       178,  178,  178,  178,  178,  178,  178,  178,  178,  178,
521
522       178,  178,  178
523     } ;
524
525 static yyconst flex_int16_t yy_nxt[656] =
526     {   0,
527       178,   27,   28,  111,   27,   88,   29,  111,   27,   27,
528        28,  111,   27,  113,   29,   51,   27,   52,   51,  178,
529        53,   55,   56,   51,   30,   52,   51,   89,   53,   55,
530        56,  178,   30,   32,   33,   34,   32,   59,   60,   90,
531        35,   61,   90,   57,   59,   60,   63,   64,   61,   90,
532        65,   57,   90,   63,   64,  120,   36,   65,   67,   68,
533        69,   67,   82,   70,   67,   68,   69,   67,  119,   70,
534        37,   32,   33,   34,   32,   72,   73,   77,   35,   72,
535        73,   75,   75,   75,   75,   98,   99,  111,   75,  103,
536       104,  111,   75,   75,   36,   75,   86,   74,   77,   75,
537
538        82,   74,   75,   82,   76,   83,  178,  100,   37,   39,
539        40,   41,   42,   43,   24,   76,   44,   77,   78,   79,
540        77,   92,   93,   84,   80,   94,  103,  104,   24,   95,
541       178,   45,   46,   47,   98,   99,  101,   99,  107,  108,
542        81,  107,  108,   96,  115,  116,   48,   49,   39,   40,
543        41,   42,   43,  103,  104,   44,  100,  178,  100,  107,
544       108,  105,  112,  178,  111,  112,  117,  109,  115,  116,
545        45,   46,   47,  118,  116,  105,   75,   75,  178,   75,
546       178,  109,  178,   75,   82,   48,   49,   82,   82,   83,
547       117,   82,  178,   83,  178,  117,   92,   93,  178,   76,
548
549        92,   93,  123,  124,  103,  104,  125,   84,   98,   99,
550       178,   84,   98,   99,  161,  101,   99,  161,  121,  103,
551       104,  178,  121,  178,  126,   92,   93,  103,  104,  178,
552       100,  107,  108,  178,  100,  178,  127,  100,  107,  108,
553       130,  107,  108,  133,  134,  128,  112,  121,  111,  112,
554       178,  127,  115,  116,  131,  130,  115,  116,  118,  116,
555       128,  129,   93,  129,   93,  135,  123,  124,  178,  131,
556       123,  124,  127,  178,  117,  138,  139,  178,  117,  161,
557       117,  128,  161,  121,  178,  121,  178,  127,  126,  141,
558       124,  178,  126,   92,   93,  174,  128,  140,  174,   92,
559
560        93,  103,  104,  107,  108,  178,  133,  134,  133,  134,
561       142,  126,  143,  146,  134,  121,  178,  144,  178,  145,
562       178,  121,  138,  139,  178,  142,  174,  143,  135,  174,
563       135,  178,  144,  178,  145,  135,  138,  139,  147,  139,
564        92,   93,  103,  104,  140,  178,   92,   93,  178,  107,
565       108,  178,  148,  178,  150,  107,  108,  178,  140,  178,
566       140,  151,  121,  178,  149,   92,   93,  148,  121,  150,
567        92,   93,  103,  104,  178,  155,  151,  178,  152,  149,
568       153,  156,   93,  154,  178,   92,   93,  121,  103,  104,
569       155,  178,  121,  152,  157,  153,   92,   93,  154,  107,
570
571       108,  103,  104,  121,  178,  158,  178,  121,  178,  157,
572        92,   93,  159,  163,  178,  162,  107,  108,  121,  178,
573       158,  178,  103,  104,  165,   92,   93,  159,  163,  178,
574       162,  178,  121,  178,  164,  166,  107,  108,  178,  165,
575       168,  169,  104,  107,  108,  178,  167,  121,  178,  164,
576       166,  178,  170,  171,   93,  168,  178,  107,  108,  107,
577       108,  167,  107,  108,  177,  108,  178,  170,  178,  178,
578       178,  178,  178,  175,  178,  121,  172,  176,  178,  178,
579       178,  178,  178,  178,  178,  178,  178,  178,  175,  178,
580       178,  172,  176,   24,   24,   24,   24,   24,   25,   25,
581
582        25,   25,   25,   26,   26,   26,   26,   26,   31,   31,
583        31,   31,   31,   38,   38,   38,   38,   38,   50,   50,
584        50,   50,   50,   54,   54,   54,   54,   54,   58,   58,
585        58,   58,   58,   62,   62,   62,   62,   62,   66,   66,
586        66,   66,   66,   71,   71,   71,   71,   71,   85,   85,
587        87,   87,  178,   87,   91,   91,   91,   91,   91,   97,
588        97,   97,   97,   97,  102,  102,  102,  102,  102,  106,
589       106,  106,  106,  106,  110,  110,  178,  110,  110,  114,
590       114,  114,  114,  114,  122,  122,  122,  122,  122,  132,
591       132,  132,  132,  132,  136,  136,  178,  136,  136,  137,
592
593       137,  137,  137,  137,  160,  160,  160,  178,  160,  173,
594       173,  173,  178,  173,   23,  178,  178,  178,  178,  178,
595       178,  178,  178,  178,  178,  178,  178,  178,  178,  178,
596       178,  178,  178,  178,  178,  178,  178,  178,  178,  178,
597       178,  178,  178,  178,  178,  178,  178,  178,  178,  178,
598       178,  178,  178,  178,  178
599     } ;
600
601 static yyconst flex_int16_t yy_chk[656] =
602     {   0,
603         0,    5,    5,  111,    5,   46,    5,   70,    5,    6,
604         6,  110,    6,   70,    6,   11,    6,   11,   11,    0,
605        11,   13,   13,   12,    5,   12,   12,   46,   12,   14,
606        14,    0,    6,    7,    7,    7,    7,   15,   15,   51,
607         7,   15,   51,   13,   16,   16,   17,   17,   16,   90,
608        17,   14,   90,   18,   18,   86,    7,   18,   19,   19,
609        19,   19,   84,   19,   20,   20,   20,   20,   83,   20,
610         7,    8,    8,    8,    8,   21,   21,   81,    8,   22,
611        22,   27,   27,   76,   27,   54,   54,   69,   27,   58,
612        58,   66,   28,   28,    8,   28,   37,   21,   36,   28,
613
614        35,   22,   30,   35,   27,   35,   23,   54,    8,    9,
615         9,    9,    9,    9,    4,   28,    9,   32,   32,   32,
616        32,   53,   53,   35,   32,   53,   60,   60,    3,   53,
617         0,    9,    9,    9,   56,   56,   57,   57,   62,   62,
618        32,   64,   64,   53,   71,   71,    9,    9,   10,   10,
619        10,   10,   10,   61,   61,   10,   56,    0,   57,   65,
620        65,   61,   67,    0,   67,   67,   71,   65,   73,   73,
621        10,   10,   10,   74,   74,   61,   75,   75,    0,   75,
622         0,   65,    0,   75,   80,   10,   10,   80,   82,   80,
623        73,   82,    0,   82,    0,   74,   91,   91,    0,   75,
624
625        93,   93,   94,   94,  102,  102,   94,   80,   97,   97,
626         0,   82,   99,   99,  156,  100,  100,  156,   91,  104,
627       104,    0,   93,    0,   94,   95,   95,  105,  105,    0,
628        97,  106,  106,    0,   99,    0,   95,  100,  108,  108,
629       105,  109,  109,  113,  113,   95,  112,   95,  112,  112,
630         0,   95,  114,  114,  109,  105,  116,  116,  117,  117,
631        95,   96,   96,  121,  121,  113,  122,  122,    0,  109,
632       124,  124,   96,    0,  114,  125,  125,    0,  116,  161,
633       117,   96,  161,   96,    0,  121,    0,   96,  122,  126,
634       126,    0,  124,  127,  127,  171,   96,  125,  171,  128,
635
636       128,  130,  130,  131,  131,    0,  132,  132,  134,  134,
637       127,  126,  128,  135,  135,  127,    0,  130,    0,  131,
638         0,  128,  137,  137,    0,  127,  174,  128,  132,  174,
639       134,    0,  130,    0,  131,  135,  139,  139,  140,  140,
640       142,  142,  144,  144,  137,    0,  143,  143,    0,  145,
641       145,    0,  142,    0,  144,  151,  151,    0,  139,    0,
642       140,  145,  142,    0,  143,  148,  148,  142,  143,  144,
643       149,  149,  150,  150,    0,  151,  145,    0,  148,  143,
644       149,  152,  152,  150,    0,  153,  153,  148,  154,  154,
645       151,    0,  149,  148,  153,  149,  157,  157,  150,  155,
646
647       155,  158,  158,  152,    0,  154,    0,  153,    0,  153,
648       162,  162,  155,  158,    0,  157,  159,  159,  157,    0,
649       154,    0,  163,  163,  162,  165,  165,  155,  158,    0,
650       157,    0,  162,    0,  159,  163,  164,  164,    0,  162,
651       165,  166,  166,  167,  167,    0,  164,  165,    0,  159,
652       163,    0,  167,  168,  168,  165,    0,  170,  170,  172,
653       172,  164,  175,  175,  176,  176,    0,  167,    0,    0,
654         0,    0,    0,  172,    0,  168,  170,  175,    0,    0,
655         0,    0,    0,    0,    0,    0,    0,    0,  172,    0,
656         0,  170,  175,  179,  179,  179,  179,  179,  180,  180,
657
658       180,  180,  180,  181,  181,  181,  181,  181,  182,  182,
659       182,  182,  182,  183,  183,  183,  183,  183,  184,  184,
660       184,  184,  184,  185,  185,  185,  185,  185,  186,  186,
661       186,  186,  186,  187,  187,  187,  187,  187,  188,  188,
662       188,  188,  188,  189,  189,  189,  189,  189,  190,  190,
663       191,  191,    0,  191,  192,  192,  192,  192,  192,  193,
664       193,  193,  193,  193,  194,  194,  194,  194,  194,  195,
665       195,  195,  195,  195,  196,  196,    0,  196,  196,  197,
666       197,  197,  197,  197,  198,  198,  198,  198,  198,  199,
667       199,  199,  199,  199,  200,  200,    0,  200,  200,  201,
668
669       201,  201,  201,  201,  202,  202,  202,    0,  202,  203,
670       203,  203,    0,  203,  178,  178,  178,  178,  178,  178,
671       178,  178,  178,  178,  178,  178,  178,  178,  178,  178,
672       178,  178,  178,  178,  178,  178,  178,  178,  178,  178,
673       178,  178,  178,  178,  178,  178,  178,  178,  178,  178,
674       178,  178,  178,  178,  178
675     } ;
676
677 /* Table of booleans, true if rule could match eol. */
678 static yyconst flex_int32_t yy_rule_can_match_eol[56] =
679     {   0,
680 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 
681     1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 
682     0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,     };
683
684 static yy_state_type yy_last_accepting_state;
685 static char *yy_last_accepting_cpos;
686
687 extern int tclscanYY_flex_debug;
688 int tclscanYY_flex_debug = 0;
689
690 /* The intent behind this definition is that it'll catch
691  * any uses of REJECT which flex missed.
692  */
693 #define REJECT reject_used_but_not_detected
694 static int yy_more_flag = 0;
695 static int yy_more_len = 0;
696 #define yymore() ((yy_more_flag) = 1)
697 #define YY_MORE_ADJ (yy_more_len)
698 #define YY_RESTORE_YY_MORE_OFFSET
699 char *tclscanYYtext;
700 #line 1 "tclscanner.l"
701 /*****************************************************************************
702  * Parser for Tcl subset
703  *
704  * Copyright (C) 2010      by Rene Zaumseil
705  * based on the work of Dimitri van Heesch.
706  *
707  * Permission to use, copy, modify, and distribute this software and its
708  * documentation under the terms of the GNU General Public License is hereby 
709  * granted. No representations are made about the suitability of this software 
710  * for any purpose. It is provided "as is" without express or implied warranty.
711  * See the GNU General Public License for more details.
712  *
713  * Documents produced by Doxygen are derivative works derived from the
714  * input used in their production; they are not affected by this license.
715  *
716  */ 
717 #line 18 "tclscanner.l"
718 #include <stdio.h> 
719 #include <stdlib.h>
720 #include <assert.h>
721 #include <ctype.h>
722 #include "qtbc.h"
723 #include <qarray.h>
724 #include <qstack.h>
725 #include <qregexp.h>
726 #include <unistd.h> 
727 #include <qfile.h>
728 #include <qdict.h>
729 #include "entry.h"
730 #include "message.h"
731 #include "config.h"
732 #include "doxygen.h"
733 #include "util.h"
734 #include "defargs.h"
735 #include "language.h"
736 #include "commentscan.h" 
737 #include "pre.h"
738 #include "tclscanner.h"
739 #include "outputlist.h"
740 #include "membername.h"
741 #include "searchindex.h"
742 #include "commentcnv.h"
743 #include "bufstr.h"
744 #include "portable.h"
745 #include <qstring.h>
746 #include <qstringlist.h>
747 #include <qlist.h>
748 #include <qmap.h>
749 #include "arguments.h"
750
751 #define YY_NEVER_INTERACTIVE 1
752 #define YY_NO_INPUT 1
753
754 #define MAX_INCLUDE_DEPTH 10
755
756 //! Application error.
757 #define tcl_err \
758   printf("Error %d %s() at line %d! ",__LINE__,tcl.file_name.data(),tclscanYYlineno); \
759   yy_push_state(ERROR); \
760   yyless(0); \
761   printf
762
763 //! Application warning.
764 #define tcl_war \
765   printf("Warning %d %s() at line %d: ",__LINE__,tcl.file_name.data(),tclscanYYlineno); \
766   printf
767
768 //! Application message.
769 #define tcl_inf \
770   if (0) printf("--- %.4d %d@%d: ",__LINE__,tclscanYYlineno,yy_start_stack_ptr) && printf
771
772 //! Debug message.
773 #define D\
774   if (0) printf("--- %.4d %d@%d: %s\n",__LINE__,tclscanYYlineno,yy_start_stack_ptr,tclscanYYtext);
775
776 // BEGIN of copy from tclUtil.c
777 // - Tcl_Interp removed
778 // - changes are marked with RZ
779 // #define's to adapt the code:
780 #define CONST           const
781 #define UCHAR           (unsigned char)
782 #define TCL_ERROR       1
783 #define TCL_OK          0
784 #define ckalloc         malloc
785 #define ckfree          free
786 #define TclCopyAndCollapse(size,src,dest) memcpy(dest,src,size); *(dest+size)=0
787 int TclFindElement(
788       CONST char *list,         /* Points to the first byte of a string
789                                  * containing a Tcl list with zero or more
790                                  * elements (possibly in braces). */
791       int listLength,           /* Number of bytes in the list's string. */
792       CONST char **elementPtr,  /* Where to put address of first significant
793                                  * character in first element of list. */
794       CONST char **nextPtr,     /* Fill in with location of character just
795                                  * after all white space following end of
796                                  * argument (next arg or end of list). */
797       int *sizePtr,             /* If non-zero, fill in with size of
798                                  * element. */
799       int *bracePtr)            /* If non-zero, fill in with non-zero/zero to
800                                  * indicate that arg was/wasn't in braces. */
801 {
802   CONST char *p = list;
803   CONST char *elemStart;        /* Points to first byte of first element. */
804   CONST char *limit;            /* Points just after list's last byte. */
805   int openBraces = 0;           /* Brace nesting level during parse. */
806   int inQuotes = 0;
807   int size = 0;         /* lint. */
808   //RZ    int numChars;
809
810   /*
811    * Skim off leading white space and check for an opening brace or quote.
812    * We treat embedded NULLs in the list as bytes belonging to a list
813    * element.
814    */
815
816   limit = (list + listLength);
817   while ((p < limit) && (isspace(UCHAR(*p)))) 
818   { /* INTL: ISO space. */
819     p++;
820   }
821   if (p == limit) 
822   {             /* no element found */
823     elemStart = limit;
824     goto done;
825   }
826
827   if (*p == '{') 
828   {
829     openBraces = 1;
830     p++;
831   } 
832   else if (*p == '"') 
833   {
834     inQuotes = 1;
835     p++;
836   }
837   elemStart = p;
838   if (bracePtr != 0) 
839   {
840     *bracePtr = openBraces;
841   }
842
843   /*
844    * Find element's end (a space, close brace, or the end of the string).
845    */
846
847   while (p < limit) 
848   {
849     switch (*p) 
850     {
851       /*
852        * Open brace: don't treat specially unless the element is in
853        * braces. In this case, keep a nesting count.
854        */
855
856       case '{':
857         if (openBraces != 0) 
858         {
859           openBraces++;
860         }
861         break;
862
863         /*
864          * Close brace: if element is in braces, keep nesting count and
865          * quit when the last close brace is seen.
866          */
867
868       case '}':
869         if (openBraces > 1) 
870         {
871           openBraces--;
872         } 
873         else if (openBraces == 1) 
874         {
875           size = (p - elemStart);
876           p++;
877           if ((p >= limit) || isspace(UCHAR(*p))) 
878           {     /* INTL: ISO space. */
879             goto done;
880           }
881
882           /*
883            * Garbage after the closing brace; return an error.
884            */
885
886           return TCL_ERROR;
887         }
888         break;
889
890         /*
891          * Backslash: skip over everything up to the end of the backslash
892          * sequence.
893          */
894
895       case '\\':
896         //RZ        Tcl_UtfBackslash(p, &numChars, NULL);
897         //RZ        p += (numChars - 1);
898         p++; //RZ
899         break;
900
901         /*
902          * Space: ignore if element is in braces or quotes; otherwise
903          * terminate element.
904          */
905
906       case ' ':
907       case '\f':
908       case '\n':
909       case '\r':
910       case '\t':
911       case '\v':
912         if ((openBraces == 0) && !inQuotes) 
913         {
914           size = (p - elemStart);
915           goto done;
916         }
917         break;
918
919         /*
920          * Double-quote: if element is in quotes then terminate it.
921          */
922
923       case '"':
924         if (inQuotes) 
925         {
926           size = (p - elemStart);
927           p++;
928           if ((p >= limit) || isspace(UCHAR(*p))) 
929           {     /* INTL: ISO space */
930             goto done;
931           }
932
933           /*
934            * Garbage after the closing quote; return an error.
935            */
936           return TCL_ERROR;
937         }
938         break;
939     }
940     p++;
941   }
942
943   /*
944    * End of list: terminate element.
945    */
946
947   if (p == limit) 
948   {
949     if (openBraces != 0) 
950     {
951       return TCL_ERROR;
952     } 
953     else if (inQuotes) 
954     {
955       return TCL_ERROR;
956     }
957     size = (p - elemStart);
958   }
959
960 done:
961   while ((p < limit) && (isspace(UCHAR(*p)))) 
962   { /* INTL: ISO space. */
963     p++;
964   }
965   *elementPtr = elemStart;
966   *nextPtr = p;
967   if (sizePtr != 0) 
968   {
969     *sizePtr = size;
970   }
971   return TCL_OK;
972 }
973
974 int Tcl_SplitList(
975     CONST char *list,           /* Pointer to string with list structure. */
976     int *argcPtr,               /* Pointer to location to fill in with the
977                                  * number of elements in the list. */
978     CONST char ***argvPtr)      /* Pointer to place to store pointer to array
979                                  * of pointers to list elements. */
980 {
981   CONST char **argv, *l, *element;
982   char *p;
983   int length, size, i, result, elSize, brace;
984
985   /*
986    * Figure out how much space to allocate. There must be enough space for
987    * both the array of pointers and also for a copy of the list. To estimate
988    * the number of pointers needed, count the number of space characters in
989    * the list.
990    */
991
992   for (size = 2, l = list; *l != 0; l++) 
993   {
994     if (isspace(UCHAR(*l))) 
995     {                   /* INTL: ISO space. */
996       size++;
997
998       /*
999        * Consecutive space can only count as a single list delimiter.
1000        */
1001
1002       while (1) 
1003       {
1004         char next = *(l + 1);
1005
1006         if (next == '\0') 
1007         {
1008           break;
1009         }
1010         ++l;
1011         if (isspace(UCHAR(next))) 
1012         {               /* INTL: ISO space. */
1013           continue;
1014         }
1015         break;
1016       }
1017     }
1018   }
1019   length = l - list;
1020   argv = (CONST char **) ckalloc((unsigned)
1021       ((size * sizeof(char *)) + length + 1));
1022   for (i = 0, p = ((char *) argv) + size*sizeof(char *);
1023       *list != 0;  i++) 
1024   {
1025     CONST char *prevList = list;
1026
1027     result = TclFindElement(list, length, &element, &list,
1028         &elSize, &brace);
1029     length -= (list - prevList);
1030     if (result != TCL_OK) 
1031     {
1032       ckfree((char *) argv);
1033       return result;
1034     }
1035     if (*element == 0) 
1036     {
1037       break;
1038     }
1039     if (i >= size) 
1040     {
1041       ckfree((char *) argv);
1042       return TCL_ERROR;
1043     }
1044     argv[i] = p;
1045     if (brace) 
1046     {
1047       memcpy(p, element, (size_t) elSize);
1048       p += elSize;
1049       *p = 0;
1050       p++;
1051     } 
1052     else 
1053     {
1054       TclCopyAndCollapse(elSize, element, p);
1055       p += elSize+1;
1056     }
1057   }
1058
1059   argv[i] = NULL;
1060   *argvPtr = argv;
1061   *argcPtr = i;
1062   return TCL_OK;
1063 }
1064 // END of tclUtil.c
1065
1066 void tcl_split_list(QString &str, QStringList &list)
1067 {
1068   int argc;
1069   const char **argv;
1070
1071   list.clear();
1072   if (str.left(1)=="{" && str.right(1)=="}")
1073   {
1074     str=str.mid(1,str.length()-2);
1075   }
1076   else if (str.left(1)=="\"" && str.right(1)=="\"")
1077   {
1078     str=str.mid(1,str.length()-2);
1079   }
1080   if (Tcl_SplitList(str.ascii(),&argc,&argv) != TCL_OK)
1081   {
1082     list.append(str);
1083   }
1084   else
1085   {
1086     for (int i = 0; i < argc; i++)
1087     {
1088       list.append(argv[i]);
1089     }
1090     ckfree((char *) argv);
1091   }
1092 }
1093
1094 //! Structure containing information about current scan context.
1095 typedef struct
1096 {
1097   char type[2]; // type of scan context: "\"" "{" "[" "?" " "
1098   int line0; // start line of scan context
1099   int line1; // end line of scan context
1100   YY_BUFFER_STATE buffer_state; // value of scan context
1101   QCString ns; // current namespace
1102   Entry *entry_fn; // if set contains the current proc/method/constructor/destructor
1103   Entry *entry_cl; // if set contain the current class
1104   Entry *entry_scan; // current scan entry
1105   Protection protection; // current protections state
1106   QStringList after; // option/value list (options: NULL comment keyword script)
1107 } tcl_scan;
1108
1109 //* Structure containing all internal global variables.
1110 static struct
1111 {
1112   CodeOutputInterface * code; // if set then we are codifying the file
1113   int code_line; // current line of code
1114   int code_linenumbers; // if true create line numbers in code
1115   const char *code_font; // used font to codify
1116   bool config_autobrief; // value of configuration option
1117   QMap<QString,QString> config_subst; // map of configuration option values
1118   QCString input_string; // file contents
1119   int input_position; // position in file
1120   QCString file_name; // name of used file
1121   ParserInterface *this_parser; // myself
1122   int command; // true if command was found
1123   int comment; // set true if comment was scaned
1124   int brace_level; // bookkeeping of braces
1125   int bracket_level; // bookkeeping of brackets
1126   int bracket_quote; // bookkeeping of quotes (toggles)
1127   char word_is; // type of current word: "\"" "{" "[" "?" " "
1128   int line_comment; // line number of comment
1129   int line_commentline; // line number of comment after command
1130   int line_command; // line number of command
1131   int line_body0; // start line of body
1132   int line_body1; // end line of body
1133   QCString string_command; // contain current command
1134   QCString string_commentline; // contain current comment after command
1135   QCString string_commentcodify; // current comment string used in codifying
1136   QCString string_comment; // contain current comment
1137   QCString string_last; // contain last read word or part of word
1138   QCString string; // temporary string value
1139   Entry*                entry_main; // top level entry
1140   Entry*                entry_file; // entry of current file
1141   Entry*                entry_current; // currently used entry
1142   Entry*                entry_inside; // contain entry of current scan context
1143   QStringList list_commandwords; // list of command words
1144   QList<tcl_scan> scan; // stack of scan contexts
1145   QAsciiDict<Entry> ns; // all read namespace entries
1146   QAsciiDict<Entry> cl; // all read class entries
1147   QAsciiDict<Entry> fn; // all read function entries
1148   QList<Entry> entry; // list of all created entries, will be deleted after codifying
1149   Protection protection; // current protections state
1150   MemberDef *memberdef; // contain current MemberDef when codifying
1151 } tcl;
1152
1153 // scanner functions
1154 static int yyread(char *buf,int max_size);
1155 static tcl_scan *tcl_scan_start(char type, QString content, QCString ns, Entry *entry_cls, Entry *entry_fn);
1156 static void tcl_scan_end();
1157 static void tcl_comment(int what,const char *text);
1158 static void tcl_word(int what,const char *text);
1159 static void tcl_command(int what,const char *text);
1160
1161 // helper functions
1162
1163 //! Create new entry.
1164 // @return new initialised entry
1165 Entry* tcl_entry_new()
1166 {
1167   Entry *myEntry = new Entry;
1168   myEntry->section    = Entry::EMPTY_SEC;
1169   myEntry->name       = "";
1170 //  myEntry->type       = "";
1171   myEntry->brief      = "";
1172 //  myEntry->doc        = "";
1173   myEntry->protection = Public;
1174 //  myEntry->mtype      = Method;
1175 //  myEntry->virt       = Normal;
1176 //  myEntry->stat       = FALSE;
1177   myEntry->fileName   = tcl.file_name;
1178   myEntry->lang       = SrcLangExt_Tcl;
1179   initGroupInfo(myEntry);
1180   // collect entries
1181   if (tcl.code==NULL)
1182   {
1183     tcl.entry.insert(0,myEntry);
1184   }
1185   return myEntry;
1186 }
1187
1188 //! Set protection level.
1189 void tcl_protection(Entry *entry) 
1190 {
1191   if (entry->protection!=Public&&entry->protection!=Protected&&entry->protection!=Private)
1192   {
1193     entry->protection = tcl.protection;
1194   }
1195   if (entry->protection!=Protected&&entry->protection!=Private)
1196   {
1197     entry->protection = Public;
1198   }
1199 }
1200
1201 //! Check name.
1202 // @return 'ns' and 'name' of given current 'ns0' and 'name0'
1203 static void tcl_name(const QCString &ns0, const QCString &name0, QCString &ns, QCString &name)
1204 {
1205   QCString myNm;
1206   int myStart;
1207
1208   if (strncmp(name0.data(),"::",2)==0)
1209   {
1210     myNm = name0.mid(2);
1211   }
1212   else if (ns0.length() && ns0 != " ")
1213   {
1214     myNm = ns0 + "::" + name0;
1215   }
1216   else
1217   {
1218     myNm = name0;
1219   }
1220   myStart = myNm.findRev("::");
1221   if (myStart == -1)
1222   {
1223     ns = "";
1224     name = myNm;
1225   }
1226   else
1227   {
1228     ns = myNm.mid(0,myStart);
1229     name = myNm.mid(myStart+2);
1230   }
1231 }
1232
1233 // Check and return namespace entry.
1234 // @return namespace entry
1235 Entry* tcl_entry_namespace(const QCString ns)
1236 {
1237   Entry *myEntry;
1238   if (ns.length())
1239   {
1240     myEntry = tcl.ns.find(ns);
1241   }
1242   else
1243   {
1244     myEntry = tcl.ns.find("::");
1245   }
1246   if (myEntry == NULL)
1247   {
1248     myEntry = tcl_entry_new();
1249     myEntry->section    = Entry::NAMESPACE_SEC;
1250     myEntry->name       = ns;
1251     tcl.entry_main->addSubEntry(myEntry);
1252     tcl.ns.insert(ns,myEntry);
1253   }
1254   return myEntry;
1255 }
1256
1257 // Check and return class entry.
1258 // @return class entry
1259 Entry* tcl_entry_class(const QCString cl)
1260 {
1261   Entry *myEntry;
1262   if (!cl.length()) return(NULL);
1263
1264   myEntry = tcl.cl.find(cl);
1265   if (myEntry == NULL)
1266   {
1267     myEntry = tcl_entry_new();
1268     myEntry->section    = Entry::CLASS_SEC;
1269     myEntry->name       = cl;
1270     tcl.entry_main->addSubEntry(myEntry);
1271     tcl.cl.insert(cl,myEntry);
1272   }
1273   return myEntry;
1274 }
1275
1276 //! Check for keywords.
1277 // @return 1 if keyword and 0 otherwise
1278 static int tcl_keyword(QCString str)
1279 {
1280   static QStringList myList;
1281   static int myInit=1;
1282   if (myInit)
1283   {
1284     // tcl keywords
1285     myList <<"append"<<"apply"<<"array"<<"auto_execok"<<"auto_import"<<"auto_load"<<"auto_mkindex"<<"auto_qualify"<<"auto_reset";
1286     myList <<"binary";
1287     myList <<"catch"<<"cd"<<"close"<<"clock"<<"concat";
1288     myList <<"eof"<<"eval"<<"exec"<<"exit"<<"expr";
1289     myList <<"fblocked"<<"fconfigure"<<"file"<<"fileevent"<<"flush"<<"for"<<"foreach"<<"format";
1290     myList <<"gets"<<"global";
1291     myList <<"http";
1292     myList <<"if"<<"incr"<<"info"<<"interp";
1293     myList <<"join";
1294     myList <<"lappend"<<"lassign"<<"lindex"<<"linsert"<<"llength"<<"load"<<"lrange"<<"lrepeat"<<"lreplace"<<"lreverse"<<"lset";
1295     myList <<"namespace";
1296     myList <<"package"<<"parray"<<"pid"<<"pkg_mkIndex"<<"proc"<<"puts"<<"pwd";
1297     myList <<"registry"<<"rename"<<"return";
1298     myList <<"scan"<<"set"<<"split"<<"string"<<"switch";
1299     myList <<"tclLog"<<"tcl_endOfWord"<<"tcl_findLibrary"<<"tcl_startOfNextWord"<<"tcl_startOfPreviousWord"<<"tcl_wordBreakAfter"<<"tcl_wordBreakBefore"<<"tell"<<"time";
1300     myList <<"unknown"<<"upvar";
1301     myList <<"variable"<<"vwait";
1302 // tk keywords
1303     myList <<"bell"<<"bind"<<"bindtags";
1304     myList <<"clipboard"<<"console"<<"consoleinterp";
1305     myList <<"destroy";
1306     myList <<"event";
1307     myList <<"focus";
1308     myList <<"grid";
1309     myList <<"lower";
1310     myList <<"option";
1311     myList <<"pack"<<"place";
1312     myList <<"raise";
1313     myList <<"send";
1314     myList <<"tkerror"<<"tkwait"<<"tk_bisque"<<"tk_focusNext"<<"tk_focusPrev"<<"tk_focusFollowsMouse"<<"tk_popup"<<"tk_setPalette"<<"tk_textCut"<<"tk_TextCopy"<<"tk_textPaste"<<"chooseColor"<<"tk_chooseColor"<<"tk_chooseDirectory"<<"tk_dialog"<<"tk_getOpenFile"<<"tkDialog"<<"tk_getSaveFile"<<"tk_messageBox";
1315     myList <<"winfo"<<"wm";
1316     myList <<"button"<<"canvas"<<"checkbutton"<<"entry"<<"frame"<<"image"<<"label"<<"labelframe"<<"listbox"<<"menu"<<"menubutton"<<"message"<<"panedwindow"<<"radiobutton"<<"scale"<<"scrollbar"<<"spinbox"<<"toplevel";
1317     myList.sort();
1318     myInit=0;
1319   }
1320   str=str.stripWhiteSpace();
1321   if (str.left(2)=="::") {str=str.mid(2);}
1322   if (myList.findIndex(str) != -1) return(1);
1323   return 0;
1324 }
1325
1326 //! End codifying with special font class.
1327 static void tcl_font_end()
1328 {
1329   if (tcl.code==NULL) return;
1330   if (tcl.code_font)
1331   {
1332     tcl.code->endFontClass();
1333     tcl.code_font=NULL;
1334   }
1335 }
1336
1337 //! Codify 'str' with special font class 's'.
1338 static void tcl_codify(const char *s,char *str)
1339 {
1340   if (tcl.code==NULL||str==NULL) return;
1341   if (s && strcmp(s,"NULL")!=0)
1342   {
1343     tcl_font_end();
1344     tcl.code->startFontClass(s);
1345     tcl.code_font=s;
1346   }
1347   char *p=str,*sp=p;
1348   char c;
1349   bool done=FALSE;
1350   while (!done)
1351   {
1352     sp=p;
1353     while ((c=*p++) && c!='\n') {}
1354     if (c=='\n')
1355     {
1356       tcl.code_line++;
1357       *(p-1)='\0';
1358       tcl.code->codify(sp);
1359       //tcl_font_end();
1360       tcl.code->endCodeLine();
1361       if (tcl.code_linenumbers)
1362       {
1363         if (tcl.code_font!=NULL)
1364         {
1365           tcl.code->endFontClass();
1366           tcl.code->writeLineNumber(0,0,0,tcl.code_line);
1367           tcl.code->startFontClass(tcl.code_font);
1368         }
1369         else
1370         {
1371           tcl.code->writeLineNumber(0,0,0,tcl.code_line);
1372         }
1373       }
1374     }
1375     else
1376     {
1377       tcl.code->codify(sp);
1378       done=TRUE;
1379     }
1380   }
1381   tcl_font_end();
1382 }
1383
1384 #if 0
1385 //! Codify 'str' with special font class 's'.
1386 static void tcl_codify(const char *s,const char *str)
1387 {
1388   if (tcl.code==NULL) return;
1389   char *tmp= (char *) malloc(strlen(str)+1);
1390   strcpy(tmp, str);
1391   tcl_codify(s,tmp);
1392   free(tmp);
1393 }
1394
1395 //! Codify 'str' with special font class 's'.
1396 static void tcl_codify(const char *s,const QString &str)
1397 {
1398   if (tcl.code==NULL) return;
1399   tcl_codify(s,str.utf8());
1400 }
1401 #endif
1402
1403 //! Codify 'str' with special font class 's'.
1404 static void tcl_codify(const char *s,const QCString &str)
1405 {
1406   if (tcl.code==NULL) return;
1407   tcl_codify(s,str.data());
1408 }
1409
1410 static void tcl_codify_cmd(const char *s,int i)
1411 {
1412   tcl_codify(s,(*tcl.list_commandwords.at(i)).utf8());
1413 }
1414
1415 //-----------------------------------------------------------------------------
1416 #undef  YY_INPUT
1417 #define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size);
1418 //-----------------------------------------------------------------------------
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429 #line 1430 "<stdout>"
1430
1431 #define INITIAL 0
1432 #define ERROR 1
1433 #define TOP 2
1434 #define COMMAND 3
1435 #define WORD 4
1436 #define COMMENT 5
1437 #define COMMENT_NL 6
1438 #define COMMENT_CODE 7
1439 #define COMMENT_VERB 8
1440 #define COMMENTLINE 9
1441 #define COMMENTLINE_NL 10
1442
1443 #ifndef YY_NO_UNISTD_H
1444 /* Special case for "unistd.h", since it is non-ANSI. We include it way
1445  * down here because we want the user's section 1 to have been scanned first.
1446  * The user has a chance to override it with an option.
1447  */
1448 #include <unistd.h>
1449 #endif
1450
1451 #ifndef YY_EXTRA_TYPE
1452 #define YY_EXTRA_TYPE void *
1453 #endif
1454
1455 static int yy_init_globals (void );
1456
1457 /* Accessor methods to globals.
1458    These are made visible to non-reentrant scanners for convenience. */
1459
1460 int tclscanYYlex_destroy (void );
1461
1462 int tclscanYYget_debug (void );
1463
1464 void tclscanYYset_debug (int debug_flag  );
1465
1466 YY_EXTRA_TYPE tclscanYYget_extra (void );
1467
1468 void tclscanYYset_extra (YY_EXTRA_TYPE user_defined  );
1469
1470 FILE *tclscanYYget_in (void );
1471
1472 void tclscanYYset_in  (FILE * in_str  );
1473
1474 FILE *tclscanYYget_out (void );
1475
1476 void tclscanYYset_out  (FILE * out_str  );
1477
1478 yy_size_t tclscanYYget_leng (void );
1479
1480 char *tclscanYYget_text (void );
1481
1482 int tclscanYYget_lineno (void );
1483
1484 void tclscanYYset_lineno (int line_number  );
1485
1486 /* Macros after this point can all be overridden by user definitions in
1487  * section 1.
1488  */
1489
1490 #ifndef YY_SKIP_YYWRAP
1491 #ifdef __cplusplus
1492 extern "C" int tclscanYYwrap (void );
1493 #else
1494 extern int tclscanYYwrap (void );
1495 #endif
1496 #endif
1497
1498     static void yyunput (int c,char *buf_ptr  );
1499     
1500 #ifndef yytext_ptr
1501 static void yy_flex_strncpy (char *,yyconst char *,int );
1502 #endif
1503
1504 #ifdef YY_NEED_STRLEN
1505 static int yy_flex_strlen (yyconst char * );
1506 #endif
1507
1508 #ifndef YY_NO_INPUT
1509
1510 #ifdef __cplusplus
1511 static int yyinput (void );
1512 #else
1513 static int input (void );
1514 #endif
1515
1516 #endif
1517
1518         static int yy_start_stack_ptr = 0;
1519         static int yy_start_stack_depth = 0;
1520         static int *yy_start_stack = NULL;
1521     
1522     static void yy_push_state (int new_state );
1523     
1524     static void yy_pop_state (void );
1525     
1526     static int yy_top_state (void );
1527     
1528 /* Amount of stuff to slurp up with each read. */
1529 #ifndef YY_READ_BUF_SIZE
1530 #define YY_READ_BUF_SIZE 262144
1531 #endif
1532
1533 /* Copy whatever the last rule matched to the standard output. */
1534 #ifndef ECHO
1535 /* This used to be an fputs(), but since the string might contain NUL's,
1536  * we now use fwrite().
1537  */
1538 #define ECHO fwrite( tclscanYYtext, tclscanYYleng, 1, tclscanYYout )
1539 #endif
1540
1541 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
1542  * is returned in "result".
1543  */
1544 #ifndef YY_INPUT
1545 #define YY_INPUT(buf,result,max_size) \
1546         if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
1547                 { \
1548                 int c = '*'; \
1549                 yy_size_t n; \
1550                 for ( n = 0; n < max_size && \
1551                              (c = getc( tclscanYYin )) != EOF && c != '\n'; ++n ) \
1552                         buf[n] = (char) c; \
1553                 if ( c == '\n' ) \
1554                         buf[n++] = (char) c; \
1555                 if ( c == EOF && ferror( tclscanYYin ) ) \
1556                         YY_FATAL_ERROR( "input in flex scanner failed" ); \
1557                 result = n; \
1558                 } \
1559         else \
1560                 { \
1561                 errno=0; \
1562                 while ( (result = fread(buf, 1, max_size, tclscanYYin))==0 && ferror(tclscanYYin)) \
1563                         { \
1564                         if( errno != EINTR) \
1565                                 { \
1566                                 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1567                                 break; \
1568                                 } \
1569                         errno=0; \
1570                         clearerr(tclscanYYin); \
1571                         } \
1572                 }\
1573 \
1574
1575 #endif
1576
1577 /* No semi-colon after return; correct usage is to write "yyterminate();" -
1578  * we don't want an extra ';' after the "return" because that will cause
1579  * some compilers to complain about unreachable statements.
1580  */
1581 #ifndef yyterminate
1582 #define yyterminate() return YY_NULL
1583 #endif
1584
1585 /* Number of entries by which start-condition stack grows. */
1586 #ifndef YY_START_STACK_INCR
1587 #define YY_START_STACK_INCR 25
1588 #endif
1589
1590 /* Report a fatal error. */
1591 #ifndef YY_FATAL_ERROR
1592 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
1593 #endif
1594
1595 /* end tables serialization structures and prototypes */
1596
1597 /* Default declaration of generated scanner - a define so the user can
1598  * easily add parameters.
1599  */
1600 #ifndef YY_DECL
1601 #define YY_DECL_IS_OURS 1
1602
1603 extern int tclscanYYlex (void);
1604
1605 #define YY_DECL int tclscanYYlex (void)
1606 #endif /* !YY_DECL */
1607
1608 /* Code executed at the beginning of each rule, after tclscanYYtext and tclscanYYleng
1609  * have been set up.
1610  */
1611 #ifndef YY_USER_ACTION
1612 #define YY_USER_ACTION
1613 #endif
1614
1615 /* Code executed at the end of each rule. */
1616 #ifndef YY_BREAK
1617 #define YY_BREAK break;
1618 #endif
1619
1620 #define YY_RULE_SETUP \
1621         YY_USER_ACTION
1622
1623 /** The main scanner function which does all the work.
1624  */
1625 YY_DECL
1626 {
1627         register yy_state_type yy_current_state;
1628         register char *yy_cp, *yy_bp;
1629         register int yy_act;
1630     
1631 #line 736 "tclscanner.l"
1632
1633 #line 1634 "<stdout>"
1634
1635         if ( !(yy_init) )
1636                 {
1637                 (yy_init) = 1;
1638
1639 #ifdef YY_USER_INIT
1640                 YY_USER_INIT;
1641 #endif
1642
1643                 if ( ! (yy_start) )
1644                         (yy_start) = 1; /* first start state */
1645
1646                 if ( ! tclscanYYin )
1647                         tclscanYYin = stdin;
1648
1649                 if ( ! tclscanYYout )
1650                         tclscanYYout = stdout;
1651
1652                 if ( ! YY_CURRENT_BUFFER ) {
1653                         tclscanYYensure_buffer_stack ();
1654                         YY_CURRENT_BUFFER_LVALUE =
1655                                 tclscanYY_create_buffer(tclscanYYin,YY_BUF_SIZE );
1656                 }
1657
1658                 tclscanYY_load_buffer_state( );
1659                 }
1660
1661         while ( 1 )             /* loops until end-of-file is reached */
1662                 {
1663                 (yy_more_len) = 0;
1664                 if ( (yy_more_flag) )
1665                         {
1666                         (yy_more_len) = (yy_c_buf_p) - (yytext_ptr);
1667                         (yy_more_flag) = 0;
1668                         }
1669                 yy_cp = (yy_c_buf_p);
1670
1671                 /* Support of tclscanYYtext. */
1672                 *yy_cp = (yy_hold_char);
1673
1674                 /* yy_bp points to the position in yy_ch_buf of the start of
1675                  * the current run.
1676                  */
1677                 yy_bp = yy_cp;
1678
1679                 yy_current_state = (yy_start);
1680 yy_match:
1681                 do
1682                         {
1683                         register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
1684                         if ( yy_accept[yy_current_state] )
1685                                 {
1686                                 (yy_last_accepting_state) = yy_current_state;
1687                                 (yy_last_accepting_cpos) = yy_cp;
1688                                 }
1689                         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1690                                 {
1691                                 yy_current_state = (int) yy_def[yy_current_state];
1692                                 if ( yy_current_state >= 179 )
1693                                         yy_c = yy_meta[(unsigned int) yy_c];
1694                                 }
1695                         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1696                         ++yy_cp;
1697                         }
1698                 while ( yy_base[yy_current_state] != 615 );
1699
1700 yy_find_action:
1701                 yy_act = yy_accept[yy_current_state];
1702                 if ( yy_act == 0 )
1703                         { /* have to back up */
1704                         yy_cp = (yy_last_accepting_cpos);
1705                         yy_current_state = (yy_last_accepting_state);
1706                         yy_act = yy_accept[yy_current_state];
1707                         }
1708
1709                 YY_DO_BEFORE_ACTION;
1710
1711                 if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
1712                         {
1713                         yy_size_t yyl;
1714                         for ( yyl = (yy_more_len); yyl < tclscanYYleng; ++yyl )
1715                                 if ( tclscanYYtext[yyl] == '\n' )
1716                                            
1717     tclscanYYlineno++;
1718 ;
1719                         }
1720
1721 do_action:      /* This label is used only to access EOF actions. */
1722
1723                 switch ( yy_act )
1724         { /* beginning of action switch */
1725                         case 0: /* must back up */
1726                         /* undo the effects of YY_DO_BEFORE_ACTION */
1727                         *yy_cp = (yy_hold_char);
1728                         yy_cp = (yy_last_accepting_cpos);
1729                         yy_current_state = (yy_last_accepting_state);
1730                         goto yy_find_action;
1731
1732 case 1:
1733 YY_RULE_SETUP
1734 #line 737 "tclscanner.l"
1735 {
1736 D
1737   yyterminate();
1738 }
1739         YY_BREAK
1740 case YY_STATE_EOF(INITIAL):
1741 case YY_STATE_EOF(ERROR):
1742 case YY_STATE_EOF(TOP):
1743 case YY_STATE_EOF(COMMAND):
1744 case YY_STATE_EOF(WORD):
1745 case YY_STATE_EOF(COMMENT):
1746 case YY_STATE_EOF(COMMENT_NL):
1747 case YY_STATE_EOF(COMMENT_CODE):
1748 case YY_STATE_EOF(COMMENT_VERB):
1749 case YY_STATE_EOF(COMMENTLINE):
1750 case YY_STATE_EOF(COMMENTLINE_NL):
1751 #line 741 "tclscanner.l"
1752 {
1753 D
1754   if (tcl.scan.count()<1)
1755   {// error
1756 D
1757     tcl_err("Tcl parser stack empty! Parser error in file '%s'.\n",tcl.file_name.data());
1758     yyterminate();
1759   }
1760   else if (tcl.scan.count()==1)
1761   {// exit, check on input?
1762 D
1763     yyterminate();
1764   }
1765   else
1766   {// continue
1767 D
1768     tcl_command(-1,"");
1769     tcl_scan_end();
1770   }
1771 }
1772         YY_BREAK
1773 case 2:
1774 YY_RULE_SETUP
1775 #line 761 "tclscanner.l"
1776 {
1777 D
1778   yyless(0);
1779   tcl.line_comment=tclscanYYlineno;
1780   tcl_comment(0,"");
1781 }
1782         YY_BREAK
1783 case 3:
1784 /* rule 3 can match eol */
1785 YY_RULE_SETUP
1786 #line 767 "tclscanner.l"
1787 {
1788 D
1789   tcl_codify(NULL,tclscanYYtext);
1790 }
1791         YY_BREAK
1792 case 4:
1793 YY_RULE_SETUP
1794 #line 771 "tclscanner.l"
1795 {
1796 D
1797   yyless(0);
1798   tcl.line_command=tclscanYYlineno;
1799   tcl_command(0,"");
1800 }
1801         YY_BREAK
1802 case 5:
1803 YY_RULE_SETUP
1804 #line 778 "tclscanner.l"
1805 {
1806 D
1807   tcl_codify("comment",tclscanYYtext);
1808 }
1809         YY_BREAK
1810 case 6:
1811 /* rule 6 can match eol */
1812 YY_RULE_SETUP
1813 #line 782 "tclscanner.l"
1814 {
1815 D
1816   tcl_codify("comment",tclscanYYtext);
1817   tcl_comment(2,tclscanYYtext+1);
1818 }
1819         YY_BREAK
1820 case 7:
1821 /* rule 7 can match eol */
1822 YY_RULE_SETUP
1823 #line 787 "tclscanner.l"
1824 {
1825 D
1826   tcl_codify("comment",tclscanYYtext);
1827   QCString t=tclscanYYtext;
1828   t = t.mid(2,t.length()-3);
1829   t.append("\n");
1830   tcl_comment(1,t.data());
1831   yy_push_state(COMMENT_NL);
1832 }
1833         YY_BREAK
1834 case 8:
1835 /* rule 8 can match eol */
1836 YY_RULE_SETUP
1837 #line 796 "tclscanner.l"
1838 {
1839 D
1840   tcl_codify("comment",tclscanYYtext);
1841   tcl_comment(1,tclscanYYtext+2);
1842 }
1843         YY_BREAK
1844 case 9:
1845 /* rule 9 can match eol */
1846 YY_RULE_SETUP
1847 #line 801 "tclscanner.l"
1848 {
1849 D
1850   QCString t=tclscanYYtext;
1851   tcl_codify("comment",t.left(7));
1852   tcl_comment(2,"\n@code\n");
1853   yyless(7);
1854   yy_push_state(COMMENT_CODE);
1855 }
1856         YY_BREAK
1857 case 10:
1858 /* rule 10 can match eol */
1859 YY_RULE_SETUP
1860 #line 809 "tclscanner.l"
1861 {
1862 D
1863   QCString t=tclscanYYtext;
1864   tcl_codify("comment",t.left(11));
1865   tcl_comment(2,"\n@verbatim\n");
1866   yyless(11);
1867   yy_push_state(COMMENT_VERB);
1868 }
1869         YY_BREAK
1870 case 11:
1871 /* rule 11 can match eol */
1872 YY_RULE_SETUP
1873 #line 817 "tclscanner.l"
1874 {
1875 D
1876   tcl_codify("comment",tclscanYYtext);
1877   QCString t=tclscanYYtext;
1878   t = t.mid(1,t.length()-3);
1879   t.append("\n");
1880   tcl_comment(2,t.data());
1881   yy_push_state(COMMENT_NL);
1882 }
1883         YY_BREAK
1884 case 12:
1885 /* rule 12 can match eol */
1886 YY_RULE_SETUP
1887 #line 826 "tclscanner.l"
1888 {
1889 D
1890   tcl_codify("comment",tclscanYYtext);
1891   tcl_comment(2,tclscanYYtext+1);
1892 }
1893         YY_BREAK
1894 case 13:
1895 YY_RULE_SETUP
1896 #line 831 "tclscanner.l"
1897 {
1898 D
1899   QCString t=tclscanYYtext;
1900   t = t.mid(0,t.length()-1);
1901   tcl_codify("comment",t.data());
1902   t = t.mid(1,t.length());
1903   tcl_comment(-2,t.data());
1904   unput(0x1A);
1905 }
1906         YY_BREAK
1907 case 14:
1908 YY_RULE_SETUP
1909 #line 840 "tclscanner.l"
1910 {
1911 D
1912   tcl_comment(-2,"");
1913   unput(0x1A);
1914 }
1915         YY_BREAK
1916 case 15:
1917 /* rule 15 can match eol */
1918 YY_RULE_SETUP
1919 #line 845 "tclscanner.l"
1920 {
1921 D
1922   tcl_comment(-2,tclscanYYtext);
1923   yyless(0);
1924 }
1925         YY_BREAK
1926 case 16:
1927 /* rule 16 can match eol */
1928 YY_RULE_SETUP
1929 #line 851 "tclscanner.l"
1930 {
1931 D
1932   QCString t=tclscanYYtext;
1933   t = t.left(t.length()-10);
1934   tcl_comment(2,t.data());
1935   tcl_comment(2,"\n@endcode\n");
1936   yy_pop_state();
1937   yyless(0);
1938 }
1939         YY_BREAK
1940 case 17:
1941 /* rule 17 can match eol */
1942 YY_RULE_SETUP
1943 #line 860 "tclscanner.l"
1944 {
1945 D
1946   yymore();
1947 }
1948         YY_BREAK
1949 case 18:
1950 YY_RULE_SETUP
1951 #line 864 "tclscanner.l"
1952 {
1953 D
1954   yy_pop_state();
1955   yyless(0);
1956 }
1957         YY_BREAK
1958 case 19:
1959 /* rule 19 can match eol */
1960 YY_RULE_SETUP
1961 #line 870 "tclscanner.l"
1962 {
1963 D
1964   QCString t=tclscanYYtext;
1965   t = t.left(t.length()-14);
1966   tcl_comment(2,t.data());
1967   tcl_comment(2,"\n@endverbatim\n");
1968   yy_pop_state();
1969   yyless(0);
1970 }
1971         YY_BREAK
1972 case 20:
1973 /* rule 20 can match eol */
1974 YY_RULE_SETUP
1975 #line 879 "tclscanner.l"
1976 {
1977 D
1978   yymore();
1979 }
1980         YY_BREAK
1981 case 21:
1982 YY_RULE_SETUP
1983 #line 883 "tclscanner.l"
1984 {
1985 D
1986   yy_pop_state();
1987   yyless(0);
1988 }
1989         YY_BREAK
1990 case 22:
1991 /* rule 22 can match eol */
1992 YY_RULE_SETUP
1993 #line 889 "tclscanner.l"
1994 {
1995 D
1996   tcl_codify("comment",tclscanYYtext);
1997   tcl_comment(2,tclscanYYtext);
1998 }
1999         YY_BREAK
2000 case 23:
2001 /* rule 23 can match eol */
2002 YY_RULE_SETUP
2003 #line 894 "tclscanner.l"
2004 {
2005 D
2006   tcl_codify("comment",tclscanYYtext);
2007   tcl_comment(2,tclscanYYtext);
2008   yy_pop_state();
2009 }
2010         YY_BREAK
2011 case 24:
2012 YY_RULE_SETUP
2013 #line 900 "tclscanner.l"
2014 {
2015 D
2016   yy_pop_state();
2017   yyless(0);
2018 }
2019         YY_BREAK
2020 case 25:
2021 YY_RULE_SETUP
2022 #line 906 "tclscanner.l"
2023 {
2024 D
2025   yy_pop_state();
2026   yyless(0);
2027 }
2028         YY_BREAK
2029 case 26:
2030 YY_RULE_SETUP
2031 #line 911 "tclscanner.l"
2032 {
2033 D
2034   tcl.string_commentcodify += tclscanYYtext;
2035 }
2036         YY_BREAK
2037 case 27:
2038 /* rule 27 can match eol */
2039 YY_RULE_SETUP
2040 #line 915 "tclscanner.l"
2041 {
2042 D
2043   tcl.string_commentcodify += tclscanYYtext;
2044   QCString t=tclscanYYtext;
2045   t = t.mid(2,t.length()-4);
2046   t.append("\n");
2047   tcl.string_commentline += t;
2048   yy_push_state(COMMENTLINE_NL);
2049 }
2050         YY_BREAK
2051 case 28:
2052 /* rule 28 can match eol */
2053 YY_RULE_SETUP
2054 #line 924 "tclscanner.l"
2055 {
2056 D
2057   tcl.string_commentcodify += tclscanYYtext;
2058   tcl.string_commentline += (tclscanYYtext+2);
2059 }
2060         YY_BREAK
2061 case 29:
2062 /* rule 29 can match eol */
2063 YY_RULE_SETUP
2064 #line 929 "tclscanner.l"
2065 {
2066 D
2067   yy_pop_state();
2068   if (tcl.string_commentline.length())
2069   {
2070     tcl.entry_current->brief = tcl.string_commentline;
2071     tcl.entry_current->briefLine = tcl.line_commentline;
2072     tcl.entry_current->briefFile = tcl.file_name;
2073   }
2074   yyless(0);
2075   tcl_command(-1,tcl.string_commentcodify.data());
2076   tcl.string_commentline="";
2077   tcl.string_commentcodify="";
2078 }
2079         YY_BREAK
2080 case 30:
2081 /* rule 30 can match eol */
2082 YY_RULE_SETUP
2083 #line 944 "tclscanner.l"
2084 {
2085 D
2086   tcl.string_commentcodify += tclscanYYtext;
2087   QCString t=tclscanYYtext;
2088   t = t.left(t.length()-3);
2089   t.append("\n");
2090   tcl.string_commentline += t;
2091 }
2092         YY_BREAK
2093 case 31:
2094 /* rule 31 can match eol */
2095 YY_RULE_SETUP
2096 #line 952 "tclscanner.l"
2097 {
2098 D
2099   tcl.string_commentcodify += tclscanYYtext;
2100   tcl.string_commentline += tclscanYYtext;
2101   yy_pop_state();
2102 }
2103         YY_BREAK
2104 case 32:
2105 YY_RULE_SETUP
2106 #line 958 "tclscanner.l"
2107 {
2108 D
2109   QCString t=tclscanYYtext;
2110   t = t.left(t.length()-1);
2111   tcl.string_commentcodify += t;
2112   tcl.string_commentline += t;
2113   yy_pop_state();
2114   unput(0x1A);
2115 }
2116         YY_BREAK
2117 case 33:
2118 /* rule 33 can match eol */
2119 YY_RULE_SETUP
2120 #line 968 "tclscanner.l"
2121 {
2122 D
2123   tcl.string_commentcodify = tclscanYYtext;
2124   tcl.string_commentcodify = tcl.string_commentcodify.left(tcl.string_commentcodify.length()-2);
2125   tcl.string_commentline = "";
2126   tcl.line_commentline = tclscanYYlineno;
2127   tcl.line_body1=tclscanYYlineno;
2128   unput('<');
2129   unput('#');
2130   yy_push_state(COMMENTLINE);
2131 }
2132         YY_BREAK
2133 case 34:
2134 /* rule 34 can match eol */
2135 YY_RULE_SETUP
2136 #line 979 "tclscanner.l"
2137 {
2138 D
2139   tcl.string_commentcodify = "";
2140   tcl.string_commentline = "";
2141   tcl.line_body1=tclscanYYlineno;
2142   tcl_command(-1,"");
2143 }
2144         YY_BREAK
2145 case 35:
2146 /* rule 35 can match eol */
2147 YY_RULE_SETUP
2148 #line 986 "tclscanner.l"
2149 {
2150 D
2151   tcl.string_commentcodify = "";
2152   tcl.string_commentline = "";
2153   tcl.line_body1=tclscanYYlineno;
2154   tcl_command(-1,tclscanYYtext);
2155 }
2156         YY_BREAK
2157 case 36:
2158 /* rule 36 can match eol */
2159 YY_RULE_SETUP
2160 #line 993 "tclscanner.l"
2161 {
2162 D
2163   tcl.string_commentcodify = "";
2164   tcl.string_commentline = "";
2165   tcl.line_body1=tclscanYYlineno-1;
2166   tcl_command(-1,tclscanYYtext);
2167 }
2168         YY_BREAK
2169 case 37:
2170 /* rule 37 can match eol */
2171 YY_RULE_SETUP
2172 #line 1000 "tclscanner.l"
2173 {
2174 D
2175   tcl_command(1,tclscanYYtext);
2176 }
2177         YY_BREAK
2178 case 38:
2179 YY_RULE_SETUP
2180 #line 1004 "tclscanner.l"
2181 {
2182 D
2183   tcl.word_is = ' ';
2184   tcl.string_last = "{*}";
2185   tcl_word(0,&tclscanYYtext[3]);
2186 }
2187         YY_BREAK
2188 case 39:
2189 YY_RULE_SETUP
2190 #line 1010 "tclscanner.l"
2191 {
2192 D
2193   tcl.word_is=' ';
2194   tcl.string_last = "";
2195   tcl_word(0,tclscanYYtext);
2196 }
2197         YY_BREAK
2198 case 40:
2199 YY_RULE_SETUP
2200 #line 1016 "tclscanner.l"
2201 {
2202 D
2203   tcl.word_is=' ';
2204   if (tclscanYYtext[0]=='{'||tclscanYYtext[0]=='['||tclscanYYtext[0]=='"') tcl.word_is = tclscanYYtext[0];
2205   tcl.string_last = "";
2206   tcl_word(0,tclscanYYtext);
2207 }
2208         YY_BREAK
2209 case 41:
2210 #line 1025 "tclscanner.l"
2211 case 42:
2212 YY_RULE_SETUP
2213 #line 1025 "tclscanner.l"
2214 {
2215   tcl_word(1,tclscanYYtext);
2216 }
2217         YY_BREAK
2218 case 43:
2219 /* rule 43 can match eol */
2220 YY_RULE_SETUP
2221 #line 1028 "tclscanner.l"
2222 {
2223   tcl_word(2,tclscanYYtext);
2224 }
2225         YY_BREAK
2226 case 44:
2227 YY_RULE_SETUP
2228 #line 1031 "tclscanner.l"
2229 {
2230   tcl_word(3,tclscanYYtext);
2231 }
2232         YY_BREAK
2233 case 45:
2234 YY_RULE_SETUP
2235 #line 1034 "tclscanner.l"
2236 {
2237   tcl_word(4,tclscanYYtext);
2238 }
2239         YY_BREAK
2240 case 46:
2241 YY_RULE_SETUP
2242 #line 1037 "tclscanner.l"
2243 {
2244   tcl_word(5,tclscanYYtext);
2245 }
2246         YY_BREAK
2247 case 47:
2248 YY_RULE_SETUP
2249 #line 1040 "tclscanner.l"
2250 {
2251   tcl_word(6,tclscanYYtext);
2252 }
2253         YY_BREAK
2254 case 48:
2255 YY_RULE_SETUP
2256 #line 1043 "tclscanner.l"
2257 {
2258   tcl_word(7,tclscanYYtext);
2259 }
2260         YY_BREAK
2261 case 49:
2262 YY_RULE_SETUP
2263 #line 1046 "tclscanner.l"
2264 {
2265   tcl_word(8,tclscanYYtext);
2266 }
2267         YY_BREAK
2268 case 50:
2269 YY_RULE_SETUP
2270 #line 1049 "tclscanner.l"
2271 {
2272   tcl_word(9,tclscanYYtext);
2273 }
2274         YY_BREAK
2275 case 51:
2276 YY_RULE_SETUP
2277 #line 1052 "tclscanner.l"
2278 {
2279   tcl_word(10,tclscanYYtext);
2280 }
2281         YY_BREAK
2282 case 52:
2283 /* rule 52 can match eol */
2284 YY_RULE_SETUP
2285 #line 1055 "tclscanner.l"
2286 {
2287   tcl_word(11,tclscanYYtext);
2288 }
2289         YY_BREAK
2290 case 53:
2291 YY_RULE_SETUP
2292 #line 1058 "tclscanner.l"
2293 {
2294   tcl_word(12,tclscanYYtext);
2295 }
2296         YY_BREAK
2297 case 54:
2298 YY_RULE_SETUP
2299 #line 1061 "tclscanner.l"
2300 {
2301   tcl_word(1,tclscanYYtext);
2302 }
2303         YY_BREAK
2304 case 55:
2305 YY_RULE_SETUP
2306 #line 1064 "tclscanner.l"
2307 ECHO;
2308         YY_BREAK
2309 #line 2310 "<stdout>"
2310
2311         case YY_END_OF_BUFFER:
2312                 {
2313                 /* Amount of text matched not including the EOB char. */
2314                 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
2315
2316                 /* Undo the effects of YY_DO_BEFORE_ACTION. */
2317                 *yy_cp = (yy_hold_char);
2318                 YY_RESTORE_YY_MORE_OFFSET
2319
2320                 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
2321                         {
2322                         /* We're scanning a new file or input source.  It's
2323                          * possible that this happened because the user
2324                          * just pointed tclscanYYin at a new source and called
2325                          * tclscanYYlex().  If so, then we have to assure
2326                          * consistency between YY_CURRENT_BUFFER and our
2327                          * globals.  Here is the right place to do so, because
2328                          * this is the first action (other than possibly a
2329                          * back-up) that will match for the new input source.
2330                          */
2331                         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2332                         YY_CURRENT_BUFFER_LVALUE->yy_input_file = tclscanYYin;
2333                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
2334                         }
2335
2336                 /* Note that here we test for yy_c_buf_p "<=" to the position
2337                  * of the first EOB in the buffer, since yy_c_buf_p will
2338                  * already have been incremented past the NUL character
2339                  * (since all states make transitions on EOB to the
2340                  * end-of-buffer state).  Contrast this with the test
2341                  * in input().
2342                  */
2343                 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
2344                         { /* This was really a NUL. */
2345                         yy_state_type yy_next_state;
2346
2347                         (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
2348
2349                         yy_current_state = yy_get_previous_state(  );
2350
2351                         /* Okay, we're now positioned to make the NUL
2352                          * transition.  We couldn't have
2353                          * yy_get_previous_state() go ahead and do it
2354                          * for us because it doesn't know how to deal
2355                          * with the possibility of jamming (and we don't
2356                          * want to build jamming into it because then it
2357                          * will run more slowly).
2358                          */
2359
2360                         yy_next_state = yy_try_NUL_trans( yy_current_state );
2361
2362                         yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2363
2364                         if ( yy_next_state )
2365                                 {
2366                                 /* Consume the NUL. */
2367                                 yy_cp = ++(yy_c_buf_p);
2368                                 yy_current_state = yy_next_state;
2369                                 goto yy_match;
2370                                 }
2371
2372                         else
2373                                 {
2374                                 yy_cp = (yy_c_buf_p);
2375                                 goto yy_find_action;
2376                                 }
2377                         }
2378
2379                 else switch ( yy_get_next_buffer(  ) )
2380                         {
2381                         case EOB_ACT_END_OF_FILE:
2382                                 {
2383                                 (yy_did_buffer_switch_on_eof) = 0;
2384
2385                                 if ( tclscanYYwrap( ) )
2386                                         {
2387                                         /* Note: because we've taken care in
2388                                          * yy_get_next_buffer() to have set up
2389                                          * tclscanYYtext, we can now set up
2390                                          * yy_c_buf_p so that if some total
2391                                          * hoser (like flex itself) wants to
2392                                          * call the scanner after we return the
2393                                          * YY_NULL, it'll still work - another
2394                                          * YY_NULL will get returned.
2395                                          */
2396                                         (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
2397
2398                                         yy_act = YY_STATE_EOF(YY_START);
2399                                         goto do_action;
2400                                         }
2401
2402                                 else
2403                                         {
2404                                         if ( ! (yy_did_buffer_switch_on_eof) )
2405                                                 YY_NEW_FILE;
2406                                         }
2407                                 break;
2408                                 }
2409
2410                         case EOB_ACT_CONTINUE_SCAN:
2411                                 (yy_c_buf_p) =
2412                                         (yytext_ptr) + yy_amount_of_matched_text;
2413
2414                                 yy_current_state = yy_get_previous_state(  );
2415
2416                                 yy_cp = (yy_c_buf_p);
2417                                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2418                                 goto yy_match;
2419
2420                         case EOB_ACT_LAST_MATCH:
2421                                 (yy_c_buf_p) =
2422                                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
2423
2424                                 yy_current_state = yy_get_previous_state(  );
2425
2426                                 yy_cp = (yy_c_buf_p);
2427                                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2428                                 goto yy_find_action;
2429                         }
2430                 break;
2431                 }
2432
2433         default:
2434                 YY_FATAL_ERROR(
2435                         "fatal flex scanner internal error--no action found" );
2436         } /* end of action switch */
2437                 } /* end of scanning one token */
2438 } /* end of tclscanYYlex */
2439
2440 /* yy_get_next_buffer - try to read in a new buffer
2441  *
2442  * Returns a code representing an action:
2443  *      EOB_ACT_LAST_MATCH -
2444  *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
2445  *      EOB_ACT_END_OF_FILE - end of file
2446  */
2447 static int yy_get_next_buffer (void)
2448 {
2449         register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
2450         register char *source = (yytext_ptr);
2451         register int number_to_move, i;
2452         int ret_val;
2453
2454         if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
2455                 YY_FATAL_ERROR(
2456                 "fatal flex scanner internal error--end of buffer missed" );
2457
2458         if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
2459                 { /* Don't try to fill the buffer, so this is an EOF. */
2460                 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
2461                         {
2462                         /* We matched a single character, the EOB, so
2463                          * treat this as a final EOF.
2464                          */
2465                         return EOB_ACT_END_OF_FILE;
2466                         }
2467
2468                 else
2469                         {
2470                         /* We matched some text prior to the EOB, first
2471                          * process it.
2472                          */
2473                         return EOB_ACT_LAST_MATCH;
2474                         }
2475                 }
2476
2477         /* Try to read more data. */
2478
2479         /* First move last chars to start of buffer. */
2480         number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
2481
2482         for ( i = 0; i < number_to_move; ++i )
2483                 *(dest++) = *(source++);
2484
2485         if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
2486                 /* don't do the read, it's not guaranteed to return an EOF,
2487                  * just force an EOF
2488                  */
2489                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
2490
2491         else
2492                 {
2493                         yy_size_t num_to_read =
2494                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
2495
2496                 while ( num_to_read <= 0 )
2497                         { /* Not enough room in the buffer - grow it. */
2498
2499                         /* just a shorter name for the current buffer */
2500                         YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
2501
2502                         int yy_c_buf_p_offset =
2503                                 (int) ((yy_c_buf_p) - b->yy_ch_buf);
2504
2505                         if ( b->yy_is_our_buffer )
2506                                 {
2507                                 yy_size_t new_size = b->yy_buf_size * 2;
2508
2509                                 if ( new_size <= 0 )
2510                                         b->yy_buf_size += b->yy_buf_size / 8;
2511                                 else
2512                                         b->yy_buf_size *= 2;
2513
2514                                 b->yy_ch_buf = (char *)
2515                                         /* Include room in for 2 EOB chars. */
2516                                         tclscanYYrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
2517                                 }
2518                         else
2519                                 /* Can't grow it, we don't own it. */
2520                                 b->yy_ch_buf = 0;
2521
2522                         if ( ! b->yy_ch_buf )
2523                                 YY_FATAL_ERROR(
2524                                 "fatal error - scanner input buffer overflow" );
2525
2526                         (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
2527
2528                         num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
2529                                                 number_to_move - 1;
2530
2531                         }
2532
2533                 if ( num_to_read > YY_READ_BUF_SIZE )
2534                         num_to_read = YY_READ_BUF_SIZE;
2535
2536                 /* Read in more data. */
2537                 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
2538                         (yy_n_chars), num_to_read );
2539
2540                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2541                 }
2542
2543         if ( (yy_n_chars) == 0 )
2544                 {
2545                 if ( number_to_move == YY_MORE_ADJ )
2546                         {
2547                         ret_val = EOB_ACT_END_OF_FILE;
2548                         tclscanYYrestart(tclscanYYin  );
2549                         }
2550
2551                 else
2552                         {
2553                         ret_val = EOB_ACT_LAST_MATCH;
2554                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
2555                                 YY_BUFFER_EOF_PENDING;
2556                         }
2557                 }
2558
2559         else
2560                 ret_val = EOB_ACT_CONTINUE_SCAN;
2561
2562         if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
2563                 /* Extend the array by 50%, plus the number we really need. */
2564                 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
2565                 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) tclscanYYrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
2566                 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
2567                         YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
2568         }
2569
2570         (yy_n_chars) += number_to_move;
2571         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
2572         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
2573
2574         (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
2575
2576         return ret_val;
2577 }
2578
2579 /* yy_get_previous_state - get the state just before the EOB char was reached */
2580
2581     static yy_state_type yy_get_previous_state (void)
2582 {
2583         register yy_state_type yy_current_state;
2584         register char *yy_cp;
2585     
2586         yy_current_state = (yy_start);
2587
2588         for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
2589                 {
2590                 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
2591                 if ( yy_accept[yy_current_state] )
2592                         {
2593                         (yy_last_accepting_state) = yy_current_state;
2594                         (yy_last_accepting_cpos) = yy_cp;
2595                         }
2596                 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2597                         {
2598                         yy_current_state = (int) yy_def[yy_current_state];
2599                         if ( yy_current_state >= 179 )
2600                                 yy_c = yy_meta[(unsigned int) yy_c];
2601                         }
2602                 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2603                 }
2604
2605         return yy_current_state;
2606 }
2607
2608 /* yy_try_NUL_trans - try to make a transition on the NUL character
2609  *
2610  * synopsis
2611  *      next_state = yy_try_NUL_trans( current_state );
2612  */
2613     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
2614 {
2615         register int yy_is_jam;
2616         register char *yy_cp = (yy_c_buf_p);
2617
2618         register YY_CHAR yy_c = 1;
2619         if ( yy_accept[yy_current_state] )
2620                 {
2621                 (yy_last_accepting_state) = yy_current_state;
2622                 (yy_last_accepting_cpos) = yy_cp;
2623                 }
2624         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2625                 {
2626                 yy_current_state = (int) yy_def[yy_current_state];
2627                 if ( yy_current_state >= 179 )
2628                         yy_c = yy_meta[(unsigned int) yy_c];
2629                 }
2630         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2631         yy_is_jam = (yy_current_state == 178);
2632
2633         return yy_is_jam ? 0 : yy_current_state;
2634 }
2635
2636     static void yyunput (int c, register char * yy_bp )
2637 {
2638         register char *yy_cp;
2639     
2640     yy_cp = (yy_c_buf_p);
2641
2642         /* undo effects of setting up tclscanYYtext */
2643         *yy_cp = (yy_hold_char);
2644
2645         if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
2646                 { /* need to shift things up to make room */
2647                 /* +2 for EOB chars. */
2648                 register yy_size_t number_to_move = (yy_n_chars) + 2;
2649                 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
2650                                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
2651                 register char *source =
2652                                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
2653
2654                 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
2655                         *--dest = *--source;
2656
2657                 yy_cp += (int) (dest - source);
2658                 yy_bp += (int) (dest - source);
2659                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
2660                         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
2661
2662                 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
2663                         YY_FATAL_ERROR( "flex scanner push-back overflow" );
2664                 }
2665
2666         *--yy_cp = (char) c;
2667
2668     if ( c == '\n' ){
2669         --tclscanYYlineno;
2670     }
2671
2672         (yytext_ptr) = yy_bp;
2673         (yy_hold_char) = *yy_cp;
2674         (yy_c_buf_p) = yy_cp;
2675 }
2676
2677 #ifndef YY_NO_INPUT
2678 #ifdef __cplusplus
2679     static int yyinput (void)
2680 #else
2681     static int input  (void)
2682 #endif
2683
2684 {
2685         int c;
2686     
2687         *(yy_c_buf_p) = (yy_hold_char);
2688
2689         if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
2690                 {
2691                 /* yy_c_buf_p now points to the character we want to return.
2692                  * If this occurs *before* the EOB characters, then it's a
2693                  * valid NUL; if not, then we've hit the end of the buffer.
2694                  */
2695                 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
2696                         /* This was really a NUL. */
2697                         *(yy_c_buf_p) = '\0';
2698
2699                 else
2700                         { /* need more input */
2701                         yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
2702                         ++(yy_c_buf_p);
2703
2704                         switch ( yy_get_next_buffer(  ) )
2705                                 {
2706                                 case EOB_ACT_LAST_MATCH:
2707                                         /* This happens because yy_g_n_b()
2708                                          * sees that we've accumulated a
2709                                          * token and flags that we need to
2710                                          * try matching the token before
2711                                          * proceeding.  But for input(),
2712                                          * there's no matching to consider.
2713                                          * So convert the EOB_ACT_LAST_MATCH
2714                                          * to EOB_ACT_END_OF_FILE.
2715                                          */
2716
2717                                         /* Reset buffer status. */
2718                                         tclscanYYrestart(tclscanYYin );
2719
2720                                         /*FALLTHROUGH*/
2721
2722                                 case EOB_ACT_END_OF_FILE:
2723                                         {
2724                                         if ( tclscanYYwrap( ) )
2725                                                 return 0;
2726
2727                                         if ( ! (yy_did_buffer_switch_on_eof) )
2728                                                 YY_NEW_FILE;
2729 #ifdef __cplusplus
2730                                         return yyinput();
2731 #else
2732                                         return input();
2733 #endif
2734                                         }
2735
2736                                 case EOB_ACT_CONTINUE_SCAN:
2737                                         (yy_c_buf_p) = (yytext_ptr) + offset;
2738                                         break;
2739                                 }
2740                         }
2741                 }
2742
2743         c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
2744         *(yy_c_buf_p) = '\0';   /* preserve tclscanYYtext */
2745         (yy_hold_char) = *++(yy_c_buf_p);
2746
2747         if ( c == '\n' )
2748                    
2749     tclscanYYlineno++;
2750 ;
2751
2752         return c;
2753 }
2754 #endif  /* ifndef YY_NO_INPUT */
2755
2756 /** Immediately switch to a different input stream.
2757  * @param input_file A readable stream.
2758  * 
2759  * @note This function does not reset the start condition to @c INITIAL .
2760  */
2761     void tclscanYYrestart  (FILE * input_file )
2762 {
2763     
2764         if ( ! YY_CURRENT_BUFFER ){
2765         tclscanYYensure_buffer_stack ();
2766                 YY_CURRENT_BUFFER_LVALUE =
2767             tclscanYY_create_buffer(tclscanYYin,YY_BUF_SIZE );
2768         }
2769
2770         tclscanYY_init_buffer(YY_CURRENT_BUFFER,input_file );
2771         tclscanYY_load_buffer_state( );
2772 }
2773
2774 /** Switch to a different input buffer.
2775  * @param new_buffer The new input buffer.
2776  * 
2777  */
2778     void tclscanYY_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
2779 {
2780     
2781         /* TODO. We should be able to replace this entire function body
2782          * with
2783          *              tclscanYYpop_buffer_state();
2784          *              tclscanYYpush_buffer_state(new_buffer);
2785      */
2786         tclscanYYensure_buffer_stack ();
2787         if ( YY_CURRENT_BUFFER == new_buffer )
2788                 return;
2789
2790         if ( YY_CURRENT_BUFFER )
2791                 {
2792                 /* Flush out information for old buffer. */
2793                 *(yy_c_buf_p) = (yy_hold_char);
2794                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2795                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2796                 }
2797
2798         YY_CURRENT_BUFFER_LVALUE = new_buffer;
2799         tclscanYY_load_buffer_state( );
2800
2801         /* We don't actually know whether we did this switch during
2802          * EOF (tclscanYYwrap()) processing, but the only time this flag
2803          * is looked at is after tclscanYYwrap() is called, so it's safe
2804          * to go ahead and always set it.
2805          */
2806         (yy_did_buffer_switch_on_eof) = 1;
2807 }
2808
2809 static void tclscanYY_load_buffer_state  (void)
2810 {
2811         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2812         (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2813         tclscanYYin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2814         (yy_hold_char) = *(yy_c_buf_p);
2815 }
2816
2817 /** Allocate and initialize an input buffer state.
2818  * @param file A readable stream.
2819  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2820  * 
2821  * @return the allocated buffer state.
2822  */
2823     YY_BUFFER_STATE tclscanYY_create_buffer  (FILE * file, int  size )
2824 {
2825         YY_BUFFER_STATE b;
2826     
2827         b = (YY_BUFFER_STATE) tclscanYYalloc(sizeof( struct yy_buffer_state )  );
2828         if ( ! b )
2829                 YY_FATAL_ERROR( "out of dynamic memory in tclscanYY_create_buffer()" );
2830
2831         b->yy_buf_size = size;
2832
2833         /* yy_ch_buf has to be 2 characters longer than the size given because
2834          * we need to put in 2 end-of-buffer characters.
2835          */
2836         b->yy_ch_buf = (char *) tclscanYYalloc(b->yy_buf_size + 2  );
2837         if ( ! b->yy_ch_buf )
2838                 YY_FATAL_ERROR( "out of dynamic memory in tclscanYY_create_buffer()" );
2839
2840         b->yy_is_our_buffer = 1;
2841
2842         tclscanYY_init_buffer(b,file );
2843
2844         return b;
2845 }
2846
2847 /** Destroy the buffer.
2848  * @param b a buffer created with tclscanYY_create_buffer()
2849  * 
2850  */
2851     void tclscanYY_delete_buffer (YY_BUFFER_STATE  b )
2852 {
2853     
2854         if ( ! b )
2855                 return;
2856
2857         if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2858                 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2859
2860         if ( b->yy_is_our_buffer )
2861                 tclscanYYfree((void *) b->yy_ch_buf  );
2862
2863         tclscanYYfree((void *) b  );
2864 }
2865
2866 #ifndef __cplusplus
2867 extern int isatty (int );
2868 #endif /* __cplusplus */
2869     
2870 /* Initializes or reinitializes a buffer.
2871  * This function is sometimes called more than once on the same buffer,
2872  * such as during a tclscanYYrestart() or at EOF.
2873  */
2874     static void tclscanYY_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
2875
2876 {
2877         int oerrno = errno;
2878     
2879         tclscanYY_flush_buffer(b );
2880
2881         b->yy_input_file = file;
2882         b->yy_fill_buffer = 1;
2883
2884     /* If b is the current buffer, then tclscanYY_init_buffer was _probably_
2885      * called from tclscanYYrestart() or through yy_get_next_buffer.
2886      * In that case, we don't want to reset the lineno or column.
2887      */
2888     if (b != YY_CURRENT_BUFFER){
2889         b->yy_bs_lineno = 1;
2890         b->yy_bs_column = 0;
2891     }
2892
2893         b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2894     
2895         errno = oerrno;
2896 }
2897
2898 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2899  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2900  * 
2901  */
2902     void tclscanYY_flush_buffer (YY_BUFFER_STATE  b )
2903 {
2904         if ( ! b )
2905                 return;
2906
2907         b->yy_n_chars = 0;
2908
2909         /* We always need two end-of-buffer characters.  The first causes
2910          * a transition to the end-of-buffer state.  The second causes
2911          * a jam in that state.
2912          */
2913         b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2914         b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2915
2916         b->yy_buf_pos = &b->yy_ch_buf[0];
2917
2918         b->yy_at_bol = 1;
2919         b->yy_buffer_status = YY_BUFFER_NEW;
2920
2921         if ( b == YY_CURRENT_BUFFER )
2922                 tclscanYY_load_buffer_state( );
2923 }
2924
2925 /** Pushes the new state onto the stack. The new state becomes
2926  *  the current state. This function will allocate the stack
2927  *  if necessary.
2928  *  @param new_buffer The new state.
2929  *  
2930  */
2931 void tclscanYYpush_buffer_state (YY_BUFFER_STATE new_buffer )
2932 {
2933         if (new_buffer == NULL)
2934                 return;
2935
2936         tclscanYYensure_buffer_stack();
2937
2938         /* This block is copied from tclscanYY_switch_to_buffer. */
2939         if ( YY_CURRENT_BUFFER )
2940                 {
2941                 /* Flush out information for old buffer. */
2942                 *(yy_c_buf_p) = (yy_hold_char);
2943                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2944                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2945                 }
2946
2947         /* Only push if top exists. Otherwise, replace top. */
2948         if (YY_CURRENT_BUFFER)
2949                 (yy_buffer_stack_top)++;
2950         YY_CURRENT_BUFFER_LVALUE = new_buffer;
2951
2952         /* copied from tclscanYY_switch_to_buffer. */
2953         tclscanYY_load_buffer_state( );
2954         (yy_did_buffer_switch_on_eof) = 1;
2955 }
2956
2957 /** Removes and deletes the top of the stack, if present.
2958  *  The next element becomes the new top.
2959  *  
2960  */
2961 void tclscanYYpop_buffer_state (void)
2962 {
2963         if (!YY_CURRENT_BUFFER)
2964                 return;
2965
2966         tclscanYY_delete_buffer(YY_CURRENT_BUFFER );
2967         YY_CURRENT_BUFFER_LVALUE = NULL;
2968         if ((yy_buffer_stack_top) > 0)
2969                 --(yy_buffer_stack_top);
2970
2971         if (YY_CURRENT_BUFFER) {
2972                 tclscanYY_load_buffer_state( );
2973                 (yy_did_buffer_switch_on_eof) = 1;
2974         }
2975 }
2976
2977 /* Allocates the stack if it does not exist.
2978  *  Guarantees space for at least one push.
2979  */
2980 static void tclscanYYensure_buffer_stack (void)
2981 {
2982         yy_size_t num_to_alloc;
2983     
2984         if (!(yy_buffer_stack)) {
2985
2986                 /* First allocation is just for 2 elements, since we don't know if this
2987                  * scanner will even need a stack. We use 2 instead of 1 to avoid an
2988                  * immediate realloc on the next call.
2989          */
2990                 num_to_alloc = 1;
2991                 (yy_buffer_stack) = (struct yy_buffer_state**)tclscanYYalloc
2992                                                                 (num_to_alloc * sizeof(struct yy_buffer_state*)
2993                                                                 );
2994                 if ( ! (yy_buffer_stack) )
2995                         YY_FATAL_ERROR( "out of dynamic memory in tclscanYYensure_buffer_stack()" );
2996                                                                   
2997                 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2998                                 
2999                 (yy_buffer_stack_max) = num_to_alloc;
3000                 (yy_buffer_stack_top) = 0;
3001                 return;
3002         }
3003
3004         if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
3005
3006                 /* Increase the buffer to prepare for a possible push. */
3007                 int grow_size = 8 /* arbitrary grow size */;
3008
3009                 num_to_alloc = (yy_buffer_stack_max) + grow_size;
3010                 (yy_buffer_stack) = (struct yy_buffer_state**)tclscanYYrealloc
3011                                                                 ((yy_buffer_stack),
3012                                                                 num_to_alloc * sizeof(struct yy_buffer_state*)
3013                                                                 );
3014                 if ( ! (yy_buffer_stack) )
3015                         YY_FATAL_ERROR( "out of dynamic memory in tclscanYYensure_buffer_stack()" );
3016
3017                 /* zero only the new slots.*/
3018                 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
3019                 (yy_buffer_stack_max) = num_to_alloc;
3020         }
3021 }
3022
3023 /** Setup the input buffer state to scan directly from a user-specified character buffer.
3024  * @param base the character buffer
3025  * @param size the size in bytes of the character buffer
3026  * 
3027  * @return the newly allocated buffer state object. 
3028  */
3029 YY_BUFFER_STATE tclscanYY_scan_buffer  (char * base, yy_size_t  size )
3030 {
3031         YY_BUFFER_STATE b;
3032     
3033         if ( size < 2 ||
3034              base[size-2] != YY_END_OF_BUFFER_CHAR ||
3035              base[size-1] != YY_END_OF_BUFFER_CHAR )
3036                 /* They forgot to leave room for the EOB's. */
3037                 return 0;
3038
3039         b = (YY_BUFFER_STATE) tclscanYYalloc(sizeof( struct yy_buffer_state )  );
3040         if ( ! b )
3041                 YY_FATAL_ERROR( "out of dynamic memory in tclscanYY_scan_buffer()" );
3042
3043         b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
3044         b->yy_buf_pos = b->yy_ch_buf = base;
3045         b->yy_is_our_buffer = 0;
3046         b->yy_input_file = 0;
3047         b->yy_n_chars = b->yy_buf_size;
3048         b->yy_is_interactive = 0;
3049         b->yy_at_bol = 1;
3050         b->yy_fill_buffer = 0;
3051         b->yy_buffer_status = YY_BUFFER_NEW;
3052
3053         tclscanYY_switch_to_buffer(b  );
3054
3055         return b;
3056 }
3057
3058 /** Setup the input buffer state to scan a string. The next call to tclscanYYlex() will
3059  * scan from a @e copy of @a str.
3060  * @param yystr a NUL-terminated string to scan
3061  * 
3062  * @return the newly allocated buffer state object.
3063  * @note If you want to scan bytes that may contain NUL values, then use
3064  *       tclscanYY_scan_bytes() instead.
3065  */
3066 YY_BUFFER_STATE tclscanYY_scan_string (yyconst char * yystr )
3067 {
3068     
3069         return tclscanYY_scan_bytes(yystr,strlen(yystr) );
3070 }
3071
3072 /** Setup the input buffer state to scan the given bytes. The next call to tclscanYYlex() will
3073  * scan from a @e copy of @a bytes.
3074  * @param bytes the byte buffer to scan
3075  * @param len the number of bytes in the buffer pointed to by @a bytes.
3076  * 
3077  * @return the newly allocated buffer state object.
3078  */
3079 YY_BUFFER_STATE tclscanYY_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len )
3080 {
3081         YY_BUFFER_STATE b;
3082         char *buf;
3083         yy_size_t n, i;
3084     
3085         /* Get memory for full buffer, including space for trailing EOB's. */
3086         n = _yybytes_len + 2;
3087         buf = (char *) tclscanYYalloc(n  );
3088         if ( ! buf )
3089                 YY_FATAL_ERROR( "out of dynamic memory in tclscanYY_scan_bytes()" );
3090
3091         for ( i = 0; i < _yybytes_len; ++i )
3092                 buf[i] = yybytes[i];
3093
3094         buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
3095
3096         b = tclscanYY_scan_buffer(buf,n );
3097         if ( ! b )
3098                 YY_FATAL_ERROR( "bad buffer in tclscanYY_scan_bytes()" );
3099
3100         /* It's okay to grow etc. this buffer, and we should throw it
3101          * away when we're done.
3102          */
3103         b->yy_is_our_buffer = 1;
3104
3105         return b;
3106 }
3107
3108     static void yy_push_state (int  new_state )
3109 {
3110         if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
3111                 {
3112                 yy_size_t new_size;
3113
3114                 (yy_start_stack_depth) += YY_START_STACK_INCR;
3115                 new_size = (yy_start_stack_depth) * sizeof( int );
3116
3117                 if ( ! (yy_start_stack) )
3118                         (yy_start_stack) = (int *) tclscanYYalloc(new_size  );
3119
3120                 else
3121                         (yy_start_stack) = (int *) tclscanYYrealloc((void *) (yy_start_stack),new_size  );
3122
3123                 if ( ! (yy_start_stack) )
3124                         YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
3125                 }
3126
3127         (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
3128
3129         BEGIN(new_state);
3130 }
3131
3132     static void yy_pop_state  (void)
3133 {
3134         if ( --(yy_start_stack_ptr) < 0 )
3135                 YY_FATAL_ERROR( "start-condition stack underflow" );
3136
3137         BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
3138 }
3139
3140     static int yy_top_state  (void)
3141 {
3142         return (yy_start_stack)[(yy_start_stack_ptr) - 1];
3143 }
3144
3145 #ifndef YY_EXIT_FAILURE
3146 #define YY_EXIT_FAILURE 2
3147 #endif
3148
3149 static void yy_fatal_error (yyconst char* msg )
3150 {
3151         (void) fprintf( stderr, "%s\n", msg );
3152         exit( YY_EXIT_FAILURE );
3153 }
3154
3155 /* Redefine yyless() so it works in section 3 code. */
3156
3157 #undef yyless
3158 #define yyless(n) \
3159         do \
3160                 { \
3161                 /* Undo effects of setting up tclscanYYtext. */ \
3162         int yyless_macro_arg = (n); \
3163         YY_LESS_LINENO(yyless_macro_arg);\
3164                 tclscanYYtext[tclscanYYleng] = (yy_hold_char); \
3165                 (yy_c_buf_p) = tclscanYYtext + yyless_macro_arg; \
3166                 (yy_hold_char) = *(yy_c_buf_p); \
3167                 *(yy_c_buf_p) = '\0'; \
3168                 tclscanYYleng = yyless_macro_arg; \
3169                 } \
3170         while ( 0 )
3171
3172 /* Accessor  methods (get/set functions) to struct members. */
3173
3174 /** Get the current line number.
3175  * 
3176  */
3177 int tclscanYYget_lineno  (void)
3178 {
3179         
3180     return tclscanYYlineno;
3181 }
3182
3183 /** Get the input stream.
3184  * 
3185  */
3186 FILE *tclscanYYget_in  (void)
3187 {
3188         return tclscanYYin;
3189 }
3190
3191 /** Get the output stream.
3192  * 
3193  */
3194 FILE *tclscanYYget_out  (void)
3195 {
3196         return tclscanYYout;
3197 }
3198
3199 /** Get the length of the current token.
3200  * 
3201  */
3202 yy_size_t tclscanYYget_leng  (void)
3203 {
3204         return tclscanYYleng;
3205 }
3206
3207 /** Get the current token.
3208  * 
3209  */
3210
3211 char *tclscanYYget_text  (void)
3212 {
3213         return tclscanYYtext;
3214 }
3215
3216 /** Set the current line number.
3217  * @param line_number
3218  * 
3219  */
3220 void tclscanYYset_lineno (int  line_number )
3221 {
3222     
3223     tclscanYYlineno = line_number;
3224 }
3225
3226 /** Set the input stream. This does not discard the current
3227  * input buffer.
3228  * @param in_str A readable stream.
3229  * 
3230  * @see tclscanYY_switch_to_buffer
3231  */
3232 void tclscanYYset_in (FILE *  in_str )
3233 {
3234         tclscanYYin = in_str ;
3235 }
3236
3237 void tclscanYYset_out (FILE *  out_str )
3238 {
3239         tclscanYYout = out_str ;
3240 }
3241
3242 int tclscanYYget_debug  (void)
3243 {
3244         return tclscanYY_flex_debug;
3245 }
3246
3247 void tclscanYYset_debug (int  bdebug )
3248 {
3249         tclscanYY_flex_debug = bdebug ;
3250 }
3251
3252 static int yy_init_globals (void)
3253 {
3254         /* Initialization is the same as for the non-reentrant scanner.
3255      * This function is called from tclscanYYlex_destroy(), so don't allocate here.
3256      */
3257
3258     /* We do not touch tclscanYYlineno unless the option is enabled. */
3259     tclscanYYlineno =  1;
3260     
3261     (yy_buffer_stack) = 0;
3262     (yy_buffer_stack_top) = 0;
3263     (yy_buffer_stack_max) = 0;
3264     (yy_c_buf_p) = (char *) 0;
3265     (yy_init) = 0;
3266     (yy_start) = 0;
3267
3268     (yy_start_stack_ptr) = 0;
3269     (yy_start_stack_depth) = 0;
3270     (yy_start_stack) =  NULL;
3271
3272 /* Defined in main.c */
3273 #ifdef YY_STDINIT
3274     tclscanYYin = stdin;
3275     tclscanYYout = stdout;
3276 #else
3277     tclscanYYin = (FILE *) 0;
3278     tclscanYYout = (FILE *) 0;
3279 #endif
3280
3281     /* For future reference: Set errno on error, since we are called by
3282      * tclscanYYlex_init()
3283      */
3284     return 0;
3285 }
3286
3287 /* tclscanYYlex_destroy is for both reentrant and non-reentrant scanners. */
3288 int tclscanYYlex_destroy  (void)
3289 {
3290     
3291     /* Pop the buffer stack, destroying each element. */
3292         while(YY_CURRENT_BUFFER){
3293                 tclscanYY_delete_buffer(YY_CURRENT_BUFFER  );
3294                 YY_CURRENT_BUFFER_LVALUE = NULL;
3295                 tclscanYYpop_buffer_state();
3296         }
3297
3298         /* Destroy the stack itself. */
3299         tclscanYYfree((yy_buffer_stack) );
3300         (yy_buffer_stack) = NULL;
3301
3302     /* Destroy the start condition stack. */
3303         tclscanYYfree((yy_start_stack)  );
3304         (yy_start_stack) = NULL;
3305
3306     /* Reset the globals. This is important in a non-reentrant scanner so the next time
3307      * tclscanYYlex() is called, initialization will occur. */
3308     yy_init_globals( );
3309
3310     return 0;
3311 }
3312
3313 /*
3314  * Internal utility routines.
3315  */
3316
3317 #ifndef yytext_ptr
3318 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
3319 {
3320         register int i;
3321         for ( i = 0; i < n; ++i )
3322                 s1[i] = s2[i];
3323 }
3324 #endif
3325
3326 #ifdef YY_NEED_STRLEN
3327 static int yy_flex_strlen (yyconst char * s )
3328 {
3329         register int n;
3330         for ( n = 0; s[n]; ++n )
3331                 ;
3332
3333         return n;
3334 }
3335 #endif
3336
3337 void *tclscanYYalloc (yy_size_t  size )
3338 {
3339         return (void *) malloc( size );
3340 }
3341
3342 void *tclscanYYrealloc  (void * ptr, yy_size_t  size )
3343 {
3344         /* The cast to (char *) in the following accommodates both
3345          * implementations that use char* generic pointers, and those
3346          * that use void* generic pointers.  It works with the latter
3347          * because both ANSI C and C++ allow castless assignment from
3348          * any pointer type to void*, and deal with argument conversions
3349          * as though doing an assignment.
3350          */
3351         return (void *) realloc( (char *) ptr, size );
3352 }
3353
3354 void tclscanYYfree (void * ptr )
3355 {
3356         free( (char *) ptr );   /* see tclscanYYrealloc() for (char *) cast */
3357 }
3358
3359 #define YYTABLES_NAME "yytables"
3360
3361 #line 1064 "tclscanner.l"
3362
3363
3364
3365 //! Start new scan context for given 'content'.
3366 // @return created new scan context.
3367 static tcl_scan *tcl_scan_start(char type, QString content, QCString ns, Entry *entry_cl, Entry *entry_fn)
3368 {
3369   tcl_scan *myScan=tcl.scan.at(0);
3370   QCString myName;
3371 tcl_inf("line=%d type=%d '%s'\n",tcl.line_body0,type,content.ascii());
3372
3373   myScan->line1=tclscanYYlineno;
3374   yy_push_state(TOP);
3375
3376   myScan=new tcl_scan;
3377   myScan->type[0] =' ';
3378   myScan->type[1] = '\0'; 
3379   switch (type) {
3380     case '"':
3381     case '{':
3382     case '[':
3383       myScan->type[0] = type;
3384       break;
3385     case '?':
3386       if (content[0]=='"' && content[content.length()-1]=='"') myScan->type[0]='"';
3387       if (content[0]=='{' && content[content.length()-1]=='}') myScan->type[0]='{';
3388       if (content[0]=='[' && content[content.length()-1]==']') myScan->type[0]='[';
3389   }
3390   if (myScan->type[0]!=' ')
3391   {
3392     tcl_codify(NULL,&myScan->type[0]);
3393     content = content.mid(1,content.length()-2);
3394   }
3395   content += (char)0x1A;// for detection end of scan context
3396   myScan->ns = ns;
3397   myScan->entry_cl = entry_cl;
3398   myScan->entry_fn = entry_fn;
3399   myScan->entry_scan = tcl.entry_current;
3400   myScan->buffer_state=tclscanYY_scan_string(content.ascii());
3401   myScan->line0=tcl.line_body0;
3402   myScan->line1=tcl.line_body1;
3403   myScan->after.clear();
3404   tclscanYYlineno=myScan->line0;
3405   myScan->protection = tcl.protection;
3406
3407   tcl.entry_inside = myScan->entry_scan;
3408   tcl.entry_current = tcl_entry_new();
3409   tcl.scan.insert(0,myScan);
3410   tclscanYY_switch_to_buffer(myScan->buffer_state);
3411   return (myScan);
3412 }
3413
3414 //! Close current scan context.
3415 static void tcl_scan_end()
3416 {
3417   tcl_scan *myScan=tcl.scan.at(0);
3418   tcl_scan *myScan1=tcl.scan.at(1);
3419 tcl_inf("line=%d\n",myScan->line1);
3420
3421   if (myScan->type[0]=='{') myScan->type[0]='}';
3422   if (myScan->type[0]=='[') myScan->type[0]=']';
3423   if (myScan->type[0]!=' ') tcl_codify(NULL,&myScan->type[0]);
3424   int myStart=-1;
3425   for (unsigned int i=0;i<myScan->after.count();i=i+2)
3426   {
3427     if (myScan->after[i]=="script") {
3428       myStart=i;
3429       break;
3430     }
3431     tcl_codify(myScan->after[i].utf8(),myScan->after[i+1].utf8());
3432   }
3433   tclscanYY_delete_buffer(myScan->buffer_state);
3434   yy_pop_state();
3435   tcl.entry_inside = myScan1->entry_scan;
3436   tclscanYY_switch_to_buffer(myScan1->buffer_state);
3437   tclscanYYlineno=myScan1->line1;
3438   tcl.protection = myScan1->protection;
3439   if (myStart>=0)
3440   {
3441     myScan1 = tcl_scan_start('?', myScan->after[myStart+1], myScan->ns, myScan->entry_cl, myScan->entry_fn);
3442     for (unsigned int i=myStart+2;i<myScan->after.count();i++)
3443     {
3444       myScan1->after.append(myScan->after[i]);
3445     }
3446     tcl.scan.remove(1);
3447   }
3448   else
3449   {
3450     tcl.scan.removeFirst();
3451   }
3452 }
3453
3454 //! Handling of word parsing.
3455 static void tcl_word(int what,const char *text) 
3456 {
3457   static char myList[1024]="";// nesting level list
3458   static int myLevel=0;// number of current nesting level
3459   static int myWhite=0;// set true when next char should be whitespace
3460   static char myWord;// internal state
3461
3462   switch (what)
3463   {
3464   case 0:// start
3465     yy_push_state(WORD);
3466     switch (text[0])
3467     {
3468       case '{':
3469       case '[':
3470       case '"': myWord = text[0]; break;
3471       default: myWord = '.';
3472     }
3473     myList[0]=myWord;
3474     myLevel=1;
3475     myWhite=0;
3476   break;
3477   case 1:// all other chars
3478     if (myWhite)
3479     {// {x}y "x"y
3480       tcl_err("expected word separator: %s\n",text);
3481       return;
3482     }
3483     if (myLevel==0)
3484     {
3485       myWord='.';
3486       myList[0]=myWord;
3487       myLevel=1;
3488     }
3489   break;
3490   case 2:// \\\n
3491     if (myLevel==0)
3492     {
3493       myWord=' ';
3494       yy_pop_state();
3495       yyless(0);
3496 tcl_inf("(\\\n) ?%s?\n",tcl.string_last.data());
3497       return;
3498     }
3499     switch (myList[myLevel-1])
3500     {
3501       case '{':
3502       case '[':
3503       case '"':
3504       break;
3505       case '.':
3506         if (myLevel==1)
3507         {
3508           myWord=' ';
3509           yy_pop_state();
3510           yyless(0);
3511 tcl_inf("(\\\n) ?%s?\n",tcl.string_last.data());
3512           return;
3513         }
3514       break;
3515     }
3516     myWhite=0;
3517   break;
3518   case 3:// {
3519     if (myWhite)
3520     {// {x}{ "x"{
3521       tcl_err("expected word separator: %s\n",text);
3522       return;
3523     }
3524     switch (myList[myLevel-1])
3525     {
3526       case '{':
3527       case '[':
3528         myList[myLevel++]='{';
3529       break;
3530       case '"':
3531       case '.':
3532       break;
3533     }
3534     myWhite=0;
3535   break;
3536   case 4:// }
3537     if (myWhite)
3538     {// {x}{ "x"{
3539       tcl_err("expected word separator: %s\n",text);
3540       return;
3541     }
3542     switch (myList[myLevel-1])
3543     {
3544       case '{':// {{x}}
3545         myLevel--;
3546         if (myLevel==0 && tcl.code==NULL) 
3547         {
3548           myWhite=1;
3549         }
3550       break;
3551       case '[':
3552       case '"':
3553       case '.':
3554       break;
3555     }
3556   break;
3557   case 5:// [
3558     if (myWhite)
3559     {// {x}[
3560       tcl_err("expected word separator: %s\n",text);
3561       return;
3562     }
3563     switch (myList[myLevel-1])
3564     {
3565       case '{':
3566       break;
3567       case '[':
3568       case '"':
3569       case '.':
3570         myList[myLevel++]='[';
3571       break;
3572     }
3573     myWhite=0;
3574   break;
3575   case 6:// ]
3576     if (myWhite)
3577     {// {x}]
3578       tcl_err("expected word separator: %s\n",text);
3579       return;
3580     }
3581     switch (myList[myLevel-1])
3582     {
3583       case '{':
3584       break;
3585       case '[':
3586         myLevel--;
3587       break;
3588       case '"':
3589       case '.':
3590       break;
3591     }
3592     myWhite=0;
3593   break;
3594   case 7:// "
3595     if (myWhite)
3596     {// {x}"
3597       tcl_err("expected word separator: %s\n",text);
3598       return;
3599     }
3600     switch (myList[myLevel-1])
3601     {
3602       case '{':
3603       break;
3604       case '[':
3605         myList[myLevel++]='"';
3606       break;
3607       case '"':
3608         myLevel--;
3609       case '.':
3610       break;
3611     }
3612   break;
3613   case 8:// ' '
3614   case 9:// \t
3615   case 10:// ;
3616   case 11:// \n
3617     if (myLevel==0)
3618     {
3619       myWord=' ';
3620       yy_pop_state();
3621       yyless(0);
3622 tcl_inf("(%d) ?%s?\n",what,tcl.string_last.data());
3623       return;
3624     }
3625     switch (myList[myLevel-1])
3626     {
3627       case '{':
3628       case '[':
3629       case '"':
3630       break;
3631       case '.':
3632         if (myLevel==1)
3633         {
3634           myWord=' ';
3635           yy_pop_state();
3636           yyless(0);
3637 tcl_inf("(.%d) ?%s?\n",what,tcl.string_last.data());
3638           return;
3639         }
3640         else
3641         {
3642           myLevel--;
3643         }
3644       break;
3645     }
3646     myWhite=0;
3647   break;
3648   case 12:// \x1A
3649     if (myLevel==0)
3650     {
3651       myWord=' ';
3652       yy_pop_state();
3653       yyless(0);
3654 tcl_inf("(%d) ?%s?\n",what,tcl.string_last.data());
3655       return;
3656     }
3657     if (myLevel!=1 || myList[0] != '.')
3658     {
3659       tcl_war("level=%d expected=%c\n",myLevel,myList[myLevel-1]);
3660     }
3661     myWord=' ';
3662     yy_pop_state();
3663     yyless(0);
3664 tcl_inf("(.%d) ?%s?\n",what,tcl.string_last.data());
3665     return;
3666     myWhite=0;
3667   break;
3668   default:
3669     tcl_err("wrong state: %d\n",what);
3670     return;
3671   }
3672   tcl.string_last += text;
3673 }
3674
3675 //! Handling of comment parsing.
3676 static void tcl_comment(int what,const char *text)
3677 {
3678   if (what==0)
3679   { // begin of comment
3680     if (tcl.comment)
3681     {
3682       tcl_err("comment in comment\n");
3683       return;
3684     }
3685     yy_push_state(COMMENT);
3686 tcl_inf("<- %s\n",text);
3687     tcl.string_comment="";
3688     tcl.comment=0;
3689   }
3690   else if (what==1)
3691   { // start new comment
3692     if (tcl.comment)
3693     {
3694       tcl_comment(99,""); // inbody
3695     }
3696     tcl.string_comment=text;
3697     tcl.comment=1;
3698   }
3699   else if (what==2)
3700   { // add to comment
3701     if (tcl.comment)
3702     {
3703       tcl.string_comment+=text;
3704     }
3705   }
3706   else if (what==-1 || what == -2)
3707   { // end of comment without/with command
3708     if (tcl.comment)
3709     {
3710       tcl.string_last=tcl.string_comment;
3711       tcl_comment(100+what,"");
3712     }
3713     else
3714     {
3715       tcl.string_last = "";
3716 tcl_inf("-> %s\n",(const char *)tcl.string_comment);
3717     }
3718     yy_pop_state();
3719     tcl.string_comment="";
3720     tcl.comment=0;
3721   }
3722   else if (what==98 || what==99)
3723   { // 98=new 99=inbody
3724     if (tcl.this_parser && tcl.string_comment.length())
3725     {
3726 tcl_inf("-> %s\n",(const char *)tcl.string_comment);
3727       int myPos=0;
3728       bool myNew=0;
3729       int myLine=tcl.line_comment;
3730       BufStr myI(1024);
3731       BufStr myO(1024);
3732       Protection myProt=tcl.protection;
3733
3734       // resolve ALIASES
3735       myI.addArray("/*!",3);
3736       myI.addArray(tcl.string_comment.data(),tcl.string_comment.length());
3737       myI.addArray("*/",2);
3738       convertCppComments(&myI,&myO,tcl.file_name);
3739       myO.dropFromStart(3);
3740       myO.shrink(myO.curPos()-2);
3741       myO.addChar('\0');
3742       QCString myDoc = myO.data();
3743       if (what==99)
3744       { // inbody comment file or namespace or class or proc/method
3745         int myPos0;
3746         int myLine0;
3747         Entry myEntry0; // used to test parsing
3748         Entry *myEntry;
3749
3750         Entry *myEntry1=NULL;
3751         if (tcl.scan.at(0)->entry_fn)
3752         {
3753           myEntry1=tcl.scan.at(0)->entry_fn;
3754         }
3755         else if (tcl.scan.at(0)->entry_cl)
3756         {
3757           myEntry1=tcl.scan.at(0)->entry_cl;
3758         }
3759
3760         myPos0=myPos;
3761         myLine0=myLine;
3762         while (parseCommentBlock(tcl.this_parser, &myEntry0, myDoc, tcl.file_name,
3763           myLine, FALSE, tcl.config_autobrief, FALSE, myProt, myPos, myNew))
3764         {
3765           if (myNew)
3766           { // we need a new entry in this case
3767             myNew=0;
3768             myEntry = tcl_entry_new();
3769             parseCommentBlock(tcl.this_parser, myEntry, myDoc, tcl.file_name,
3770               myLine0, FALSE, tcl.config_autobrief, FALSE, myProt, myPos0, myNew);
3771             tcl.entry_inside->addSubEntry(myEntry);
3772           }
3773           else
3774           { // we can add to current entry in this case
3775             if (myEntry1==NULL)
3776             {
3777               myEntry1=tcl_entry_namespace(tcl.scan.at(0)->ns);
3778             }
3779             parseCommentBlock(tcl.this_parser, myEntry1, myDoc, tcl.file_name,
3780               myLine0, FALSE, tcl.config_autobrief, FALSE, myProt, myPos0, myNew);
3781           }
3782           myPos0=myPos;
3783           myLine0=myLine;
3784         }
3785         if (myNew)
3786         { // we need a new entry
3787           myNew=0;
3788           myEntry = tcl_entry_new();
3789           parseCommentBlock(tcl.this_parser, myEntry, myDoc, tcl.file_name,
3790             myLine0, FALSE, tcl.config_autobrief, FALSE, myProt, myPos0, myNew);
3791           tcl.entry_inside->addSubEntry(myEntry);
3792         }
3793         else
3794         { // we can add to current entry
3795           if (myEntry1==NULL)
3796           {
3797             myEntry1=tcl_entry_namespace(tcl.scan.at(0)->ns);
3798           }
3799           parseCommentBlock(tcl.this_parser, myEntry1, myDoc, tcl.file_name,
3800             myLine0, FALSE, tcl.config_autobrief, FALSE, myProt, myPos0, myNew);
3801         }
3802       }
3803       else
3804       { // new entry
3805         tcl.entry_current = tcl_entry_new();
3806         while (parseCommentBlock(tcl.this_parser, tcl.entry_current, myDoc,
3807           tcl.file_name, myLine, FALSE, tcl.config_autobrief, FALSE,
3808           myProt, myPos, myNew))
3809         {
3810           if (myNew)
3811           {
3812             tcl.entry_inside->addSubEntry(tcl.entry_current);
3813             tcl.entry_current = tcl_entry_new();
3814           }
3815           else
3816           {
3817             tcl.entry_current->section = tcl.entry_inside->section;
3818             tcl.entry_current->name = tcl.entry_inside->name;
3819           }
3820         }
3821         if (myNew)
3822         {
3823           tcl.entry_inside->addSubEntry(tcl.entry_current);
3824           tcl.entry_current = tcl_entry_new();
3825         }
3826         else
3827         {
3828           tcl.entry_current->section = tcl.entry_inside->section;
3829           tcl.entry_current->name = tcl.entry_inside->name;
3830         }
3831       }
3832       if (tcl.protection != myProt)
3833       {
3834         tcl.scan.at(0)->protection = tcl.protection = myProt;
3835       }
3836     }
3837   }
3838   else
3839   {
3840     tcl_err("what %d\n",what);
3841     return;
3842   }
3843 }
3844
3845 //! Parse given \c arglist .
3846 static void tcl_command_ARGLIST(QString &arglist)
3847 {
3848 D
3849   Argument *myArg;
3850   QStringList myArgs;
3851   QString myArglist="";
3852
3853   if (tcl.entry_current->argList==NULL)
3854   {
3855     tcl.entry_current->argList=new ArgumentList;
3856   }
3857   tcl_split_list(arglist,myArgs);
3858   for (uint i=0;i<myArgs.count();i++)
3859   {
3860     QStringList myArgs1;
3861     myArg=new Argument;
3862
3863     tcl_split_list(*myArgs.at(i),myArgs1);
3864     if (myArgs1.count()==2)
3865     {
3866       myArg->name= (*myArgs1.at(0)).utf8();
3867       myArg->defval= (*myArgs1.at(1)).utf8();
3868       if (myArg->defval.isEmpty())
3869       {
3870         myArg->defval = " ";
3871       }
3872       myArglist += "?" + QCString(myArg->name) + "? ";
3873     }
3874     else
3875     {
3876       myArg->name= (*myArgs.at(i)).utf8();
3877       myArglist += QString(myArg->name) + " ";
3878     }
3879     tcl.entry_current->argList->append(myArg);
3880   }
3881   arglist = myArglist;
3882   tcl.entry_current->args = arglist.utf8();
3883 }
3884
3885 //! Create link.
3886 static void tcl_codify_link(QCString name)
3887 {
3888   if (tcl.code == NULL || name.isEmpty()) return;
3889   static int init=0;
3890   static QAsciiDict<MemberDef> fn;
3891   if (init==0) 
3892   {
3893     init=1;
3894     MemberNameSDict::Iterator mni(*Doxygen::memberNameSDict);
3895     MemberNameSDict::Iterator fni(*Doxygen::functionNameSDict);
3896     MemberName *mn=0;
3897     MemberDef *md;
3898     for (mni.toFirst();(mn=mni.current());++mni) 
3899     {
3900       MemberNameIterator mi(*mn);
3901       for (mi.toFirst();(md=mi.current());++mi) 
3902       {
3903         fn.insert(md->qualifiedName(),md);
3904       }
3905     }
3906     for (fni.toFirst();(mn=fni.current());++fni) 
3907     {
3908       MemberNameIterator fi(*mn);
3909       for (fi.toFirst();(md=fi.current());++fi) 
3910       {
3911         fn.insert(md->qualifiedName(),md);
3912       }
3913     }
3914   }
3915   MemberDef *myDef;
3916   QCString myName=name; 
3917   if (name.mid(0,2)=="::") // fully qualified global command
3918   {
3919     myName = myName.mid(2);
3920     myDef = fn.find(myName);
3921   }
3922   else // not qualified name
3923   {
3924     QCString myName1=myName; 
3925     myDef = NULL;
3926     myName1 = tcl.scan.at(0)->ns;
3927     if (myName1 == " " || myName1 == "")
3928     {
3929       myName1 = myName;
3930     }
3931     else
3932     {
3933       myName1 = myName1 + "::" + myName;
3934     }
3935     myDef = fn.find(myName1); // search namespace command
3936     if (myDef == NULL)
3937     {
3938       myDef = fn.find(myName); // search global command
3939     }
3940   }
3941   if (myDef != NULL) // documented command
3942   {
3943     tcl.code->writeCodeLink(myDef->getReference().data(),
3944                 myDef->getOutputFileBase().data(),
3945                 myDef->anchor().data(),
3946                 name,
3947                 myDef->qualifiedName().data());
3948     if (tcl.memberdef)
3949     {
3950         myDef->addSourceReferencedBy(tcl.memberdef);
3951         tcl.memberdef->addSourceReferences(myDef);
3952     }
3953   }
3954   else if (tcl_keyword(myName)) // check keyword
3955   {
3956     tcl_codify("keyword",name);
3957   }
3958   else
3959   {
3960     tcl_codify(NULL,name); // something else
3961   }
3962   
3963 }
3964
3965 //! Handle internal tcl commands.
3966 // "if expr1 ?then? body1 elseif expr2 ?then? body2 elseif ... ?else?  ?bodyN?"
3967 static void tcl_command_IF(QStringList type)
3968 {
3969 D
3970   tcl_codify_cmd("keyword",0);
3971   tcl_codify_cmd(NULL,1);
3972   tcl_scan *myScan=tcl.scan.at(0);
3973   myScan = tcl_scan_start('?',*tcl.list_commandwords.at(2),
3974         myScan->ns,myScan->entry_cl,myScan->entry_fn);
3975   for (unsigned int i = 3;i<tcl.list_commandwords.count();i++)
3976   {
3977     myScan->after << type[i] << tcl.list_commandwords[i];
3978   }
3979 }
3980 //! Handle internal tcl commands.
3981 // "for start test next body"
3982 static void tcl_command_FOR()
3983 {
3984 D
3985   tcl_codify_cmd("keyword",0);
3986   tcl_codify_cmd(NULL,1);
3987   tcl_scan *myScan=tcl.scan.at(0);
3988   myScan = tcl_scan_start('?',*tcl.list_commandwords.at(2),
3989         myScan->ns,myScan->entry_cl,myScan->entry_fn);
3990   myScan->after << "NULL" << tcl.list_commandwords[3];
3991   myScan->after << "script" << tcl.list_commandwords[4];
3992   myScan->after << "NULL" << tcl.list_commandwords[5];
3993   myScan->after << "script" << tcl.list_commandwords[6];
3994   myScan->after << "NULL" << tcl.list_commandwords[7];
3995   myScan->after << "script" << tcl.list_commandwords[8];
3996 }
3997
3998 ///! Handle internal tcl commands.
3999 // "foreach varname list body" and
4000 // "foreach varlist1 list1 ?varlist2 list2 ...? body"
4001 static void tcl_command_FOREACH()
4002 {
4003 D
4004   unsigned int i;
4005   tcl_codify_cmd("keyword",0);
4006   for (i = 1;i<tcl.list_commandwords.count()-1;i++)
4007   {
4008     tcl_codify_cmd(NULL,i);
4009   }
4010   tcl_scan *myScan=tcl.scan.at(0);
4011   myScan = tcl_scan_start('?',*tcl.list_commandwords.at(tcl.list_commandwords.count()-1),
4012         myScan->ns,myScan->entry_cl,myScan->entry_fn);
4013 }
4014
4015 ///! Handle internal tcl commands.
4016 // "while test body"
4017 static void tcl_command_WHILE()
4018 {
4019 D
4020   tcl_codify_cmd("keyword",0);
4021   tcl_codify_cmd(NULL,1);
4022   tcl_scan *myScan=tcl.scan.at(0);
4023   myScan = tcl_scan_start('?',*tcl.list_commandwords.at(2),
4024         myScan->ns,myScan->entry_cl,myScan->entry_fn);
4025   myScan->after << "NULL" << tcl.list_commandwords[3];
4026   myScan->after << "script" << tcl.list_commandwords[4];
4027 }
4028
4029 //! Handle all other commands.
4030 // Create links of first command word or first command word inside [].
4031 static void tcl_command_OTHER()
4032 {
4033   if (tcl.code == NULL) return;
4034 D
4035   QCString myName;
4036   for (unsigned int i=0; i< tcl.list_commandwords.count(); i++)
4037   {
4038     myName = (*tcl.list_commandwords.at(i)).utf8();
4039     if (i==0)
4040     {
4041       tcl_codify_link(myName);
4042     }
4043     else if (i%2 != 0)
4044     {
4045       tcl_codify(NULL,myName);
4046     }
4047     else
4048     {
4049       QCString myStr="";
4050       int myCmd=0;
4051       unsigned int i;
4052       for (i=0;i<myName.length();i++)
4053       {
4054         QChar c = myName[i];
4055         if (myCmd) 
4056         {
4057           if (c==' '||c=='\t'||c=='\n'||c==']') 
4058           {//end of command
4059             tcl_codify_link(myStr);
4060             myStr="";
4061             myCmd=0;
4062           }
4063           myStr+=c;
4064         } 
4065         else 
4066         {
4067           myStr+=c;
4068           if (c=='[') 
4069           {//start of command
4070             for (;i<myName.length();i++)
4071             {
4072               c = myName[i+1];
4073               if (c!=' ' && c!='\t' && c!='\n') break;
4074               myStr+=c;
4075             }
4076             tcl_codify(NULL,myStr);
4077             myStr="";
4078             myCmd=1;
4079           }
4080         }
4081       }
4082       tcl_codify(NULL,myStr);
4083     }
4084   }
4085 }
4086
4087 //! Handle \c proc statements.
4088 static void tcl_command_PROC()
4089 {
4090 D
4091   QCString myNs, myName;
4092   Entry *myEntryNs;
4093   Entry *myEntry;
4094   tcl_scan *myScan = tcl.scan.at(0);
4095
4096   tcl_codify_cmd("keyword",0);
4097   tcl_codify_cmd(NULL,1);
4098   tcl_codify_cmd(NULL,2);
4099   tcl_codify_cmd(NULL,3);
4100   tcl_codify_cmd(NULL,4);
4101   tcl_codify_cmd(NULL,5);
4102   tcl_name(myScan->ns,(*tcl.list_commandwords.at(2)).utf8(),myNs,myName);
4103   if (myNs.length())
4104   {
4105     myEntryNs = tcl_entry_namespace(myNs);
4106   }
4107   else
4108   {
4109     myEntryNs = tcl_entry_namespace(myScan->ns);
4110   }
4111   //why not needed here? tcl.fn.remove(myName);
4112   tcl.entry_current->section = Entry::FUNCTION_SEC;
4113   tcl.entry_current->mtype = Method;
4114   tcl.entry_current->name = myName;
4115   tcl.entry_current->startLine = tcl.line_command;
4116   tcl.entry_current->bodyLine = tcl.line_body0;
4117   tcl.entry_current->endBodyLine = tcl.line_body1;
4118   tcl_protection(tcl.entry_current);
4119   tcl_command_ARGLIST(*tcl.list_commandwords.at(4));
4120   myEntryNs->addSubEntry(tcl.entry_current);
4121   myEntry = tcl.entry_current;
4122   tcl.fn.insert(myName,myEntry);
4123   myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(6),
4124         myEntryNs->name,NULL,myEntry);
4125 }
4126
4127 //! Handle \c itcl::body statements and \c oo::define method and method inside \c itcl::class statements.
4128 static void tcl_command_METHOD()
4129 {
4130 D
4131   QCString myNs, myName;
4132   Entry *myEntryCl, *myEntry;
4133   tcl_scan *myScan = tcl.scan.at(0);
4134
4135   tcl_codify_cmd("keyword",0);
4136   tcl_codify_cmd(NULL,1);
4137   tcl_codify_cmd(NULL,2);
4138   tcl_codify_cmd(NULL,3);
4139   tcl_codify_cmd(NULL,4);
4140   tcl_codify_cmd(NULL,5);
4141   tcl_name(myScan->ns,(*tcl.list_commandwords.at(2)).utf8(),myNs,myName);
4142   if (myNs.length())
4143   {
4144     myEntryCl = tcl_entry_class(myNs);
4145   }
4146   else
4147   {
4148     myNs = myScan->ns;
4149     myEntryCl = myScan->entry_cl;
4150   }
4151   // needed in case of more then one definition p.e. itcl::method and itcl::body
4152   // see also bug #
4153   tcl.fn.remove(myName);
4154   tcl.entry_current->section = Entry::FUNCTION_SEC;
4155   tcl.entry_current->mtype = Method;
4156   tcl.entry_current->name = myName;
4157   tcl.entry_current->startLine = tcl.line_command;
4158   tcl.entry_current->bodyLine = tcl.line_body0;
4159   tcl.entry_current->endBodyLine = tcl.line_body1;
4160   tcl_protection(tcl.entry_current);
4161   tcl_command_ARGLIST(*tcl.list_commandwords.at(4));
4162   myEntryCl->addSubEntry(tcl.entry_current);
4163   tcl.fn.insert(myName,tcl.entry_current);
4164   myEntry = tcl.entry_current;
4165   myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(6),
4166         myNs, myEntryCl, myEntry);
4167 }
4168
4169 //! Handle \c constructor statements inside class definitions.
4170 static void tcl_command_CONSTRUCTOR()
4171 {
4172 D
4173   QCString myNs, myName;
4174   Entry *myEntryCl, *myEntry;
4175   tcl_scan *myScan = tcl.scan.at(0);
4176
4177   tcl_codify_cmd("keyword",0);
4178   tcl_codify_cmd(NULL,1);
4179   tcl_codify_cmd(NULL,2);
4180   tcl_codify_cmd(NULL,3);
4181   tcl_name(myScan->ns,(*tcl.list_commandwords.at(0)).utf8(),myNs,myName);
4182   if (myNs.length())
4183   {
4184     myEntryCl = tcl_entry_class(myNs);
4185   }
4186   else
4187   {
4188     myNs = myScan->ns;
4189     myEntryCl = myScan->entry_cl;
4190   }
4191   tcl.entry_current->section = Entry::FUNCTION_SEC;
4192   tcl.entry_current->mtype = Method;
4193   tcl.entry_current->name = myName;
4194   tcl.entry_current->startLine = tcl.line_command;
4195   tcl.entry_current->bodyLine = tcl.line_body0;
4196   tcl.entry_current->endBodyLine = tcl.line_body1;
4197   tcl_protection(tcl.entry_current);
4198   tcl_command_ARGLIST(*tcl.list_commandwords.at(2));
4199   myEntryCl->addSubEntry(tcl.entry_current);
4200   myEntry = tcl.entry_current;
4201   tcl.fn.insert(myName,myEntry);
4202   myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(4),
4203         myNs, myEntryCl, myEntry);
4204 }
4205
4206 //! Handle \c destructor statements inside class definitions.
4207 static void tcl_command_DESTRUCTOR()
4208 {
4209 D
4210   QCString myNs, myName;
4211   Entry *myEntryCl, *myEntry;
4212   tcl_scan *myScan = tcl.scan.at(0);
4213
4214   tcl_codify_cmd("keyword",0);
4215   tcl_codify_cmd(NULL,1);
4216   tcl_name(myScan->ns,(*tcl.list_commandwords.at(0)).utf8(),myNs,myName);
4217   if (myNs.length())
4218   {
4219     myEntryCl = tcl_entry_class(myNs);
4220   }
4221   else
4222   {
4223     myNs = myScan->ns;
4224     myEntryCl = myScan->entry_cl;
4225   }
4226   tcl.entry_current->section = Entry::FUNCTION_SEC;
4227   tcl.entry_current->mtype = Method;
4228   tcl.entry_current->name = myName;
4229   tcl.entry_current->startLine = tcl.line_command;
4230   tcl.entry_current->bodyLine = tcl.line_body0;
4231   tcl.entry_current->endBodyLine = tcl.line_body1;
4232   tcl_protection(tcl.entry_current);
4233   myEntryCl->addSubEntry(tcl.entry_current);
4234   myEntry = tcl.entry_current;
4235   tcl.fn.insert(myName,myEntry);
4236   myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(2),
4237         myNs, myEntryCl, myEntry);
4238 }
4239
4240 //! Handle \c namespace statements.
4241 static void tcl_command_NAMESPACE()
4242 {
4243 D
4244   QCString myNs, myName, myStr;
4245   Entry *myEntryNs=NULL;
4246   tcl_scan *myScan = tcl.scan.at(0);
4247
4248   tcl_codify_cmd("keyword",0);
4249   tcl_codify_cmd(NULL,1);
4250   tcl_codify_cmd("keyword",2);
4251   tcl_codify_cmd(NULL,3);
4252   tcl_codify_cmd(NULL,4);
4253   tcl_codify_cmd(NULL,5);
4254   tcl_name(myScan->ns,(*tcl.list_commandwords.at(4)).utf8(),myNs,myName);
4255   if (myNs.length())
4256   {
4257     myName = myNs+"::"+myName;
4258   }
4259   tcl.entry_current->section = Entry::NAMESPACE_SEC;
4260   tcl.entry_current->name = myName;
4261   tcl.entry_current->startLine = tcl.line_command;
4262   tcl.entry_current->bodyLine = tcl.line_body0;
4263   tcl.entry_current->endBodyLine = tcl.line_body1;
4264   tcl.entry_main->addSubEntry(tcl.entry_current);
4265   tcl.ns.insert(myName,tcl.entry_current);
4266   myEntryNs = tcl.entry_current;
4267   myStr = (*tcl.list_commandwords.at(6)).utf8();
4268   if (tcl.list_commandwords.count() > 7)
4269   {
4270     for (uint i=7;i<tcl.list_commandwords.count();i++)
4271     {
4272       myStr.append((*tcl.list_commandwords.at(i)).utf8());
4273     }
4274     tcl.word_is=' ';
4275   }
4276   myScan = tcl_scan_start(tcl.word_is,myStr, myName, NULL, NULL);
4277 }
4278
4279 //! Handle \c itcl::class statements.
4280 static void tcl_command_ITCL_CLASS()
4281 {
4282 D
4283   QCString myNs, myName, myStr;
4284   Entry *myEntryCl;
4285   tcl_scan *myScan = tcl.scan.at(0);
4286
4287   tcl_codify_cmd("keyword",0);
4288   tcl_codify_cmd(NULL,1);
4289   tcl_codify_cmd("NULL",2);
4290   tcl_codify_cmd("NULL",3);
4291   tcl_name(myScan->ns,(*tcl.list_commandwords.at(2)).utf8(),myNs,myName);
4292   if (myNs.length())
4293   {
4294     myName = myNs+"::"+myName;
4295   }
4296   tcl.entry_current->section = Entry::CLASS_SEC;
4297   tcl.entry_current->name = myName;
4298   tcl.entry_current->startLine = tcl.line_command;
4299   tcl.entry_current->bodyLine = tcl.line_body0;
4300   tcl.entry_current->endBodyLine = tcl.line_body1;
4301   tcl.entry_main->addSubEntry(tcl.entry_current);
4302   tcl.cl.insert(myName,tcl.entry_current);
4303   myEntryCl = tcl.entry_current;
4304   myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(4),
4305         myName, myEntryCl, NULL);
4306 }
4307
4308 //! Handle \c oo::class statements.
4309 static void tcl_command_OO_CLASS()
4310 {
4311 D
4312   QCString myNs, myName, myStr;
4313   //Entry *myEntryNs;
4314   Entry *myEntryCl;
4315   tcl_scan *myScan = tcl.scan.at(0);
4316
4317   tcl_codify_cmd("keyword",0);
4318   tcl_codify_cmd(NULL,1);
4319   tcl_codify_cmd("NULL",2);
4320   tcl_codify_cmd("NULL",3);
4321   tcl_codify_cmd("NULL",4);
4322   tcl_codify_cmd("NULL",5);
4323   tcl_name(myScan->ns,(*tcl.list_commandwords.at(4)).utf8(),myNs,myName);
4324   if (myNs.length())
4325   {
4326     myName = myNs+"::"+myName;
4327   }
4328   tcl.entry_current->section = Entry::CLASS_SEC;
4329   tcl.entry_current->name = myName;
4330   tcl.entry_current->startLine = tcl.line_command;
4331   tcl.entry_current->bodyLine = tcl.line_body0;
4332   tcl.entry_current->endBodyLine = tcl.line_body1;
4333   tcl.entry_main->addSubEntry(tcl.entry_current);
4334   //myEntryNs = tcl_entry_namespace(myName);
4335   tcl.cl.insert(myName,tcl.entry_current);
4336   myEntryCl = tcl.entry_current;
4337   myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(6),
4338         myName, myEntryCl, NULL);
4339 }
4340
4341 //! Handle \c oo::define statements.
4342 static void tcl_command_OO_DEFINE()
4343 {
4344 D
4345   QCString myNs, myName, myStr;
4346   Entry *myEntryCl;
4347   tcl_scan *myScan = tcl.scan.at(0);
4348
4349   tcl_codify_cmd("keyword",0);
4350   tcl_codify_cmd(NULL,1);
4351   tcl_codify_cmd("NULL",2);
4352   tcl_codify_cmd("NULL",3);
4353   tcl_name(myScan->ns,(*tcl.list_commandwords.at(2)).utf8(),myNs,myName);
4354   if (myNs.length())
4355   {
4356     myName = myNs+"::"+myName;
4357   }
4358   myEntryCl = tcl_entry_class(myName);
4359   myStr = (*tcl.list_commandwords.at(4)).utf8();
4360   if (tcl.list_commandwords.count() > 5)
4361   {
4362     for (uint i=5;i<tcl.list_commandwords.count();i++)
4363     {
4364       myStr.append((*tcl.list_commandwords.at(i)).utf8());
4365     }
4366     tcl.word_is=' ';
4367   }
4368   myScan = tcl_scan_start(tcl.word_is,myStr,myName,myEntryCl,NULL);
4369 }
4370
4371 //! Handle \c variable statements.
4372 static void tcl_command_VARIABLE(int inclass)
4373 {
4374 D
4375   QCString myNs, myName;
4376   Entry *myEntry;
4377   tcl_scan *myScan = tcl.scan.at(0);
4378
4379   tcl_codify_cmd("keyword",0);
4380   for (unsigned int i=1; i< tcl.list_commandwords.count(); i++)
4381   {
4382     tcl_codify_cmd(NULL,i);
4383   }
4384   tcl_name(myScan->ns,(*tcl.list_commandwords.at(2)).utf8(),myNs,myName);
4385   if (myNs.length())
4386   {// qualified variables go into namespace
4387     myEntry = tcl_entry_namespace(myNs);
4388     tcl.entry_current->stat = true;
4389   }
4390   else
4391   {
4392     if (inclass)
4393     {
4394       myEntry = myScan->entry_cl;
4395       tcl.entry_current->stat = false;
4396     }
4397     else
4398     {
4399       myEntry = tcl_entry_namespace(myScan->ns);
4400       tcl.entry_current->stat = true;
4401     }
4402   }
4403   tcl.entry_current->section = Entry::VARIABLE_SEC;
4404   tcl.entry_current->name = myName;
4405   tcl.entry_current->startLine = tcl.line_command;
4406   tcl.entry_current->bodyLine = tcl.line_body0;
4407   tcl.entry_current->endBodyLine = tcl.line_body1;
4408   tcl_protection(tcl.entry_current);
4409   myEntry->addSubEntry(tcl.entry_current);
4410   tcl.entry_current = tcl_entry_new();
4411 }
4412
4413 //! Handling of command parsing.
4414 //! what=0  -> ...
4415 //! what=1  -> ...
4416 //! what=-1 -> ...
4417 static void tcl_command(int what,const char *text)
4418 {
4419   int myLine=0;
4420   if (what==0)
4421   {
4422     tcl.scan.at(0)->line1=tclscanYYlineno;// current line in scan context
4423     tcl.line_body0=tclscanYYlineno;// start line of command
4424 tcl_inf("<- %s\n",text);
4425     yy_push_state(COMMAND);
4426     tcl.list_commandwords.clear();
4427     tcl.string_command="";
4428     tcl.string_last="";
4429     tcl.command=1;
4430     return;
4431   }
4432   else if (what==1)
4433   {
4434     if (tcl.string_last.length())
4435     {
4436       tcl.list_commandwords.append(tcl.string_last);
4437       tcl.string_last="";
4438     }
4439     if (text) 
4440     {
4441       tcl.list_commandwords.append(text);
4442     }
4443     return;
4444   }
4445   else if (what!=-1)
4446   {// should not happen
4447     tcl_err("what %d\n",what);
4448     return;
4449   }
4450   QCString myText = text;
4451 tcl_inf("->\n");
4452   if (tcl.command==0)
4453   {
4454     return; //TODO check on inside comment
4455   }
4456   if (tcl.string_last != "")
4457   {// get last word
4458     tcl.list_commandwords.append(tcl.string_last);
4459     tcl.string_last="";
4460   }
4461   yy_pop_state();
4462
4463   // check command
4464   QCString myStr = (*tcl.list_commandwords.at(0)).utf8();
4465   int myLevel = 0;
4466   Protection myProt = tcl.protection;
4467
4468   if (tcl.list_commandwords.count() < 3)
4469   {
4470     tcl_command_OTHER();
4471     goto command_text;
4472   }
4473   // remove leading "::" and apply TCL_SUBST
4474   if (myStr.left(2)=="::") myStr = myStr.mid(2);
4475   if (tcl.config_subst.contains(myStr))
4476   {
4477     myStr=tcl.config_subst[myStr].utf8();
4478   }
4479   if (myStr=="private")
4480   {
4481     tcl.protection = Private;
4482     myLevel = 1;
4483   }
4484   else if (myStr=="protected")
4485   {
4486     tcl.protection = Protected;
4487     myLevel = 1;
4488   }
4489   else if (myStr=="public")
4490   {
4491     tcl.protection = Public;
4492     myLevel = 1;
4493   }
4494   if (myLevel)
4495   {
4496     tcl_codify_cmd("keyword",0);
4497     tcl_codify_cmd(NULL,1);
4498     tcl.list_commandwords.remove(tcl.list_commandwords.at(1));
4499     tcl.list_commandwords.remove(tcl.list_commandwords.at(0));
4500     if (tcl.list_commandwords.count()==1)
4501     {
4502       tcl_scan *myScan = tcl.scan.at(0);
4503       myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(0),
4504         myScan->ns,myScan->entry_cl,myScan->entry_fn);
4505       myProt = tcl.protection;
4506       goto command_end;
4507     }
4508     myStr       = (*tcl.list_commandwords.at(0)).utf8();
4509     // remove leading "::" and apply TCL_SUBST
4510     if (myStr.left(2)=="::") myStr = myStr.mid(2);
4511     if (tcl.config_subst.contains(myStr))
4512     {
4513       myStr=tcl.config_subst[myStr].utf8();
4514     }
4515   }
4516   if (myStr=="proc")
4517   {
4518     if (tcl.list_commandwords.count() == 5)
4519     {// itcl::proc
4520       tcl.list_commandwords.append("");
4521       tcl.list_commandwords.append("");
4522     }
4523     if (tcl.list_commandwords.count() != 7) {myLine=__LINE__;goto command_warn;}
4524     tcl_command_PROC();
4525     goto command_end;
4526   }
4527   if (myStr=="method")
4528   {
4529     if (tcl.list_commandwords.count() == 5)
4530     {// itcl::method
4531       tcl.list_commandwords.append("");
4532       tcl.list_commandwords.append("");
4533     }
4534     if (tcl.list_commandwords.count() != 7) {myLine=__LINE__;goto command_warn;}
4535     tcl_command_METHOD();
4536     goto command_end;
4537   }
4538   if (myStr=="constructor")
4539   {
4540     if (tcl.list_commandwords.count() != 5) {myLine=__LINE__;goto command_warn;}
4541     tcl_command_CONSTRUCTOR();
4542     goto command_end;
4543   }
4544   if (myStr=="destructor")
4545   {
4546     if (tcl.list_commandwords.count() != 3) {myLine=__LINE__;goto command_warn;}
4547     tcl_command_DESTRUCTOR();
4548     goto command_end;
4549   }
4550   if (myStr=="namespace")
4551   {
4552     if ((*tcl.list_commandwords.at(2)).utf8()=="eval")
4553     {
4554       if (tcl.list_commandwords.count() < 7) {myLine=__LINE__;goto command_warn;}
4555       tcl_command_NAMESPACE();
4556       goto command_end;
4557     }
4558     tcl_command_OTHER();
4559     goto command_text;
4560   }
4561   if (myStr=="itcl::class")
4562   {
4563     if (tcl.list_commandwords.count() != 5) {myLine=__LINE__;goto command_warn;}
4564     tcl_command_ITCL_CLASS();
4565     goto command_end;
4566   }
4567   if (myStr=="itcl::body")
4568   {
4569     if (tcl.list_commandwords.count() != 7) {myLine=__LINE__;goto command_warn;}
4570     tcl_command_METHOD();
4571     goto command_end;
4572   }
4573   if (myStr=="oo::class")
4574   {
4575     if ((*tcl.list_commandwords.at(2)).utf8()=="create")
4576     {
4577       if (tcl.list_commandwords.count() != 7) {myLine=__LINE__;goto command_warn;}
4578       tcl_command_OO_CLASS();
4579       goto command_end;
4580     }
4581     tcl_command_OTHER();
4582     goto command_text;
4583   }
4584   if (myStr=="oo::define")
4585   {
4586     if (tcl.list_commandwords.count() < 5) {myLine=__LINE__;goto command_warn;}
4587     tcl_command_OO_DEFINE();
4588     goto command_end;
4589   }
4590   if (myStr=="variable")
4591   {
4592     if (tcl.list_commandwords.count() < 3) {myLine=__LINE__;goto command_warn;}
4593     if (tcl.scan.at(0)->entry_fn == NULL)
4594     {// only parsed outside functions
4595       tcl_command_VARIABLE(tcl.scan.at(0)->entry_cl!=NULL&&tcl.scan.at(0)->entry_cl->name!="");
4596       goto command_text;
4597     }
4598   }
4599   if (myStr=="common")
4600   {
4601     if (tcl.list_commandwords.count() < 3) {myLine=__LINE__;goto command_warn;}
4602     if (tcl.scan.at(0)->entry_fn == NULL)
4603     {// only parsed outside functions
4604       tcl_command_VARIABLE(0);
4605       goto command_text;
4606     }
4607   }
4608   if (myStr=="inherit" || myStr=="superclass")
4609   {
4610     if (tcl.list_commandwords.count() < 3) {myLine=__LINE__;goto command_warn;}
4611     if (tcl.scan.at(0)->entry_cl!=NULL&&tcl.scan.at(0)->entry_cl->name!="")
4612     {
4613       for (unsigned int i = 2; i < tcl.list_commandwords.count(); i = i + 2)
4614       {
4615         tcl.scan.at(0)->entry_cl->extends->append(new BaseInfo((*tcl.list_commandwords.at(i)).utf8(),Public,Normal));
4616       }
4617     }
4618     goto command_end;
4619   }
4620   /*
4621    * Start of internal tcl keywords
4622    * Ready: if, for, foreach, while
4623    * TODO: switch, eval, ?
4624    */
4625   if (myStr=="for")
4626   {
4627     if (tcl.list_commandwords.count() != 9) {myLine=__LINE__;goto command_warn;}
4628     tcl_command_FOR();
4629     goto command_end;
4630   }
4631   if (myStr=="foreach")
4632   {
4633     if (tcl.list_commandwords.count() < 7 || tcl.list_commandwords.count()%2==0) {myLine=__LINE__;goto command_warn;}
4634     tcl_command_FOREACH();
4635     goto command_end;
4636   }
4637   /*
4638 if expr1 ?then? body1 elseif expr2 ?then? body2 elseif ... ?else?  ?bodyN?
4639   */
4640   if (myStr=="if" && tcl.list_commandwords.count() > 4)
4641   {
4642     QStringList myType;
4643     myType << "keyword" << "NULL" << "script" << "NULL";
4644     char myState='x';// last word: e'x'pr 't'hen 'b'ody 'e'lse else'i'f..
4645     for (unsigned int i = 4; i < tcl.list_commandwords.count(); i = i + 2)
4646     {
4647       QCString myStr=(*tcl.list_commandwords.at(i)).utf8();
4648       if (myState=='x')
4649       {
4650         if (myStr=="then") 
4651         {
4652           myState='t';
4653           myType << "keyword" << "NULL";
4654         }
4655         else
4656         {
4657           myState='b';
4658           myType << "script" << "NULL";
4659         }
4660       }
4661       else if (myState=='t')
4662       {
4663         myState='b';
4664         myType << "script" << "NULL";
4665       }
4666       else if (myState=='b')
4667       {
4668         if (myStr=="elseif") {
4669           myState='i';
4670           myType << "keyword" << "NULL";
4671         }
4672         else if (myStr=="else" && i==tcl.list_commandwords.count()-3)
4673         {
4674           myState = 'b';
4675           myType << "keyword" << "NULL" << "script";
4676           i = tcl.list_commandwords.count();
4677         }
4678         else if (i==tcl.list_commandwords.count()-1)
4679         {
4680           myState = 'b';
4681           myType << "script";
4682           i = tcl.list_commandwords.count();
4683         }
4684         else
4685         {
4686           myLine=__LINE__;goto command_warn;
4687         }
4688       }
4689       else if (myState=='i')
4690       {
4691         myState='x';
4692         myType << "script" << "NULL";
4693       }
4694     }
4695     if (myState != 'b') {myLine=__LINE__;goto command_warn;}
4696     tcl_command_IF(myType);
4697     goto command_end;
4698   }
4699   if (myStr=="while")
4700   {
4701     if (tcl.list_commandwords.count() != 5) {myLine=__LINE__;goto command_warn;}
4702     tcl_command_WHILE();
4703     goto command_end;
4704   }
4705   tcl_command_OTHER();
4706   goto command_text;
4707   command_warn:// print warning message because of wrong used syntax
4708     tcl_war("%d count=%d: %s\n",myLine,tcl.list_commandwords.count(),tcl.list_commandwords.join(" ").ascii());
4709     tcl_command_OTHER();
4710   command_text:// print remaining text as comment
4711     if (!myText.isEmpty()) tcl_codify("comment",myText);
4712     myText = "";
4713   command_end:// add remaining text to current context
4714     if (!myText.isEmpty()) tcl.scan.at(0)->after << "comment" << myText;
4715     tcl.list_commandwords.clear();
4716     tcl.command = 0;
4717     tcl.protection = myProt;
4718 }
4719
4720 //----------------------------------------------------------------------------
4721 //! Common initializations.
4722 static void tcl_init()
4723 {
4724   // Get values from option TCL_SUBST
4725   tcl.config_subst.clear();
4726   if (Config::instance()->get("TCL_SUBST")) 
4727   {
4728     QStrList myStrList = Config_getList("TCL_SUBST");
4729     const char *s=myStrList.first();
4730     while (s) 
4731     {
4732       QCString myStr=s;
4733       int i=myStr.find('=');
4734       if (i>0)
4735       {
4736         QCString myName=myStr.left(i).stripWhiteSpace();
4737         QCString myValue=myStr.right(myStr.length()-i-1).stripWhiteSpace();
4738         if (!myName.isEmpty() && !myValue.isEmpty())
4739 tcl_inf("TCL_SUBST: use '%s'\n",s);
4740         tcl.config_subst[myName] = myValue;
4741       }
4742       s = myStrList.next();
4743     }
4744   }
4745
4746   if (tcl.input_string.at(tcl.input_string.length()-1) == '\n') 
4747   {
4748     tcl.input_string[tcl.input_string.length()-1] = 0x1A;
4749   } 
4750   else 
4751   {
4752     tcl.input_string += 0x1A;
4753   }
4754   tcl.code = NULL;
4755   tcl.code_font=NULL;
4756   tcl.code_line=1;
4757   tcl.code_linenumbers=1;
4758   tcl.config_autobrief = Config_getBool("JAVADOC_AUTOBRIEF");
4759   tcl.input_position = 0;
4760   tcl.file_name = NULL;
4761   tcl.this_parser = NULL;
4762   tcl.command=0;
4763   tcl.comment=0;
4764   tcl.brace_level=0;
4765   tcl.bracket_level=0;
4766   tcl.bracket_quote=0;
4767   tcl.word_is=' ';
4768   tcl.string_command="";
4769   tcl.string_commentline="";
4770   tcl.string_commentcodify="";
4771   tcl.string_comment    = "";
4772   tcl.string_last       = "";
4773   tcl.entry_main        = NULL;
4774   tcl.entry_file        = NULL;
4775   tcl.entry_current     = NULL;
4776   tcl.entry_inside      = NULL;
4777   tcl.list_commandwords.clear();
4778   tcl.scan.clear();
4779   tcl.ns.clear();
4780   tcl.cl.clear();
4781   tcl.fn.clear();
4782   tclscanYYlineno               = 1;
4783   tcl.protection        = Public;
4784   tcl.memberdef         = NULL;
4785 }
4786
4787 //! Start parsing.
4788 static void tcl_parse(const QCString ns, const QCString cls)
4789 {
4790   tcl_scan *myScan;
4791
4792   tcl.entry_file          = tcl_entry_new();
4793   tcl.entry_file->name    = tcl.file_name;
4794   tcl.entry_file->section = Entry::SOURCE_SEC;
4795   tcl.entry_file->protection = Public;
4796   tcl.entry_main->addSubEntry(tcl.entry_file);
4797   Entry *myEntry=tcl_entry_new();
4798   myEntry->name="";
4799   tcl.entry_main->addSubEntry(myEntry);
4800   tcl.ns.insert("::",myEntry);
4801   tcl.entry_current = tcl_entry_new();
4802
4803   tclscanYYrestart( tclscanYYin );
4804   BEGIN( TOP );
4805   tclscanYYlineno=1;
4806   myScan = new tcl_scan;
4807   myScan->type[0]=' ';myScan->type[1]='\n';
4808   myScan->after.clear();
4809   myScan->line0=tclscanYYlineno;
4810   myScan->line1=tclscanYYlineno;
4811   myScan->buffer_state=YY_CURRENT_BUFFER;
4812   myScan->ns=ns;
4813   myScan->entry_cl=tcl_entry_class(cls);
4814   myScan->entry_fn=NULL;
4815   tcl.entry_inside = tcl.entry_file;
4816   myScan->entry_scan = tcl.entry_inside;
4817   tcl.scan.insert(0,myScan);
4818   tclscanYYlex();
4819   tcl.scan.clear();
4820   tcl.ns.clear();
4821   tcl.cl.clear();
4822   tcl.fn.clear();
4823   tcl.entry.clear();
4824 }
4825
4826 //! Parse text file and build up entry tree.
4827 void TclLanguageScanner::parseInput(const char *fileName,const char *input,Entry *root)
4828 {
4829   QFile            myFile;
4830 tcl_inf("%s\n",fileName);
4831   myFile.setName(fileName);
4832   if (!myFile.open(IO_ReadOnly)) return;
4833   if (strlen(input)<1) return;
4834
4835   tcl.input_string = input;
4836   if (tcl.input_string.length()<1) return;
4837
4838   msg("Parsing %s...\n",fileName);
4839   groupEnterFile(fileName,tclscanYYlineno);
4840
4841   tcl_init();
4842   tcl.code = NULL;
4843   tcl.file_name = fileName;
4844   tcl.this_parser = this;
4845   tcl.entry_main          = root; /* toplevel entry */
4846   tcl_parse("","");
4847   groupLeaveFile(tcl.file_name,tclscanYYlineno);
4848   root->program.resize(0);
4849   myFile.close();
4850 }
4851
4852 //! Parse file and codify.
4853 void TclLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf,
4854                    const char * scopeName,
4855                    const QCString & input,
4856                    bool isExampleBlock,
4857                    const char * exampleName,
4858                    FileDef * fileDef,
4859                    int startLine,
4860                    int endLine,
4861                    bool inlineFragment,
4862                    MemberDef *memberDef,
4863                    bool showLineNumbers,
4864                    Definition *searchCtx
4865                   )
4866 {
4867   (void)scopeName;
4868   (void)exampleName;
4869   (void)fileDef;
4870   (void)endLine;
4871   (void)inlineFragment;
4872   (void)searchCtx;
4873
4874   if (input.length()<1) return;
4875   tcl.input_string = input;
4876
4877   QCString myNs="";
4878   QCString myCls="";
4879   if (memberDef)
4880   {
4881     if (memberDef->getClassDef())
4882     {
4883       myCls = memberDef->getClassDef()->displayName();
4884       myNs = myCls;
4885     }
4886     else if (memberDef->getNamespaceDef())
4887     {
4888       myNs = memberDef->getNamespaceDef()->displayName();
4889     }
4890   }
4891
4892   QString myStr="Codifying..";
4893   if (scopeName)
4894   {
4895     myStr +=" scope=";
4896     myStr+=scopeName;
4897   }
4898   if (exampleName)
4899   {
4900     myStr+=" example=";
4901     myStr+=exampleName;
4902   }
4903   if (memberDef)
4904   {
4905     myStr+=" member=";
4906     myStr+=memberDef->memberTypeName();
4907     myStr+=" ";
4908     myStr+=memberDef->qualifiedName();
4909   }
4910   if (fileDef)
4911   {
4912     myStr+=" file=";
4913     myStr+=fileDef->fileName();
4914   }
4915 tcl_inf("%s (%d,%d) %d %d\n",myStr.ascii(),startLine,endLine,isExampleBlock,inlineFragment);
4916 //tcl_inf("%s\n"input.data());
4917   if (isExampleBlock)
4918   {
4919     tcl_codify(NULL,input);
4920     return;
4921   }
4922   tcl_init();
4923   tcl.memberdef = memberDef;
4924   tcl.code = &codeOutIntf;
4925   if (startLine<0) 
4926   {
4927     startLine=1;
4928   }
4929   tclscanYYlineno=startLine;
4930   tcl.code_linenumbers = showLineNumbers;
4931   tcl.code_line=tclscanYYlineno;
4932   if (tcl.code_linenumbers) 
4933   {
4934     tcl.code->writeLineNumber(0,0,0,tcl.code_line);
4935   }
4936   tcl.file_name = "";
4937   tcl.this_parser = NULL;
4938   tcl.entry_main = tcl_entry_new();
4939   tcl_parse(myNs,myCls);
4940   tcl.scan.clear();
4941   tcl.ns.clear();
4942   tcl.cl.clear();
4943   tcl.fn.clear();
4944   tcl.entry.clear();
4945 }
4946
4947 bool TclLanguageScanner::needsPreprocessing(const QCString &extension)
4948 {
4949   (void)extension;
4950   return FALSE;
4951 }
4952
4953 void TclLanguageScanner::resetCodeParserState()
4954 {
4955 }
4956
4957 void TclLanguageScanner::parsePrototype(const char *text)
4958 {
4959   (void)text;
4960 }
4961
4962 static int yyread(char *buf,int max_size)
4963 {
4964   int c=0;
4965
4966   *buf = '\0';
4967   while ( c < max_size && tcl.input_string.at(tcl.input_position) )
4968   {
4969     *buf = tcl.input_string.at(tcl.input_position++) ;
4970     c++; buf++;
4971   }
4972   //printf("Read from=%d size=%d max=%d c=%d\n",tcl.input_position,strlen(&tcl.input_string[tcl.input_position]),max_size,c);
4973   return c;
4974 }
4975
4976 //----------------------------------------------------------------------------
4977
4978 // to avoid a warning
4979 void tclDummy()
4980 {
4981   yy_top_state();
4982 }
4983
4984 #if !defined(YY_FLEX_SUBMINOR_VERSION) 
4985 //----------------------------------------------------------------------------
4986 extern "C" { // some bogus code to keep the compiler happy
4987   void tclscannerYYdummy() { yy_flex_realloc(0,0); } 
4988 }
4989 #endif
4990
4991