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