Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Examples

vos/corelibs/typechain/tclexer.cc

Go to the documentation of this file.
00001 #line 2 "tclexer.cc"
00002 
00003 #line 4 "tclexer.cc"
00004 
00005 #define  YY_INT_ALIGNED short int
00006 
00007 /* A lexical scanner generated by flex */
00008 
00009 #define FLEX_SCANNER
00010 #define YY_FLEX_MAJOR_VERSION 2
00011 #define YY_FLEX_MINOR_VERSION 5
00012 #define YY_FLEX_SUBMINOR_VERSION 31
00013 #if YY_FLEX_SUBMINOR_VERSION > 0
00014 #define FLEX_BETA
00015 #endif
00016 
00017     /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
00018      * following macro.
00019      */
00020     #define yyFlexLexer tcFlexLexer
00021 
00022 /* First, we deal with  platform-specific or compiler-specific issues. */
00023 
00024 /* begin standard C headers. */
00025 
00026 /* end standard C headers. */
00027 
00028 /* flex integer type definitions */
00029 
00030 #ifndef FLEXINT_H
00031 #define FLEXINT_H
00032 
00033 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
00034 
00035 #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
00036 #include <inttypes.h>
00037 typedef int8_t flex_int8_t;
00038 typedef uint8_t flex_uint8_t;
00039 typedef int16_t flex_int16_t;
00040 typedef uint16_t flex_uint16_t;
00041 typedef int32_t flex_int32_t;
00042 typedef uint32_t flex_uint32_t;
00043 #else
00044 typedef signed char flex_int8_t;
00045 typedef short int flex_int16_t;
00046 typedef int flex_int32_t;
00047 typedef unsigned char flex_uint8_t; 
00048 typedef unsigned short int flex_uint16_t;
00049 typedef unsigned int flex_uint32_t;
00050 #endif /* ! C99 */
00051 
00052 /* Limits of integral types. */
00053 #ifndef INT8_MIN
00054 #define INT8_MIN               (-128)
00055 #endif
00056 #ifndef INT16_MIN
00057 #define INT16_MIN              (-32767-1)
00058 #endif
00059 #ifndef INT32_MIN
00060 #define INT32_MIN              (-2147483647-1)
00061 #endif
00062 #ifndef INT8_MAX
00063 #define INT8_MAX               (127)
00064 #endif
00065 #ifndef INT16_MAX
00066 #define INT16_MAX              (32767)
00067 #endif
00068 #ifndef INT32_MAX
00069 #define INT32_MAX              (2147483647)
00070 #endif
00071 #ifndef UINT8_MAX
00072 #define UINT8_MAX              (255U)
00073 #endif
00074 #ifndef UINT16_MAX
00075 #define UINT16_MAX             (65535U)
00076 #endif
00077 #ifndef UINT32_MAX
00078 #define UINT32_MAX             (4294967295U)
00079 #endif
00080 
00081 #endif /* ! FLEXINT_H */
00082 
00083 /* begin standard C++ headers. */
00084 #include <iostream> 
00085 #include <errno.h>
00086 #include <cstdlib>
00087 #include <cstring>
00088 /* end standard C++ headers. */
00089 
00090 #ifdef __cplusplus
00091 
00092 /* The "const" storage-class-modifier is valid. */
00093 #define YY_USE_CONST
00094 
00095 #else   /* ! __cplusplus */
00096 
00097 #if __STDC__
00098 
00099 #define YY_USE_CONST
00100 
00101 #endif  /* __STDC__ */
00102 #endif  /* ! __cplusplus */
00103 
00104 #ifdef YY_USE_CONST
00105 #define yyconst const
00106 #else
00107 #define yyconst
00108 #endif
00109 
00110 /* Returned upon end-of-file. */
00111 #define YY_NULL 0
00112 
00113 /* Promotes a possibly negative, possibly signed char to an unsigned
00114  * integer for use as an array index.  If the signed char is negative,
00115  * we want to instead treat it as an 8-bit unsigned char, hence the
00116  * double cast.
00117  */
00118 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
00119 
00120 /* Enter a start condition.  This macro really ought to take a parameter,
00121  * but we do it the disgusting crufty way forced on us by the ()-less
00122  * definition of BEGIN.
00123  */
00124 #define BEGIN (yy_start) = 1 + 2 *
00125 
00126 /* Translate the current start state into a value that can be later handed
00127  * to BEGIN to return to the state.  The YYSTATE alias is for lex
00128  * compatibility.
00129  */
00130 #define YY_START (((yy_start) - 1) / 2)
00131 #define YYSTATE YY_START
00132 
00133 /* Action number for EOF rule of a given start state. */
00134 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
00135 
00136 /* Special action meaning "start processing a new file". */
00137 #define YY_NEW_FILE yyrestart( yyin  )
00138 
00139 #define YY_END_OF_BUFFER_CHAR 0
00140 
00141 /* Size of default input buffer. */
00142 #ifndef YY_BUF_SIZE
00143 #define YY_BUF_SIZE 16384
00144 #endif
00145 
00146 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
00147 #define YY_TYPEDEF_YY_BUFFER_STATE
00148 typedef struct yy_buffer_state *YY_BUFFER_STATE;
00149 #endif
00150 
00151 extern int yyleng;
00152 
00153 #define EOB_ACT_CONTINUE_SCAN 0
00154 #define EOB_ACT_END_OF_FILE 1
00155 #define EOB_ACT_LAST_MATCH 2
00156 
00157     #define YY_LESS_LINENO(n)
00158     
00159 /* Return all but the first "n" matched characters back to the input stream. */
00160 #define yyless(n) \
00161     do \
00162         { \
00163         /* Undo effects of setting up yytext. */ \
00164         int yyless_macro_arg = (n); \
00165         YY_LESS_LINENO(yyless_macro_arg);\
00166         *yy_cp = (yy_hold_char); \
00167         YY_RESTORE_YY_MORE_OFFSET \
00168         (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
00169         YY_DO_BEFORE_ACTION; /* set up yytext again */ \
00170         } \
00171     while ( 0 )
00172 
00173 #define unput(c) yyunput( c, (yytext_ptr)  )
00174 
00175 /* The following is because we cannot portably get our hands on size_t
00176  * (without autoconf's help, which isn't available because we want
00177  * flex-generated scanners to compile on their own).
00178  */
00179 
00180 #ifndef YY_TYPEDEF_YY_SIZE_T
00181 #define YY_TYPEDEF_YY_SIZE_T
00182 typedef unsigned int yy_size_t;
00183 #endif
00184 
00185 #ifndef YY_STRUCT_YY_BUFFER_STATE
00186 #define YY_STRUCT_YY_BUFFER_STATE
00187 struct yy_buffer_state
00188     {
00189 
00190     std::istream* yy_input_file;
00191 
00192     char *yy_ch_buf;        /* input buffer */
00193     char *yy_buf_pos;       /* current position in input buffer */
00194 
00195     /* Size of input buffer in bytes, not including room for EOB
00196      * characters.
00197      */
00198     yy_size_t yy_buf_size;
00199 
00200     /* Number of characters read into yy_ch_buf, not including EOB
00201      * characters.
00202      */
00203     int yy_n_chars;
00204 
00205     /* Whether we "own" the buffer - i.e., we know we created it,
00206      * and can realloc() it to grow it, and should free() it to
00207      * delete it.
00208      */
00209     int yy_is_our_buffer;
00210 
00211     /* Whether this is an "interactive" input source; if so, and
00212      * if we're using stdio for input, then we want to use getc()
00213      * instead of fread(), to make sure we stop fetching input after
00214      * each newline.
00215      */
00216     int yy_is_interactive;
00217 
00218     /* Whether we're considered to be at the beginning of a line.
00219      * If so, '^' rules will be active on the next match, otherwise
00220      * not.
00221      */
00222     int yy_at_bol;
00223 
00224     int yy_bs_lineno; /**< The line count. */
00225     int yy_bs_column; /**< The column count. */
00226     
00227     /* Whether to try to fill the input buffer when we reach the
00228      * end of it.
00229      */
00230     int yy_fill_buffer;
00231 
00232     int yy_buffer_status;
00233 
00234 #define YY_BUFFER_NEW 0
00235 #define YY_BUFFER_NORMAL 1
00236     /* When an EOF's been seen but there's still some text to process
00237      * then we mark the buffer as YY_EOF_PENDING, to indicate that we
00238      * shouldn't try reading from the input source any more.  We might
00239      * still have a bunch of tokens to match, though, because of
00240      * possible backing-up.
00241      *
00242      * When we actually see the EOF, we change the status to "new"
00243      * (via yyrestart()), so that the user can continue scanning by
00244      * just pointing yyin at a new input file.
00245      */
00246 #define YY_BUFFER_EOF_PENDING 2
00247 
00248     };
00249 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
00250 
00251 /* We provide macros for accessing buffer states in case in the
00252  * future we want to put the buffer states in a more general
00253  * "scanner state".
00254  *
00255  * Returns the top of the stack, or NULL.
00256  */
00257 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
00258                           ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
00259                           : NULL)
00260 
00261 /* Same as previous macro, but useful when we know that the buffer stack is not
00262  * NULL or when we need an lvalue. For internal use only.
00263  */
00264 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
00265 
00266 void *tcalloc (yy_size_t  );
00267 void *tcrealloc (void *,yy_size_t  );
00268 void tcfree (void *  );
00269 
00270 #define yy_new_buffer yy_create_buffer
00271 
00272 #define yy_set_interactive(is_interactive) \
00273     { \
00274     if ( ! YY_CURRENT_BUFFER ){ \
00275         yyensure_buffer_stack (); \
00276         YY_CURRENT_BUFFER_LVALUE =    \
00277             yy_create_buffer( yyin, YY_BUF_SIZE ); \
00278     } \
00279     YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
00280     }
00281 
00282 #define yy_set_bol(at_bol) \
00283     { \
00284     if ( ! YY_CURRENT_BUFFER ){\
00285         yyensure_buffer_stack (); \
00286         YY_CURRENT_BUFFER_LVALUE =    \
00287             yy_create_buffer( yyin, YY_BUF_SIZE ); \
00288     } \
00289     YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
00290     }
00291 
00292 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
00293 
00294 /* Begin user sect3 */
00295 
00296 #define yywrap(n) 1
00297 #define YY_SKIP_YYWRAP
00298 
00299 typedef unsigned char YY_CHAR;
00300 
00301 #define yytext_ptr yytext
00302 
00303 #include <FlexLexer.h>
00304 int yyFlexLexer::yylex()
00305     {
00306     LexerError( "yyFlexLexer::yylex invoked but %option yyclass used" );
00307     return 0;
00308     }
00309 
00310 #define YY_DECL int TypechainLexer::yylex()
00311 
00312 /* Done after the current pattern has been matched and before the
00313  * corresponding action - sets up yytext.
00314  */
00315 #define YY_DO_BEFORE_ACTION \
00316     (yytext_ptr) = yy_bp; \
00317     yyleng = (size_t) (yy_cp - yy_bp); \
00318     (yy_hold_char) = *yy_cp; \
00319     *yy_cp = '\0'; \
00320     (yy_c_buf_p) = yy_cp;
00321 
00322 #define YY_NUM_RULES 9
00323 #define YY_END_OF_BUFFER 10
00324 /* This struct is not used in this scanner,
00325    but its presence is necessary. */
00326 struct yy_trans_info
00327     {
00328     flex_int32_t yy_verify;
00329     flex_int32_t yy_nxt;
00330     };
00331 static yyconst flex_int16_t yy_accept[37] =
00332     {   0,
00333         0,    0,    0,    0,    0,    0,   10,    2,    9,    3,
00334         9,    1,    4,    9,    8,    7,    6,    5,    9,    2,
00335         0,    3,    1,    3,    1,    4,    0,    8,    7,    6,
00336         8,    7,    6,    5,    0,    0
00337     } ;
00338 
00339 static yyconst flex_int32_t yy_ec[256] =
00340     {   0,
00341         1,    1,    1,    1,    1,    1,    1,    1,    2,    2,
00342         1,    1,    2,    1,    1,    1,    1,    1,    1,    1,
00343         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00344         1,    2,    1,    1,    1,    1,    1,    1,    1,    3,
00345         4,    1,    1,    5,    1,    1,    1,    1,    1,    1,
00346         1,    1,    1,    1,    1,    1,    1,    6,    6,    1,
00347         7,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00348         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00349         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00350         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00351 
00352         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00353         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00354         1,    1,    1,    6,    1,    1,    1,    1,    1,    1,
00355         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00356         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00357         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00358         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00359         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00360         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00361         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00362 
00363         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00364         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00365         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00366         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00367         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00368         1,    1,    1,    1,    1
00369     } ;
00370 
00371 static yyconst flex_int32_t yy_meta[8] =
00372     {   0,
00373         1,    1,    1,    1,    1,    1,    1
00374     } ;
00375 
00376 static yyconst flex_int16_t yy_base[37] =
00377     {   0,
00378         0,    0,    7,    0,   14,    0,   49,   47,   20,   45,
00379        50,   44,   44,   25,   42,   41,   40,   40,   31,   39,
00380         0,   37,   36,   35,   32,   30,    0,   26,   23,   22,
00381        18,   17,   16,   16,    0,   50
00382     } ;
00383 
00384 static yyconst flex_int16_t yy_def[37] =
00385     {   0,
00386        36,    1,   36,    3,    3,    5,   36,   36,   36,   36,
00387        36,   36,   36,   36,   36,   36,   36,   36,   36,   36,
00388         9,   36,   36,   36,   36,   36,   14,   36,   36,   36,
00389        36,   36,   36,   36,   19,    0
00390     } ;
00391 
00392 static yyconst flex_int16_t yy_nxt[58] =
00393     {   0,
00394         8,    9,   10,   11,   11,   12,   11,   13,   14,   11,
00395        15,   16,   11,   17,   18,   19,   34,   33,   32,   31,
00396        11,   21,   22,   33,   32,   23,   27,   31,   28,   29,
00397        26,   30,   35,   25,   28,   29,   24,   25,   24,   20,
00398        34,   33,   32,   31,   26,   25,   24,   20,   36,    7,
00399        36,   36,   36,   36,   36,   36,   36
00400     } ;
00401 
00402 static yyconst flex_int16_t yy_chk[58] =
00403     {   0,
00404         1,    1,    1,    1,    1,    1,    1,    3,    3,    3,
00405         3,    3,    3,    3,    5,    5,   34,   33,   32,   31,
00406         5,    9,    9,   30,   29,    9,   14,   28,   14,   14,
00407        26,   14,   19,   25,   19,   19,   24,   23,   22,   20,
00408        18,   17,   16,   15,   13,   12,   10,    8,    7,   36,
00409        36,   36,   36,   36,   36,   36,   36
00410     } ;
00411 
00412 /* The intent behind this definition is that it'll catch
00413  * any uses of REJECT which flex missed.
00414  */
00415 #define REJECT reject_used_but_not_detected
00416 #define yymore() yymore_used_but_not_detected
00417 #define YY_MORE_ADJ 0
00418 #define YY_RESTORE_YY_MORE_OFFSET
00419 #line 1 "tclexer.ll"
00420 /** tclexer Typechain Flex Lexical Scanner
00421     @see TypechainLexer
00422 
00423 
00424     @author Reed Hedges <reed@zerohour.net>
00425 
00426     Copyright (C) 2002 Reed Hedges
00427 
00428     This library is free software; you can redistribute it and/or
00429     modify it under the terms of the GNU Lesser General Public
00430     License as published by the Free Software Foundation; either
00431     version 2 of the License, or (at your option) any later version.
00432 
00433     This library is distributed in the hope that it will be useful,
00434     but WITHOUT ANY WARRANTY; without even the implied warranty of
00435     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00436     Lesser General Public License for more details.
00437 
00438     You should have received a copy of the GNU Lesser General Public
00439     License along with this library; if not, write to the Free Software
00440     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00441 
00442 */
00443 //%option outfile="tclexer.cc"
00444 // Don't use this for testing (See below) !! :
00445 #line 36 "tclexer.ll"
00446 
00447 //#define TESTING 1 // If defined, a test program is generated (with main()).
00448 
00449 #include "tclexer.hh"
00450 #include <iostream>
00451 
00452 //#define YY_USER_ACTION    printf("matched: %s.\n", yytext);
00453     
00454 
00455 
00456 #line 457 "tclexer.cc"
00457 
00458 #define INITIAL 0
00459 #define PARAMKEY 1
00460 #define PARAMVAL 2
00461 
00462 /* Special case for "unistd.h", since it is non-ANSI. We include it way
00463  * down here because we want the user's section 1 to have been scanned first.
00464  * The user has a chance to override it with an option.
00465  */
00466 #include <unistd.h>
00467 
00468 #ifndef YY_EXTRA_TYPE
00469 #define YY_EXTRA_TYPE void *
00470 #endif
00471 
00472 #ifndef yytext_ptr
00473 static void yy_flex_strncpy (char *,yyconst char *,int );
00474 #endif
00475 
00476 #ifdef YY_NEED_STRLEN
00477 static int yy_flex_strlen (yyconst char * );
00478 #endif
00479 
00480 #ifndef YY_NO_INPUT
00481 
00482 #endif
00483 
00484 /* Amount of stuff to slurp up with each read. */
00485 #ifndef YY_READ_BUF_SIZE
00486 #define YY_READ_BUF_SIZE 8192
00487 #endif
00488 
00489 /* Copy whatever the last rule matched to the standard output. */
00490 #ifndef ECHO
00491 #define ECHO LexerOutput( yytext, yyleng )
00492 #endif
00493 
00494 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
00495  * is returned in "result".
00496  */
00497 #ifndef YY_INPUT
00498 #define YY_INPUT(buf,result,max_size) \
00499 \
00500     if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
00501         YY_FATAL_ERROR( "input in flex scanner failed" );
00502 
00503 #endif
00504 
00505 /* No semi-colon after return; correct usage is to write "yyterminate();" -
00506  * we don't want an extra ';' after the "return" because that will cause
00507  * some compilers to complain about unreachable statements.
00508  */
00509 #ifndef yyterminate
00510 #define yyterminate() return YY_NULL
00511 #endif
00512 
00513 /* Number of entries by which start-condition stack grows. */
00514 #ifndef YY_START_STACK_INCR
00515 #define YY_START_STACK_INCR 25
00516 #endif
00517 
00518 /* Report a fatal error. */
00519 #ifndef YY_FATAL_ERROR
00520 #define YY_FATAL_ERROR(msg) LexerError( msg )
00521 #endif
00522 
00523 /* end tables serialization structures and prototypes */
00524 
00525 /* Default declaration of generated scanner - a define so the user can
00526  * easily add parameters.
00527  */
00528 #ifndef YY_DECL
00529 #define YY_DECL_IS_OURS 1
00530 #define YY_DECL int yyFlexLexer::yylex()
00531 #endif /* !YY_DECL */
00532 
00533 /* Code executed at the beginning of each rule, after yytext and yyleng
00534  * have been set up.
00535  */
00536 #ifndef YY_USER_ACTION
00537 #define YY_USER_ACTION
00538 #endif
00539 
00540 /* Code executed at the end of each rule. */
00541 #ifndef YY_BREAK
00542 #define YY_BREAK break;
00543 #endif
00544 
00545 #define YY_RULE_SETUP \
00546     YY_USER_ACTION
00547 
00548 /** The main scanner function which does all the work.
00549  */
00550 YY_DECL
00551 {
00552     register yy_state_type yy_current_state;
00553     register char *yy_cp, *yy_bp;
00554     register int yy_act;
00555     
00556 #line 53 "tclexer.ll"
00557 
00558 
00559 #line 560 "tclexer.cc"
00560 
00561     if ( (yy_init) )
00562         {
00563         (yy_init) = 0;
00564 
00565 #ifdef YY_USER_INIT
00566         YY_USER_INIT;
00567 #endif
00568 
00569         if ( ! (yy_start) )
00570             (yy_start) = 1; /* first start state */
00571 
00572         if ( ! yyin )
00573             yyin = & std::cin;
00574 
00575         if ( ! yyout )
00576             yyout = & std::cout;
00577 
00578         if ( ! YY_CURRENT_BUFFER ) {
00579             yyensure_buffer_stack ();
00580             YY_CURRENT_BUFFER_LVALUE =
00581                 yy_create_buffer( yyin, YY_BUF_SIZE );
00582         }
00583 
00584         yy_load_buffer_state(  );
00585         }
00586 
00587     while ( 1 )     /* loops until end-of-file is reached */
00588         {
00589         yy_cp = (yy_c_buf_p);
00590 
00591         /* Support of yytext. */
00592         *yy_cp = (yy_hold_char);
00593 
00594         /* yy_bp points to the position in yy_ch_buf of the start of
00595          * the current run.
00596          */
00597         yy_bp = yy_cp;
00598 
00599         yy_current_state = (yy_start);
00600 yy_match:
00601         do
00602             {
00603             register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
00604             if ( yy_accept[yy_current_state] )
00605                 {
00606                 (yy_last_accepting_state) = yy_current_state;
00607                 (yy_last_accepting_cpos) = yy_cp;
00608                 }
00609             while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
00610                 {
00611                 yy_current_state = (int) yy_def[yy_current_state];
00612                 if ( yy_current_state >= 37 )
00613                     yy_c = yy_meta[(unsigned int) yy_c];
00614                 }
00615             yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
00616             ++yy_cp;
00617             }
00618         while ( yy_current_state != 36 );
00619         yy_cp = (yy_last_accepting_cpos);
00620         yy_current_state = (yy_last_accepting_state);
00621 
00622 yy_find_action:
00623         yy_act = yy_accept[yy_current_state];
00624 
00625         YY_DO_BEFORE_ACTION;
00626 
00627 do_action:  /* This label is used only to access EOF actions. */
00628 
00629         switch ( yy_act )
00630     { /* beginning of action switch */
00631             case 0: /* must back up */
00632             /* undo the effects of YY_DO_BEFORE_ACTION */
00633             *yy_cp = (yy_hold_char);
00634             yy_cp = (yy_last_accepting_cpos);
00635             yy_current_state = (yy_last_accepting_state);
00636             goto yy_find_action;
00637 
00638 case 1:
00639 /* rule 1 can match eol */
00640 YY_RULE_SETUP
00641 #line 55 "tclexer.ll"
00642 complete_token(token, params);  clear_vars();
00643     YY_BREAK
00644 case 2:
00645 YY_RULE_SETUP
00646 #line 56 "tclexer.ll"
00647 token = string(yytext);
00648     YY_BREAK
00649 case 3:
00650 /* rule 3 can match eol */
00651 YY_RULE_SETUP
00652 #line 57 "tclexer.ll"
00653 BEGIN(PARAMKEY);
00654     YY_BREAK
00655 case 4:
00656 YY_RULE_SETUP
00657 #line 58 "tclexer.ll"
00658 params[yytext] = ""; lastkey = strdup(yytext);
00659     YY_BREAK
00660 case 5:
00661 YY_RULE_SETUP
00662 #line 59 "tclexer.ll"
00663 params[lastkey] = string(yytext);
00664     YY_BREAK
00665 case 6:
00666 /* rule 6 can match eol */
00667 YY_RULE_SETUP
00668 #line 60 "tclexer.ll"
00669 BEGIN(PARAMVAL);
00670     YY_BREAK
00671 case 7:
00672 /* rule 7 can match eol */
00673 YY_RULE_SETUP
00674 #line 61 "tclexer.ll"
00675 BEGIN(PARAMKEY);
00676     YY_BREAK
00677 case 8:
00678 /* rule 8 can match eol */
00679 YY_RULE_SETUP
00680 #line 62 "tclexer.ll"
00681 BEGIN(INITIAL);
00682     YY_BREAK
00683 case YY_STATE_EOF(INITIAL):
00684 case YY_STATE_EOF(PARAMKEY):
00685 case YY_STATE_EOF(PARAMVAL):
00686 #line 63 "tclexer.ll"
00687 final_type(token, params); clear_vars(); return 0;
00688     YY_BREAK
00689 case 9:
00690 YY_RULE_SETUP
00691 #line 65 "tclexer.ll"
00692 ECHO;
00693     YY_BREAK
00694 #line 695 "tclexer.cc"
00695 
00696     case YY_END_OF_BUFFER:
00697         {
00698         /* Amount of text matched not including the EOB char. */
00699         int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
00700 
00701         /* Undo the effects of YY_DO_BEFORE_ACTION. */
00702         *yy_cp = (yy_hold_char);
00703         YY_RESTORE_YY_MORE_OFFSET
00704 
00705         if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
00706             {
00707             /* We're scanning a new file or input source.  It's
00708              * possible that this happened because the user
00709              * just pointed yyin at a new source and called
00710              * yylex().  If so, then we have to assure
00711              * consistency between YY_CURRENT_BUFFER and our
00712              * globals.  Here is the right place to do so, because
00713              * this is the first action (other than possibly a
00714              * back-up) that will match for the new input source.
00715              */
00716             (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
00717             YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
00718             YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
00719             }
00720 
00721         /* Note that here we test for yy_c_buf_p "<=" to the position
00722          * of the first EOB in the buffer, since yy_c_buf_p will
00723          * already have been incremented past the NUL character
00724          * (since all states make transitions on EOB to the
00725          * end-of-buffer state).  Contrast this with the test
00726          * in input().
00727          */
00728         if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
00729             { /* This was really a NUL. */
00730             yy_state_type yy_next_state;
00731 
00732             (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
00733 
00734             yy_current_state = yy_get_previous_state(  );
00735 
00736             /* Okay, we're now positioned to make the NUL
00737              * transition.  We couldn't have
00738              * yy_get_previous_state() go ahead and do it
00739              * for us because it doesn't know how to deal
00740              * with the possibility of jamming (and we don't
00741              * want to build jamming into it because then it
00742              * will run more slowly).
00743              */
00744 
00745             yy_next_state = yy_try_NUL_trans( yy_current_state );
00746 
00747             yy_bp = (yytext_ptr) + YY_MORE_ADJ;
00748 
00749             if ( yy_next_state )
00750                 {
00751                 /* Consume the NUL. */
00752                 yy_cp = ++(yy_c_buf_p);
00753                 yy_current_state = yy_next_state;
00754                 goto yy_match;
00755                 }
00756 
00757             else
00758                 {
00759                 yy_cp = (yy_last_accepting_cpos);
00760                 yy_current_state = (yy_last_accepting_state);
00761                 goto yy_find_action;
00762                 }
00763             }
00764 
00765         else switch ( yy_get_next_buffer(  ) )
00766             {
00767             case EOB_ACT_END_OF_FILE:
00768                 {
00769                 (yy_did_buffer_switch_on_eof) = 0;
00770 
00771                 if ( yywrap(  ) )
00772                     {
00773                     /* Note: because we've taken care in
00774                      * yy_get_next_buffer() to have set up
00775                      * yytext, we can now set up
00776                      * yy_c_buf_p so that if some total
00777                      * hoser (like flex itself) wants to
00778                      * call the scanner after we return the
00779                      * YY_NULL, it'll still work - another
00780                      * YY_NULL will get returned.
00781                      */
00782                     (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
00783 
00784                     yy_act = YY_STATE_EOF(YY_START);
00785                     goto do_action;
00786                     }
00787 
00788                 else
00789                     {
00790                     if ( ! (yy_did_buffer_switch_on_eof) )
00791                         YY_NEW_FILE;
00792                     }
00793                 break;
00794                 }
00795 
00796             case EOB_ACT_CONTINUE_SCAN:
00797                 (yy_c_buf_p) =
00798                     (yytext_ptr) + yy_amount_of_matched_text;
00799 
00800                 yy_current_state = yy_get_previous_state(  );
00801 
00802                 yy_cp = (yy_c_buf_p);
00803                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
00804                 goto yy_match;
00805 
00806             case EOB_ACT_LAST_MATCH:
00807                 (yy_c_buf_p) =
00808                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
00809 
00810                 yy_current_state = yy_get_previous_state(  );
00811 
00812                 yy_cp = (yy_c_buf_p);
00813                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
00814                 goto yy_find_action;
00815             }
00816         break;
00817         }
00818 
00819     default:
00820         YY_FATAL_ERROR(
00821             "fatal flex scanner internal error--no action found" );
00822     } /* end of action switch */
00823         } /* end of scanning one token */
00824 } /* end of yylex */
00825 
00826 yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
00827 {
00828     yyin = arg_yyin;
00829     yyout = arg_yyout;
00830     yy_c_buf_p = 0;
00831     yy_init = 1;
00832     yy_start = 0;
00833     yy_flex_debug = 0;
00834     yylineno = 1;   // this will only get updated if %option yylineno
00835 
00836     yy_did_buffer_switch_on_eof = 0;
00837 
00838     yy_looking_for_trail_begin = 0;
00839     yy_more_flag = 0;
00840     yy_more_len = 0;
00841     yy_more_offset = yy_prev_more_offset = 0;
00842 
00843     yy_start_stack_ptr = yy_start_stack_depth = 0;
00844     yy_start_stack = 0;
00845 
00846     (yy_buffer_stack) = 0;
00847     (yy_buffer_stack_top) = 0;
00848     (yy_buffer_stack_max) = 0;
00849 
00850     yy_state_buf = 0;
00851 
00852 }
00853 
00854 yyFlexLexer::~yyFlexLexer()
00855 {
00856     delete [] yy_state_buf;
00857     tcfree(yy_start_stack  );
00858     yy_delete_buffer( YY_CURRENT_BUFFER );
00859 }
00860 
00861 void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
00862 {
00863     if ( new_in )
00864         {
00865         yy_delete_buffer( YY_CURRENT_BUFFER );
00866         yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE  ) );
00867         }
00868 
00869     if ( new_out )
00870         yyout = new_out;
00871 }
00872 
00873 #ifdef YY_INTERACTIVE
00874 int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
00875 #else
00876 int yyFlexLexer::LexerInput( char* buf, int max_size )
00877 #endif
00878 {
00879     if ( yyin->eof() || yyin->fail() )
00880         return 0;
00881 
00882 #ifdef YY_INTERACTIVE
00883     yyin->get( buf[0] );
00884 
00885     if ( yyin->eof() )
00886         return 0;
00887 
00888     if ( yyin->bad() )
00889         return -1;
00890 
00891     return 1;
00892 
00893 #else
00894     (void) yyin->read( buf, max_size );
00895 
00896     if ( yyin->bad() )
00897         return -1;
00898     else
00899         return yyin->gcount();
00900 #endif
00901 }
00902 
00903 void yyFlexLexer::LexerOutput( const char* buf, int size )
00904 {
00905     (void) yyout->write( buf, size );
00906 }
00907 
00908 /* yy_get_next_buffer - try to read in a new buffer
00909  *
00910  * Returns a code representing an action:
00911  *  EOB_ACT_LAST_MATCH -
00912  *  EOB_ACT_CONTINUE_SCAN - continue scanning from current position
00913  *  EOB_ACT_END_OF_FILE - end of file
00914  */
00915 int yyFlexLexer::yy_get_next_buffer()
00916 {
00917         register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
00918     register char *source = (yytext_ptr);
00919     register int number_to_move, i;
00920     int ret_val;
00921 
00922     if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
00923         YY_FATAL_ERROR(
00924         "fatal flex scanner internal error--end of buffer missed" );
00925 
00926     if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
00927         { /* Don't try to fill the buffer, so this is an EOF. */
00928         if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
00929             {
00930             /* We matched a single character, the EOB, so
00931              * treat this as a final EOF.
00932              */
00933             return EOB_ACT_END_OF_FILE;
00934             }
00935 
00936         else
00937             {
00938             /* We matched some text prior to the EOB, first
00939              * process it.
00940              */
00941             return EOB_ACT_LAST_MATCH;
00942             }
00943         }
00944 
00945     /* Try to read more data. */
00946 
00947     /* First move last chars to start of buffer. */
00948     number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
00949 
00950     for ( i = 0; i < number_to_move; ++i )
00951         *(dest++) = *(source++);
00952 
00953     if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
00954         /* don't do the read, it's not guaranteed to return an EOF,
00955          * just force an EOF
00956          */
00957         YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
00958 
00959     else
00960         {
00961             size_t num_to_read =
00962             YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
00963 
00964         while ( num_to_read <= 0 )
00965             { /* Not enough room in the buffer - grow it. */
00966 
00967             /* just a shorter name for the current buffer */
00968             YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
00969 
00970             int yy_c_buf_p_offset =
00971                 (int) ((yy_c_buf_p) - b->yy_ch_buf);
00972 
00973             if ( b->yy_is_our_buffer )
00974                 {
00975                 int new_size = b->yy_buf_size * 2;
00976 
00977                 if ( new_size <= 0 )
00978                     b->yy_buf_size += b->yy_buf_size / 8;
00979                 else
00980                     b->yy_buf_size *= 2;
00981 
00982                 b->yy_ch_buf = (char *)
00983                     /* Include room in for 2 EOB chars. */
00984                     tcrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
00985                 }
00986             else
00987                 /* Can't grow it, we don't own it. */
00988                 b->yy_ch_buf = 0;
00989 
00990             if ( ! b->yy_ch_buf )
00991                 YY_FATAL_ERROR(
00992                 "fatal error - scanner input buffer overflow" );
00993 
00994             (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
00995 
00996             num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
00997                         number_to_move - 1;
00998 
00999             }
01000 
01001         if ( num_to_read > YY_READ_BUF_SIZE )
01002             num_to_read = YY_READ_BUF_SIZE;
01003 
01004         /* Read in more data. */
01005         YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
01006             (yy_n_chars), num_to_read );
01007 
01008         YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
01009         }
01010 
01011     if ( (yy_n_chars) == 0 )
01012         {
01013         if ( number_to_move == YY_MORE_ADJ )
01014             {
01015             ret_val = EOB_ACT_END_OF_FILE;
01016             yyrestart( yyin  );
01017             }
01018 
01019         else
01020             {
01021             ret_val = EOB_ACT_LAST_MATCH;
01022             YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
01023                 YY_BUFFER_EOF_PENDING;
01024             }
01025         }
01026 
01027     else
01028         ret_val = EOB_ACT_CONTINUE_SCAN;
01029 
01030     (yy_n_chars) += number_to_move;
01031     YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
01032     YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
01033 
01034     (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
01035 
01036     return ret_val;
01037 }
01038 
01039 /* yy_get_previous_state - get the state just before the EOB char was reached */
01040 
01041     yy_state_type yyFlexLexer::yy_get_previous_state()
01042 {
01043     register yy_state_type yy_current_state;
01044     register char *yy_cp;
01045     
01046     yy_current_state = (yy_start);
01047 
01048     for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
01049         {
01050         register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
01051         if ( yy_accept[yy_current_state] )
01052             {
01053             (yy_last_accepting_state) = yy_current_state;
01054             (yy_last_accepting_cpos) = yy_cp;
01055             }
01056         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01057             {
01058             yy_current_state = (int) yy_def[yy_current_state];
01059             if ( yy_current_state >= 37 )
01060                 yy_c = yy_meta[(unsigned int) yy_c];
01061             }
01062         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01063         }
01064 
01065     return yy_current_state;
01066 }
01067 
01068 /* yy_try_NUL_trans - try to make a transition on the NUL character
01069  *
01070  * synopsis
01071  *  next_state = yy_try_NUL_trans( current_state );
01072  */
01073     yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
01074 {
01075     register int yy_is_jam;
01076         register char *yy_cp = (yy_c_buf_p);
01077 
01078     register YY_CHAR yy_c = 1;
01079     if ( yy_accept[yy_current_state] )
01080         {
01081         (yy_last_accepting_state) = yy_current_state;
01082         (yy_last_accepting_cpos) = yy_cp;
01083         }
01084     while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01085         {
01086         yy_current_state = (int) yy_def[yy_current_state];
01087         if ( yy_current_state >= 37 )
01088             yy_c = yy_meta[(unsigned int) yy_c];
01089         }
01090     yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01091     yy_is_jam = (yy_current_state == 36);
01092 
01093     return yy_is_jam ? 0 : yy_current_state;
01094 }
01095 
01096     void yyFlexLexer::yyunput( int c, register char* yy_bp)
01097 {
01098     register char *yy_cp;
01099     
01100     yy_cp = (yy_c_buf_p);
01101 
01102     /* undo effects of setting up yytext */
01103     *yy_cp = (yy_hold_char);
01104 
01105     if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
01106         { /* need to shift things up to make room */
01107         /* +2 for EOB chars. */
01108         register int number_to_move = (yy_n_chars) + 2;
01109         register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
01110                     YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
01111         register char *source =
01112                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
01113 
01114         while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
01115             *--dest = *--source;
01116 
01117         yy_cp += (int) (dest - source);
01118         yy_bp += (int) (dest - source);
01119         YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
01120             (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
01121 
01122         if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
01123             YY_FATAL_ERROR( "flex scanner push-back overflow" );
01124         }
01125 
01126     *--yy_cp = (char) c;
01127 
01128     (yytext_ptr) = yy_bp;
01129     (yy_hold_char) = *yy_cp;
01130     (yy_c_buf_p) = yy_cp;
01131 }
01132 
01133     int yyFlexLexer::yyinput()
01134 {
01135     int c;
01136     
01137     *(yy_c_buf_p) = (yy_hold_char);
01138 
01139     if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
01140         {
01141         /* yy_c_buf_p now points to the character we want to return.
01142          * If this occurs *before* the EOB characters, then it's a
01143          * valid NUL; if not, then we've hit the end of the buffer.
01144          */
01145         if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
01146             /* This was really a NUL. */
01147             *(yy_c_buf_p) = '\0';
01148 
01149         else
01150             { /* need more input */
01151             int offset = (yy_c_buf_p) - (yytext_ptr);
01152             ++(yy_c_buf_p);
01153 
01154             switch ( yy_get_next_buffer(  ) )
01155                 {
01156                 case EOB_ACT_LAST_MATCH:
01157                     /* This happens because yy_g_n_b()
01158                      * sees that we've accumulated a
01159                      * token and flags that we need to
01160                      * try matching the token before
01161                      * proceeding.  But for input(),
01162                      * there's no matching to consider.
01163                      * So convert the EOB_ACT_LAST_MATCH
01164                      * to EOB_ACT_END_OF_FILE.
01165                      */
01166 
01167                     /* Reset buffer status. */
01168                     yyrestart( yyin );
01169 
01170                     /*FALLTHROUGH*/
01171 
01172                 case EOB_ACT_END_OF_FILE:
01173                     {
01174                     if ( yywrap(  ) )
01175                         return EOF;
01176 
01177                     if ( ! (yy_did_buffer_switch_on_eof) )
01178                         YY_NEW_FILE;
01179 #ifdef __cplusplus
01180                     return yyinput();
01181 #else
01182                     return input();
01183 #endif
01184                     }
01185 
01186                 case EOB_ACT_CONTINUE_SCAN:
01187                     (yy_c_buf_p) = (yytext_ptr) + offset;
01188                     break;
01189                 }
01190             }
01191         }
01192 
01193     c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
01194     *(yy_c_buf_p) = '\0';   /* preserve yytext */
01195     (yy_hold_char) = *++(yy_c_buf_p);
01196 
01197     return c;
01198 }
01199 
01200 /** Immediately switch to a different input stream.
01201  * @param input_file A readable stream.
01202  * 
01203  * @note This function does not reset the start condition to @c INITIAL .
01204  */
01205     void yyFlexLexer::yyrestart( std::istream* input_file )
01206 {
01207     
01208     if ( ! YY_CURRENT_BUFFER ){
01209         yyensure_buffer_stack ();
01210         YY_CURRENT_BUFFER_LVALUE =
01211             yy_create_buffer( yyin, YY_BUF_SIZE );
01212     }
01213 
01214     yy_init_buffer( YY_CURRENT_BUFFER, input_file );
01215     yy_load_buffer_state(  );
01216 }
01217 
01218 /** Switch to a different input buffer.
01219  * @param new_buffer The new input buffer.
01220  * 
01221  */
01222     void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
01223 {
01224     
01225     /* TODO. We should be able to replace this entire function body
01226      * with
01227      *      yypop_buffer_state();
01228      *      yypush_buffer_state(new_buffer);
01229      */
01230     yyensure_buffer_stack ();
01231     if ( YY_CURRENT_BUFFER == new_buffer )
01232         return;
01233 
01234     if ( YY_CURRENT_BUFFER )
01235         {
01236         /* Flush out information for old buffer. */
01237         *(yy_c_buf_p) = (yy_hold_char);
01238         YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
01239         YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
01240         }
01241 
01242     YY_CURRENT_BUFFER_LVALUE = new_buffer;
01243     yy_load_buffer_state(  );
01244 
01245     /* We don't actually know whether we did this switch during
01246      * EOF (yywrap()) processing, but the only time this flag
01247      * is looked at is after yywrap() is called, so it's safe
01248      * to go ahead and always set it.
01249      */
01250     (yy_did_buffer_switch_on_eof) = 1;
01251 }
01252 
01253     void yyFlexLexer::yy_load_buffer_state()
01254 {
01255         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
01256     (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
01257     yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
01258     (yy_hold_char) = *(yy_c_buf_p);
01259 }
01260 
01261 /** Allocate and initialize an input buffer state.
01262  * @param file A readable stream.
01263  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
01264  * 
01265  * @return the allocated buffer state.
01266  */
01267     YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
01268 {
01269     YY_BUFFER_STATE b;
01270     
01271     b = (YY_BUFFER_STATE) tcalloc(sizeof( struct yy_buffer_state )  );
01272     if ( ! b )
01273         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
01274 
01275     b->yy_buf_size = size;
01276 
01277     /* yy_ch_buf has to be 2 characters longer than the size given because
01278      * we need to put in 2 end-of-buffer characters.
01279      */
01280     b->yy_ch_buf = (char *) tcalloc(b->yy_buf_size + 2  );
01281     if ( ! b->yy_ch_buf )
01282         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
01283 
01284     b->yy_is_our_buffer = 1;
01285 
01286     yy_init_buffer( b, file );
01287 
01288     return b;
01289 }
01290 
01291 /** Destroy the buffer.
01292  * @param b a buffer created with yy_create_buffer()
01293  * 
01294  */
01295     void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
01296 {
01297     
01298     if ( ! b )
01299         return;
01300 
01301     if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
01302         YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
01303 
01304     if ( b->yy_is_our_buffer )
01305         tcfree((void *) b->yy_ch_buf  );
01306 
01307     tcfree((void *) b  );
01308 }
01309 
01310 /* Initializes or reinitializes a buffer.
01311  * This function is sometimes called more than once on the same buffer,
01312  * such as during a yyrestart() or at EOF.
01313  */
01314     void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
01315 
01316 {
01317     int oerrno = errno;
01318     
01319     yy_flush_buffer( b );
01320 
01321     b->yy_input_file = file;
01322     b->yy_fill_buffer = 1;
01323 
01324     /* If b is the current buffer, then yy_init_buffer was _probably_
01325      * called from yyrestart() or through yy_get_next_buffer.
01326      * In that case, we don't want to reset the lineno or column.
01327      */
01328     if (b != YY_CURRENT_BUFFER){
01329         b->yy_bs_lineno = 1;
01330         b->yy_bs_column = 0;
01331     }
01332 
01333     b->yy_is_interactive = 0;
01334     errno = oerrno;
01335 }
01336 
01337 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
01338  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
01339  * 
01340  */
01341     void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
01342 {
01343         if ( ! b )
01344         return;
01345 
01346     b->yy_n_chars = 0;
01347 
01348     /* We always need two end-of-buffer characters.  The first causes
01349      * a transition to the end-of-buffer state.  The second causes
01350      * a jam in that state.
01351      */
01352     b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
01353     b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
01354 
01355     b->yy_buf_pos = &b->yy_ch_buf[0];
01356 
01357     b->yy_at_bol = 1;
01358     b->yy_buffer_status = YY_BUFFER_NEW;
01359 
01360     if ( b == YY_CURRENT_BUFFER )
01361         yy_load_buffer_state(  );
01362 }
01363 
01364 /** Pushes the new state onto the stack. The new state becomes
01365  *  the current state. This function will allocate the stack
01366  *  if necessary.
01367  *  @param new_buffer The new state.
01368  *  
01369  */
01370 void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
01371 {
01372         if (new_buffer == NULL)
01373         return;
01374 
01375     yyensure_buffer_stack();
01376 
01377     /* This block is copied from yy_switch_to_buffer. */
01378     if ( YY_CURRENT_BUFFER )
01379         {
01380         /* Flush out information for old buffer. */
01381         *(yy_c_buf_p) = (yy_hold_char);
01382         YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
01383         YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
01384         }
01385 
01386     /* Only push if top exists. Otherwise, replace top. */
01387     if (YY_CURRENT_BUFFER)
01388         (yy_buffer_stack_top)++;
01389     YY_CURRENT_BUFFER_LVALUE = new_buffer;
01390 
01391     /* copied from yy_switch_to_buffer. */
01392     yy_load_buffer_state(  );
01393     (yy_did_buffer_switch_on_eof) = 1;
01394 }
01395 
01396 /** Removes and deletes the top of the stack, if present.
01397  *  The next element becomes the new top.
01398  *  
01399  */
01400 void yyFlexLexer::yypop_buffer_state (void)
01401 {
01402         if (!YY_CURRENT_BUFFER)
01403         return;
01404 
01405     yy_delete_buffer(YY_CURRENT_BUFFER );
01406     YY_CURRENT_BUFFER_LVALUE = NULL;
01407     if ((yy_buffer_stack_top) > 0)
01408         --(yy_buffer_stack_top);
01409 
01410     if (YY_CURRENT_BUFFER) {
01411         yy_load_buffer_state(  );
01412         (yy_did_buffer_switch_on_eof) = 1;
01413     }
01414 }
01415 
01416 /* Allocates the stack if it does not exist.
01417  *  Guarantees space for at least one push.
01418  */
01419 void yyFlexLexer::yyensure_buffer_stack(void)
01420 {
01421     int num_to_alloc;
01422     
01423     if (!(yy_buffer_stack)) {
01424 
01425         /* First allocation is just for 2 elements, since we don't know if this
01426          * scanner will even need a stack. We use 2 instead of 1 to avoid an
01427          * immediate realloc on the next call.
01428          */
01429         num_to_alloc = 1;
01430         (yy_buffer_stack) = (struct yy_buffer_state**)tcalloc
01431                                 (num_to_alloc * sizeof(struct yy_buffer_state*)
01432                                 );
01433         
01434         memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
01435                 
01436         (yy_buffer_stack_max) = num_to_alloc;
01437         (yy_buffer_stack_top) = 0;
01438         return;
01439     }
01440 
01441     if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
01442 
01443         /* Increase the buffer to prepare for a possible push. */
01444         int grow_size = 8 /* arbitrary grow size */;
01445 
01446         num_to_alloc = (yy_buffer_stack_max) + grow_size;
01447         (yy_buffer_stack) = (struct yy_buffer_state**)tcrealloc
01448                                 ((yy_buffer_stack),
01449                                 num_to_alloc * sizeof(struct yy_buffer_state*)
01450                                 );
01451 
01452         /* zero only the new slots.*/
01453         memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
01454         (yy_buffer_stack_max) = num_to_alloc;
01455     }
01456 }
01457 
01458     void yyFlexLexer::yy_push_state( int new_state )
01459 {
01460         if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
01461         {
01462         yy_size_t new_size;
01463 
01464         (yy_start_stack_depth) += YY_START_STACK_INCR;
01465         new_size = (yy_start_stack_depth) * sizeof( int );
01466 
01467         if ( ! (yy_start_stack) )
01468             (yy_start_stack) = (int *) tcalloc(new_size  );
01469 
01470         else
01471             (yy_start_stack) = (int *) tcrealloc((void *) (yy_start_stack),new_size  );
01472 
01473         if ( ! (yy_start_stack) )
01474             YY_FATAL_ERROR(
01475             "out of memory expanding start-condition stack" );
01476         }
01477 
01478     (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
01479 
01480     BEGIN(new_state);
01481 }
01482 
01483     void yyFlexLexer::yy_pop_state()
01484 {
01485         if ( --(yy_start_stack_ptr) < 0 )
01486         YY_FATAL_ERROR( "start-condition stack underflow" );
01487 
01488     BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
01489 }
01490 
01491     int yyFlexLexer::yy_top_state()
01492 {
01493         return (yy_start_stack)[(yy_start_stack_ptr) - 1];
01494 }
01495 
01496 #ifndef YY_EXIT_FAILURE
01497 #define YY_EXIT_FAILURE 2
01498 #endif
01499 
01500 void yyFlexLexer::LexerError( yyconst char msg[] )
01501 {
01502         std::cerr << msg << std::endl;
01503     exit( YY_EXIT_FAILURE );
01504 }
01505 
01506 /* Redefine yyless() so it works in section 3 code. */
01507 
01508 #undef yyless
01509 #define yyless(n) \
01510     do \
01511         { \
01512         /* Undo effects of setting up yytext. */ \
01513         int yyless_macro_arg = (n); \
01514         YY_LESS_LINENO(yyless_macro_arg);\
01515         yytext[yyleng] = (yy_hold_char); \
01516         (yy_c_buf_p) = yytext + yyless_macro_arg; \
01517         (yy_hold_char) = *(yy_c_buf_p); \
01518         *(yy_c_buf_p) = '\0'; \
01519         yyleng = yyless_macro_arg; \
01520         } \
01521     while ( 0 )
01522 
01523 /* Accessor  methods (get/set functions) to struct members. */
01524 
01525 /*
01526  * Internal utility routines.
01527  */
01528 
01529 #ifndef yytext_ptr
01530 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
01531 {
01532     register int i;
01533         for ( i = 0; i < n; ++i )
01534         s1[i] = s2[i];
01535 }
01536 #endif
01537 
01538 #ifdef YY_NEED_STRLEN
01539 static int yy_flex_strlen (yyconst char * s )
01540 {
01541     register int n;
01542         for ( n = 0; s[n]; ++n )
01543         ;
01544 
01545     return n;
01546 }
01547 #endif
01548 
01549 void *tcalloc (yy_size_t  size )
01550 {
01551     return (void *) malloc( size );
01552 }
01553 
01554 void *tcrealloc  (void * ptr, yy_size_t  size )
01555 {
01556     /* The cast to (char *) in the following accommodates both
01557      * implementations that use char* generic pointers, and those
01558      * that use void* generic pointers.  It works with the latter
01559      * because both ANSI C and C++ allow castless assignment from
01560      * any pointer type to void*, and deal with argument conversions
01561      * as though doing an assignment.
01562      */
01563     return (void *) realloc( (char *) ptr, size );
01564 }
01565 
01566 void tcfree (void * ptr )
01567 {
01568     free( (char *) ptr );   /* see tcrealloc() for (char *) cast */
01569 }
01570 
01571 #define YYTABLES_NAME "yytables"
01572 
01573 #undef YY_NEW_FILE
01574 #undef YY_FLUSH_BUFFER
01575 #undef yy_set_bol
01576 #undef yy_new_buffer
01577 #undef yy_set_interactive
01578 #undef yytext_ptr
01579 #undef YY_DO_BEFORE_ACTION
01580 
01581 #ifdef YY_DECL_IS_OURS
01582 #undef YY_DECL_IS_OURS
01583 #undef YY_DECL
01584 #endif
01585 #line 65 "tclexer.ll"
01586 
01587 
01588 
01589 
01590 #ifdef TESTING
01591 /* Testing: */
01592 
01593 class TestingTypechainLexer : public TypechainLexer {
01594 
01595 public:
01596     TestingTypechainLexer(string s) : TypechainLexer(s) {
01597     }
01598 
01599     void print_params(map<string,string> params) {
01600         for(map<string,string>::const_iterator i = params.begin(); i != params.end(); i++) {
01601             printf("\tkey: '%s'  val: '%s'\n", i->first.c_str(), i->second.c_str());
01602         }
01603     }
01604 
01605     void complete_token(string token, map<string, string> params) {
01606         printf("complete_token: '%s'. params:\n", token.c_str());
01607         print_params(params);
01608     }
01609 
01610     void final_type(string token, map<string, string> params) {
01611         printf("final_type: '%s'. params:\n", token.c_str());
01612         print_params(params);
01613     }
01614 
01615 
01616 };
01617 
01618 
01619 int main() {
01620     TestingTypechainLexer lexer("hello; \n world(foo= bar\t, baz  ) |      la/la");
01621     lexer.yylex();
01622     return 0;
01623 }
01624 
01625 #endif //ifdef TESTING
01626 
01627 

Generated on Tue Aug 12 03:55:38 2003 for Interreality Project - VOS by doxygen 1.3.2