4 #define YY_INT_ALIGNED short int
6 /* A lexical scanner generated by flex */
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
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
35 /* First, we deal with platform-specific or compiler-specific issues. */
37 /* begin standard C headers. */
43 /* end standard C headers. */
45 /* flex integer type definitions */
50 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
52 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
54 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
55 * if you want the limit (max/min) macros for int types.
57 #ifndef __STDC_LIMIT_MACROS
58 #define __STDC_LIMIT_MACROS 1
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;
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;
78 /* Limits of integral types. */
80 #define INT8_MIN (-128)
83 #define INT16_MIN (-32767-1)
86 #define INT32_MIN (-2147483647-1)
89 #define INT8_MAX (127)
92 #define INT16_MAX (32767)
95 #define INT32_MAX (2147483647)
98 #define UINT8_MAX (255U)
101 #define UINT16_MAX (65535U)
104 #define UINT32_MAX (4294967295U)
107 #endif /* ! FLEXINT_H */
111 /* The "const" storage-class-modifier is valid. */
114 #else /* ! __cplusplus */
116 /* C99 requires __STDC__ to be defined as 1. */
117 #if defined (__STDC__)
121 #endif /* defined (__STDC__) */
122 #endif /* ! __cplusplus */
125 #define yyconst const
130 /* Returned upon end-of-file. */
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
138 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
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.
144 #define BEGIN (yy_start) = 1 + 2 *
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
150 #define YY_START (((yy_start) - 1) / 2)
151 #define YYSTATE YY_START
153 /* Action number for EOF rule of a given start state. */
154 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
156 /* Special action meaning "start processing a new file". */
157 #define YY_NEW_FILE tclscanYYrestart(tclscanYYin )
159 #define YY_END_OF_BUFFER_CHAR 0
161 /* Size of default input buffer. */
163 #define YY_BUF_SIZE 262144
166 /* The state buf must be large enough to hold one state per character in the main buffer.
168 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
170 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
171 #define YY_TYPEDEF_YY_BUFFER_STATE
172 typedef struct yy_buffer_state *YY_BUFFER_STATE;
175 #ifndef YY_TYPEDEF_YY_SIZE_T
176 #define YY_TYPEDEF_YY_SIZE_T
177 typedef size_t yy_size_t;
180 extern yy_size_t tclscanYYleng;
182 extern FILE *tclscanYYin, *tclscanYYout;
184 #define EOB_ACT_CONTINUE_SCAN 0
185 #define EOB_ACT_END_OF_FILE 1
186 #define EOB_ACT_LAST_MATCH 2
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.
195 #define YY_LESS_LINENO(n) \
198 for ( yyl = n; yyl < tclscanYYleng; ++yyl )\
199 if ( tclscanYYtext[yyl] == '\n' )\
203 /* Return all but the first "n" matched characters back to the input stream. */
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 */ \
217 #define unput(c) yyunput( c, (yytext_ptr) )
219 #ifndef YY_STRUCT_YY_BUFFER_STATE
220 #define YY_STRUCT_YY_BUFFER_STATE
221 struct yy_buffer_state
225 char *yy_ch_buf; /* input buffer */
226 char *yy_buf_pos; /* current position in input buffer */
228 /* Size of input buffer in bytes, not including room for EOB
231 yy_size_t yy_buf_size;
233 /* Number of characters read into yy_ch_buf, not including EOB
236 yy_size_t yy_n_chars;
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
242 int yy_is_our_buffer;
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
249 int yy_is_interactive;
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
257 int yy_bs_lineno; /**< The line count. */
258 int yy_bs_column; /**< The column count. */
260 /* Whether to try to fill the input buffer when we reach the
265 int yy_buffer_status;
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.
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.
279 #define YY_BUFFER_EOF_PENDING 2
282 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
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. */
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
293 * Returns the top of the stack, or NULL.
295 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
296 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
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.
302 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
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;
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 */
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 ...
317 static int yy_did_buffer_switch_on_eof;
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 );
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 );
331 #define YY_FLUSH_BUFFER tclscanYY_flush_buffer(YY_CURRENT_BUFFER )
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 );
337 void *tclscanYYalloc (yy_size_t );
338 void *tclscanYYrealloc (void *,yy_size_t );
339 void tclscanYYfree (void * );
341 #define yy_new_buffer tclscanYY_create_buffer
343 #define yy_set_interactive(is_interactive) \
345 if ( ! YY_CURRENT_BUFFER ){ \
346 tclscanYYensure_buffer_stack (); \
347 YY_CURRENT_BUFFER_LVALUE = \
348 tclscanYY_create_buffer(tclscanYYin,YY_BUF_SIZE ); \
350 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
353 #define yy_set_bol(at_bol) \
355 if ( ! YY_CURRENT_BUFFER ){\
356 tclscanYYensure_buffer_stack (); \
357 YY_CURRENT_BUFFER_LVALUE = \
358 tclscanYY_create_buffer(tclscanYYin,YY_BUF_SIZE ); \
360 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
363 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
365 /* Begin user sect3 */
367 #define tclscanYYwrap(n) 1
368 #define YY_SKIP_YYWRAP
370 typedef unsigned char YY_CHAR;
372 FILE *tclscanYYin = (FILE *) 0, *tclscanYYout = (FILE *) 0;
374 typedef int yy_state_type;
376 extern int tclscanYYlineno;
378 int tclscanYYlineno = 1;
380 extern char *tclscanYYtext;
381 #define yytext_ptr tclscanYYtext
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[] );
388 /* Done after the current pattern has been matched and before the
389 * corresponding action - sets up tclscanYYtext.
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; \
397 (yy_c_buf_p) = yy_cp;
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. */
405 flex_int32_t yy_verify;
408 static yyconst flex_int16_t yy_accept[179] =
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,
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
431 static yyconst flex_int32_t yy_ec[256] =
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,
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,
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,
463 static yyconst flex_int32_t yy_meta[41] =
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
471 static yyconst flex_int16_t yy_base[204] =
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,
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,
498 static yyconst flex_int16_t yy_def[204] =
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,
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,
525 static yyconst flex_int16_t yy_nxt[656] =
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,
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,
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,
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,
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,
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,
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
601 static yyconst flex_int16_t yy_chk[656] =
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,
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,
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,
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,
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,
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,
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
677 /* Table of booleans, true if rule could match eol. */
678 static yyconst flex_int32_t yy_rule_can_match_eol[56] =
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, };
684 static yy_state_type yy_last_accepting_state;
685 static char *yy_last_accepting_cpos;
687 extern int tclscanYY_flex_debug;
688 int tclscanYY_flex_debug = 0;
690 /* The intent behind this definition is that it'll catch
691 * any uses of REJECT which flex missed.
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
700 #line 1 "tclscanner.l"
701 /*****************************************************************************
702 * Parser for Tcl subset
704 * Copyright (C) 2010 by Rene Zaumseil
705 * based on the work of Dimitri van Heesch.
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.
713 * Documents produced by Doxygen are derivative works derived from the
714 * input used in their production; they are not affected by this license.
717 #line 18 "tclscanner.l"
735 #include "language.h"
736 #include "commentscan.h"
738 #include "tclscanner.h"
739 #include "outputlist.h"
740 #include "membername.h"
741 #include "searchindex.h"
742 #include "commentcnv.h"
744 #include "portable.h"
746 #include <qstringlist.h>
749 #include "arguments.h"
751 #define YY_NEVER_INTERACTIVE 1
752 #define YY_NO_INPUT 1
754 #define MAX_INCLUDE_DEPTH 10
756 //! Application error.
758 printf("Error %d %s() at line %d! ",__LINE__,tcl.file_name.data(),tclscanYYlineno); \
759 yy_push_state(ERROR); \
763 //! Application warning.
765 printf("Warning %d %s() at line %d: ",__LINE__,tcl.file_name.data(),tclscanYYlineno); \
768 //! Application message.
770 if (0) printf("--- %.4d %d@%d: ",__LINE__,tclscanYYlineno,yy_start_stack_ptr) && printf
774 if (0) printf("--- %.4d %d@%d: %s\n",__LINE__,tclscanYYlineno,yy_start_stack_ptr,tclscanYYtext);
776 // BEGIN of copy from tclUtil.c
777 // - Tcl_Interp removed
778 // - changes are marked with RZ
779 // #define's to adapt the code:
781 #define UCHAR (unsigned char)
784 #define ckalloc malloc
786 #define TclCopyAndCollapse(size,src,dest) memcpy(dest,src,size); *(dest+size)=0
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
799 int *bracePtr) /* If non-zero, fill in with non-zero/zero to
800 * indicate that arg was/wasn't in braces. */
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. */
807 int size = 0; /* lint. */
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
816 limit = (list + listLength);
817 while ((p < limit) && (isspace(UCHAR(*p))))
818 { /* INTL: ISO space. */
822 { /* no element found */
840 *bracePtr = openBraces;
844 * Find element's end (a space, close brace, or the end of the string).
852 * Open brace: don't treat specially unless the element is in
853 * braces. In this case, keep a nesting count.
864 * Close brace: if element is in braces, keep nesting count and
865 * quit when the last close brace is seen.
873 else if (openBraces == 1)
875 size = (p - elemStart);
877 if ((p >= limit) || isspace(UCHAR(*p)))
878 { /* INTL: ISO space. */
883 * Garbage after the closing brace; return an error.
891 * Backslash: skip over everything up to the end of the backslash
896 //RZ Tcl_UtfBackslash(p, &numChars, NULL);
897 //RZ p += (numChars - 1);
902 * Space: ignore if element is in braces or quotes; otherwise
912 if ((openBraces == 0) && !inQuotes)
914 size = (p - elemStart);
920 * Double-quote: if element is in quotes then terminate it.
926 size = (p - elemStart);
928 if ((p >= limit) || isspace(UCHAR(*p)))
929 { /* INTL: ISO space */
934 * Garbage after the closing quote; return an error.
944 * End of list: terminate element.
957 size = (p - elemStart);
961 while ((p < limit) && (isspace(UCHAR(*p))))
962 { /* INTL: ISO space. */
965 *elementPtr = elemStart;
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. */
981 CONST char **argv, *l, *element;
983 int length, size, i, result, elSize, brace;
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
992 for (size = 2, l = list; *l != 0; l++)
994 if (isspace(UCHAR(*l)))
995 { /* INTL: ISO space. */
999 * Consecutive space can only count as a single list delimiter.
1004 char next = *(l + 1);
1011 if (isspace(UCHAR(next)))
1012 { /* INTL: ISO space. */
1020 argv = (CONST char **) ckalloc((unsigned)
1021 ((size * sizeof(char *)) + length + 1));
1022 for (i = 0, p = ((char *) argv) + size*sizeof(char *);
1025 CONST char *prevList = list;
1027 result = TclFindElement(list, length, &element, &list,
1029 length -= (list - prevList);
1030 if (result != TCL_OK)
1032 ckfree((char *) argv);
1041 ckfree((char *) argv);
1047 memcpy(p, element, (size_t) elSize);
1054 TclCopyAndCollapse(elSize, element, p);
1066 void tcl_split_list(QString &str, QStringList &list)
1072 if (str.left(1)=="{" && str.right(1)=="}")
1074 str=str.mid(1,str.length()-2);
1076 else if (str.left(1)=="\"" && str.right(1)=="\"")
1078 str=str.mid(1,str.length()-2);
1080 if (Tcl_SplitList(str.ascii(),&argc,&argv) != TCL_OK)
1086 for (int i = 0; i < argc; i++)
1088 list.append(argv[i]);
1090 ckfree((char *) argv);
1094 //! Structure containing information about current scan context.
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)
1109 //* Structure containing all internal global variables.
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
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);
1163 //! Create new entry.
1164 // @return new initialised entry
1165 Entry* tcl_entry_new()
1167 Entry *myEntry = new Entry;
1168 myEntry->section = Entry::EMPTY_SEC;
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);
1183 tcl.entry.insert(0,myEntry);
1188 //! Set protection level.
1189 void tcl_protection(Entry *entry)
1191 if (entry->protection!=Public&&entry->protection!=Protected&&entry->protection!=Private)
1193 entry->protection = tcl.protection;
1195 if (entry->protection!=Protected&&entry->protection!=Private)
1197 entry->protection = Public;
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)
1208 if (strncmp(name0.data(),"::",2)==0)
1210 myNm = name0.mid(2);
1212 else if (ns0.length() && ns0 != " ")
1214 myNm = ns0 + "::" + name0;
1220 myStart = myNm.findRev("::");
1228 ns = myNm.mid(0,myStart);
1229 name = myNm.mid(myStart+2);
1233 // Check and return namespace entry.
1234 // @return namespace entry
1235 Entry* tcl_entry_namespace(const QCString ns)
1240 myEntry = tcl.ns.find(ns);
1244 myEntry = tcl.ns.find("::");
1246 if (myEntry == NULL)
1248 myEntry = tcl_entry_new();
1249 myEntry->section = Entry::NAMESPACE_SEC;
1251 tcl.entry_main->addSubEntry(myEntry);
1252 tcl.ns.insert(ns,myEntry);
1257 // Check and return class entry.
1258 // @return class entry
1259 Entry* tcl_entry_class(const QCString cl)
1262 if (!cl.length()) return(NULL);
1264 myEntry = tcl.cl.find(cl);
1265 if (myEntry == NULL)
1267 myEntry = tcl_entry_new();
1268 myEntry->section = Entry::CLASS_SEC;
1270 tcl.entry_main->addSubEntry(myEntry);
1271 tcl.cl.insert(cl,myEntry);
1276 //! Check for keywords.
1277 // @return 1 if keyword and 0 otherwise
1278 static int tcl_keyword(QCString str)
1280 static QStringList myList;
1281 static int myInit=1;
1285 myList <<"append"<<"apply"<<"array"<<"auto_execok"<<"auto_import"<<"auto_load"<<"auto_mkindex"<<"auto_qualify"<<"auto_reset";
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";
1292 myList <<"if"<<"incr"<<"info"<<"interp";
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";
1303 myList <<"bell"<<"bind"<<"bindtags";
1304 myList <<"clipboard"<<"console"<<"consoleinterp";
1311 myList <<"pack"<<"place";
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";
1320 str=str.stripWhiteSpace();
1321 if (str.left(2)=="::") {str=str.mid(2);}
1322 if (myList.findIndex(str) != -1) return(1);
1326 //! End codifying with special font class.
1327 static void tcl_font_end()
1329 if (tcl.code==NULL) return;
1332 tcl.code->endFontClass();
1337 //! Codify 'str' with special font class 's'.
1338 static void tcl_codify(const char *s,char *str)
1340 if (tcl.code==NULL||str==NULL) return;
1341 if (s && strcmp(s,"NULL")!=0)
1344 tcl.code->startFontClass(s);
1353 while ((c=*p++) && c!='\n') {}
1358 tcl.code->codify(sp);
1360 tcl.code->endCodeLine();
1361 if (tcl.code_linenumbers)
1363 if (tcl.code_font!=NULL)
1365 tcl.code->endFontClass();
1366 tcl.code->writeLineNumber(0,0,0,tcl.code_line);
1367 tcl.code->startFontClass(tcl.code_font);
1371 tcl.code->writeLineNumber(0,0,0,tcl.code_line);
1377 tcl.code->codify(sp);
1385 //! Codify 'str' with special font class 's'.
1386 static void tcl_codify(const char *s,const char *str)
1388 if (tcl.code==NULL) return;
1389 char *tmp= (char *) malloc(strlen(str)+1);
1395 //! Codify 'str' with special font class 's'.
1396 static void tcl_codify(const char *s,const QString &str)
1398 if (tcl.code==NULL) return;
1399 tcl_codify(s,str.utf8());
1403 //! Codify 'str' with special font class 's'.
1404 static void tcl_codify(const char *s,const QCString &str)
1406 if (tcl.code==NULL) return;
1407 tcl_codify(s,str.data());
1410 static void tcl_codify_cmd(const char *s,int i)
1412 tcl_codify(s,(*tcl.list_commandwords.at(i)).utf8());
1415 //-----------------------------------------------------------------------------
1417 #define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size);
1418 //-----------------------------------------------------------------------------
1429 #line 1430 "<stdout>"
1437 #define COMMENT_NL 6
1438 #define COMMENT_CODE 7
1439 #define COMMENT_VERB 8
1440 #define COMMENTLINE 9
1441 #define COMMENTLINE_NL 10
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.
1451 #ifndef YY_EXTRA_TYPE
1452 #define YY_EXTRA_TYPE void *
1455 static int yy_init_globals (void );
1457 /* Accessor methods to globals.
1458 These are made visible to non-reentrant scanners for convenience. */
1460 int tclscanYYlex_destroy (void );
1462 int tclscanYYget_debug (void );
1464 void tclscanYYset_debug (int debug_flag );
1466 YY_EXTRA_TYPE tclscanYYget_extra (void );
1468 void tclscanYYset_extra (YY_EXTRA_TYPE user_defined );
1470 FILE *tclscanYYget_in (void );
1472 void tclscanYYset_in (FILE * in_str );
1474 FILE *tclscanYYget_out (void );
1476 void tclscanYYset_out (FILE * out_str );
1478 yy_size_t tclscanYYget_leng (void );
1480 char *tclscanYYget_text (void );
1482 int tclscanYYget_lineno (void );
1484 void tclscanYYset_lineno (int line_number );
1486 /* Macros after this point can all be overridden by user definitions in
1490 #ifndef YY_SKIP_YYWRAP
1492 extern "C" int tclscanYYwrap (void );
1494 extern int tclscanYYwrap (void );
1498 static void yyunput (int c,char *buf_ptr );
1501 static void yy_flex_strncpy (char *,yyconst char *,int );
1504 #ifdef YY_NEED_STRLEN
1505 static int yy_flex_strlen (yyconst char * );
1511 static int yyinput (void );
1513 static int input (void );
1518 static int yy_start_stack_ptr = 0;
1519 static int yy_start_stack_depth = 0;
1520 static int *yy_start_stack = NULL;
1522 static void yy_push_state (int new_state );
1524 static void yy_pop_state (void );
1526 static int yy_top_state (void );
1528 /* Amount of stuff to slurp up with each read. */
1529 #ifndef YY_READ_BUF_SIZE
1530 #define YY_READ_BUF_SIZE 262144
1533 /* Copy whatever the last rule matched to the standard output. */
1535 /* This used to be an fputs(), but since the string might contain NUL's,
1536 * we now use fwrite().
1538 #define ECHO fwrite( tclscanYYtext, tclscanYYleng, 1, tclscanYYout )
1541 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1542 * is returned in "result".
1545 #define YY_INPUT(buf,result,max_size) \
1546 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
1550 for ( n = 0; n < max_size && \
1551 (c = getc( tclscanYYin )) != EOF && c != '\n'; ++n ) \
1552 buf[n] = (char) c; \
1554 buf[n++] = (char) c; \
1555 if ( c == EOF && ferror( tclscanYYin ) ) \
1556 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1562 while ( (result = fread(buf, 1, max_size, tclscanYYin))==0 && ferror(tclscanYYin)) \
1564 if( errno != EINTR) \
1566 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1570 clearerr(tclscanYYin); \
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.
1582 #define yyterminate() return YY_NULL
1585 /* Number of entries by which start-condition stack grows. */
1586 #ifndef YY_START_STACK_INCR
1587 #define YY_START_STACK_INCR 25
1590 /* Report a fatal error. */
1591 #ifndef YY_FATAL_ERROR
1592 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
1595 /* end tables serialization structures and prototypes */
1597 /* Default declaration of generated scanner - a define so the user can
1598 * easily add parameters.
1601 #define YY_DECL_IS_OURS 1
1603 extern int tclscanYYlex (void);
1605 #define YY_DECL int tclscanYYlex (void)
1606 #endif /* !YY_DECL */
1608 /* Code executed at the beginning of each rule, after tclscanYYtext and tclscanYYleng
1611 #ifndef YY_USER_ACTION
1612 #define YY_USER_ACTION
1615 /* Code executed at the end of each rule. */
1617 #define YY_BREAK break;
1620 #define YY_RULE_SETUP \
1623 /** The main scanner function which does all the work.
1627 register yy_state_type yy_current_state;
1628 register char *yy_cp, *yy_bp;
1629 register int yy_act;
1631 #line 736 "tclscanner.l"
1633 #line 1634 "<stdout>"
1644 (yy_start) = 1; /* first start state */
1646 if ( ! tclscanYYin )
1647 tclscanYYin = stdin;
1649 if ( ! tclscanYYout )
1650 tclscanYYout = stdout;
1652 if ( ! YY_CURRENT_BUFFER ) {
1653 tclscanYYensure_buffer_stack ();
1654 YY_CURRENT_BUFFER_LVALUE =
1655 tclscanYY_create_buffer(tclscanYYin,YY_BUF_SIZE );
1658 tclscanYY_load_buffer_state( );
1661 while ( 1 ) /* loops until end-of-file is reached */
1664 if ( (yy_more_flag) )
1666 (yy_more_len) = (yy_c_buf_p) - (yytext_ptr);
1669 yy_cp = (yy_c_buf_p);
1671 /* Support of tclscanYYtext. */
1672 *yy_cp = (yy_hold_char);
1674 /* yy_bp points to the position in yy_ch_buf of the start of
1679 yy_current_state = (yy_start);
1683 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
1684 if ( yy_accept[yy_current_state] )
1686 (yy_last_accepting_state) = yy_current_state;
1687 (yy_last_accepting_cpos) = yy_cp;
1689 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
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];
1695 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1698 while ( yy_base[yy_current_state] != 615 );
1701 yy_act = yy_accept[yy_current_state];
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];
1709 YY_DO_BEFORE_ACTION;
1711 if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
1714 for ( yyl = (yy_more_len); yyl < tclscanYYleng; ++yyl )
1715 if ( tclscanYYtext[yyl] == '\n' )
1721 do_action: /* This label is used only to access EOF actions. */
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;
1734 #line 737 "tclscanner.l"
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"
1754 if (tcl.scan.count()<1)
1757 tcl_err("Tcl parser stack empty! Parser error in file '%s'.\n",tcl.file_name.data());
1760 else if (tcl.scan.count()==1)
1761 {// exit, check on input?
1775 #line 761 "tclscanner.l"
1779 tcl.line_comment=tclscanYYlineno;
1784 /* rule 3 can match eol */
1786 #line 767 "tclscanner.l"
1789 tcl_codify(NULL,tclscanYYtext);
1794 #line 771 "tclscanner.l"
1798 tcl.line_command=tclscanYYlineno;
1804 #line 778 "tclscanner.l"
1807 tcl_codify("comment",tclscanYYtext);
1811 /* rule 6 can match eol */
1813 #line 782 "tclscanner.l"
1816 tcl_codify("comment",tclscanYYtext);
1817 tcl_comment(2,tclscanYYtext+1);
1821 /* rule 7 can match eol */
1823 #line 787 "tclscanner.l"
1826 tcl_codify("comment",tclscanYYtext);
1827 QCString t=tclscanYYtext;
1828 t = t.mid(2,t.length()-3);
1830 tcl_comment(1,t.data());
1831 yy_push_state(COMMENT_NL);
1835 /* rule 8 can match eol */
1837 #line 796 "tclscanner.l"
1840 tcl_codify("comment",tclscanYYtext);
1841 tcl_comment(1,tclscanYYtext+2);
1845 /* rule 9 can match eol */
1847 #line 801 "tclscanner.l"
1850 QCString t=tclscanYYtext;
1851 tcl_codify("comment",t.left(7));
1852 tcl_comment(2,"\n@code\n");
1854 yy_push_state(COMMENT_CODE);
1858 /* rule 10 can match eol */
1860 #line 809 "tclscanner.l"
1863 QCString t=tclscanYYtext;
1864 tcl_codify("comment",t.left(11));
1865 tcl_comment(2,"\n@verbatim\n");
1867 yy_push_state(COMMENT_VERB);
1871 /* rule 11 can match eol */
1873 #line 817 "tclscanner.l"
1876 tcl_codify("comment",tclscanYYtext);
1877 QCString t=tclscanYYtext;
1878 t = t.mid(1,t.length()-3);
1880 tcl_comment(2,t.data());
1881 yy_push_state(COMMENT_NL);
1885 /* rule 12 can match eol */
1887 #line 826 "tclscanner.l"
1890 tcl_codify("comment",tclscanYYtext);
1891 tcl_comment(2,tclscanYYtext+1);
1896 #line 831 "tclscanner.l"
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());
1909 #line 840 "tclscanner.l"
1917 /* rule 15 can match eol */
1919 #line 845 "tclscanner.l"
1922 tcl_comment(-2,tclscanYYtext);
1927 /* rule 16 can match eol */
1929 #line 851 "tclscanner.l"
1932 QCString t=tclscanYYtext;
1933 t = t.left(t.length()-10);
1934 tcl_comment(2,t.data());
1935 tcl_comment(2,"\n@endcode\n");
1941 /* rule 17 can match eol */
1943 #line 860 "tclscanner.l"
1951 #line 864 "tclscanner.l"
1959 /* rule 19 can match eol */
1961 #line 870 "tclscanner.l"
1964 QCString t=tclscanYYtext;
1965 t = t.left(t.length()-14);
1966 tcl_comment(2,t.data());
1967 tcl_comment(2,"\n@endverbatim\n");
1973 /* rule 20 can match eol */
1975 #line 879 "tclscanner.l"
1983 #line 883 "tclscanner.l"
1991 /* rule 22 can match eol */
1993 #line 889 "tclscanner.l"
1996 tcl_codify("comment",tclscanYYtext);
1997 tcl_comment(2,tclscanYYtext);
2001 /* rule 23 can match eol */
2003 #line 894 "tclscanner.l"
2006 tcl_codify("comment",tclscanYYtext);
2007 tcl_comment(2,tclscanYYtext);
2013 #line 900 "tclscanner.l"
2022 #line 906 "tclscanner.l"
2031 #line 911 "tclscanner.l"
2034 tcl.string_commentcodify += tclscanYYtext;
2038 /* rule 27 can match eol */
2040 #line 915 "tclscanner.l"
2043 tcl.string_commentcodify += tclscanYYtext;
2044 QCString t=tclscanYYtext;
2045 t = t.mid(2,t.length()-4);
2047 tcl.string_commentline += t;
2048 yy_push_state(COMMENTLINE_NL);
2052 /* rule 28 can match eol */
2054 #line 924 "tclscanner.l"
2057 tcl.string_commentcodify += tclscanYYtext;
2058 tcl.string_commentline += (tclscanYYtext+2);
2062 /* rule 29 can match eol */
2064 #line 929 "tclscanner.l"
2068 if (tcl.string_commentline.length())
2070 tcl.entry_current->brief = tcl.string_commentline;
2071 tcl.entry_current->briefLine = tcl.line_commentline;
2072 tcl.entry_current->briefFile = tcl.file_name;
2075 tcl_command(-1,tcl.string_commentcodify.data());
2076 tcl.string_commentline="";
2077 tcl.string_commentcodify="";
2081 /* rule 30 can match eol */
2083 #line 944 "tclscanner.l"
2086 tcl.string_commentcodify += tclscanYYtext;
2087 QCString t=tclscanYYtext;
2088 t = t.left(t.length()-3);
2090 tcl.string_commentline += t;
2094 /* rule 31 can match eol */
2096 #line 952 "tclscanner.l"
2099 tcl.string_commentcodify += tclscanYYtext;
2100 tcl.string_commentline += tclscanYYtext;
2106 #line 958 "tclscanner.l"
2109 QCString t=tclscanYYtext;
2110 t = t.left(t.length()-1);
2111 tcl.string_commentcodify += t;
2112 tcl.string_commentline += t;
2118 /* rule 33 can match eol */
2120 #line 968 "tclscanner.l"
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;
2130 yy_push_state(COMMENTLINE);
2134 /* rule 34 can match eol */
2136 #line 979 "tclscanner.l"
2139 tcl.string_commentcodify = "";
2140 tcl.string_commentline = "";
2141 tcl.line_body1=tclscanYYlineno;
2146 /* rule 35 can match eol */
2148 #line 986 "tclscanner.l"
2151 tcl.string_commentcodify = "";
2152 tcl.string_commentline = "";
2153 tcl.line_body1=tclscanYYlineno;
2154 tcl_command(-1,tclscanYYtext);
2158 /* rule 36 can match eol */
2160 #line 993 "tclscanner.l"
2163 tcl.string_commentcodify = "";
2164 tcl.string_commentline = "";
2165 tcl.line_body1=tclscanYYlineno-1;
2166 tcl_command(-1,tclscanYYtext);
2170 /* rule 37 can match eol */
2172 #line 1000 "tclscanner.l"
2175 tcl_command(1,tclscanYYtext);
2180 #line 1004 "tclscanner.l"
2184 tcl.string_last = "{*}";
2185 tcl_word(0,&tclscanYYtext[3]);
2190 #line 1010 "tclscanner.l"
2194 tcl.string_last = "";
2195 tcl_word(0,tclscanYYtext);
2200 #line 1016 "tclscanner.l"
2204 if (tclscanYYtext[0]=='{'||tclscanYYtext[0]=='['||tclscanYYtext[0]=='"') tcl.word_is = tclscanYYtext[0];
2205 tcl.string_last = "";
2206 tcl_word(0,tclscanYYtext);
2210 #line 1025 "tclscanner.l"
2213 #line 1025 "tclscanner.l"
2215 tcl_word(1,tclscanYYtext);
2219 /* rule 43 can match eol */
2221 #line 1028 "tclscanner.l"
2223 tcl_word(2,tclscanYYtext);
2228 #line 1031 "tclscanner.l"
2230 tcl_word(3,tclscanYYtext);
2235 #line 1034 "tclscanner.l"
2237 tcl_word(4,tclscanYYtext);
2242 #line 1037 "tclscanner.l"
2244 tcl_word(5,tclscanYYtext);
2249 #line 1040 "tclscanner.l"
2251 tcl_word(6,tclscanYYtext);
2256 #line 1043 "tclscanner.l"
2258 tcl_word(7,tclscanYYtext);
2263 #line 1046 "tclscanner.l"
2265 tcl_word(8,tclscanYYtext);
2270 #line 1049 "tclscanner.l"
2272 tcl_word(9,tclscanYYtext);
2277 #line 1052 "tclscanner.l"
2279 tcl_word(10,tclscanYYtext);
2283 /* rule 52 can match eol */
2285 #line 1055 "tclscanner.l"
2287 tcl_word(11,tclscanYYtext);
2292 #line 1058 "tclscanner.l"
2294 tcl_word(12,tclscanYYtext);
2299 #line 1061 "tclscanner.l"
2301 tcl_word(1,tclscanYYtext);
2306 #line 1064 "tclscanner.l"
2309 #line 2310 "<stdout>"
2311 case YY_END_OF_BUFFER:
2313 /* Amount of text matched not including the EOB char. */
2314 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
2316 /* Undo the effects of YY_DO_BEFORE_ACTION. */
2317 *yy_cp = (yy_hold_char);
2318 YY_RESTORE_YY_MORE_OFFSET
2320 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
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.
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;
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
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;
2347 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
2349 yy_current_state = yy_get_previous_state( );
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).
2360 yy_next_state = yy_try_NUL_trans( yy_current_state );
2362 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2364 if ( yy_next_state )
2366 /* Consume the NUL. */
2367 yy_cp = ++(yy_c_buf_p);
2368 yy_current_state = yy_next_state;
2374 yy_cp = (yy_c_buf_p);
2375 goto yy_find_action;
2379 else switch ( yy_get_next_buffer( ) )
2381 case EOB_ACT_END_OF_FILE:
2383 (yy_did_buffer_switch_on_eof) = 0;
2385 if ( tclscanYYwrap( ) )
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.
2396 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
2398 yy_act = YY_STATE_EOF(YY_START);
2404 if ( ! (yy_did_buffer_switch_on_eof) )
2410 case EOB_ACT_CONTINUE_SCAN:
2412 (yytext_ptr) + yy_amount_of_matched_text;
2414 yy_current_state = yy_get_previous_state( );
2416 yy_cp = (yy_c_buf_p);
2417 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2420 case EOB_ACT_LAST_MATCH:
2422 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
2424 yy_current_state = yy_get_previous_state( );
2426 yy_cp = (yy_c_buf_p);
2427 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2428 goto yy_find_action;
2435 "fatal flex scanner internal error--no action found" );
2436 } /* end of action switch */
2437 } /* end of scanning one token */
2438 } /* end of tclscanYYlex */
2440 /* yy_get_next_buffer - try to read in a new buffer
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
2447 static int yy_get_next_buffer (void)
2449 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
2450 register char *source = (yytext_ptr);
2451 register int number_to_move, i;
2454 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
2456 "fatal flex scanner internal error--end of buffer missed" );
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 )
2462 /* We matched a single character, the EOB, so
2463 * treat this as a final EOF.
2465 return EOB_ACT_END_OF_FILE;
2470 /* We matched some text prior to the EOB, first
2473 return EOB_ACT_LAST_MATCH;
2477 /* Try to read more data. */
2479 /* First move last chars to start of buffer. */
2480 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
2482 for ( i = 0; i < number_to_move; ++i )
2483 *(dest++) = *(source++);
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,
2489 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
2493 yy_size_t num_to_read =
2494 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
2496 while ( num_to_read <= 0 )
2497 { /* Not enough room in the buffer - grow it. */
2499 /* just a shorter name for the current buffer */
2500 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
2502 int yy_c_buf_p_offset =
2503 (int) ((yy_c_buf_p) - b->yy_ch_buf);
2505 if ( b->yy_is_our_buffer )
2507 yy_size_t new_size = b->yy_buf_size * 2;
2509 if ( new_size <= 0 )
2510 b->yy_buf_size += b->yy_buf_size / 8;
2512 b->yy_buf_size *= 2;
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 );
2519 /* Can't grow it, we don't own it. */
2522 if ( ! b->yy_ch_buf )
2524 "fatal error - scanner input buffer overflow" );
2526 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
2528 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
2533 if ( num_to_read > YY_READ_BUF_SIZE )
2534 num_to_read = YY_READ_BUF_SIZE;
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 );
2540 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2543 if ( (yy_n_chars) == 0 )
2545 if ( number_to_move == YY_MORE_ADJ )
2547 ret_val = EOB_ACT_END_OF_FILE;
2548 tclscanYYrestart(tclscanYYin );
2553 ret_val = EOB_ACT_LAST_MATCH;
2554 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
2555 YY_BUFFER_EOF_PENDING;
2560 ret_val = EOB_ACT_CONTINUE_SCAN;
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()" );
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;
2574 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
2579 /* yy_get_previous_state - get the state just before the EOB char was reached */
2581 static yy_state_type yy_get_previous_state (void)
2583 register yy_state_type yy_current_state;
2584 register char *yy_cp;
2586 yy_current_state = (yy_start);
2588 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
2590 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
2591 if ( yy_accept[yy_current_state] )
2593 (yy_last_accepting_state) = yy_current_state;
2594 (yy_last_accepting_cpos) = yy_cp;
2596 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
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];
2602 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2605 return yy_current_state;
2608 /* yy_try_NUL_trans - try to make a transition on the NUL character
2611 * next_state = yy_try_NUL_trans( current_state );
2613 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
2615 register int yy_is_jam;
2616 register char *yy_cp = (yy_c_buf_p);
2618 register YY_CHAR yy_c = 1;
2619 if ( yy_accept[yy_current_state] )
2621 (yy_last_accepting_state) = yy_current_state;
2622 (yy_last_accepting_cpos) = yy_cp;
2624 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
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];
2630 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2631 yy_is_jam = (yy_current_state == 178);
2633 return yy_is_jam ? 0 : yy_current_state;
2636 static void yyunput (int c, register char * yy_bp )
2638 register char *yy_cp;
2640 yy_cp = (yy_c_buf_p);
2642 /* undo effects of setting up tclscanYYtext */
2643 *yy_cp = (yy_hold_char);
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];
2654 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
2655 *--dest = *--source;
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;
2662 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
2663 YY_FATAL_ERROR( "flex scanner push-back overflow" );
2666 *--yy_cp = (char) c;
2672 (yytext_ptr) = yy_bp;
2673 (yy_hold_char) = *yy_cp;
2674 (yy_c_buf_p) = yy_cp;
2679 static int yyinput (void)
2681 static int input (void)
2687 *(yy_c_buf_p) = (yy_hold_char);
2689 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
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.
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';
2700 { /* need more input */
2701 yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
2704 switch ( yy_get_next_buffer( ) )
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.
2717 /* Reset buffer status. */
2718 tclscanYYrestart(tclscanYYin );
2722 case EOB_ACT_END_OF_FILE:
2724 if ( tclscanYYwrap( ) )
2727 if ( ! (yy_did_buffer_switch_on_eof) )
2736 case EOB_ACT_CONTINUE_SCAN:
2737 (yy_c_buf_p) = (yytext_ptr) + offset;
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);
2754 #endif /* ifndef YY_NO_INPUT */
2756 /** Immediately switch to a different input stream.
2757 * @param input_file A readable stream.
2759 * @note This function does not reset the start condition to @c INITIAL .
2761 void tclscanYYrestart (FILE * input_file )
2764 if ( ! YY_CURRENT_BUFFER ){
2765 tclscanYYensure_buffer_stack ();
2766 YY_CURRENT_BUFFER_LVALUE =
2767 tclscanYY_create_buffer(tclscanYYin,YY_BUF_SIZE );
2770 tclscanYY_init_buffer(YY_CURRENT_BUFFER,input_file );
2771 tclscanYY_load_buffer_state( );
2774 /** Switch to a different input buffer.
2775 * @param new_buffer The new input buffer.
2778 void tclscanYY_switch_to_buffer (YY_BUFFER_STATE new_buffer )
2781 /* TODO. We should be able to replace this entire function body
2783 * tclscanYYpop_buffer_state();
2784 * tclscanYYpush_buffer_state(new_buffer);
2786 tclscanYYensure_buffer_stack ();
2787 if ( YY_CURRENT_BUFFER == new_buffer )
2790 if ( YY_CURRENT_BUFFER )
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);
2798 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2799 tclscanYY_load_buffer_state( );
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.
2806 (yy_did_buffer_switch_on_eof) = 1;
2809 static void tclscanYY_load_buffer_state (void)
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);
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.
2821 * @return the allocated buffer state.
2823 YY_BUFFER_STATE tclscanYY_create_buffer (FILE * file, int size )
2827 b = (YY_BUFFER_STATE) tclscanYYalloc(sizeof( struct yy_buffer_state ) );
2829 YY_FATAL_ERROR( "out of dynamic memory in tclscanYY_create_buffer()" );
2831 b->yy_buf_size = size;
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.
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()" );
2840 b->yy_is_our_buffer = 1;
2842 tclscanYY_init_buffer(b,file );
2847 /** Destroy the buffer.
2848 * @param b a buffer created with tclscanYY_create_buffer()
2851 void tclscanYY_delete_buffer (YY_BUFFER_STATE b )
2857 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2858 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2860 if ( b->yy_is_our_buffer )
2861 tclscanYYfree((void *) b->yy_ch_buf );
2863 tclscanYYfree((void *) b );
2867 extern int isatty (int );
2868 #endif /* __cplusplus */
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.
2874 static void tclscanYY_init_buffer (YY_BUFFER_STATE b, FILE * file )
2879 tclscanYY_flush_buffer(b );
2881 b->yy_input_file = file;
2882 b->yy_fill_buffer = 1;
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.
2888 if (b != YY_CURRENT_BUFFER){
2889 b->yy_bs_lineno = 1;
2890 b->yy_bs_column = 0;
2893 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
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.
2902 void tclscanYY_flush_buffer (YY_BUFFER_STATE b )
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.
2913 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2914 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2916 b->yy_buf_pos = &b->yy_ch_buf[0];
2919 b->yy_buffer_status = YY_BUFFER_NEW;
2921 if ( b == YY_CURRENT_BUFFER )
2922 tclscanYY_load_buffer_state( );
2925 /** Pushes the new state onto the stack. The new state becomes
2926 * the current state. This function will allocate the stack
2928 * @param new_buffer The new state.
2931 void tclscanYYpush_buffer_state (YY_BUFFER_STATE new_buffer )
2933 if (new_buffer == NULL)
2936 tclscanYYensure_buffer_stack();
2938 /* This block is copied from tclscanYY_switch_to_buffer. */
2939 if ( YY_CURRENT_BUFFER )
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);
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;
2952 /* copied from tclscanYY_switch_to_buffer. */
2953 tclscanYY_load_buffer_state( );
2954 (yy_did_buffer_switch_on_eof) = 1;
2957 /** Removes and deletes the top of the stack, if present.
2958 * The next element becomes the new top.
2961 void tclscanYYpop_buffer_state (void)
2963 if (!YY_CURRENT_BUFFER)
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);
2971 if (YY_CURRENT_BUFFER) {
2972 tclscanYY_load_buffer_state( );
2973 (yy_did_buffer_switch_on_eof) = 1;
2977 /* Allocates the stack if it does not exist.
2978 * Guarantees space for at least one push.
2980 static void tclscanYYensure_buffer_stack (void)
2982 yy_size_t num_to_alloc;
2984 if (!(yy_buffer_stack)) {
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.
2991 (yy_buffer_stack) = (struct yy_buffer_state**)tclscanYYalloc
2992 (num_to_alloc * sizeof(struct yy_buffer_state*)
2994 if ( ! (yy_buffer_stack) )
2995 YY_FATAL_ERROR( "out of dynamic memory in tclscanYYensure_buffer_stack()" );
2997 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2999 (yy_buffer_stack_max) = num_to_alloc;
3000 (yy_buffer_stack_top) = 0;
3004 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
3006 /* Increase the buffer to prepare for a possible push. */
3007 int grow_size = 8 /* arbitrary grow size */;
3009 num_to_alloc = (yy_buffer_stack_max) + grow_size;
3010 (yy_buffer_stack) = (struct yy_buffer_state**)tclscanYYrealloc
3012 num_to_alloc * sizeof(struct yy_buffer_state*)
3014 if ( ! (yy_buffer_stack) )
3015 YY_FATAL_ERROR( "out of dynamic memory in tclscanYYensure_buffer_stack()" );
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;
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
3027 * @return the newly allocated buffer state object.
3029 YY_BUFFER_STATE tclscanYY_scan_buffer (char * base, yy_size_t size )
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. */
3039 b = (YY_BUFFER_STATE) tclscanYYalloc(sizeof( struct yy_buffer_state ) );
3041 YY_FATAL_ERROR( "out of dynamic memory in tclscanYY_scan_buffer()" );
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;
3050 b->yy_fill_buffer = 0;
3051 b->yy_buffer_status = YY_BUFFER_NEW;
3053 tclscanYY_switch_to_buffer(b );
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
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.
3066 YY_BUFFER_STATE tclscanYY_scan_string (yyconst char * yystr )
3069 return tclscanYY_scan_bytes(yystr,strlen(yystr) );
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.
3077 * @return the newly allocated buffer state object.
3079 YY_BUFFER_STATE tclscanYY_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
3085 /* Get memory for full buffer, including space for trailing EOB's. */
3086 n = _yybytes_len + 2;
3087 buf = (char *) tclscanYYalloc(n );
3089 YY_FATAL_ERROR( "out of dynamic memory in tclscanYY_scan_bytes()" );
3091 for ( i = 0; i < _yybytes_len; ++i )
3092 buf[i] = yybytes[i];
3094 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
3096 b = tclscanYY_scan_buffer(buf,n );
3098 YY_FATAL_ERROR( "bad buffer in tclscanYY_scan_bytes()" );
3100 /* It's okay to grow etc. this buffer, and we should throw it
3101 * away when we're done.
3103 b->yy_is_our_buffer = 1;
3108 static void yy_push_state (int new_state )
3110 if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
3114 (yy_start_stack_depth) += YY_START_STACK_INCR;
3115 new_size = (yy_start_stack_depth) * sizeof( int );
3117 if ( ! (yy_start_stack) )
3118 (yy_start_stack) = (int *) tclscanYYalloc(new_size );
3121 (yy_start_stack) = (int *) tclscanYYrealloc((void *) (yy_start_stack),new_size );
3123 if ( ! (yy_start_stack) )
3124 YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
3127 (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
3132 static void yy_pop_state (void)
3134 if ( --(yy_start_stack_ptr) < 0 )
3135 YY_FATAL_ERROR( "start-condition stack underflow" );
3137 BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
3140 static int yy_top_state (void)
3142 return (yy_start_stack)[(yy_start_stack_ptr) - 1];
3145 #ifndef YY_EXIT_FAILURE
3146 #define YY_EXIT_FAILURE 2
3149 static void yy_fatal_error (yyconst char* msg )
3151 (void) fprintf( stderr, "%s\n", msg );
3152 exit( YY_EXIT_FAILURE );
3155 /* Redefine yyless() so it works in section 3 code. */
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; \
3172 /* Accessor methods (get/set functions) to struct members. */
3174 /** Get the current line number.
3177 int tclscanYYget_lineno (void)
3180 return tclscanYYlineno;
3183 /** Get the input stream.
3186 FILE *tclscanYYget_in (void)
3191 /** Get the output stream.
3194 FILE *tclscanYYget_out (void)
3196 return tclscanYYout;
3199 /** Get the length of the current token.
3202 yy_size_t tclscanYYget_leng (void)
3204 return tclscanYYleng;
3207 /** Get the current token.
3211 char *tclscanYYget_text (void)
3213 return tclscanYYtext;
3216 /** Set the current line number.
3217 * @param line_number
3220 void tclscanYYset_lineno (int line_number )
3223 tclscanYYlineno = line_number;
3226 /** Set the input stream. This does not discard the current
3228 * @param in_str A readable stream.
3230 * @see tclscanYY_switch_to_buffer
3232 void tclscanYYset_in (FILE * in_str )
3234 tclscanYYin = in_str ;
3237 void tclscanYYset_out (FILE * out_str )
3239 tclscanYYout = out_str ;
3242 int tclscanYYget_debug (void)
3244 return tclscanYY_flex_debug;
3247 void tclscanYYset_debug (int bdebug )
3249 tclscanYY_flex_debug = bdebug ;
3252 static int yy_init_globals (void)
3254 /* Initialization is the same as for the non-reentrant scanner.
3255 * This function is called from tclscanYYlex_destroy(), so don't allocate here.
3258 /* We do not touch tclscanYYlineno unless the option is enabled. */
3259 tclscanYYlineno = 1;
3261 (yy_buffer_stack) = 0;
3262 (yy_buffer_stack_top) = 0;
3263 (yy_buffer_stack_max) = 0;
3264 (yy_c_buf_p) = (char *) 0;
3268 (yy_start_stack_ptr) = 0;
3269 (yy_start_stack_depth) = 0;
3270 (yy_start_stack) = NULL;
3272 /* Defined in main.c */
3274 tclscanYYin = stdin;
3275 tclscanYYout = stdout;
3277 tclscanYYin = (FILE *) 0;
3278 tclscanYYout = (FILE *) 0;
3281 /* For future reference: Set errno on error, since we are called by
3282 * tclscanYYlex_init()
3287 /* tclscanYYlex_destroy is for both reentrant and non-reentrant scanners. */
3288 int tclscanYYlex_destroy (void)
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();
3298 /* Destroy the stack itself. */
3299 tclscanYYfree((yy_buffer_stack) );
3300 (yy_buffer_stack) = NULL;
3302 /* Destroy the start condition stack. */
3303 tclscanYYfree((yy_start_stack) );
3304 (yy_start_stack) = NULL;
3306 /* Reset the globals. This is important in a non-reentrant scanner so the next time
3307 * tclscanYYlex() is called, initialization will occur. */
3314 * Internal utility routines.
3318 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
3321 for ( i = 0; i < n; ++i )
3326 #ifdef YY_NEED_STRLEN
3327 static int yy_flex_strlen (yyconst char * s )
3330 for ( n = 0; s[n]; ++n )
3337 void *tclscanYYalloc (yy_size_t size )
3339 return (void *) malloc( size );
3342 void *tclscanYYrealloc (void * ptr, yy_size_t size )
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.
3351 return (void *) realloc( (char *) ptr, size );
3354 void tclscanYYfree (void * ptr )
3356 free( (char *) ptr ); /* see tclscanYYrealloc() for (char *) cast */
3359 #define YYTABLES_NAME "yytables"
3361 #line 1064 "tclscanner.l"
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)
3369 tcl_scan *myScan=tcl.scan.at(0);
3371 tcl_inf("line=%d type=%d '%s'\n",tcl.line_body0,type,content.ascii());
3373 myScan->line1=tclscanYYlineno;
3376 myScan=new tcl_scan;
3377 myScan->type[0] =' ';
3378 myScan->type[1] = '\0';
3383 myScan->type[0] = type;
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]='[';
3390 if (myScan->type[0]!=' ')
3392 tcl_codify(NULL,&myScan->type[0]);
3393 content = content.mid(1,content.length()-2);
3395 content += (char)0x1A;// for detection end of scan context
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;
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);
3414 //! Close current scan context.
3415 static void tcl_scan_end()
3417 tcl_scan *myScan=tcl.scan.at(0);
3418 tcl_scan *myScan1=tcl.scan.at(1);
3419 tcl_inf("line=%d\n",myScan->line1);
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]);
3425 for (unsigned int i=0;i<myScan->after.count();i=i+2)
3427 if (myScan->after[i]=="script") {
3431 tcl_codify(myScan->after[i].utf8(),myScan->after[i+1].utf8());
3433 tclscanYY_delete_buffer(myScan->buffer_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;
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++)
3444 myScan1->after.append(myScan->after[i]);
3450 tcl.scan.removeFirst();
3454 //! Handling of word parsing.
3455 static void tcl_word(int what,const char *text)
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
3465 yy_push_state(WORD);
3470 case '"': myWord = text[0]; break;
3471 default: myWord = '.';
3477 case 1:// all other chars
3480 tcl_err("expected word separator: %s\n",text);
3496 tcl_inf("(\\\n) ?%s?\n",tcl.string_last.data());
3499 switch (myList[myLevel-1])
3511 tcl_inf("(\\\n) ?%s?\n",tcl.string_last.data());
3521 tcl_err("expected word separator: %s\n",text);
3524 switch (myList[myLevel-1])
3528 myList[myLevel++]='{';
3539 tcl_err("expected word separator: %s\n",text);
3542 switch (myList[myLevel-1])
3546 if (myLevel==0 && tcl.code==NULL)
3560 tcl_err("expected word separator: %s\n",text);
3563 switch (myList[myLevel-1])
3570 myList[myLevel++]='[';
3578 tcl_err("expected word separator: %s\n",text);
3581 switch (myList[myLevel-1])
3597 tcl_err("expected word separator: %s\n",text);
3600 switch (myList[myLevel-1])
3605 myList[myLevel++]='"';
3622 tcl_inf("(%d) ?%s?\n",what,tcl.string_last.data());
3625 switch (myList[myLevel-1])
3637 tcl_inf("(.%d) ?%s?\n",what,tcl.string_last.data());
3654 tcl_inf("(%d) ?%s?\n",what,tcl.string_last.data());
3657 if (myLevel!=1 || myList[0] != '.')
3659 tcl_war("level=%d expected=%c\n",myLevel,myList[myLevel-1]);
3664 tcl_inf("(.%d) ?%s?\n",what,tcl.string_last.data());
3669 tcl_err("wrong state: %d\n",what);
3672 tcl.string_last += text;
3675 //! Handling of comment parsing.
3676 static void tcl_comment(int what,const char *text)
3679 { // begin of comment
3682 tcl_err("comment in comment\n");
3685 yy_push_state(COMMENT);
3686 tcl_inf("<- %s\n",text);
3687 tcl.string_comment="";
3691 { // start new comment
3694 tcl_comment(99,""); // inbody
3696 tcl.string_comment=text;
3703 tcl.string_comment+=text;
3706 else if (what==-1 || what == -2)
3707 { // end of comment without/with command
3710 tcl.string_last=tcl.string_comment;
3711 tcl_comment(100+what,"");
3715 tcl.string_last = "";
3716 tcl_inf("-> %s\n",(const char *)tcl.string_comment);
3719 tcl.string_comment="";
3722 else if (what==98 || what==99)
3723 { // 98=new 99=inbody
3724 if (tcl.this_parser && tcl.string_comment.length())
3726 tcl_inf("-> %s\n",(const char *)tcl.string_comment);
3729 int myLine=tcl.line_comment;
3732 Protection myProt=tcl.protection;
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);
3742 QCString myDoc = myO.data();
3744 { // inbody comment file or namespace or class or proc/method
3747 Entry myEntry0; // used to test parsing
3750 Entry *myEntry1=NULL;
3751 if (tcl.scan.at(0)->entry_fn)
3753 myEntry1=tcl.scan.at(0)->entry_fn;
3755 else if (tcl.scan.at(0)->entry_cl)
3757 myEntry1=tcl.scan.at(0)->entry_cl;
3762 while (parseCommentBlock(tcl.this_parser, &myEntry0, myDoc, tcl.file_name,
3763 myLine, FALSE, tcl.config_autobrief, FALSE, myProt, myPos, myNew))
3766 { // we need a new entry in this case
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);
3774 { // we can add to current entry in this case
3777 myEntry1=tcl_entry_namespace(tcl.scan.at(0)->ns);
3779 parseCommentBlock(tcl.this_parser, myEntry1, myDoc, tcl.file_name,
3780 myLine0, FALSE, tcl.config_autobrief, FALSE, myProt, myPos0, myNew);
3786 { // we need a new entry
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);
3794 { // we can add to current entry
3797 myEntry1=tcl_entry_namespace(tcl.scan.at(0)->ns);
3799 parseCommentBlock(tcl.this_parser, myEntry1, myDoc, tcl.file_name,
3800 myLine0, FALSE, tcl.config_autobrief, FALSE, myProt, myPos0, myNew);
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))
3812 tcl.entry_inside->addSubEntry(tcl.entry_current);
3813 tcl.entry_current = tcl_entry_new();
3817 tcl.entry_current->section = tcl.entry_inside->section;
3818 tcl.entry_current->name = tcl.entry_inside->name;
3823 tcl.entry_inside->addSubEntry(tcl.entry_current);
3824 tcl.entry_current = tcl_entry_new();
3828 tcl.entry_current->section = tcl.entry_inside->section;
3829 tcl.entry_current->name = tcl.entry_inside->name;
3832 if (tcl.protection != myProt)
3834 tcl.scan.at(0)->protection = tcl.protection = myProt;
3840 tcl_err("what %d\n",what);
3845 //! Parse given \c arglist .
3846 static void tcl_command_ARGLIST(QString &arglist)
3851 QString myArglist="";
3853 if (tcl.entry_current->argList==NULL)
3855 tcl.entry_current->argList=new ArgumentList;
3857 tcl_split_list(arglist,myArgs);
3858 for (uint i=0;i<myArgs.count();i++)
3860 QStringList myArgs1;
3863 tcl_split_list(*myArgs.at(i),myArgs1);
3864 if (myArgs1.count()==2)
3866 myArg->name= (*myArgs1.at(0)).utf8();
3867 myArg->defval= (*myArgs1.at(1)).utf8();
3868 if (myArg->defval.isEmpty())
3870 myArg->defval = " ";
3872 myArglist += "?" + QCString(myArg->name) + "? ";
3876 myArg->name= (*myArgs.at(i)).utf8();
3877 myArglist += QString(myArg->name) + " ";
3879 tcl.entry_current->argList->append(myArg);
3881 arglist = myArglist;
3882 tcl.entry_current->args = arglist.utf8();
3886 static void tcl_codify_link(QCString name)
3888 if (tcl.code == NULL || name.isEmpty()) return;
3890 static QAsciiDict<MemberDef> fn;
3894 MemberNameSDict::Iterator mni(*Doxygen::memberNameSDict);
3895 MemberNameSDict::Iterator fni(*Doxygen::functionNameSDict);
3898 for (mni.toFirst();(mn=mni.current());++mni)
3900 MemberNameIterator mi(*mn);
3901 for (mi.toFirst();(md=mi.current());++mi)
3903 fn.insert(md->qualifiedName(),md);
3906 for (fni.toFirst();(mn=fni.current());++fni)
3908 MemberNameIterator fi(*mn);
3909 for (fi.toFirst();(md=fi.current());++fi)
3911 fn.insert(md->qualifiedName(),md);
3916 QCString myName=name;
3917 if (name.mid(0,2)=="::") // fully qualified global command
3919 myName = myName.mid(2);
3920 myDef = fn.find(myName);
3922 else // not qualified name
3924 QCString myName1=myName;
3926 myName1 = tcl.scan.at(0)->ns;
3927 if (myName1 == " " || myName1 == "")
3933 myName1 = myName1 + "::" + myName;
3935 myDef = fn.find(myName1); // search namespace command
3938 myDef = fn.find(myName); // search global command
3941 if (myDef != NULL) // documented command
3943 tcl.code->writeCodeLink(myDef->getReference().data(),
3944 myDef->getOutputFileBase().data(),
3945 myDef->anchor().data(),
3947 myDef->qualifiedName().data());
3950 myDef->addSourceReferencedBy(tcl.memberdef);
3951 tcl.memberdef->addSourceReferences(myDef);
3954 else if (tcl_keyword(myName)) // check keyword
3956 tcl_codify("keyword",name);
3960 tcl_codify(NULL,name); // something else
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)
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++)
3977 myScan->after << type[i] << tcl.list_commandwords[i];
3980 //! Handle internal tcl commands.
3981 // "for start test next body"
3982 static void tcl_command_FOR()
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];
3998 ///! Handle internal tcl commands.
3999 // "foreach varname list body" and
4000 // "foreach varlist1 list1 ?varlist2 list2 ...? body"
4001 static void tcl_command_FOREACH()
4005 tcl_codify_cmd("keyword",0);
4006 for (i = 1;i<tcl.list_commandwords.count()-1;i++)
4008 tcl_codify_cmd(NULL,i);
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);
4015 ///! Handle internal tcl commands.
4016 // "while test body"
4017 static void tcl_command_WHILE()
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];
4029 //! Handle all other commands.
4030 // Create links of first command word or first command word inside [].
4031 static void tcl_command_OTHER()
4033 if (tcl.code == NULL) return;
4036 for (unsigned int i=0; i< tcl.list_commandwords.count(); i++)
4038 myName = (*tcl.list_commandwords.at(i)).utf8();
4041 tcl_codify_link(myName);
4045 tcl_codify(NULL,myName);
4052 for (i=0;i<myName.length();i++)
4054 QChar c = myName[i];
4057 if (c==' '||c=='\t'||c=='\n'||c==']')
4059 tcl_codify_link(myStr);
4070 for (;i<myName.length();i++)
4073 if (c!=' ' && c!='\t' && c!='\n') break;
4076 tcl_codify(NULL,myStr);
4082 tcl_codify(NULL,myStr);
4087 //! Handle \c proc statements.
4088 static void tcl_command_PROC()
4091 QCString myNs, myName;
4094 tcl_scan *myScan = tcl.scan.at(0);
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);
4105 myEntryNs = tcl_entry_namespace(myNs);
4109 myEntryNs = tcl_entry_namespace(myScan->ns);
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);
4127 //! Handle \c itcl::body statements and \c oo::define method and method inside \c itcl::class statements.
4128 static void tcl_command_METHOD()
4131 QCString myNs, myName;
4132 Entry *myEntryCl, *myEntry;
4133 tcl_scan *myScan = tcl.scan.at(0);
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);
4144 myEntryCl = tcl_entry_class(myNs);
4149 myEntryCl = myScan->entry_cl;
4151 // needed in case of more then one definition p.e. itcl::method and itcl::body
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);
4169 //! Handle \c constructor statements inside class definitions.
4170 static void tcl_command_CONSTRUCTOR()
4173 QCString myNs, myName;
4174 Entry *myEntryCl, *myEntry;
4175 tcl_scan *myScan = tcl.scan.at(0);
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);
4184 myEntryCl = tcl_entry_class(myNs);
4189 myEntryCl = myScan->entry_cl;
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);
4206 //! Handle \c destructor statements inside class definitions.
4207 static void tcl_command_DESTRUCTOR()
4210 QCString myNs, myName;
4211 Entry *myEntryCl, *myEntry;
4212 tcl_scan *myScan = tcl.scan.at(0);
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);
4219 myEntryCl = tcl_entry_class(myNs);
4224 myEntryCl = myScan->entry_cl;
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);
4240 //! Handle \c namespace statements.
4241 static void tcl_command_NAMESPACE()
4244 QCString myNs, myName, myStr;
4245 Entry *myEntryNs=NULL;
4246 tcl_scan *myScan = tcl.scan.at(0);
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);
4257 myName = myNs+"::"+myName;
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)
4270 for (uint i=7;i<tcl.list_commandwords.count();i++)
4272 myStr.append((*tcl.list_commandwords.at(i)).utf8());
4276 myScan = tcl_scan_start(tcl.word_is,myStr, myName, NULL, NULL);
4279 //! Handle \c itcl::class statements.
4280 static void tcl_command_ITCL_CLASS()
4283 QCString myNs, myName, myStr;
4285 tcl_scan *myScan = tcl.scan.at(0);
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);
4294 myName = myNs+"::"+myName;
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);
4308 //! Handle \c oo::class statements.
4309 static void tcl_command_OO_CLASS()
4312 QCString myNs, myName, myStr;
4315 tcl_scan *myScan = tcl.scan.at(0);
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);
4326 myName = myNs+"::"+myName;
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);
4341 //! Handle \c oo::define statements.
4342 static void tcl_command_OO_DEFINE()
4345 QCString myNs, myName, myStr;
4347 tcl_scan *myScan = tcl.scan.at(0);
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);
4356 myName = myNs+"::"+myName;
4358 myEntryCl = tcl_entry_class(myName);
4359 myStr = (*tcl.list_commandwords.at(4)).utf8();
4360 if (tcl.list_commandwords.count() > 5)
4362 for (uint i=5;i<tcl.list_commandwords.count();i++)
4364 myStr.append((*tcl.list_commandwords.at(i)).utf8());
4368 myScan = tcl_scan_start(tcl.word_is,myStr,myName,myEntryCl,NULL);
4371 //! Handle \c variable statements.
4372 static void tcl_command_VARIABLE(int inclass)
4375 QCString myNs, myName;
4377 tcl_scan *myScan = tcl.scan.at(0);
4379 tcl_codify_cmd("keyword",0);
4380 for (unsigned int i=1; i< tcl.list_commandwords.count(); i++)
4382 tcl_codify_cmd(NULL,i);
4384 tcl_name(myScan->ns,(*tcl.list_commandwords.at(2)).utf8(),myNs,myName);
4386 {// qualified variables go into namespace
4387 myEntry = tcl_entry_namespace(myNs);
4388 tcl.entry_current->stat = true;
4394 myEntry = myScan->entry_cl;
4395 tcl.entry_current->stat = false;
4399 myEntry = tcl_entry_namespace(myScan->ns);
4400 tcl.entry_current->stat = true;
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();
4413 //! Handling of command parsing.
4417 static void tcl_command(int what,const char *text)
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="";
4434 if (tcl.string_last.length())
4436 tcl.list_commandwords.append(tcl.string_last);
4441 tcl.list_commandwords.append(text);
4446 {// should not happen
4447 tcl_err("what %d\n",what);
4450 QCString myText = text;
4454 return; //TODO check on inside comment
4456 if (tcl.string_last != "")
4458 tcl.list_commandwords.append(tcl.string_last);
4464 QCString myStr = (*tcl.list_commandwords.at(0)).utf8();
4466 Protection myProt = tcl.protection;
4468 if (tcl.list_commandwords.count() < 3)
4470 tcl_command_OTHER();
4473 // remove leading "::" and apply TCL_SUBST
4474 if (myStr.left(2)=="::") myStr = myStr.mid(2);
4475 if (tcl.config_subst.contains(myStr))
4477 myStr=tcl.config_subst[myStr].utf8();
4479 if (myStr=="private")
4481 tcl.protection = Private;
4484 else if (myStr=="protected")
4486 tcl.protection = Protected;
4489 else if (myStr=="public")
4491 tcl.protection = Public;
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)
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;
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))
4513 myStr=tcl.config_subst[myStr].utf8();
4518 if (tcl.list_commandwords.count() == 5)
4520 tcl.list_commandwords.append("");
4521 tcl.list_commandwords.append("");
4523 if (tcl.list_commandwords.count() != 7) {myLine=__LINE__;goto command_warn;}
4527 if (myStr=="method")
4529 if (tcl.list_commandwords.count() == 5)
4531 tcl.list_commandwords.append("");
4532 tcl.list_commandwords.append("");
4534 if (tcl.list_commandwords.count() != 7) {myLine=__LINE__;goto command_warn;}
4535 tcl_command_METHOD();
4538 if (myStr=="constructor")
4540 if (tcl.list_commandwords.count() != 5) {myLine=__LINE__;goto command_warn;}
4541 tcl_command_CONSTRUCTOR();
4544 if (myStr=="destructor")
4546 if (tcl.list_commandwords.count() != 3) {myLine=__LINE__;goto command_warn;}
4547 tcl_command_DESTRUCTOR();
4550 if (myStr=="namespace")
4552 if ((*tcl.list_commandwords.at(2)).utf8()=="eval")
4554 if (tcl.list_commandwords.count() < 7) {myLine=__LINE__;goto command_warn;}
4555 tcl_command_NAMESPACE();
4558 tcl_command_OTHER();
4561 if (myStr=="itcl::class")
4563 if (tcl.list_commandwords.count() != 5) {myLine=__LINE__;goto command_warn;}
4564 tcl_command_ITCL_CLASS();
4567 if (myStr=="itcl::body")
4569 if (tcl.list_commandwords.count() != 7) {myLine=__LINE__;goto command_warn;}
4570 tcl_command_METHOD();
4573 if (myStr=="oo::class")
4575 if ((*tcl.list_commandwords.at(2)).utf8()=="create")
4577 if (tcl.list_commandwords.count() != 7) {myLine=__LINE__;goto command_warn;}
4578 tcl_command_OO_CLASS();
4581 tcl_command_OTHER();
4584 if (myStr=="oo::define")
4586 if (tcl.list_commandwords.count() < 5) {myLine=__LINE__;goto command_warn;}
4587 tcl_command_OO_DEFINE();
4590 if (myStr=="variable")
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!="");
4599 if (myStr=="common")
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);
4608 if (myStr=="inherit" || myStr=="superclass")
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!="")
4613 for (unsigned int i = 2; i < tcl.list_commandwords.count(); i = i + 2)
4615 tcl.scan.at(0)->entry_cl->extends->append(new BaseInfo((*tcl.list_commandwords.at(i)).utf8(),Public,Normal));
4621 * Start of internal tcl keywords
4622 * Ready: if, for, foreach, while
4623 * TODO: switch, eval, ?
4627 if (tcl.list_commandwords.count() != 9) {myLine=__LINE__;goto command_warn;}
4631 if (myStr=="foreach")
4633 if (tcl.list_commandwords.count() < 7 || tcl.list_commandwords.count()%2==0) {myLine=__LINE__;goto command_warn;}
4634 tcl_command_FOREACH();
4638 if expr1 ?then? body1 elseif expr2 ?then? body2 elseif ... ?else? ?bodyN?
4640 if (myStr=="if" && tcl.list_commandwords.count() > 4)
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)
4647 QCString myStr=(*tcl.list_commandwords.at(i)).utf8();
4653 myType << "keyword" << "NULL";
4658 myType << "script" << "NULL";
4661 else if (myState=='t')
4664 myType << "script" << "NULL";
4666 else if (myState=='b')
4668 if (myStr=="elseif") {
4670 myType << "keyword" << "NULL";
4672 else if (myStr=="else" && i==tcl.list_commandwords.count()-3)
4675 myType << "keyword" << "NULL" << "script";
4676 i = tcl.list_commandwords.count();
4678 else if (i==tcl.list_commandwords.count()-1)
4682 i = tcl.list_commandwords.count();
4686 myLine=__LINE__;goto command_warn;
4689 else if (myState=='i')
4692 myType << "script" << "NULL";
4695 if (myState != 'b') {myLine=__LINE__;goto command_warn;}
4696 tcl_command_IF(myType);
4701 if (tcl.list_commandwords.count() != 5) {myLine=__LINE__;goto command_warn;}
4702 tcl_command_WHILE();
4705 tcl_command_OTHER();
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);
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();
4717 tcl.protection = myProt;
4720 //----------------------------------------------------------------------------
4721 //! Common initializations.
4722 static void tcl_init()
4724 // Get values from option TCL_SUBST
4725 tcl.config_subst.clear();
4726 if (Config::instance()->get("TCL_SUBST"))
4728 QStrList myStrList = Config_getList("TCL_SUBST");
4729 const char *s=myStrList.first();
4733 int i=myStr.find('=');
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;
4742 s = myStrList.next();
4746 if (tcl.input_string.at(tcl.input_string.length()-1) == '\n')
4748 tcl.input_string[tcl.input_string.length()-1] = 0x1A;
4752 tcl.input_string += 0x1A;
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;
4765 tcl.bracket_level=0;
4766 tcl.bracket_quote=0;
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();
4782 tclscanYYlineno = 1;
4783 tcl.protection = Public;
4784 tcl.memberdef = NULL;
4788 static void tcl_parse(const QCString ns, const QCString cls)
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();
4799 tcl.entry_main->addSubEntry(myEntry);
4800 tcl.ns.insert("::",myEntry);
4801 tcl.entry_current = tcl_entry_new();
4803 tclscanYYrestart( tclscanYYin );
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;
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);
4826 //! Parse text file and build up entry tree.
4827 void TclLanguageScanner::parseInput(const char *fileName,const char *input,Entry *root)
4830 tcl_inf("%s\n",fileName);
4831 myFile.setName(fileName);
4832 if (!myFile.open(IO_ReadOnly)) return;
4833 if (strlen(input)<1) return;
4835 tcl.input_string = input;
4836 if (tcl.input_string.length()<1) return;
4838 msg("Parsing %s...\n",fileName);
4839 groupEnterFile(fileName,tclscanYYlineno);
4843 tcl.file_name = fileName;
4844 tcl.this_parser = this;
4845 tcl.entry_main = root; /* toplevel entry */
4847 groupLeaveFile(tcl.file_name,tclscanYYlineno);
4848 root->program.resize(0);
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,
4861 bool inlineFragment,
4862 MemberDef *memberDef,
4863 bool showLineNumbers,
4864 Definition *searchCtx
4871 (void)inlineFragment;
4874 if (input.length()<1) return;
4875 tcl.input_string = input;
4881 if (memberDef->getClassDef())
4883 myCls = memberDef->getClassDef()->displayName();
4886 else if (memberDef->getNamespaceDef())
4888 myNs = memberDef->getNamespaceDef()->displayName();
4892 QString myStr="Codifying..";
4906 myStr+=memberDef->memberTypeName();
4908 myStr+=memberDef->qualifiedName();
4913 myStr+=fileDef->fileName();
4915 tcl_inf("%s (%d,%d) %d %d\n",myStr.ascii(),startLine,endLine,isExampleBlock,inlineFragment);
4916 //tcl_inf("%s\n"input.data());
4919 tcl_codify(NULL,input);
4923 tcl.memberdef = memberDef;
4924 tcl.code = &codeOutIntf;
4929 tclscanYYlineno=startLine;
4930 tcl.code_linenumbers = showLineNumbers;
4931 tcl.code_line=tclscanYYlineno;
4932 if (tcl.code_linenumbers)
4934 tcl.code->writeLineNumber(0,0,0,tcl.code_line);
4937 tcl.this_parser = NULL;
4938 tcl.entry_main = tcl_entry_new();
4939 tcl_parse(myNs,myCls);
4947 bool TclLanguageScanner::needsPreprocessing(const QCString &extension)
4953 void TclLanguageScanner::resetCodeParserState()
4957 void TclLanguageScanner::parsePrototype(const char *text)
4962 static int yyread(char *buf,int max_size)
4967 while ( c < max_size && tcl.input_string.at(tcl.input_position) )
4969 *buf = tcl.input_string.at(tcl.input_position++) ;
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);
4976 //----------------------------------------------------------------------------
4978 // to avoid a warning
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); }