Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. #line 2 "glcpp/glcpp-lex.c"
  2.  
  3. #line 4 "glcpp/glcpp-lex.c"
  4.  
  5. #define  YY_INT_ALIGNED short int
  6.  
  7. /* A lexical scanner generated by flex */
  8.  
  9. #define FLEX_SCANNER
  10. #define YY_FLEX_MAJOR_VERSION 2
  11. #define YY_FLEX_MINOR_VERSION 5
  12. #define YY_FLEX_SUBMINOR_VERSION 39
  13. #if YY_FLEX_SUBMINOR_VERSION > 0
  14. #define FLEX_BETA
  15. #endif
  16.  
  17. /* First, we deal with  platform-specific or compiler-specific issues. */
  18.  
  19. /* begin standard C headers. */
  20. #include <stdio.h>
  21. #include <string.h>
  22. #include <errno.h>
  23. #include <stdlib.h>
  24.  
  25. /* end standard C headers. */
  26.  
  27. /* flex integer type definitions */
  28.  
  29. #ifndef FLEXINT_H
  30. #define FLEXINT_H
  31.  
  32. /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
  33.  
  34. #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  35.  
  36. /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
  37.  * if you want the limit (max/min) macros for int types.
  38.  */
  39. #ifndef __STDC_LIMIT_MACROS
  40. #define __STDC_LIMIT_MACROS 1
  41. #endif
  42.  
  43. #include <inttypes.h>
  44. typedef int8_t flex_int8_t;
  45. typedef uint8_t flex_uint8_t;
  46. typedef int16_t flex_int16_t;
  47. typedef uint16_t flex_uint16_t;
  48. typedef int32_t flex_int32_t;
  49. typedef uint32_t flex_uint32_t;
  50. #else
  51. typedef signed char flex_int8_t;
  52. typedef short int flex_int16_t;
  53. typedef int flex_int32_t;
  54. typedef unsigned char flex_uint8_t;
  55. typedef unsigned short int flex_uint16_t;
  56. typedef unsigned int flex_uint32_t;
  57.  
  58. /* Limits of integral types. */
  59. #ifndef INT8_MIN
  60. #define INT8_MIN               (-128)
  61. #endif
  62. #ifndef INT16_MIN
  63. #define INT16_MIN              (-32767-1)
  64. #endif
  65. #ifndef INT32_MIN
  66. #define INT32_MIN              (-2147483647-1)
  67. #endif
  68. #ifndef INT8_MAX
  69. #define INT8_MAX               (127)
  70. #endif
  71. #ifndef INT16_MAX
  72. #define INT16_MAX              (32767)
  73. #endif
  74. #ifndef INT32_MAX
  75. #define INT32_MAX              (2147483647)
  76. #endif
  77. #ifndef UINT8_MAX
  78. #define UINT8_MAX              (255U)
  79. #endif
  80. #ifndef UINT16_MAX
  81. #define UINT16_MAX             (65535U)
  82. #endif
  83. #ifndef UINT32_MAX
  84. #define UINT32_MAX             (4294967295U)
  85. #endif
  86.  
  87. #endif /* ! C99 */
  88.  
  89. #endif /* ! FLEXINT_H */
  90.  
  91. #ifdef __cplusplus
  92.  
  93. /* The "const" storage-class-modifier is valid. */
  94. #define YY_USE_CONST
  95.  
  96. #else   /* ! __cplusplus */
  97.  
  98. /* C99 requires __STDC__ to be defined as 1. */
  99. #if defined (__STDC__)
  100.  
  101. #define YY_USE_CONST
  102.  
  103. #endif  /* defined (__STDC__) */
  104. #endif  /* ! __cplusplus */
  105.  
  106. #ifdef YY_USE_CONST
  107. #define yyconst const
  108. #else
  109. #define yyconst
  110. #endif
  111.  
  112. /* Returned upon end-of-file. */
  113. #define YY_NULL 0
  114.  
  115. /* Promotes a possibly negative, possibly signed char to an unsigned
  116.  * integer for use as an array index.  If the signed char is negative,
  117.  * we want to instead treat it as an 8-bit unsigned char, hence the
  118.  * double cast.
  119.  */
  120. #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
  121.  
  122. /* An opaque pointer. */
  123. #ifndef YY_TYPEDEF_YY_SCANNER_T
  124. #define YY_TYPEDEF_YY_SCANNER_T
  125. typedef void* yyscan_t;
  126. #endif
  127.  
  128. /* For convenience, these vars (plus the bison vars far below)
  129.    are macros in the reentrant scanner. */
  130. #define yyin yyg->yyin_r
  131. #define yyout yyg->yyout_r
  132. #define yyextra yyg->yyextra_r
  133. #define yyleng yyg->yyleng_r
  134. #define yytext yyg->yytext_r
  135. #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
  136. #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
  137. #define yy_flex_debug yyg->yy_flex_debug_r
  138.  
  139. /* Enter a start condition.  This macro really ought to take a parameter,
  140.  * but we do it the disgusting crufty way forced on us by the ()-less
  141.  * definition of BEGIN.
  142.  */
  143. #define BEGIN yyg->yy_start = 1 + 2 *
  144.  
  145. /* Translate the current start state into a value that can be later handed
  146.  * to BEGIN to return to the state.  The YYSTATE alias is for lex
  147.  * compatibility.
  148.  */
  149. #define YY_START ((yyg->yy_start - 1) / 2)
  150. #define YYSTATE YY_START
  151.  
  152. /* Action number for EOF rule of a given start state. */
  153. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  154.  
  155. /* Special action meaning "start processing a new file". */
  156. #define YY_NEW_FILE glcpp_restart(yyin ,yyscanner )
  157.  
  158. #define YY_END_OF_BUFFER_CHAR 0
  159.  
  160. /* Size of default input buffer. */
  161. #ifndef YY_BUF_SIZE
  162. #define YY_BUF_SIZE 16384
  163. #endif
  164.  
  165. /* The state buf must be large enough to hold one state per character in the main buffer.
  166.  */
  167. #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
  168.  
  169. #ifndef YY_TYPEDEF_YY_BUFFER_STATE
  170. #define YY_TYPEDEF_YY_BUFFER_STATE
  171. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  172. #endif
  173.  
  174. #ifndef YY_TYPEDEF_YY_SIZE_T
  175. #define YY_TYPEDEF_YY_SIZE_T
  176. typedef size_t yy_size_t;
  177. #endif
  178.  
  179. #define EOB_ACT_CONTINUE_SCAN 0
  180. #define EOB_ACT_END_OF_FILE 1
  181. #define EOB_ACT_LAST_MATCH 2
  182.  
  183.     #define YY_LESS_LINENO(n)
  184.     #define YY_LINENO_REWIND_TO(ptr)
  185.    
  186. /* Return all but the first "n" matched characters back to the input stream. */
  187. #define yyless(n) \
  188.         do \
  189.                 { \
  190.                 /* Undo effects of setting up yytext. */ \
  191.         int yyless_macro_arg = (n); \
  192.         YY_LESS_LINENO(yyless_macro_arg);\
  193.                 *yy_cp = yyg->yy_hold_char; \
  194.                 YY_RESTORE_YY_MORE_OFFSET \
  195.                 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
  196.                 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  197.                 } \
  198.         while ( 0 )
  199.  
  200. #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
  201.  
  202. #ifndef YY_STRUCT_YY_BUFFER_STATE
  203. #define YY_STRUCT_YY_BUFFER_STATE
  204. struct yy_buffer_state
  205.         {
  206.         FILE *yy_input_file;
  207.  
  208.         char *yy_ch_buf;                /* input buffer */
  209.         char *yy_buf_pos;               /* current position in input buffer */
  210.  
  211.         /* Size of input buffer in bytes, not including room for EOB
  212.          * characters.
  213.          */
  214.         yy_size_t yy_buf_size;
  215.  
  216.         /* Number of characters read into yy_ch_buf, not including EOB
  217.          * characters.
  218.          */
  219.         yy_size_t yy_n_chars;
  220.  
  221.         /* Whether we "own" the buffer - i.e., we know we created it,
  222.          * and can realloc() it to grow it, and should free() it to
  223.          * delete it.
  224.          */
  225.         int yy_is_our_buffer;
  226.  
  227.         /* Whether this is an "interactive" input source; if so, and
  228.          * if we're using stdio for input, then we want to use getc()
  229.          * instead of fread(), to make sure we stop fetching input after
  230.          * each newline.
  231.          */
  232.         int yy_is_interactive;
  233.  
  234.         /* Whether we're considered to be at the beginning of a line.
  235.          * If so, '^' rules will be active on the next match, otherwise
  236.          * not.
  237.          */
  238.         int yy_at_bol;
  239.  
  240.     int yy_bs_lineno; /**< The line count. */
  241.     int yy_bs_column; /**< The column count. */
  242.    
  243.         /* Whether to try to fill the input buffer when we reach the
  244.          * end of it.
  245.          */
  246.         int yy_fill_buffer;
  247.  
  248.         int yy_buffer_status;
  249.  
  250. #define YY_BUFFER_NEW 0
  251. #define YY_BUFFER_NORMAL 1
  252.         /* When an EOF's been seen but there's still some text to process
  253.          * then we mark the buffer as YY_EOF_PENDING, to indicate that we
  254.          * shouldn't try reading from the input source any more.  We might
  255.          * still have a bunch of tokens to match, though, because of
  256.          * possible backing-up.
  257.          *
  258.          * When we actually see the EOF, we change the status to "new"
  259.          * (via glcpp_restart()), so that the user can continue scanning by
  260.          * just pointing yyin at a new input file.
  261.          */
  262. #define YY_BUFFER_EOF_PENDING 2
  263.  
  264.         };
  265. #endif /* !YY_STRUCT_YY_BUFFER_STATE */
  266.  
  267. /* We provide macros for accessing buffer states in case in the
  268.  * future we want to put the buffer states in a more general
  269.  * "scanner state".
  270.  *
  271.  * Returns the top of the stack, or NULL.
  272.  */
  273. #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
  274.                           ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
  275.                           : NULL)
  276.  
  277. /* Same as previous macro, but useful when we know that the buffer stack is not
  278.  * NULL or when we need an lvalue. For internal use only.
  279.  */
  280. #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
  281.  
  282. void glcpp_restart (FILE *input_file ,yyscan_t yyscanner );
  283. void glcpp__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
  284. YY_BUFFER_STATE glcpp__create_buffer (FILE *file,int size ,yyscan_t yyscanner );
  285. void glcpp__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
  286. void glcpp__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
  287. void glcpp_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
  288. void glcpp_pop_buffer_state (yyscan_t yyscanner );
  289.  
  290. static void glcpp_ensure_buffer_stack (yyscan_t yyscanner );
  291. static void glcpp__load_buffer_state (yyscan_t yyscanner );
  292. static void glcpp__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
  293.  
  294. #define YY_FLUSH_BUFFER glcpp__flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
  295.  
  296. YY_BUFFER_STATE glcpp__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
  297. YY_BUFFER_STATE glcpp__scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
  298. YY_BUFFER_STATE glcpp__scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner );
  299.  
  300. void *glcpp_alloc (yy_size_t ,yyscan_t yyscanner );
  301. void *glcpp_realloc (void *,yy_size_t ,yyscan_t yyscanner );
  302. void glcpp_free (void * ,yyscan_t yyscanner );
  303.  
  304. #define yy_new_buffer glcpp__create_buffer
  305.  
  306. #define yy_set_interactive(is_interactive) \
  307.         { \
  308.         if ( ! YY_CURRENT_BUFFER ){ \
  309.         glcpp_ensure_buffer_stack (yyscanner); \
  310.                 YY_CURRENT_BUFFER_LVALUE =    \
  311.             glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
  312.         } \
  313.         YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
  314.         }
  315.  
  316. #define yy_set_bol(at_bol) \
  317.         { \
  318.         if ( ! YY_CURRENT_BUFFER ){\
  319.         glcpp_ensure_buffer_stack (yyscanner); \
  320.                 YY_CURRENT_BUFFER_LVALUE =    \
  321.             glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
  322.         } \
  323.         YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
  324.         }
  325.  
  326. #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
  327.  
  328. /* Begin user sect3 */
  329.  
  330. #define glcpp_wrap(yyscanner) 1
  331. #define YY_SKIP_YYWRAP
  332.  
  333. typedef unsigned char YY_CHAR;
  334.  
  335. typedef int yy_state_type;
  336.  
  337. #define yytext_ptr yytext_r
  338.  
  339. static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
  340. static yy_state_type yy_try_NUL_trans (yy_state_type current_state  ,yyscan_t yyscanner);
  341. static int yy_get_next_buffer (yyscan_t yyscanner );
  342. static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
  343.  
  344. /* Done after the current pattern has been matched and before the
  345.  * corresponding action - sets up yytext.
  346.  */
  347. #define YY_DO_BEFORE_ACTION \
  348.         yyg->yytext_ptr = yy_bp; \
  349.         yyleng = (size_t) (yy_cp - yy_bp); \
  350.         yyg->yy_hold_char = *yy_cp; \
  351.         *yy_cp = '\0'; \
  352.         yyg->yy_c_buf_p = yy_cp;
  353.  
  354. #define YY_NUM_RULES 52
  355. #define YY_END_OF_BUFFER 53
  356. /* This struct is not used in this scanner,
  357.    but its presence is necessary. */
  358. struct yy_trans_info
  359.         {
  360.         flex_int32_t yy_verify;
  361.         flex_int32_t yy_nxt;
  362.         };
  363. static yyconst flex_int16_t yy_accept[174] =
  364.     {   0,
  365.         0,    0,    3,    3,    0,    0,    0,    0,    0,    0,
  366.         0,    0,    0,    0,   53,   48,   49,   50,   51,   50,
  367.        47,    8,   47,   47,   47,   47,   47,   47,   31,   30,
  368.        47,   47,   47,   45,   45,   47,    3,    4,    4,    5,
  369.        29,   27,   51,   26,   24,   23,   13,   13,   24,   24,
  370.        24,   24,   24,   24,   24,   24,   48,   50,   38,   43,
  371.        39,   41,   42,   46,    2,    1,   46,   31,   46,   31,
  372.        46,   30,   30,   33,   35,   37,   36,   34,   45,   45,
  373.        40,    3,    4,    4,    4,    5,    6,    6,    5,    7,
  374.        29,   27,   28,    1,   25,   26,   23,   13,    0,    0,
  375.  
  376.         0,    0,    0,    0,    0,    0,    0,    0,    1,   32,
  377.        32,   45,    4,    6,   28,    1,    0,    0,    0,    0,
  378.         0,    0,   16,    0,    0,    0,    0,    0,    0,   32,
  379.        45,    0,    0,   18,    0,    0,    0,    0,    0,    0,
  380.         0,    0,    0,   45,    0,   17,   19,   20,    0,   14,
  381.         0,   12,    0,   22,    0,   45,   21,   20,    0,   15,
  382.        11,    0,   44,   21,    0,   11,   11,   10,    0,    0,
  383.         9,   11,    0
  384.     } ;
  385.  
  386. static yyconst flex_int32_t yy_ec[256] =
  387.     {   0,
  388.         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
  389.         4,    4,    5,    1,    1,    1,    1,    1,    1,    1,
  390.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  391.         1,    2,    6,    1,    7,    1,    8,    9,    1,   10,
  392.         8,   11,   12,    8,   13,   14,   15,   16,   17,   17,
  393.        17,   17,   17,   17,   17,   18,   18,    1,    8,   19,
  394.        20,   21,    1,    1,   22,   22,   22,   22,   23,   22,
  395.        24,   24,   24,   24,   24,   24,   24,   24,   24,   25,
  396.        24,   24,   24,   24,   26,   24,   24,   27,   24,   24,
  397.         8,    1,    8,    8,   24,    1,   28,   22,   22,   29,
  398.  
  399.        30,   31,   32,   24,   33,   24,   24,   34,   35,   36,
  400.        37,   38,   24,   39,   40,   41,   42,   43,   24,   44,
  401.        24,   24,    8,   45,    8,    8,    1,    1,    1,    1,
  402.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  403.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  404.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  405.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  406.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  407.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  408.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  409.  
  410.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  411.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  412.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  413.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  414.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  415.         1,    1,    1,    1,    1
  416.     } ;
  417.  
  418. static yyconst flex_int32_t yy_meta[46] =
  419.     {   0,
  420.         1,    2,    3,    2,    3,    1,    1,    1,    1,    4,
  421.         5,    1,    1,    6,    1,    7,    7,    7,    1,    1,
  422.         1,    7,    7,    7,    7,    7,    7,    7,    8,    7,
  423.         7,    7,    7,    7,    7,    8,    7,    7,    7,    7,
  424.         7,    7,    7,    7,    1
  425.     } ;
  426.  
  427. static yyconst flex_int16_t yy_base[191] =
  428.     {   0,
  429.         0,    0,   43,   44,   55,    0,   47,   48,   99,  141,
  430.       102,  103,  106,  107,  435,  433,  436,  428,  436,  429,
  431.       411,  423,  436,  420,  416,  414,   99,  107,  169,  198,
  432.       100,  406,  103,    0,  395,  379,  122,  418,  419,  144,
  433.         0,  419,  115,  410,  436,  417,  413,  414,  120,  386,
  434.       114,  384,  381,  374,  376,  381,  409,  436,  436,  436,
  435.       436,  436,  436,  138,  436,    0,  139,  164,  197,  126,
  436.       229,    0,  139,  436,  436,  436,  436,  436,    0,  378,
  437.       436,  131,  403,  404,  436,  186,  401,  402,  197,  436,
  438.         0,  402,    0,  163,  436,  393,  400,  436,  370,  133,
  439.  
  440.       371,  360,  357,  169,  361,  368,  366,  355,    0,  146,
  441.       191,  360,  436,  436,    0,  227,  359,  360,  360,  356,
  442.       351,  357,  436,  356,  356,  341,  329,  319,  301,  206,
  443.       304,  297,    0,  436,  297,  288,  276,  280,  268,  261,
  444.       220,  219,  216,  218,  214,  436,  436,    0,  203,  436,
  445.       207,  232,  198,  436,  188,  164,  185,    0,  145,  436,
  446.       251,  124,    0,  155,  117,  227,  259,  436,  138,   85,
  447.       111,  234,  436,  264,  272,  280,  283,  285,  293,  301,
  448.       309,  317,  322,  330,  338,  346,  354,  362,  368,  376
  449.     } ;
  450.  
  451. static yyconst flex_int16_t yy_def[191] =
  452.     {   0,
  453.       173,    1,  174,  174,  173,    5,  175,  175,  176,  176,
  454.       175,  175,  175,  175,  173,  173,  173,  173,  173,  173,
  455.       173,  173,  173,  173,  173,  173,  173,  173,  177,  177,
  456.       173,  173,  173,  178,  178,  173,  179,  173,  173,  180,
  457.       181,  173,  182,  183,  173,  173,  173,  173,  173,  173,
  458.       173,  173,  173,  173,  173,  173,  173,  173,  173,  173,
  459.       173,  173,  173,  177,  173,  184,  177,   30,  177,   69,
  460.        69,   30,   69,  173,  173,  173,  173,  173,  178,  178,
  461.       173,  179,  173,  173,  173,  180,  173,  173,  180,  173,
  462.       181,  173,  185,  186,  173,  183,  173,  173,  173,  173,
  463.  
  464.       173,  173,  173,  187,  173,  173,  173,  173,  184,   71,
  465.        71,  178,  173,  173,  185,  186,  173,  173,  173,  173,
  466.       173,  173,  173,  173,  173,  173,  173,  173,  173,   69,
  467.       178,  173,  188,  173,  173,  173,  173,  173,  173,  173,
  468.       173,  173,  173,  178,  173,  173,  173,  189,  173,  173,
  469.       173,  173,  173,  173,  173,  178,  173,  189,  173,  173,
  470.       190,  173,  178,  173,  173,  190,  190,  173,  173,  173,
  471.       173,  190,    0,  173,  173,  173,  173,  173,  173,  173,
  472.       173,  173,  173,  173,  173,  173,  173,  173,  173,  173
  473.     } ;
  474.  
  475. static yyconst flex_int16_t yy_nxt[482] =
  476.     {   0,
  477.        16,   17,   18,   19,   20,   21,   22,   23,   24,   23,
  478.        23,   25,   26,   27,   28,   29,   30,   30,   31,   32,
  479.        33,   34,   34,   34,   34,   34,   34,   34,   35,   34,
  480.        34,   34,   34,   34,   34,   34,   34,   34,   34,   34,
  481.        34,   34,   34,   34,   36,   38,   38,   39,   39,   18,
  482.        18,   20,   20,   40,   40,   41,   42,   18,   19,   20,
  483.        41,   41,   41,   41,   41,   41,   41,   41,   41,   43,
  484.        41,   41,   41,   41,   41,   41,   44,   44,   44,   44,
  485.        44,   44,   44,   44,   44,   44,   44,   44,   44,   44,
  486.        44,   44,   44,   44,   44,   44,   44,   44,   44,   41,
  487.  
  488.        46,   47,   19,   48,   18,   18,   20,   20,   18,   18,
  489.        20,   20,  171,   49,   64,   64,   64,   65,   74,   75,
  490.       172,   66,   77,   78,   83,   65,   84,   50,   51,   94,
  491.        65,   52,   53,   83,   66,   84,   54,  173,  173,  171,
  492.        55,   56,   46,   47,   19,   48,   87,  100,   88,  101,
  493.       173,  173,  102,  170,   89,   49,  164,  103,   90,  169,
  494.        69,   69,   69,   69,  109,  118,  109,   69,   69,   50,
  495.        51,  130,  119,   52,   53,   69,   69,  165,   54,   68,
  496.        68,   67,   55,   56,   68,   68,  164,  130,   87,   70,
  497.        88,   69,  163,   69,   70,   71,  173,  124,   69,   87,
  498.  
  499.       173,   88,   67,   67,  125,   70,   69,   89,   67,   67,
  500.        70,   90,   71,   72,   72,   72,  130,  173,  173,   69,
  501.        69,   69,   69,   73,  162,  161,   69,   69,  109,  173,
  502.       109,  173,  130,  152,   69,   69,  173,  160,  173,   73,
  503.       173,  173,  159,  157,  110,  110,  110,  156,  155,  154,
  504.       110,  111,  167,  168,  153,  168,  110,  110,  111,  110,
  505.       167,  168,  152,  168,   37,   37,   37,   37,   37,   37,
  506.        37,   37,   19,   19,   19,   19,   19,   19,   19,   19,
  507.        45,   45,   45,   45,   45,   45,   45,   45,   67,   67,
  508.        67,   79,   79,   82,   82,   82,   82,  151,   82,   82,
  509.  
  510.        82,   86,   86,   86,   86,   86,   86,   86,   86,   91,
  511.       150,  149,   91,   91,   91,   91,   91,   93,   93,   93,
  512.        93,   93,   93,   93,   93,   96,  148,  147,   96,   96,
  513.       109,  109,  145,  109,  109,  109,  109,  109,  115,  144,
  514.       143,  115,  115,  115,  115,  115,  116,  116,  142,  116,
  515.       116,  116,  116,  116,  123,  123,  123,  123,  123,  123,
  516.       141,  123,  146,  146,  146,  146,  146,  146,  158,  158,
  517.       140,  158,  158,  158,  158,  158,  166,  166,  166,  166,
  518.       166,  166,  166,  166,  139,  138,  137,  136,  135,  134,
  519.       133,  132,  131,  129,  128,  127,  126,  122,  121,  120,
  520.  
  521.       117,   97,   95,   92,  114,  114,  113,  113,  112,   57,
  522.       108,  107,  106,  105,  104,   99,   98,   98,   97,   95,
  523.        92,   85,   85,   81,   80,   76,   63,   62,   61,   60,
  524.        59,   58,   58,   57,  173,   15,  173,  173,  173,  173,
  525.       173,  173,  173,  173,  173,  173,  173,  173,  173,  173,
  526.       173,  173,  173,  173,  173,  173,  173,  173,  173,  173,
  527.       173,  173,  173,  173,  173,  173,  173,  173,  173,  173,
  528.       173,  173,  173,  173,  173,  173,  173,  173,  173,  173,
  529.       173
  530.     } ;
  531.  
  532. static yyconst flex_int16_t yy_chk[482] =
  533.     {   0,
  534.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  535.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  536.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  537.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  538.         1,    1,    1,    1,    1,    3,    4,    3,    4,    7,
  539.         8,    7,    8,    3,    4,    5,    5,    5,    5,    5,
  540.         5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
  541.         5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
  542.         5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
  543.         5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
  544.  
  545.         9,    9,    9,    9,   11,   12,   11,   12,   13,   14,
  546.        13,   14,  171,    9,   27,   27,   27,   28,   31,   31,
  547.       170,   28,   33,   33,   37,   43,   37,    9,    9,   43,
  548.        49,    9,    9,   82,   49,   82,    9,   70,   70,  169,
  549.         9,    9,   10,   10,   10,   10,   40,   51,   40,   51,
  550.        73,   73,   51,  165,   40,   10,  164,   51,   40,  162,
  551.        64,   67,   64,   67,   94,  100,   94,   64,   67,   10,
  552.        10,  110,  100,   10,   10,   64,   67,  159,   10,   68,
  553.        68,   68,   10,   10,   29,   29,  157,  110,   86,   68,
  554.        86,   29,  156,   29,   29,   29,   86,  104,   29,   89,
  555.  
  556.        86,   89,  111,  111,  104,   68,   29,   89,   69,   69,
  557.        29,   89,   29,   30,   30,   30,  111,  130,  130,   69,
  558.        30,   69,   30,   30,  155,  153,   69,   30,  116,  166,
  559.       116,  166,  111,  152,   69,   30,  172,  151,  172,   30,
  560.        71,   71,  149,  145,   71,   71,   71,  144,  143,  142,
  561.        71,   71,  161,  161,  141,  161,   71,   71,   71,   71,
  562.       167,  167,  140,  167,  174,  174,  174,  174,  174,  174,
  563.       174,  174,  175,  175,  175,  175,  175,  175,  175,  175,
  564.       176,  176,  176,  176,  176,  176,  176,  176,  177,  177,
  565.       177,  178,  178,  179,  179,  179,  179,  139,  179,  179,
  566.  
  567.       179,  180,  180,  180,  180,  180,  180,  180,  180,  181,
  568.       138,  137,  181,  181,  181,  181,  181,  182,  182,  182,
  569.       182,  182,  182,  182,  182,  183,  136,  135,  183,  183,
  570.       184,  184,  132,  184,  184,  184,  184,  184,  185,  131,
  571.       129,  185,  185,  185,  185,  185,  186,  186,  128,  186,
  572.       186,  186,  186,  186,  187,  187,  187,  187,  187,  187,
  573.       127,  187,  188,  188,  188,  188,  188,  188,  189,  189,
  574.       126,  189,  189,  189,  189,  189,  190,  190,  190,  190,
  575.       190,  190,  190,  190,  125,  124,  122,  121,  120,  119,
  576.       118,  117,  112,  108,  107,  106,  105,  103,  102,  101,
  577.  
  578.        99,   97,   96,   92,   88,   87,   84,   83,   80,   57,
  579.        56,   55,   54,   53,   52,   50,   48,   47,   46,   44,
  580.        42,   39,   38,   36,   35,   32,   26,   25,   24,   22,
  581.        21,   20,   18,   16,   15,  173,  173,  173,  173,  173,
  582.       173,  173,  173,  173,  173,  173,  173,  173,  173,  173,
  583.       173,  173,  173,  173,  173,  173,  173,  173,  173,  173,
  584.       173,  173,  173,  173,  173,  173,  173,  173,  173,  173,
  585.       173,  173,  173,  173,  173,  173,  173,  173,  173,  173,
  586.       173
  587.     } ;
  588.  
  589. /* The intent behind this definition is that it'll catch
  590.  * any uses of REJECT which flex missed.
  591.  */
  592. #define REJECT reject_used_but_not_detected
  593. #define yymore() yymore_used_but_not_detected
  594. #define YY_MORE_ADJ 0
  595. #define YY_RESTORE_YY_MORE_OFFSET
  596. #line 1 "../../../src/glsl/glcpp/glcpp-lex.l"
  597. #line 2 "../../../src/glsl/glcpp/glcpp-lex.l"
  598. /*
  599.  * Copyright © 2010 Intel Corporation
  600.  *
  601.  * Permission is hereby granted, free of charge, to any person obtaining a
  602.  * copy of this software and associated documentation files (the "Software"),
  603.  * to deal in the Software without restriction, including without limitation
  604.  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  605.  * and/or sell copies of the Software, and to permit persons to whom the
  606.  * Software is furnished to do so, subject to the following conditions:
  607.  *
  608.  * The above copyright notice and this permission notice (including the next
  609.  * paragraph) shall be included in all copies or substantial portions of the
  610.  * Software.
  611.  *
  612.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  613.  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  614.  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
  615.  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  616.  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  617.  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  618.  * DEALINGS IN THE SOFTWARE.
  619.  */
  620.  
  621. #include <stdio.h>
  622. #include <string.h>
  623. #include <ctype.h>
  624.  
  625. #include "glcpp.h"
  626. #include "glcpp-parse.h"
  627.  
  628. /* Flex annoyingly generates some functions without making them
  629.  * static. Let's declare them here. */
  630. int glcpp_get_column  (yyscan_t yyscanner);
  631. void glcpp_set_column (int  column_no , yyscan_t yyscanner);
  632.  
  633. #ifdef _MSC_VER
  634. #define YY_NO_UNISTD_H
  635. #endif
  636.  
  637. #define YY_NO_INPUT
  638.  
  639. #define YY_USER_ACTION                                                  \
  640.         do {                                                            \
  641.                 if (parser->has_new_line_number)                        \
  642.                         yylineno = parser->new_line_number;             \
  643.                 if (parser->has_new_source_number)                      \
  644.                         yylloc->source = parser->new_source_number;     \
  645.                 yylloc->first_column = yycolumn + 1;                    \
  646.                 yylloc->first_line = yylloc->last_line = yylineno;      \
  647.                 yycolumn += yyleng;                                     \
  648.                 yylloc->last_column = yycolumn + 1;                     \
  649.                 parser->has_new_line_number = 0;                        \
  650.                 parser->has_new_source_number = 0;                      \
  651.         } while(0);
  652.  
  653. #define YY_USER_INIT                    \
  654.         do {                            \
  655.                 yylineno = 1;           \
  656.                 yycolumn = 0;           \
  657.                 yylloc->source = 0;     \
  658.         } while(0)
  659.  
  660. /* It's ugly to have macros that have return statements inside of
  661.  * them, but flex-based lexer generation is all built around the
  662.  * return statement.
  663.  *
  664.  * To mitigate the ugliness, we defer as much of the logic as possible
  665.  * to an actual function, not a macro (see
  666.  * glcpplex_update_state_per_token) and we make the word RETURN
  667.  * prominent in all of the macros which may return.
  668.  *
  669.  * The most-commonly-used macro is RETURN_TOKEN which will perform all
  670.  * necessary state updates based on the provided token,, then
  671.  * conditionally return the token. It will not return a token if the
  672.  * parser is currently skipping tokens, (such as within #if
  673.  * 0...#else).
  674.  *
  675.  * The RETURN_TOKEN_NEVER_SKIP macro is a lower-level variant that
  676.  * makes the token returning unconditional. This is needed for things
  677.  * like #if and the tokens of its condition, (since these must be
  678.  * evaluated by the parser even when otherwise skipping).
  679.  *
  680.  * Finally, RETURN_STRING_TOKEN is a simple convenience wrapper on top
  681.  * of RETURN_TOKEN that performs a string copy of yytext before the
  682.  * return.
  683.  */
  684. #define RETURN_TOKEN_NEVER_SKIP(token)                                  \
  685.         do {                                                            \
  686.                 if (glcpp_lex_update_state_per_token (parser, token))   \
  687.                         return token;                                   \
  688.         } while (0)
  689.  
  690. #define RETURN_TOKEN(token)                                             \
  691.         do {                                                            \
  692.                 if (! parser->skipping) {                               \
  693.                         RETURN_TOKEN_NEVER_SKIP(token);                 \
  694.                 }                                                       \
  695.         } while(0)
  696.  
  697. #define RETURN_STRING_TOKEN(token)                                      \
  698.         do {                                                            \
  699.                 if (! parser->skipping) {                               \
  700.                         yylval->str = ralloc_strdup (yyextra, yytext);  \
  701.                         RETURN_TOKEN_NEVER_SKIP (token);                \
  702.                 }                                                       \
  703.         } while(0)
  704.  
  705.  
  706. /* Update all state necessary for each token being returned.
  707.  *
  708.  * Here we'll be tracking newlines and spaces so that the lexer can
  709.  * alter its behavior as necessary, (for example, '#' has special
  710.  * significance if it is the first non-whitespace, non-comment token
  711.  * in a line, but does not otherwise).
  712.  *
  713.  * NOTE: If this function returns FALSE, then no token should be
  714.  * returned at all. This is used to suprress duplicate SPACE tokens.
  715.  */
  716. static int
  717. glcpp_lex_update_state_per_token (glcpp_parser_t *parser, int token)
  718. {
  719.         /* After the first non-space token in a line, we won't
  720.          * allow any '#' to introduce a directive. */
  721.         if (token == NEWLINE) {
  722.                 parser->first_non_space_token_this_line = 1;
  723.         } else if (token != SPACE) {
  724.                 parser->first_non_space_token_this_line = 0;
  725.         }
  726.  
  727.         /* Track newlines just to know whether a newline needs
  728.          * to be inserted if end-of-file comes early. */
  729.         if (token == NEWLINE) {
  730.                 parser->last_token_was_newline = 1;
  731.         } else {
  732.                 parser->last_token_was_newline = 0;
  733.         }
  734.  
  735.         /* Track spaces to avoid emitting multiple SPACE
  736.          * tokens in a row. */
  737.         if (token == SPACE) {
  738.                 if (! parser->last_token_was_space) {
  739.                         parser->last_token_was_space = 1;
  740.                         return 1;
  741.                 } else {
  742.                         parser->last_token_was_space = 1;
  743.                         return 0;
  744.                 }
  745.         } else {
  746.                 parser->last_token_was_space = 0;
  747.                 return 1;
  748.         }
  749. }
  750.  
  751.  
  752. /* Note: When adding any start conditions to this list, you must also
  753. * update the "Internal compiler error" catch-all rule near the end of
  754. * this file. */
  755.  
  756. /* The OTHER class is simply a catch-all for things that the CPP
  757. parser just doesn't care about. Since flex regular expressions that
  758. match longer strings take priority over those matching shorter
  759. strings, we have to be careful to avoid OTHER matching and hiding
  760. something that CPP does care about. So we simply exclude all
  761. characters that appear in any other expressions. */
  762. #line 763 "glcpp/glcpp-lex.c"
  763.  
  764. #define INITIAL 0
  765. #define COMMENT 1
  766. #define DEFINE 2
  767. #define DONE 3
  768. #define HASH 4
  769. #define NEWLINE_CATCHUP 5
  770. #define UNREACHABLE 6
  771.  
  772. #ifndef YY_NO_UNISTD_H
  773. /* Special case for "unistd.h", since it is non-ANSI. We include it way
  774.  * down here because we want the user's section 1 to have been scanned first.
  775.  * The user has a chance to override it with an option.
  776.  */
  777. #include <unistd.h>
  778. #endif
  779.  
  780. #define YY_EXTRA_TYPE glcpp_parser_t *
  781.  
  782. /* Holds the entire state of the reentrant scanner. */
  783. struct yyguts_t
  784.     {
  785.  
  786.     /* User-defined. Not touched by flex. */
  787.     YY_EXTRA_TYPE yyextra_r;
  788.  
  789.     /* The rest are the same as the globals declared in the non-reentrant scanner. */
  790.     FILE *yyin_r, *yyout_r;
  791.     size_t yy_buffer_stack_top; /**< index of top of stack. */
  792.     size_t yy_buffer_stack_max; /**< capacity of stack. */
  793.     YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
  794.     char yy_hold_char;
  795.     yy_size_t yy_n_chars;
  796.     yy_size_t yyleng_r;
  797.     char *yy_c_buf_p;
  798.     int yy_init;
  799.     int yy_start;
  800.     int yy_did_buffer_switch_on_eof;
  801.     int yy_start_stack_ptr;
  802.     int yy_start_stack_depth;
  803.     int *yy_start_stack;
  804.     yy_state_type yy_last_accepting_state;
  805.     char* yy_last_accepting_cpos;
  806.  
  807.     int yylineno_r;
  808.     int yy_flex_debug_r;
  809.  
  810.     char *yytext_r;
  811.     int yy_more_flag;
  812.     int yy_more_len;
  813.  
  814.     YYSTYPE * yylval_r;
  815.  
  816.     YYLTYPE * yylloc_r;
  817.  
  818.     }; /* end struct yyguts_t */
  819.  
  820. static int yy_init_globals (yyscan_t yyscanner );
  821.  
  822.     /* This must go here because YYSTYPE and YYLTYPE are included
  823.      * from bison output in section 1.*/
  824.     #    define yylval yyg->yylval_r
  825.    
  826.     #    define yylloc yyg->yylloc_r
  827.    
  828. int glcpp_lex_init (yyscan_t* scanner);
  829.  
  830. int glcpp_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
  831.  
  832. /* Accessor methods to globals.
  833.    These are made visible to non-reentrant scanners for convenience. */
  834.  
  835. int glcpp_lex_destroy (yyscan_t yyscanner );
  836.  
  837. int glcpp_get_debug (yyscan_t yyscanner );
  838.  
  839. void glcpp_set_debug (int debug_flag ,yyscan_t yyscanner );
  840.  
  841. YY_EXTRA_TYPE glcpp_get_extra (yyscan_t yyscanner );
  842.  
  843. void glcpp_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
  844.  
  845. FILE *glcpp_get_in (yyscan_t yyscanner );
  846.  
  847. void glcpp_set_in  (FILE * in_str ,yyscan_t yyscanner );
  848.  
  849. FILE *glcpp_get_out (yyscan_t yyscanner );
  850.  
  851. void glcpp_set_out  (FILE * out_str ,yyscan_t yyscanner );
  852.  
  853. yy_size_t glcpp_get_leng (yyscan_t yyscanner );
  854.  
  855. char *glcpp_get_text (yyscan_t yyscanner );
  856.  
  857. int glcpp_get_lineno (yyscan_t yyscanner );
  858.  
  859. void glcpp_set_lineno (int line_number ,yyscan_t yyscanner );
  860.  
  861. int glcpp_get_column  (yyscan_t yyscanner );
  862.  
  863. void glcpp_set_column (int column_no ,yyscan_t yyscanner );
  864.  
  865. YYSTYPE * glcpp_get_lval (yyscan_t yyscanner );
  866.  
  867. void glcpp_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
  868.  
  869.        YYLTYPE *glcpp_get_lloc (yyscan_t yyscanner );
  870.    
  871.         void glcpp_set_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
  872.    
  873. /* Macros after this point can all be overridden by user definitions in
  874.  * section 1.
  875.  */
  876.  
  877. #ifndef YY_SKIP_YYWRAP
  878. #ifdef __cplusplus
  879. extern "C" int glcpp_wrap (yyscan_t yyscanner );
  880. #else
  881. extern int glcpp_wrap (yyscan_t yyscanner );
  882. #endif
  883. #endif
  884.  
  885.     static void yyunput (int c,char *buf_ptr  ,yyscan_t yyscanner);
  886.    
  887. #ifndef yytext_ptr
  888. static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
  889. #endif
  890.  
  891. #ifdef YY_NEED_STRLEN
  892. static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
  893. #endif
  894.  
  895. #ifndef YY_NO_INPUT
  896.  
  897. #ifdef __cplusplus
  898. static int yyinput (yyscan_t yyscanner );
  899. #else
  900. static int input (yyscan_t yyscanner );
  901. #endif
  902.  
  903. #endif
  904.  
  905.     static void yy_push_state (int new_state ,yyscan_t yyscanner);
  906.    
  907.     static void yy_pop_state (yyscan_t yyscanner );
  908.    
  909.     static int yy_top_state (yyscan_t yyscanner );
  910.    
  911. /* Amount of stuff to slurp up with each read. */
  912. #ifndef YY_READ_BUF_SIZE
  913. #define YY_READ_BUF_SIZE 8192
  914. #endif
  915.  
  916. /* Copy whatever the last rule matched to the standard output. */
  917. #ifndef ECHO
  918. /* This used to be an fputs(), but since the string might contain NUL's,
  919.  * we now use fwrite().
  920.  */
  921. #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
  922. #endif
  923.  
  924. /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
  925.  * is returned in "result".
  926.  */
  927. #ifndef YY_INPUT
  928. #define YY_INPUT(buf,result,max_size) \
  929.         if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
  930.                 { \
  931.                 int c = '*'; \
  932.                 size_t n; \
  933.                 for ( n = 0; n < max_size && \
  934.                              (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
  935.                         buf[n] = (char) c; \
  936.                 if ( c == '\n' ) \
  937.                         buf[n++] = (char) c; \
  938.                 if ( c == EOF && ferror( yyin ) ) \
  939.                         YY_FATAL_ERROR( "input in flex scanner failed" ); \
  940.                 result = n; \
  941.                 } \
  942.         else \
  943.                 { \
  944.                 errno=0; \
  945.                 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
  946.                         { \
  947.                         if( errno != EINTR) \
  948.                                 { \
  949.                                 YY_FATAL_ERROR( "input in flex scanner failed" ); \
  950.                                 break; \
  951.                                 } \
  952.                         errno=0; \
  953.                         clearerr(yyin); \
  954.                         } \
  955.                 }\
  956. \
  957.  
  958. #endif
  959.  
  960. /* No semi-colon after return; correct usage is to write "yyterminate();" -
  961.  * we don't want an extra ';' after the "return" because that will cause
  962.  * some compilers to complain about unreachable statements.
  963.  */
  964. #ifndef yyterminate
  965. #define yyterminate() return YY_NULL
  966. #endif
  967.  
  968. /* Number of entries by which start-condition stack grows. */
  969. #ifndef YY_START_STACK_INCR
  970. #define YY_START_STACK_INCR 25
  971. #endif
  972.  
  973. /* Report a fatal error. */
  974. #ifndef YY_FATAL_ERROR
  975. #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
  976. #endif
  977.  
  978. /* end tables serialization structures and prototypes */
  979.  
  980. /* Default declaration of generated scanner - a define so the user can
  981.  * easily add parameters.
  982.  */
  983. #ifndef YY_DECL
  984. #define YY_DECL_IS_OURS 1
  985.  
  986. extern int glcpp_lex \
  987.                (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
  988.  
  989. #define YY_DECL int glcpp_lex \
  990.                (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
  991. #endif /* !YY_DECL */
  992.  
  993. /* Code executed at the beginning of each rule, after yytext and yyleng
  994.  * have been set up.
  995.  */
  996. #ifndef YY_USER_ACTION
  997. #define YY_USER_ACTION
  998. #endif
  999.  
  1000. /* Code executed at the end of each rule. */
  1001. #ifndef YY_BREAK
  1002. #define YY_BREAK break;
  1003. #endif
  1004.  
  1005. #define YY_RULE_SETUP \
  1006.         YY_USER_ACTION
  1007.  
  1008. /** The main scanner function which does all the work.
  1009.  */
  1010. YY_DECL
  1011. {
  1012.         register yy_state_type yy_current_state;
  1013.         register char *yy_cp, *yy_bp;
  1014.         register int yy_act;
  1015.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1016.  
  1017.     yylval = yylval_param;
  1018.  
  1019.     yylloc = yylloc_param;
  1020.  
  1021.         if ( !yyg->yy_init )
  1022.                 {
  1023.                 yyg->yy_init = 1;
  1024.  
  1025. #ifdef YY_USER_INIT
  1026.                 YY_USER_INIT;
  1027. #endif
  1028.  
  1029.                 if ( ! yyg->yy_start )
  1030.                         yyg->yy_start = 1;      /* first start state */
  1031.  
  1032.                 if ( ! yyin )
  1033.                         yyin = stdin;
  1034.  
  1035.                 if ( ! yyout )
  1036.                         yyout = stdout;
  1037.  
  1038.                 if ( ! YY_CURRENT_BUFFER ) {
  1039.                         glcpp_ensure_buffer_stack (yyscanner);
  1040.                         YY_CURRENT_BUFFER_LVALUE =
  1041.                                 glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
  1042.                 }
  1043.  
  1044.                 glcpp__load_buffer_state(yyscanner );
  1045.                 }
  1046.  
  1047.         {
  1048. #line 194 "../../../src/glsl/glcpp/glcpp-lex.l"
  1049.  
  1050.  
  1051.         glcpp_parser_t *parser = yyextra;
  1052.  
  1053.         /* When we lex a multi-line comment, we replace it (as
  1054.          * specified) with a single space. But if the comment spanned
  1055.          * multiple lines, then subsequent parsing stages will not
  1056.          * count correct line numbers. To avoid this problem we keep
  1057.          * track of all newlines that were commented out by a
  1058.          * multi-line comment, and we emit a NEWLINE token for each at
  1059.          * the next legal opportunity, (which is when the lexer would
  1060.          * be emitting a NEWLINE token anyway).
  1061.          */
  1062.         if (YY_START == NEWLINE_CATCHUP) {
  1063.                 if (parser->commented_newlines)
  1064.                         parser->commented_newlines--;
  1065.                 if (parser->commented_newlines == 0)
  1066.                         BEGIN INITIAL;
  1067.                 RETURN_TOKEN_NEVER_SKIP (NEWLINE);
  1068.         }
  1069.  
  1070.         /* Set up the parser->skipping bit here before doing any lexing.
  1071.          *
  1072.          * This bit controls whether tokens are skipped, (as implemented by
  1073.          * RETURN_TOKEN), such as between "#if 0" and "#endif".
  1074.          *
  1075.          * The parser maintains a skip_stack indicating whether we should be
  1076.          * skipping, (and nested levels of #if/#ifdef/#ifndef/#endif) will
  1077.          * push and pop items from the stack.
  1078.          *
  1079.          * Here are the rules for determining whether we are skipping:
  1080.          *
  1081.          *      1. If the skip stack is NULL, we are outside of all #if blocks
  1082.          *         and we are not skipping.
  1083.          *
  1084.          *      2. If the skip stack is non-NULL, the type of the top node in
  1085.          *         the stack determines whether to skip. A type of
  1086.          *         SKIP_NO_SKIP is used for blocks wheere we are emitting
  1087.          *         tokens, (such as between #if 1 and #endif, or after the
  1088.          *         #else of an #if 0, etc.).
  1089.          *
  1090.          *      3. The lexing_directive bit overrides the skip stack. This bit
  1091.          *         is set when we are actively lexing the expression for a
  1092.          *         pre-processor condition, (such as #if, #elif, or #else). In
  1093.          *         this case, even if otherwise skipping, we need to emit the
  1094.          *         tokens for this condition so that the parser can evaluate
  1095.          *         the expression. (For, #else, there's no expression, but we
  1096.          *         emit tokens so the parser can generate a nice error message
  1097.          *         if there are any tokens here).
  1098.          */
  1099.         if (parser->skip_stack &&
  1100.             parser->skip_stack->type != SKIP_NO_SKIP &&
  1101.             ! parser->lexing_directive)
  1102.         {
  1103.                 parser->skipping = 1;
  1104.         } else {
  1105.                 parser->skipping = 0;
  1106.         }
  1107.  
  1108.         /* Single-line comments */
  1109. #line 1110 "glcpp/glcpp-lex.c"
  1110.  
  1111.         while ( 1 )             /* loops until end-of-file is reached */
  1112.                 {
  1113.                 yy_cp = yyg->yy_c_buf_p;
  1114.  
  1115.                 /* Support of yytext. */
  1116.                 *yy_cp = yyg->yy_hold_char;
  1117.  
  1118.                 /* yy_bp points to the position in yy_ch_buf of the start of
  1119.                  * the current run.
  1120.                  */
  1121.                 yy_bp = yy_cp;
  1122.  
  1123.                 yy_current_state = yyg->yy_start;
  1124. yy_match:
  1125.                 do
  1126.                         {
  1127.                         register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
  1128.                         if ( yy_accept[yy_current_state] )
  1129.                                 {
  1130.                                 yyg->yy_last_accepting_state = yy_current_state;
  1131.                                 yyg->yy_last_accepting_cpos = yy_cp;
  1132.                                 }
  1133.                         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1134.                                 {
  1135.                                 yy_current_state = (int) yy_def[yy_current_state];
  1136.                                 if ( yy_current_state >= 174 )
  1137.                                         yy_c = yy_meta[(unsigned int) yy_c];
  1138.                                 }
  1139.                         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  1140.                         ++yy_cp;
  1141.                         }
  1142.                 while ( yy_current_state != 173 );
  1143.                 yy_cp = yyg->yy_last_accepting_cpos;
  1144.                 yy_current_state = yyg->yy_last_accepting_state;
  1145.  
  1146. yy_find_action:
  1147.                 yy_act = yy_accept[yy_current_state];
  1148.  
  1149.                 YY_DO_BEFORE_ACTION;
  1150.  
  1151. do_action:      /* This label is used only to access EOF actions. */
  1152.  
  1153.                 switch ( yy_act )
  1154.         { /* beginning of action switch */
  1155.                         case 0: /* must back up */
  1156.                         /* undo the effects of YY_DO_BEFORE_ACTION */
  1157.                         *yy_cp = yyg->yy_hold_char;
  1158.                         yy_cp = yyg->yy_last_accepting_cpos;
  1159.                         yy_current_state = yyg->yy_last_accepting_state;
  1160.                         goto yy_find_action;
  1161.  
  1162. case 1:
  1163. YY_RULE_SETUP
  1164. #line 254 "../../../src/glsl/glcpp/glcpp-lex.l"
  1165. {
  1166. }
  1167.         YY_BREAK
  1168. /* Multi-line comments */
  1169. case 2:
  1170. YY_RULE_SETUP
  1171. #line 258 "../../../src/glsl/glcpp/glcpp-lex.l"
  1172. { yy_push_state(COMMENT, yyscanner); }
  1173.         YY_BREAK
  1174. case 3:
  1175. YY_RULE_SETUP
  1176. #line 259 "../../../src/glsl/glcpp/glcpp-lex.l"
  1177.  
  1178.         YY_BREAK
  1179. case 4:
  1180. /* rule 4 can match eol */
  1181. YY_RULE_SETUP
  1182. #line 260 "../../../src/glsl/glcpp/glcpp-lex.l"
  1183. { yylineno++; yycolumn = 0; parser->commented_newlines++; }
  1184.         YY_BREAK
  1185. case 5:
  1186. YY_RULE_SETUP
  1187. #line 261 "../../../src/glsl/glcpp/glcpp-lex.l"
  1188.  
  1189.         YY_BREAK
  1190. case 6:
  1191. /* rule 6 can match eol */
  1192. YY_RULE_SETUP
  1193. #line 262 "../../../src/glsl/glcpp/glcpp-lex.l"
  1194. { yylineno++; yycolumn = 0; parser->commented_newlines++; }
  1195.         YY_BREAK
  1196. case 7:
  1197. YY_RULE_SETUP
  1198. #line 263 "../../../src/glsl/glcpp/glcpp-lex.l"
  1199. {
  1200.         yy_pop_state(yyscanner);
  1201.         /* In the <HASH> start condition, we don't want any SPACE token. */
  1202.         if (yyextra->space_tokens && YY_START != HASH)
  1203.                 RETURN_TOKEN (SPACE);
  1204. }
  1205.         YY_BREAK
  1206. case 8:
  1207. YY_RULE_SETUP
  1208. #line 270 "../../../src/glsl/glcpp/glcpp-lex.l"
  1209. {
  1210.  
  1211.         /* If the '#' is the first non-whitespace, non-comment token on this
  1212.          * line, then it introduces a directive, switch to the <HASH> start
  1213.          * condition.
  1214.          *
  1215.          * Otherwise, this is just punctuation, so return the HASH_TOKEN
  1216.          * token. */
  1217.         if (parser->first_non_space_token_this_line) {
  1218.                 BEGIN HASH;
  1219.         }
  1220.  
  1221.         RETURN_TOKEN_NEVER_SKIP (HASH_TOKEN);
  1222. }
  1223.         YY_BREAK
  1224. case 9:
  1225. YY_RULE_SETUP
  1226. #line 285 "../../../src/glsl/glcpp/glcpp-lex.l"
  1227. {
  1228.         BEGIN INITIAL;
  1229.         yyextra->space_tokens = 0;
  1230.         RETURN_STRING_TOKEN (VERSION_TOKEN);
  1231. }
  1232.         YY_BREAK
  1233. /* Swallow empty #pragma directives, (to avoid confusing the
  1234.          * downstream compiler).
  1235.          *
  1236.          * Note: We use a simple regular expression for the lookahead
  1237.          * here. Specifically, we cannot use the complete {NEWLINE} expression
  1238.          * since it uses alternation and we've found that there's a flex bug
  1239.          * where using alternation in the lookahead portion of a pattern
  1240.          * triggers a buffer overrun. */
  1241. case 10:
  1242. /* rule 10 can match eol */
  1243. *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
  1244. YY_LINENO_REWIND_TO(yy_cp - 1);
  1245. yyg->yy_c_buf_p = yy_cp -= 1;
  1246. YY_DO_BEFORE_ACTION; /* set up yytext again */
  1247. YY_RULE_SETUP
  1248. #line 299 "../../../src/glsl/glcpp/glcpp-lex.l"
  1249. {
  1250.         BEGIN INITIAL;
  1251. }
  1252.         YY_BREAK
  1253. /* glcpp doesn't handle #extension, #version, or #pragma directives.
  1254.          * Simply pass them through to the main compiler's lexer/parser. */
  1255. case 11:
  1256. YY_RULE_SETUP
  1257. #line 305 "../../../src/glsl/glcpp/glcpp-lex.l"
  1258. {
  1259.         BEGIN INITIAL;
  1260.         RETURN_STRING_TOKEN (PRAGMA);
  1261. }
  1262.         YY_BREAK
  1263. case 12:
  1264. YY_RULE_SETUP
  1265. #line 310 "../../../src/glsl/glcpp/glcpp-lex.l"
  1266. {
  1267.         BEGIN INITIAL;
  1268.         RETURN_TOKEN (LINE);
  1269. }
  1270.         YY_BREAK
  1271. case 13:
  1272. /* rule 13 can match eol */
  1273. YY_RULE_SETUP
  1274. #line 315 "../../../src/glsl/glcpp/glcpp-lex.l"
  1275. {
  1276.         BEGIN INITIAL;
  1277.         RETURN_TOKEN_NEVER_SKIP (NEWLINE);
  1278. }
  1279.         YY_BREAK
  1280. /* For the pre-processor directives, we return these tokens
  1281.          * even when we are otherwise skipping. */
  1282. case 14:
  1283. YY_RULE_SETUP
  1284. #line 322 "../../../src/glsl/glcpp/glcpp-lex.l"
  1285. {
  1286.         BEGIN INITIAL;
  1287.         yyextra->lexing_directive = 1;
  1288.         yyextra->space_tokens = 0;
  1289.         RETURN_TOKEN_NEVER_SKIP (IFDEF);
  1290. }
  1291.         YY_BREAK
  1292. case 15:
  1293. YY_RULE_SETUP
  1294. #line 329 "../../../src/glsl/glcpp/glcpp-lex.l"
  1295. {
  1296.         BEGIN INITIAL;
  1297.         yyextra->lexing_directive = 1;
  1298.         yyextra->space_tokens = 0;
  1299.         RETURN_TOKEN_NEVER_SKIP (IFNDEF);
  1300. }
  1301.         YY_BREAK
  1302. case 16:
  1303. /* rule 16 can match eol */
  1304. *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
  1305. YY_LINENO_REWIND_TO(yy_bp + 2);
  1306. yyg->yy_c_buf_p = yy_cp = yy_bp + 2;
  1307. YY_DO_BEFORE_ACTION; /* set up yytext again */
  1308. YY_RULE_SETUP
  1309. #line 336 "../../../src/glsl/glcpp/glcpp-lex.l"
  1310. {
  1311.         BEGIN INITIAL;
  1312.         yyextra->lexing_directive = 1;
  1313.         yyextra->space_tokens = 0;
  1314.         RETURN_TOKEN_NEVER_SKIP (IF);
  1315. }
  1316.         YY_BREAK
  1317. case 17:
  1318. /* rule 17 can match eol */
  1319. *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
  1320. YY_LINENO_REWIND_TO(yy_bp + 4);
  1321. yyg->yy_c_buf_p = yy_cp = yy_bp + 4;
  1322. YY_DO_BEFORE_ACTION; /* set up yytext again */
  1323. YY_RULE_SETUP
  1324. #line 343 "../../../src/glsl/glcpp/glcpp-lex.l"
  1325. {
  1326.         BEGIN INITIAL;
  1327.         yyextra->lexing_directive = 1;
  1328.         yyextra->space_tokens = 0;
  1329.         RETURN_TOKEN_NEVER_SKIP (ELIF);
  1330. }
  1331.         YY_BREAK
  1332. case 18:
  1333. YY_RULE_SETUP
  1334. #line 350 "../../../src/glsl/glcpp/glcpp-lex.l"
  1335. {
  1336.         BEGIN INITIAL;
  1337.         yyextra->space_tokens = 0;
  1338.         RETURN_TOKEN_NEVER_SKIP (ELSE);
  1339. }
  1340.         YY_BREAK
  1341. case 19:
  1342. YY_RULE_SETUP
  1343. #line 356 "../../../src/glsl/glcpp/glcpp-lex.l"
  1344. {
  1345.         BEGIN INITIAL;
  1346.         yyextra->space_tokens = 0;
  1347.         RETURN_TOKEN_NEVER_SKIP (ENDIF);
  1348. }
  1349.         YY_BREAK
  1350. case 20:
  1351. YY_RULE_SETUP
  1352. #line 362 "../../../src/glsl/glcpp/glcpp-lex.l"
  1353. {
  1354.         BEGIN INITIAL;
  1355.         RETURN_STRING_TOKEN (ERROR_TOKEN);
  1356. }
  1357.         YY_BREAK
  1358. /* After we see a "#define" we enter the <DEFINE> start state
  1359.          * for the lexer. Within <DEFINE> we are looking for the first
  1360.          * identifier and specifically checking whether the identifier
  1361.          * is followed by a '(' or not, (to lex either a
  1362.          * FUNC_IDENTIFIER or an OBJ_IDENITIFIER token).
  1363.          *
  1364.          * While in the <DEFINE> state we also need to explicitly
  1365.          * handle a few other things that may appear before the
  1366.          * identifier:
  1367.          *
  1368.          *      * Comments, (handled above with the main support for
  1369.          *        comments).
  1370.          *
  1371.          *      * Whitespace (simply ignored)
  1372.          *
  1373.          *      * Anything else, (not an identifier, not a comment,
  1374.          *        and not whitespace). This will generate an error.
  1375.          */
  1376. case 21:
  1377. YY_RULE_SETUP
  1378. #line 385 "../../../src/glsl/glcpp/glcpp-lex.l"
  1379. {
  1380.         if (! parser->skipping) {
  1381.                 BEGIN DEFINE;
  1382.                 yyextra->space_tokens = 0;
  1383.                 RETURN_TOKEN (DEFINE_TOKEN);
  1384.         }
  1385. }
  1386.         YY_BREAK
  1387. case 22:
  1388. YY_RULE_SETUP
  1389. #line 393 "../../../src/glsl/glcpp/glcpp-lex.l"
  1390. {
  1391.         BEGIN INITIAL;
  1392.         yyextra->space_tokens = 0;
  1393.         RETURN_TOKEN (UNDEF);
  1394. }
  1395.         YY_BREAK
  1396. case 23:
  1397. YY_RULE_SETUP
  1398. #line 399 "../../../src/glsl/glcpp/glcpp-lex.l"
  1399. {
  1400.         /* Nothing to do here. Importantly, don't leave the <HASH>
  1401.          * start condition, since it's legal to have space between the
  1402.          * '#' and the directive.. */
  1403. }
  1404.         YY_BREAK
  1405. /* This will catch any non-directive garbage after a HASH */
  1406. case 24:
  1407. YY_RULE_SETUP
  1408. #line 406 "../../../src/glsl/glcpp/glcpp-lex.l"
  1409. {
  1410.         BEGIN INITIAL;
  1411.         RETURN_TOKEN (GARBAGE);
  1412. }
  1413.         YY_BREAK
  1414. /* An identifier immediately followed by '(' */
  1415. case 25:
  1416. *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
  1417. yyg->yy_c_buf_p = yy_cp -= 1;
  1418. YY_DO_BEFORE_ACTION; /* set up yytext again */
  1419. YY_RULE_SETUP
  1420. #line 412 "../../../src/glsl/glcpp/glcpp-lex.l"
  1421. {
  1422.         BEGIN INITIAL;
  1423.         RETURN_STRING_TOKEN (FUNC_IDENTIFIER);
  1424. }
  1425.         YY_BREAK
  1426. /* An identifier not immediately followed by '(' */
  1427. case 26:
  1428. YY_RULE_SETUP
  1429. #line 418 "../../../src/glsl/glcpp/glcpp-lex.l"
  1430. {
  1431.         BEGIN INITIAL;
  1432.         RETURN_STRING_TOKEN (OBJ_IDENTIFIER);
  1433. }
  1434.         YY_BREAK
  1435. /* Whitespace */
  1436. case 27:
  1437. YY_RULE_SETUP
  1438. #line 424 "../../../src/glsl/glcpp/glcpp-lex.l"
  1439. {
  1440.         /* Just ignore it. Nothing to do here. */
  1441. }
  1442.         YY_BREAK
  1443. /* '/' not followed by '*', so not a comment. This is an error. */
  1444. case 28:
  1445. /* rule 28 can match eol */
  1446. YY_RULE_SETUP
  1447. #line 429 "../../../src/glsl/glcpp/glcpp-lex.l"
  1448. {
  1449.         BEGIN INITIAL;
  1450.         glcpp_error(yylloc, yyextra, "#define followed by a non-identifier: %s", yytext);
  1451.         RETURN_STRING_TOKEN (INTEGER_STRING);
  1452. }
  1453.         YY_BREAK
  1454. /* A character that can't start an identifier, comment, or
  1455.          * space. This is an error. */
  1456. case 29:
  1457. YY_RULE_SETUP
  1458. #line 437 "../../../src/glsl/glcpp/glcpp-lex.l"
  1459. {
  1460.         BEGIN INITIAL;
  1461.         glcpp_error(yylloc, yyextra, "#define followed by a non-identifier: %s", yytext);
  1462.         RETURN_STRING_TOKEN (INTEGER_STRING);
  1463. }
  1464.         YY_BREAK
  1465. case 30:
  1466. YY_RULE_SETUP
  1467. #line 443 "../../../src/glsl/glcpp/glcpp-lex.l"
  1468. {
  1469.         RETURN_STRING_TOKEN (INTEGER_STRING);
  1470. }
  1471.         YY_BREAK
  1472. case 31:
  1473. YY_RULE_SETUP
  1474. #line 447 "../../../src/glsl/glcpp/glcpp-lex.l"
  1475. {
  1476.         RETURN_STRING_TOKEN (INTEGER_STRING);
  1477. }
  1478.         YY_BREAK
  1479. case 32:
  1480. YY_RULE_SETUP
  1481. #line 451 "../../../src/glsl/glcpp/glcpp-lex.l"
  1482. {
  1483.         RETURN_STRING_TOKEN (INTEGER_STRING);
  1484. }
  1485.         YY_BREAK
  1486. case 33:
  1487. YY_RULE_SETUP
  1488. #line 455 "../../../src/glsl/glcpp/glcpp-lex.l"
  1489. {
  1490.         RETURN_TOKEN (LEFT_SHIFT);
  1491. }
  1492.         YY_BREAK
  1493. case 34:
  1494. YY_RULE_SETUP
  1495. #line 459 "../../../src/glsl/glcpp/glcpp-lex.l"
  1496. {
  1497.         RETURN_TOKEN (RIGHT_SHIFT);
  1498. }
  1499.         YY_BREAK
  1500. case 35:
  1501. YY_RULE_SETUP
  1502. #line 463 "../../../src/glsl/glcpp/glcpp-lex.l"
  1503. {
  1504.         RETURN_TOKEN (LESS_OR_EQUAL);
  1505. }
  1506.         YY_BREAK
  1507. case 36:
  1508. YY_RULE_SETUP
  1509. #line 467 "../../../src/glsl/glcpp/glcpp-lex.l"
  1510. {
  1511.         RETURN_TOKEN (GREATER_OR_EQUAL);
  1512. }
  1513.         YY_BREAK
  1514. case 37:
  1515. YY_RULE_SETUP
  1516. #line 471 "../../../src/glsl/glcpp/glcpp-lex.l"
  1517. {
  1518.         RETURN_TOKEN (EQUAL);
  1519. }
  1520.         YY_BREAK
  1521. case 38:
  1522. YY_RULE_SETUP
  1523. #line 475 "../../../src/glsl/glcpp/glcpp-lex.l"
  1524. {
  1525.         RETURN_TOKEN (NOT_EQUAL);
  1526. }
  1527.         YY_BREAK
  1528. case 39:
  1529. YY_RULE_SETUP
  1530. #line 479 "../../../src/glsl/glcpp/glcpp-lex.l"
  1531. {
  1532.         RETURN_TOKEN (AND);
  1533. }
  1534.         YY_BREAK
  1535. case 40:
  1536. YY_RULE_SETUP
  1537. #line 483 "../../../src/glsl/glcpp/glcpp-lex.l"
  1538. {
  1539.         RETURN_TOKEN (OR);
  1540. }
  1541.         YY_BREAK
  1542. case 41:
  1543. YY_RULE_SETUP
  1544. #line 487 "../../../src/glsl/glcpp/glcpp-lex.l"
  1545. {
  1546.         RETURN_TOKEN (PLUS_PLUS);
  1547. }
  1548.         YY_BREAK
  1549. case 42:
  1550. YY_RULE_SETUP
  1551. #line 491 "../../../src/glsl/glcpp/glcpp-lex.l"
  1552. {
  1553.         RETURN_TOKEN (MINUS_MINUS);
  1554. }
  1555.         YY_BREAK
  1556. case 43:
  1557. YY_RULE_SETUP
  1558. #line 495 "../../../src/glsl/glcpp/glcpp-lex.l"
  1559. {
  1560.         if (! parser->skipping) {
  1561.                 if (parser->is_gles)
  1562.                         glcpp_error(yylloc, yyextra, "Token pasting (##) is illegal in GLES");
  1563.                 RETURN_TOKEN (PASTE);
  1564.         }
  1565. }
  1566.         YY_BREAK
  1567. case 44:
  1568. YY_RULE_SETUP
  1569. #line 503 "../../../src/glsl/glcpp/glcpp-lex.l"
  1570. {
  1571.         RETURN_TOKEN (DEFINED);
  1572. }
  1573.         YY_BREAK
  1574. case 45:
  1575. YY_RULE_SETUP
  1576. #line 507 "../../../src/glsl/glcpp/glcpp-lex.l"
  1577. {
  1578.         RETURN_STRING_TOKEN (IDENTIFIER);
  1579. }
  1580.         YY_BREAK
  1581. case 46:
  1582. YY_RULE_SETUP
  1583. #line 511 "../../../src/glsl/glcpp/glcpp-lex.l"
  1584. {
  1585.         RETURN_STRING_TOKEN (OTHER);
  1586. }
  1587.         YY_BREAK
  1588. case 47:
  1589. YY_RULE_SETUP
  1590. #line 515 "../../../src/glsl/glcpp/glcpp-lex.l"
  1591. {
  1592.         RETURN_TOKEN (yytext[0]);
  1593. }
  1594.         YY_BREAK
  1595. case 48:
  1596. YY_RULE_SETUP
  1597. #line 519 "../../../src/glsl/glcpp/glcpp-lex.l"
  1598. {
  1599.         RETURN_STRING_TOKEN (OTHER);
  1600. }
  1601.         YY_BREAK
  1602. case 49:
  1603. YY_RULE_SETUP
  1604. #line 523 "../../../src/glsl/glcpp/glcpp-lex.l"
  1605. {
  1606.         if (yyextra->space_tokens) {
  1607.                 RETURN_TOKEN (SPACE);
  1608.         }
  1609. }
  1610.         YY_BREAK
  1611. /* We preserve all newlines, even between #if 0..#endif, so no
  1612.         skipping.. */
  1613. case 50:
  1614. /* rule 50 can match eol */
  1615. YY_RULE_SETUP
  1616. #line 531 "../../../src/glsl/glcpp/glcpp-lex.l"
  1617. {
  1618.         if (parser->commented_newlines) {
  1619.                 BEGIN NEWLINE_CATCHUP;
  1620.         } else {
  1621.                 BEGIN INITIAL;
  1622.         }
  1623.         yyextra->space_tokens = 1;
  1624.         yyextra->lexing_directive = 0;
  1625.         yylineno++;
  1626.         yycolumn = 0;
  1627.         RETURN_TOKEN_NEVER_SKIP (NEWLINE);
  1628. }
  1629.         YY_BREAK
  1630. case YY_STATE_EOF(INITIAL):
  1631. case YY_STATE_EOF(COMMENT):
  1632. case YY_STATE_EOF(DEFINE):
  1633. case YY_STATE_EOF(HASH):
  1634. #line 544 "../../../src/glsl/glcpp/glcpp-lex.l"
  1635. {
  1636.         if (YY_START == COMMENT)
  1637.                 glcpp_error(yylloc, yyextra, "Unterminated comment");
  1638.         BEGIN DONE; /* Don't keep matching this rule forever. */
  1639.         yyextra->lexing_directive = 0;
  1640.         if (! parser->last_token_was_newline)
  1641.                 RETURN_TOKEN (NEWLINE);
  1642. }
  1643.         YY_BREAK
  1644. /* This is a catch-all to avoid the annoying default flex action which
  1645.          * matches any character and prints it. If any input ever matches this
  1646.          * rule, then we have made a mistake above and need to fix one or more
  1647.          * of the preceding patterns to match that input. */
  1648. case 51:
  1649. YY_RULE_SETUP
  1650. #line 558 "../../../src/glsl/glcpp/glcpp-lex.l"
  1651. {
  1652.         glcpp_error(yylloc, yyextra, "Internal compiler error: Unexpected character: %s", yytext);
  1653.  
  1654.         /* We don't actually use the UNREACHABLE start condition. We
  1655.         only have this block here so that we can pretend to call some
  1656.         generated functions, (to avoid "defined but not used"
  1657.         warnings. */
  1658.         if (YY_START == UNREACHABLE) {
  1659.                 unput('.');
  1660.                 yy_top_state(yyextra);
  1661.         }
  1662. }
  1663.         YY_BREAK
  1664. case 52:
  1665. YY_RULE_SETUP
  1666. #line 571 "../../../src/glsl/glcpp/glcpp-lex.l"
  1667. YY_FATAL_ERROR( "flex scanner jammed" );
  1668.         YY_BREAK
  1669. #line 1670 "glcpp/glcpp-lex.c"
  1670. case YY_STATE_EOF(DONE):
  1671. case YY_STATE_EOF(NEWLINE_CATCHUP):
  1672. case YY_STATE_EOF(UNREACHABLE):
  1673.         yyterminate();
  1674.  
  1675.         case YY_END_OF_BUFFER:
  1676.                 {
  1677.                 /* Amount of text matched not including the EOB char. */
  1678.                 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
  1679.  
  1680.                 /* Undo the effects of YY_DO_BEFORE_ACTION. */
  1681.                 *yy_cp = yyg->yy_hold_char;
  1682.                 YY_RESTORE_YY_MORE_OFFSET
  1683.  
  1684.                 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
  1685.                         {
  1686.                         /* We're scanning a new file or input source.  It's
  1687.                          * possible that this happened because the user
  1688.                          * just pointed yyin at a new source and called
  1689.                          * glcpp_lex().  If so, then we have to assure
  1690.                          * consistency between YY_CURRENT_BUFFER and our
  1691.                          * globals.  Here is the right place to do so, because
  1692.                          * this is the first action (other than possibly a
  1693.                          * back-up) that will match for the new input source.
  1694.                          */
  1695.                         yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  1696.                         YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
  1697.                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
  1698.                         }
  1699.  
  1700.                 /* Note that here we test for yy_c_buf_p "<=" to the position
  1701.                  * of the first EOB in the buffer, since yy_c_buf_p will
  1702.                  * already have been incremented past the NUL character
  1703.                  * (since all states make transitions on EOB to the
  1704.                  * end-of-buffer state).  Contrast this with the test
  1705.                  * in input().
  1706.                  */
  1707.                 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
  1708.                         { /* This was really a NUL. */
  1709.                         yy_state_type yy_next_state;
  1710.  
  1711.                         yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
  1712.  
  1713.                         yy_current_state = yy_get_previous_state( yyscanner );
  1714.  
  1715.                         /* Okay, we're now positioned to make the NUL
  1716.                          * transition.  We couldn't have
  1717.                          * yy_get_previous_state() go ahead and do it
  1718.                          * for us because it doesn't know how to deal
  1719.                          * with the possibility of jamming (and we don't
  1720.                          * want to build jamming into it because then it
  1721.                          * will run more slowly).
  1722.                          */
  1723.  
  1724.                         yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
  1725.  
  1726.                         yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
  1727.  
  1728.                         if ( yy_next_state )
  1729.                                 {
  1730.                                 /* Consume the NUL. */
  1731.                                 yy_cp = ++yyg->yy_c_buf_p;
  1732.                                 yy_current_state = yy_next_state;
  1733.                                 goto yy_match;
  1734.                                 }
  1735.  
  1736.                         else
  1737.                                 {
  1738.                                 yy_cp = yyg->yy_last_accepting_cpos;
  1739.                                 yy_current_state = yyg->yy_last_accepting_state;
  1740.                                 goto yy_find_action;
  1741.                                 }
  1742.                         }
  1743.  
  1744.                 else switch ( yy_get_next_buffer( yyscanner ) )
  1745.                         {
  1746.                         case EOB_ACT_END_OF_FILE:
  1747.                                 {
  1748.                                 yyg->yy_did_buffer_switch_on_eof = 0;
  1749.  
  1750.                                 if ( glcpp_wrap(yyscanner ) )
  1751.                                         {
  1752.                                         /* Note: because we've taken care in
  1753.                                          * yy_get_next_buffer() to have set up
  1754.                                          * yytext, we can now set up
  1755.                                          * yy_c_buf_p so that if some total
  1756.                                          * hoser (like flex itself) wants to
  1757.                                          * call the scanner after we return the
  1758.                                          * YY_NULL, it'll still work - another
  1759.                                          * YY_NULL will get returned.
  1760.                                          */
  1761.                                         yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
  1762.  
  1763.                                         yy_act = YY_STATE_EOF(YY_START);
  1764.                                         goto do_action;
  1765.                                         }
  1766.  
  1767.                                 else
  1768.                                         {
  1769.                                         if ( ! yyg->yy_did_buffer_switch_on_eof )
  1770.                                                 YY_NEW_FILE;
  1771.                                         }
  1772.                                 break;
  1773.                                 }
  1774.  
  1775.                         case EOB_ACT_CONTINUE_SCAN:
  1776.                                 yyg->yy_c_buf_p =
  1777.                                         yyg->yytext_ptr + yy_amount_of_matched_text;
  1778.  
  1779.                                 yy_current_state = yy_get_previous_state( yyscanner );
  1780.  
  1781.                                 yy_cp = yyg->yy_c_buf_p;
  1782.                                 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
  1783.                                 goto yy_match;
  1784.  
  1785.                         case EOB_ACT_LAST_MATCH:
  1786.                                 yyg->yy_c_buf_p =
  1787.                                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
  1788.  
  1789.                                 yy_current_state = yy_get_previous_state( yyscanner );
  1790.  
  1791.                                 yy_cp = yyg->yy_c_buf_p;
  1792.                                 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
  1793.                                 goto yy_find_action;
  1794.                         }
  1795.                 break;
  1796.                 }
  1797.  
  1798.         default:
  1799.                 YY_FATAL_ERROR(
  1800.                         "fatal flex scanner internal error--no action found" );
  1801.         } /* end of action switch */
  1802.                 } /* end of scanning one token */
  1803.         } /* end of user's declarations */
  1804. } /* end of glcpp_lex */
  1805.  
  1806. /* yy_get_next_buffer - try to read in a new buffer
  1807.  *
  1808.  * Returns a code representing an action:
  1809.  *      EOB_ACT_LAST_MATCH -
  1810.  *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  1811.  *      EOB_ACT_END_OF_FILE - end of file
  1812.  */
  1813. static int yy_get_next_buffer (yyscan_t yyscanner)
  1814. {
  1815.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1816.         register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
  1817.         register char *source = yyg->yytext_ptr;
  1818.         register int number_to_move, i;
  1819.         int ret_val;
  1820.  
  1821.         if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
  1822.                 YY_FATAL_ERROR(
  1823.                 "fatal flex scanner internal error--end of buffer missed" );
  1824.  
  1825.         if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
  1826.                 { /* Don't try to fill the buffer, so this is an EOF. */
  1827.                 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
  1828.                         {
  1829.                         /* We matched a single character, the EOB, so
  1830.                          * treat this as a final EOF.
  1831.                          */
  1832.                         return EOB_ACT_END_OF_FILE;
  1833.                         }
  1834.  
  1835.                 else
  1836.                         {
  1837.                         /* We matched some text prior to the EOB, first
  1838.                          * process it.
  1839.                          */
  1840.                         return EOB_ACT_LAST_MATCH;
  1841.                         }
  1842.                 }
  1843.  
  1844.         /* Try to read more data. */
  1845.  
  1846.         /* First move last chars to start of buffer. */
  1847.         number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
  1848.  
  1849.         for ( i = 0; i < number_to_move; ++i )
  1850.                 *(dest++) = *(source++);
  1851.  
  1852.         if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
  1853.                 /* don't do the read, it's not guaranteed to return an EOF,
  1854.                  * just force an EOF
  1855.                  */
  1856.                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
  1857.  
  1858.         else
  1859.                 {
  1860.                         yy_size_t num_to_read =
  1861.                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
  1862.  
  1863.                 while ( num_to_read <= 0 )
  1864.                         { /* Not enough room in the buffer - grow it. */
  1865.  
  1866.                         /* just a shorter name for the current buffer */
  1867.                         YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
  1868.  
  1869.                         int yy_c_buf_p_offset =
  1870.                                 (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
  1871.  
  1872.                         if ( b->yy_is_our_buffer )
  1873.                                 {
  1874.                                 yy_size_t new_size = b->yy_buf_size * 2;
  1875.  
  1876.                                 if ( new_size <= 0 )
  1877.                                         b->yy_buf_size += b->yy_buf_size / 8;
  1878.                                 else
  1879.                                         b->yy_buf_size *= 2;
  1880.  
  1881.                                 b->yy_ch_buf = (char *)
  1882.                                         /* Include room in for 2 EOB chars. */
  1883.                                         glcpp_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
  1884.                                 }
  1885.                         else
  1886.                                 /* Can't grow it, we don't own it. */
  1887.                                 b->yy_ch_buf = 0;
  1888.  
  1889.                         if ( ! b->yy_ch_buf )
  1890.                                 YY_FATAL_ERROR(
  1891.                                 "fatal error - scanner input buffer overflow" );
  1892.  
  1893.                         yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
  1894.  
  1895.                         num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
  1896.                                                 number_to_move - 1;
  1897.  
  1898.                         }
  1899.  
  1900.                 if ( num_to_read > YY_READ_BUF_SIZE )
  1901.                         num_to_read = YY_READ_BUF_SIZE;
  1902.  
  1903.                 /* Read in more data. */
  1904.                 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
  1905.                         yyg->yy_n_chars, num_to_read );
  1906.  
  1907.                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
  1908.                 }
  1909.  
  1910.         if ( yyg->yy_n_chars == 0 )
  1911.                 {
  1912.                 if ( number_to_move == YY_MORE_ADJ )
  1913.                         {
  1914.                         ret_val = EOB_ACT_END_OF_FILE;
  1915.                         glcpp_restart(yyin  ,yyscanner);
  1916.                         }
  1917.  
  1918.                 else
  1919.                         {
  1920.                         ret_val = EOB_ACT_LAST_MATCH;
  1921.                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
  1922.                                 YY_BUFFER_EOF_PENDING;
  1923.                         }
  1924.                 }
  1925.  
  1926.         else
  1927.                 ret_val = EOB_ACT_CONTINUE_SCAN;
  1928.  
  1929.         if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
  1930.                 /* Extend the array by 50%, plus the number we really need. */
  1931.                 yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
  1932.                 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) glcpp_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
  1933.                 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
  1934.                         YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
  1935.         }
  1936.  
  1937.         yyg->yy_n_chars += number_to_move;
  1938.         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
  1939.         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
  1940.  
  1941.         yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
  1942.  
  1943.         return ret_val;
  1944. }
  1945.  
  1946. /* yy_get_previous_state - get the state just before the EOB char was reached */
  1947.  
  1948.     static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
  1949. {
  1950.         register yy_state_type yy_current_state;
  1951.         register char *yy_cp;
  1952.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1953.  
  1954.         yy_current_state = yyg->yy_start;
  1955.  
  1956.         for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
  1957.                 {
  1958.                 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
  1959.                 if ( yy_accept[yy_current_state] )
  1960.                         {
  1961.                         yyg->yy_last_accepting_state = yy_current_state;
  1962.                         yyg->yy_last_accepting_cpos = yy_cp;
  1963.                         }
  1964.                 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1965.                         {
  1966.                         yy_current_state = (int) yy_def[yy_current_state];
  1967.                         if ( yy_current_state >= 174 )
  1968.                                 yy_c = yy_meta[(unsigned int) yy_c];
  1969.                         }
  1970.                 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  1971.                 }
  1972.  
  1973.         return yy_current_state;
  1974. }
  1975.  
  1976. /* yy_try_NUL_trans - try to make a transition on the NUL character
  1977.  *
  1978.  * synopsis
  1979.  *      next_state = yy_try_NUL_trans( current_state );
  1980.  */
  1981.     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state , yyscan_t yyscanner)
  1982. {
  1983.         register int yy_is_jam;
  1984.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
  1985.         register char *yy_cp = yyg->yy_c_buf_p;
  1986.  
  1987.         register YY_CHAR yy_c = 1;
  1988.         if ( yy_accept[yy_current_state] )
  1989.                 {
  1990.                 yyg->yy_last_accepting_state = yy_current_state;
  1991.                 yyg->yy_last_accepting_cpos = yy_cp;
  1992.                 }
  1993.         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1994.                 {
  1995.                 yy_current_state = (int) yy_def[yy_current_state];
  1996.                 if ( yy_current_state >= 174 )
  1997.                         yy_c = yy_meta[(unsigned int) yy_c];
  1998.                 }
  1999.         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  2000.         yy_is_jam = (yy_current_state == 173);
  2001.  
  2002.         (void)yyg;
  2003.         return yy_is_jam ? 0 : yy_current_state;
  2004. }
  2005.  
  2006.     static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner)
  2007. {
  2008.         register char *yy_cp;
  2009.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2010.  
  2011.     yy_cp = yyg->yy_c_buf_p;
  2012.  
  2013.         /* undo effects of setting up yytext */
  2014.         *yy_cp = yyg->yy_hold_char;
  2015.  
  2016.         if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
  2017.                 { /* need to shift things up to make room */
  2018.                 /* +2 for EOB chars. */
  2019.                 register yy_size_t number_to_move = yyg->yy_n_chars + 2;
  2020.                 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
  2021.                                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
  2022.                 register char *source =
  2023.                                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
  2024.  
  2025.                 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
  2026.                         *--dest = *--source;
  2027.  
  2028.                 yy_cp += (int) (dest - source);
  2029.                 yy_bp += (int) (dest - source);
  2030.                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
  2031.                         yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
  2032.  
  2033.                 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
  2034.                         YY_FATAL_ERROR( "flex scanner push-back overflow" );
  2035.                 }
  2036.  
  2037.         *--yy_cp = (char) c;
  2038.  
  2039.         yyg->yytext_ptr = yy_bp;
  2040.         yyg->yy_hold_char = *yy_cp;
  2041.         yyg->yy_c_buf_p = yy_cp;
  2042. }
  2043.  
  2044. #ifndef YY_NO_INPUT
  2045. #ifdef __cplusplus
  2046.     static int yyinput (yyscan_t yyscanner)
  2047. #else
  2048.     static int input  (yyscan_t yyscanner)
  2049. #endif
  2050.  
  2051. {
  2052.         int c;
  2053.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2054.  
  2055.         *yyg->yy_c_buf_p = yyg->yy_hold_char;
  2056.  
  2057.         if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
  2058.                 {
  2059.                 /* yy_c_buf_p now points to the character we want to return.
  2060.                  * If this occurs *before* the EOB characters, then it's a
  2061.                  * valid NUL; if not, then we've hit the end of the buffer.
  2062.                  */
  2063.                 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
  2064.                         /* This was really a NUL. */
  2065.                         *yyg->yy_c_buf_p = '\0';
  2066.  
  2067.                 else
  2068.                         { /* need more input */
  2069.                         yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
  2070.                         ++yyg->yy_c_buf_p;
  2071.  
  2072.                         switch ( yy_get_next_buffer( yyscanner ) )
  2073.                                 {
  2074.                                 case EOB_ACT_LAST_MATCH:
  2075.                                         /* This happens because yy_g_n_b()
  2076.                                          * sees that we've accumulated a
  2077.                                          * token and flags that we need to
  2078.                                          * try matching the token before
  2079.                                          * proceeding.  But for input(),
  2080.                                          * there's no matching to consider.
  2081.                                          * So convert the EOB_ACT_LAST_MATCH
  2082.                                          * to EOB_ACT_END_OF_FILE.
  2083.                                          */
  2084.  
  2085.                                         /* Reset buffer status. */
  2086.                                         glcpp_restart(yyin ,yyscanner);
  2087.  
  2088.                                         /*FALLTHROUGH*/
  2089.  
  2090.                                 case EOB_ACT_END_OF_FILE:
  2091.                                         {
  2092.                                         if ( glcpp_wrap(yyscanner ) )
  2093.                                                 return EOF;
  2094.  
  2095.                                         if ( ! yyg->yy_did_buffer_switch_on_eof )
  2096.                                                 YY_NEW_FILE;
  2097. #ifdef __cplusplus
  2098.                                         return yyinput(yyscanner);
  2099. #else
  2100.                                         return input(yyscanner);
  2101. #endif
  2102.                                         }
  2103.  
  2104.                                 case EOB_ACT_CONTINUE_SCAN:
  2105.                                         yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
  2106.                                         break;
  2107.                                 }
  2108.                         }
  2109.                 }
  2110.  
  2111.         c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
  2112.         *yyg->yy_c_buf_p = '\0';        /* preserve yytext */
  2113.         yyg->yy_hold_char = *++yyg->yy_c_buf_p;
  2114.  
  2115.         return c;
  2116. }
  2117. #endif  /* ifndef YY_NO_INPUT */
  2118.  
  2119. /** Immediately switch to a different input stream.
  2120.  * @param input_file A readable stream.
  2121.  * @param yyscanner The scanner object.
  2122.  * @note This function does not reset the start condition to @c INITIAL .
  2123.  */
  2124.     void glcpp_restart  (FILE * input_file , yyscan_t yyscanner)
  2125. {
  2126.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2127.  
  2128.         if ( ! YY_CURRENT_BUFFER ){
  2129.         glcpp_ensure_buffer_stack (yyscanner);
  2130.                 YY_CURRENT_BUFFER_LVALUE =
  2131.             glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
  2132.         }
  2133.  
  2134.         glcpp__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
  2135.         glcpp__load_buffer_state(yyscanner );
  2136. }
  2137.  
  2138. /** Switch to a different input buffer.
  2139.  * @param new_buffer The new input buffer.
  2140.  * @param yyscanner The scanner object.
  2141.  */
  2142.     void glcpp__switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)
  2143. {
  2144.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2145.  
  2146.         /* TODO. We should be able to replace this entire function body
  2147.          * with
  2148.          *              glcpp_pop_buffer_state();
  2149.          *              glcpp_push_buffer_state(new_buffer);
  2150.      */
  2151.         glcpp_ensure_buffer_stack (yyscanner);
  2152.         if ( YY_CURRENT_BUFFER == new_buffer )
  2153.                 return;
  2154.  
  2155.         if ( YY_CURRENT_BUFFER )
  2156.                 {
  2157.                 /* Flush out information for old buffer. */
  2158.                 *yyg->yy_c_buf_p = yyg->yy_hold_char;
  2159.                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
  2160.                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
  2161.                 }
  2162.  
  2163.         YY_CURRENT_BUFFER_LVALUE = new_buffer;
  2164.         glcpp__load_buffer_state(yyscanner );
  2165.  
  2166.         /* We don't actually know whether we did this switch during
  2167.          * EOF (glcpp_wrap()) processing, but the only time this flag
  2168.          * is looked at is after glcpp_wrap() is called, so it's safe
  2169.          * to go ahead and always set it.
  2170.          */
  2171.         yyg->yy_did_buffer_switch_on_eof = 1;
  2172. }
  2173.  
  2174. static void glcpp__load_buffer_state  (yyscan_t yyscanner)
  2175. {
  2176.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2177.         yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  2178.         yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
  2179.         yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
  2180.         yyg->yy_hold_char = *yyg->yy_c_buf_p;
  2181. }
  2182.  
  2183. /** Allocate and initialize an input buffer state.
  2184.  * @param file A readable stream.
  2185.  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
  2186.  * @param yyscanner The scanner object.
  2187.  * @return the allocated buffer state.
  2188.  */
  2189.     YY_BUFFER_STATE glcpp__create_buffer  (FILE * file, int  size , yyscan_t yyscanner)
  2190. {
  2191.         YY_BUFFER_STATE b;
  2192.    
  2193.         b = (YY_BUFFER_STATE) glcpp_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
  2194.         if ( ! b )
  2195.                 YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" );
  2196.  
  2197.         b->yy_buf_size = size;
  2198.  
  2199.         /* yy_ch_buf has to be 2 characters longer than the size given because
  2200.          * we need to put in 2 end-of-buffer characters.
  2201.          */
  2202.         b->yy_ch_buf = (char *) glcpp_alloc(b->yy_buf_size + 2 ,yyscanner );
  2203.         if ( ! b->yy_ch_buf )
  2204.                 YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" );
  2205.  
  2206.         b->yy_is_our_buffer = 1;
  2207.  
  2208.         glcpp__init_buffer(b,file ,yyscanner);
  2209.  
  2210.         return b;
  2211. }
  2212.  
  2213. /** Destroy the buffer.
  2214.  * @param b a buffer created with glcpp__create_buffer()
  2215.  * @param yyscanner The scanner object.
  2216.  */
  2217.     void glcpp__delete_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
  2218. {
  2219.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2220.  
  2221.         if ( ! b )
  2222.                 return;
  2223.  
  2224.         if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
  2225.                 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
  2226.  
  2227.         if ( b->yy_is_our_buffer )
  2228.                 glcpp_free((void *) b->yy_ch_buf ,yyscanner );
  2229.  
  2230.         glcpp_free((void *) b ,yyscanner );
  2231. }
  2232.  
  2233. /* Initializes or reinitializes a buffer.
  2234.  * This function is sometimes called more than once on the same buffer,
  2235.  * such as during a glcpp_restart() or at EOF.
  2236.  */
  2237.     static void glcpp__init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)
  2238.  
  2239. {
  2240.         int oerrno = errno;
  2241.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2242.  
  2243.         glcpp__flush_buffer(b ,yyscanner);
  2244.  
  2245.         b->yy_input_file = file;
  2246.         b->yy_fill_buffer = 1;
  2247.  
  2248.     /* If b is the current buffer, then glcpp__init_buffer was _probably_
  2249.      * called from glcpp_restart() or through yy_get_next_buffer.
  2250.      * In that case, we don't want to reset the lineno or column.
  2251.      */
  2252.     if (b != YY_CURRENT_BUFFER){
  2253.         b->yy_bs_lineno = 1;
  2254.         b->yy_bs_column = 0;
  2255.     }
  2256.  
  2257.         b->yy_is_interactive = 0;
  2258.    
  2259.         errno = oerrno;
  2260. }
  2261.  
  2262. /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
  2263.  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
  2264.  * @param yyscanner The scanner object.
  2265.  */
  2266.     void glcpp__flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
  2267. {
  2268.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2269.         if ( ! b )
  2270.                 return;
  2271.  
  2272.         b->yy_n_chars = 0;
  2273.  
  2274.         /* We always need two end-of-buffer characters.  The first causes
  2275.          * a transition to the end-of-buffer state.  The second causes
  2276.          * a jam in that state.
  2277.          */
  2278.         b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
  2279.         b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  2280.  
  2281.         b->yy_buf_pos = &b->yy_ch_buf[0];
  2282.  
  2283.         b->yy_at_bol = 1;
  2284.         b->yy_buffer_status = YY_BUFFER_NEW;
  2285.  
  2286.         if ( b == YY_CURRENT_BUFFER )
  2287.                 glcpp__load_buffer_state(yyscanner );
  2288. }
  2289.  
  2290. /** Pushes the new state onto the stack. The new state becomes
  2291.  *  the current state. This function will allocate the stack
  2292.  *  if necessary.
  2293.  *  @param new_buffer The new state.
  2294.  *  @param yyscanner The scanner object.
  2295.  */
  2296. void glcpp_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
  2297. {
  2298.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2299.         if (new_buffer == NULL)
  2300.                 return;
  2301.  
  2302.         glcpp_ensure_buffer_stack(yyscanner);
  2303.  
  2304.         /* This block is copied from glcpp__switch_to_buffer. */
  2305.         if ( YY_CURRENT_BUFFER )
  2306.                 {
  2307.                 /* Flush out information for old buffer. */
  2308.                 *yyg->yy_c_buf_p = yyg->yy_hold_char;
  2309.                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
  2310.                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
  2311.                 }
  2312.  
  2313.         /* Only push if top exists. Otherwise, replace top. */
  2314.         if (YY_CURRENT_BUFFER)
  2315.                 yyg->yy_buffer_stack_top++;
  2316.         YY_CURRENT_BUFFER_LVALUE = new_buffer;
  2317.  
  2318.         /* copied from glcpp__switch_to_buffer. */
  2319.         glcpp__load_buffer_state(yyscanner );
  2320.         yyg->yy_did_buffer_switch_on_eof = 1;
  2321. }
  2322.  
  2323. /** Removes and deletes the top of the stack, if present.
  2324.  *  The next element becomes the new top.
  2325.  *  @param yyscanner The scanner object.
  2326.  */
  2327. void glcpp_pop_buffer_state (yyscan_t yyscanner)
  2328. {
  2329.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2330.         if (!YY_CURRENT_BUFFER)
  2331.                 return;
  2332.  
  2333.         glcpp__delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
  2334.         YY_CURRENT_BUFFER_LVALUE = NULL;
  2335.         if (yyg->yy_buffer_stack_top > 0)
  2336.                 --yyg->yy_buffer_stack_top;
  2337.  
  2338.         if (YY_CURRENT_BUFFER) {
  2339.                 glcpp__load_buffer_state(yyscanner );
  2340.                 yyg->yy_did_buffer_switch_on_eof = 1;
  2341.         }
  2342. }
  2343.  
  2344. /* Allocates the stack if it does not exist.
  2345.  *  Guarantees space for at least one push.
  2346.  */
  2347. static void glcpp_ensure_buffer_stack (yyscan_t yyscanner)
  2348. {
  2349.         yy_size_t num_to_alloc;
  2350.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2351.  
  2352.         if (!yyg->yy_buffer_stack) {
  2353.  
  2354.                 /* First allocation is just for 2 elements, since we don't know if this
  2355.                  * scanner will even need a stack. We use 2 instead of 1 to avoid an
  2356.                  * immediate realloc on the next call.
  2357.          */
  2358.                 num_to_alloc = 1;
  2359.                 yyg->yy_buffer_stack = (struct yy_buffer_state**)glcpp_alloc
  2360.                                                                 (num_to_alloc * sizeof(struct yy_buffer_state*)
  2361.                                                                 , yyscanner);
  2362.                 if ( ! yyg->yy_buffer_stack )
  2363.                         YY_FATAL_ERROR( "out of dynamic memory in glcpp_ensure_buffer_stack()" );
  2364.                                                                  
  2365.                 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
  2366.                                
  2367.                 yyg->yy_buffer_stack_max = num_to_alloc;
  2368.                 yyg->yy_buffer_stack_top = 0;
  2369.                 return;
  2370.         }
  2371.  
  2372.         if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
  2373.  
  2374.                 /* Increase the buffer to prepare for a possible push. */
  2375.                 int grow_size = 8 /* arbitrary grow size */;
  2376.  
  2377.                 num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
  2378.                 yyg->yy_buffer_stack = (struct yy_buffer_state**)glcpp_realloc
  2379.                                                                 (yyg->yy_buffer_stack,
  2380.                                                                 num_to_alloc * sizeof(struct yy_buffer_state*)
  2381.                                                                 , yyscanner);
  2382.                 if ( ! yyg->yy_buffer_stack )
  2383.                         YY_FATAL_ERROR( "out of dynamic memory in glcpp_ensure_buffer_stack()" );
  2384.  
  2385.                 /* zero only the new slots.*/
  2386.                 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
  2387.                 yyg->yy_buffer_stack_max = num_to_alloc;
  2388.         }
  2389. }
  2390.  
  2391. /** Setup the input buffer state to scan directly from a user-specified character buffer.
  2392.  * @param base the character buffer
  2393.  * @param size the size in bytes of the character buffer
  2394.  * @param yyscanner The scanner object.
  2395.  * @return the newly allocated buffer state object.
  2396.  */
  2397. YY_BUFFER_STATE glcpp__scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)
  2398. {
  2399.         YY_BUFFER_STATE b;
  2400.    
  2401.         if ( size < 2 ||
  2402.              base[size-2] != YY_END_OF_BUFFER_CHAR ||
  2403.              base[size-1] != YY_END_OF_BUFFER_CHAR )
  2404.                 /* They forgot to leave room for the EOB's. */
  2405.                 return 0;
  2406.  
  2407.         b = (YY_BUFFER_STATE) glcpp_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
  2408.         if ( ! b )
  2409.                 YY_FATAL_ERROR( "out of dynamic memory in glcpp__scan_buffer()" );
  2410.  
  2411.         b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
  2412.         b->yy_buf_pos = b->yy_ch_buf = base;
  2413.         b->yy_is_our_buffer = 0;
  2414.         b->yy_input_file = 0;
  2415.         b->yy_n_chars = b->yy_buf_size;
  2416.         b->yy_is_interactive = 0;
  2417.         b->yy_at_bol = 1;
  2418.         b->yy_fill_buffer = 0;
  2419.         b->yy_buffer_status = YY_BUFFER_NEW;
  2420.  
  2421.         glcpp__switch_to_buffer(b ,yyscanner );
  2422.  
  2423.         return b;
  2424. }
  2425.  
  2426. /** Setup the input buffer state to scan a string. The next call to glcpp_lex() will
  2427.  * scan from a @e copy of @a str.
  2428.  * @param yystr a NUL-terminated string to scan
  2429.  * @param yyscanner The scanner object.
  2430.  * @return the newly allocated buffer state object.
  2431.  * @note If you want to scan bytes that may contain NUL values, then use
  2432.  *       glcpp__scan_bytes() instead.
  2433.  */
  2434. YY_BUFFER_STATE glcpp__scan_string (yyconst char * yystr , yyscan_t yyscanner)
  2435. {
  2436.    
  2437.         return glcpp__scan_bytes(yystr,strlen(yystr) ,yyscanner);
  2438. }
  2439.  
  2440. /** Setup the input buffer state to scan the given bytes. The next call to glcpp_lex() will
  2441.  * scan from a @e copy of @a bytes.
  2442.  * @param yybytes the byte buffer to scan
  2443.  * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
  2444.  * @param yyscanner The scanner object.
  2445.  * @return the newly allocated buffer state object.
  2446.  */
  2447. YY_BUFFER_STATE glcpp__scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len , yyscan_t yyscanner)
  2448. {
  2449.         YY_BUFFER_STATE b;
  2450.         char *buf;
  2451.         yy_size_t n;
  2452.         yy_size_t i;
  2453.    
  2454.         /* Get memory for full buffer, including space for trailing EOB's. */
  2455.         n = _yybytes_len + 2;
  2456.         buf = (char *) glcpp_alloc(n ,yyscanner );
  2457.         if ( ! buf )
  2458.                 YY_FATAL_ERROR( "out of dynamic memory in glcpp__scan_bytes()" );
  2459.  
  2460.         for ( i = 0; i < _yybytes_len; ++i )
  2461.                 buf[i] = yybytes[i];
  2462.  
  2463.         buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
  2464.  
  2465.         b = glcpp__scan_buffer(buf,n ,yyscanner);
  2466.         if ( ! b )
  2467.                 YY_FATAL_ERROR( "bad buffer in glcpp__scan_bytes()" );
  2468.  
  2469.         /* It's okay to grow etc. this buffer, and we should throw it
  2470.          * away when we're done.
  2471.          */
  2472.         b->yy_is_our_buffer = 1;
  2473.  
  2474.         return b;
  2475. }
  2476.  
  2477.     static void yy_push_state (int  new_state , yyscan_t yyscanner)
  2478. {
  2479.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2480.         if ( yyg->yy_start_stack_ptr >= yyg->yy_start_stack_depth )
  2481.                 {
  2482.                 yy_size_t new_size;
  2483.  
  2484.                 yyg->yy_start_stack_depth += YY_START_STACK_INCR;
  2485.                 new_size = yyg->yy_start_stack_depth * sizeof( int );
  2486.  
  2487.                 if ( ! yyg->yy_start_stack )
  2488.                         yyg->yy_start_stack = (int *) glcpp_alloc(new_size ,yyscanner );
  2489.  
  2490.                 else
  2491.                         yyg->yy_start_stack = (int *) glcpp_realloc((void *) yyg->yy_start_stack,new_size ,yyscanner );
  2492.  
  2493.                 if ( ! yyg->yy_start_stack )
  2494.                         YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
  2495.                 }
  2496.  
  2497.         yyg->yy_start_stack[yyg->yy_start_stack_ptr++] = YY_START;
  2498.  
  2499.         BEGIN(new_state);
  2500. }
  2501.  
  2502.     static void yy_pop_state  (yyscan_t yyscanner)
  2503. {
  2504.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2505.         if ( --yyg->yy_start_stack_ptr < 0 )
  2506.                 YY_FATAL_ERROR( "start-condition stack underflow" );
  2507.  
  2508.         BEGIN(yyg->yy_start_stack[yyg->yy_start_stack_ptr]);
  2509. }
  2510.  
  2511.     static int yy_top_state  (yyscan_t yyscanner)
  2512. {
  2513.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2514.         return yyg->yy_start_stack[yyg->yy_start_stack_ptr - 1];
  2515. }
  2516.  
  2517. #ifndef YY_EXIT_FAILURE
  2518. #define YY_EXIT_FAILURE 2
  2519. #endif
  2520.  
  2521. static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
  2522. {
  2523.         (void) fprintf( stderr, "%s\n", msg );
  2524.         exit( YY_EXIT_FAILURE );
  2525. }
  2526.  
  2527. /* Redefine yyless() so it works in section 3 code. */
  2528.  
  2529. #undef yyless
  2530. #define yyless(n) \
  2531.         do \
  2532.                 { \
  2533.                 /* Undo effects of setting up yytext. */ \
  2534.         int yyless_macro_arg = (n); \
  2535.         YY_LESS_LINENO(yyless_macro_arg);\
  2536.                 yytext[yyleng] = yyg->yy_hold_char; \
  2537.                 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
  2538.                 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
  2539.                 *yyg->yy_c_buf_p = '\0'; \
  2540.                 yyleng = yyless_macro_arg; \
  2541.                 } \
  2542.         while ( 0 )
  2543.  
  2544. /* Accessor  methods (get/set functions) to struct members. */
  2545.  
  2546. /** Get the user-defined data for this scanner.
  2547.  * @param yyscanner The scanner object.
  2548.  */
  2549. YY_EXTRA_TYPE glcpp_get_extra  (yyscan_t yyscanner)
  2550. {
  2551.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2552.     return yyextra;
  2553. }
  2554.  
  2555. /** Get the current line number.
  2556.  * @param yyscanner The scanner object.
  2557.  */
  2558. int glcpp_get_lineno  (yyscan_t yyscanner)
  2559. {
  2560.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2561.    
  2562.         if (! YY_CURRENT_BUFFER)
  2563.             return 0;
  2564.    
  2565.     return yylineno;
  2566. }
  2567.  
  2568. /** Get the current column number.
  2569.  * @param yyscanner The scanner object.
  2570.  */
  2571. int glcpp_get_column  (yyscan_t yyscanner)
  2572. {
  2573.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2574.    
  2575.         if (! YY_CURRENT_BUFFER)
  2576.             return 0;
  2577.    
  2578.     return yycolumn;
  2579. }
  2580.  
  2581. /** Get the input stream.
  2582.  * @param yyscanner The scanner object.
  2583.  */
  2584. FILE *glcpp_get_in  (yyscan_t yyscanner)
  2585. {
  2586.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2587.     return yyin;
  2588. }
  2589.  
  2590. /** Get the output stream.
  2591.  * @param yyscanner The scanner object.
  2592.  */
  2593. FILE *glcpp_get_out  (yyscan_t yyscanner)
  2594. {
  2595.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2596.     return yyout;
  2597. }
  2598.  
  2599. /** Get the length of the current token.
  2600.  * @param yyscanner The scanner object.
  2601.  */
  2602. yy_size_t glcpp_get_leng  (yyscan_t yyscanner)
  2603. {
  2604.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2605.     return yyleng;
  2606. }
  2607.  
  2608. /** Get the current token.
  2609.  * @param yyscanner The scanner object.
  2610.  */
  2611.  
  2612. char *glcpp_get_text  (yyscan_t yyscanner)
  2613. {
  2614.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2615.     return yytext;
  2616. }
  2617.  
  2618. /** Set the user-defined data. This data is never touched by the scanner.
  2619.  * @param user_defined The data to be associated with this scanner.
  2620.  * @param yyscanner The scanner object.
  2621.  */
  2622. void glcpp_set_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)
  2623. {
  2624.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2625.     yyextra = user_defined ;
  2626. }
  2627.  
  2628. /** Set the current line number.
  2629.  * @param line_number
  2630.  * @param yyscanner The scanner object.
  2631.  */
  2632. void glcpp_set_lineno (int  line_number , yyscan_t yyscanner)
  2633. {
  2634.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2635.  
  2636.         /* lineno is only valid if an input buffer exists. */
  2637.         if (! YY_CURRENT_BUFFER )
  2638.            YY_FATAL_ERROR( "glcpp_set_lineno called with no buffer" );
  2639.    
  2640.     yylineno = line_number;
  2641. }
  2642.  
  2643. /** Set the current column.
  2644.  * @param line_number
  2645.  * @param yyscanner The scanner object.
  2646.  */
  2647. void glcpp_set_column (int  column_no , yyscan_t yyscanner)
  2648. {
  2649.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2650.  
  2651.         /* column is only valid if an input buffer exists. */
  2652.         if (! YY_CURRENT_BUFFER )
  2653.            YY_FATAL_ERROR( "glcpp_set_column called with no buffer" );
  2654.    
  2655.     yycolumn = column_no;
  2656. }
  2657.  
  2658. /** Set the input stream. This does not discard the current
  2659.  * input buffer.
  2660.  * @param in_str A readable stream.
  2661.  * @param yyscanner The scanner object.
  2662.  * @see glcpp__switch_to_buffer
  2663.  */
  2664. void glcpp_set_in (FILE *  in_str , yyscan_t yyscanner)
  2665. {
  2666.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2667.     yyin = in_str ;
  2668. }
  2669.  
  2670. void glcpp_set_out (FILE *  out_str , yyscan_t yyscanner)
  2671. {
  2672.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2673.     yyout = out_str ;
  2674. }
  2675.  
  2676. int glcpp_get_debug  (yyscan_t yyscanner)
  2677. {
  2678.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2679.     return yy_flex_debug;
  2680. }
  2681.  
  2682. void glcpp_set_debug (int  bdebug , yyscan_t yyscanner)
  2683. {
  2684.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2685.     yy_flex_debug = bdebug ;
  2686. }
  2687.  
  2688. /* Accessor methods for yylval and yylloc */
  2689.  
  2690. YYSTYPE * glcpp_get_lval  (yyscan_t yyscanner)
  2691. {
  2692.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2693.     return yylval;
  2694. }
  2695.  
  2696. void glcpp_set_lval (YYSTYPE *  yylval_param , yyscan_t yyscanner)
  2697. {
  2698.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2699.     yylval = yylval_param;
  2700. }
  2701.  
  2702. YYLTYPE *glcpp_get_lloc  (yyscan_t yyscanner)
  2703. {
  2704.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2705.     return yylloc;
  2706. }
  2707.    
  2708. void glcpp_set_lloc (YYLTYPE *  yylloc_param , yyscan_t yyscanner)
  2709. {
  2710.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2711.     yylloc = yylloc_param;
  2712. }
  2713.    
  2714. /* User-visible API */
  2715.  
  2716. /* glcpp_lex_init is special because it creates the scanner itself, so it is
  2717.  * the ONLY reentrant function that doesn't take the scanner as the last argument.
  2718.  * That's why we explicitly handle the declaration, instead of using our macros.
  2719.  */
  2720.  
  2721. int glcpp_lex_init(yyscan_t* ptr_yy_globals)
  2722.  
  2723. {
  2724.     if (ptr_yy_globals == NULL){
  2725.         errno = EINVAL;
  2726.         return 1;
  2727.     }
  2728.  
  2729.     *ptr_yy_globals = (yyscan_t) glcpp_alloc ( sizeof( struct yyguts_t ), NULL );
  2730.  
  2731.     if (*ptr_yy_globals == NULL){
  2732.         errno = ENOMEM;
  2733.         return 1;
  2734.     }
  2735.  
  2736.     /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
  2737.     memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
  2738.  
  2739.     return yy_init_globals ( *ptr_yy_globals );
  2740. }
  2741.  
  2742. /* glcpp_lex_init_extra has the same functionality as glcpp_lex_init, but follows the
  2743.  * convention of taking the scanner as the last argument. Note however, that
  2744.  * this is a *pointer* to a scanner, as it will be allocated by this call (and
  2745.  * is the reason, too, why this function also must handle its own declaration).
  2746.  * The user defined value in the first argument will be available to glcpp_alloc in
  2747.  * the yyextra field.
  2748.  */
  2749.  
  2750. int glcpp_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
  2751.  
  2752. {
  2753.     struct yyguts_t dummy_yyguts;
  2754.  
  2755.     glcpp_set_extra (yy_user_defined, &dummy_yyguts);
  2756.  
  2757.     if (ptr_yy_globals == NULL){
  2758.         errno = EINVAL;
  2759.         return 1;
  2760.     }
  2761.        
  2762.     *ptr_yy_globals = (yyscan_t) glcpp_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
  2763.        
  2764.     if (*ptr_yy_globals == NULL){
  2765.         errno = ENOMEM;
  2766.         return 1;
  2767.     }
  2768.    
  2769.     /* By setting to 0xAA, we expose bugs in
  2770.     yy_init_globals. Leave at 0x00 for releases. */
  2771.     memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
  2772.    
  2773.     glcpp_set_extra (yy_user_defined, *ptr_yy_globals);
  2774.    
  2775.     return yy_init_globals ( *ptr_yy_globals );
  2776. }
  2777.  
  2778. static int yy_init_globals (yyscan_t yyscanner)
  2779. {
  2780.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2781.     /* Initialization is the same as for the non-reentrant scanner.
  2782.      * This function is called from glcpp_lex_destroy(), so don't allocate here.
  2783.      */
  2784.  
  2785.     yyg->yy_buffer_stack = 0;
  2786.     yyg->yy_buffer_stack_top = 0;
  2787.     yyg->yy_buffer_stack_max = 0;
  2788.     yyg->yy_c_buf_p = (char *) 0;
  2789.     yyg->yy_init = 0;
  2790.     yyg->yy_start = 0;
  2791.  
  2792.     yyg->yy_start_stack_ptr = 0;
  2793.     yyg->yy_start_stack_depth = 0;
  2794.     yyg->yy_start_stack =  NULL;
  2795.  
  2796. /* Defined in main.c */
  2797. #ifdef YY_STDINIT
  2798.     yyin = stdin;
  2799.     yyout = stdout;
  2800. #else
  2801.     yyin = (FILE *) 0;
  2802.     yyout = (FILE *) 0;
  2803. #endif
  2804.  
  2805.     /* For future reference: Set errno on error, since we are called by
  2806.      * glcpp_lex_init()
  2807.      */
  2808.     return 0;
  2809. }
  2810.  
  2811. /* glcpp_lex_destroy is for both reentrant and non-reentrant scanners. */
  2812. int glcpp_lex_destroy  (yyscan_t yyscanner)
  2813. {
  2814.     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2815.  
  2816.     /* Pop the buffer stack, destroying each element. */
  2817.         while(YY_CURRENT_BUFFER){
  2818.                 glcpp__delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
  2819.                 YY_CURRENT_BUFFER_LVALUE = NULL;
  2820.                 glcpp_pop_buffer_state(yyscanner);
  2821.         }
  2822.  
  2823.         /* Destroy the stack itself. */
  2824.         glcpp_free(yyg->yy_buffer_stack ,yyscanner);
  2825.         yyg->yy_buffer_stack = NULL;
  2826.  
  2827.     /* Destroy the start condition stack. */
  2828.         glcpp_free(yyg->yy_start_stack ,yyscanner );
  2829.         yyg->yy_start_stack = NULL;
  2830.  
  2831.     /* Reset the globals. This is important in a non-reentrant scanner so the next time
  2832.      * glcpp_lex() is called, initialization will occur. */
  2833.     yy_init_globals( yyscanner);
  2834.  
  2835.     /* Destroy the main struct (reentrant only). */
  2836.     glcpp_free ( yyscanner , yyscanner );
  2837.     yyscanner = NULL;
  2838.     return 0;
  2839. }
  2840.  
  2841. /*
  2842.  * Internal utility routines.
  2843.  */
  2844.  
  2845. #ifndef yytext_ptr
  2846. static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
  2847. {
  2848.         register int i;
  2849.         for ( i = 0; i < n; ++i )
  2850.                 s1[i] = s2[i];
  2851. }
  2852. #endif
  2853.  
  2854. #ifdef YY_NEED_STRLEN
  2855. static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
  2856. {
  2857.         register int n;
  2858.         for ( n = 0; s[n]; ++n )
  2859.                 ;
  2860.  
  2861.         return n;
  2862. }
  2863. #endif
  2864.  
  2865. void *glcpp_alloc (yy_size_t  size , yyscan_t yyscanner)
  2866. {
  2867.         return (void *) malloc( size );
  2868. }
  2869.  
  2870. void *glcpp_realloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)
  2871. {
  2872.         /* The cast to (char *) in the following accommodates both
  2873.          * implementations that use char* generic pointers, and those
  2874.          * that use void* generic pointers.  It works with the latter
  2875.          * because both ANSI C and C++ allow castless assignment from
  2876.          * any pointer type to void*, and deal with argument conversions
  2877.          * as though doing an assignment.
  2878.          */
  2879.         return (void *) realloc( (char *) ptr, size );
  2880. }
  2881.  
  2882. void glcpp_free (void * ptr , yyscan_t yyscanner)
  2883. {
  2884.         free( (char *) ptr );   /* see glcpp_realloc() for (char *) cast */
  2885. }
  2886.  
  2887. #define YYTABLES_NAME "yytables"
  2888.  
  2889. #line 571 "../../../src/glsl/glcpp/glcpp-lex.l"
  2890.  
  2891.  
  2892.  
  2893. void
  2894. glcpp_lex_set_source_string(glcpp_parser_t *parser, const char *shader)
  2895. {
  2896.         glcpp__scan_string(shader,parser->scanner);
  2897. }
  2898.  
  2899.