Replace gmx_large_int_t with gmx_int64_t
[alexxy/gromacs.git] / src / gromacs / selection / scanner.cpp
1 #line 2 "scanner.cpp"
2 #line 50 "scanner.l"
3 // Required before flex definitions, since it includes <stdint.h>.
4 // Otherwise, compilers not strictly C99 get macro redefinition errors,
5 // since flex defines INT64_MAX etc. in such cases.
6 #include "gromacs/legacyheaders/types/simple.h"
7
8
9
10 #line 11 "scanner.cpp"
11
12 #define  YY_INT_ALIGNED short int
13
14 /* A lexical scanner generated by flex */
15
16 #define FLEX_SCANNER
17 #define YY_FLEX_MAJOR_VERSION 2
18 #define YY_FLEX_MINOR_VERSION 5
19 #define YY_FLEX_SUBMINOR_VERSION 37
20 #if YY_FLEX_SUBMINOR_VERSION > 0
21 #define FLEX_BETA
22 #endif
23
24 /* First, we deal with  platform-specific or compiler-specific issues. */
25
26 /* begin standard C headers. */
27 #include <stdio.h>
28 #include <string.h>
29 #include <errno.h>
30 #include <stdlib.h>
31
32 /* end standard C headers. */
33
34 /* flex integer type definitions */
35
36 #ifndef FLEXINT_H
37 #define FLEXINT_H
38
39 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
40
41 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
42
43 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
44  * if you want the limit (max/min) macros for int types. 
45  */
46 #ifndef __STDC_LIMIT_MACROS
47 #define __STDC_LIMIT_MACROS 1
48 #endif
49
50 #include <inttypes.h>
51 typedef int8_t flex_int8_t;
52 typedef uint8_t flex_uint8_t;
53 typedef int16_t flex_int16_t;
54 typedef uint16_t flex_uint16_t;
55 typedef int32_t flex_int32_t;
56 typedef uint32_t flex_uint32_t;
57 #else
58 typedef signed char flex_int8_t;
59 typedef short int flex_int16_t;
60 typedef int flex_int32_t;
61 typedef unsigned char flex_uint8_t; 
62 typedef unsigned short int flex_uint16_t;
63 typedef unsigned int flex_uint32_t;
64
65 /* Limits of integral types. */
66 #ifndef INT8_MIN
67 #define INT8_MIN               (-128)
68 #endif
69 #ifndef INT16_MIN
70 #define INT16_MIN              (-32767-1)
71 #endif
72 #ifndef INT32_MIN
73 #define INT32_MIN              (-2147483647-1)
74 #endif
75 #ifndef INT8_MAX
76 #define INT8_MAX               (127)
77 #endif
78 #ifndef INT16_MAX
79 #define INT16_MAX              (32767)
80 #endif
81 #ifndef INT32_MAX
82 #define INT32_MAX              (2147483647)
83 #endif
84 #ifndef UINT8_MAX
85 #define UINT8_MAX              (255U)
86 #endif
87 #ifndef UINT16_MAX
88 #define UINT16_MAX             (65535U)
89 #endif
90 #ifndef UINT32_MAX
91 #define UINT32_MAX             (4294967295U)
92 #endif
93
94 #endif /* ! C99 */
95
96 #endif /* ! FLEXINT_H */
97
98 #ifdef __cplusplus
99
100 /* The "const" storage-class-modifier is valid. */
101 #define YY_USE_CONST
102
103 #else   /* ! __cplusplus */
104
105 /* C99 requires __STDC__ to be defined as 1. */
106 #if defined (__STDC__)
107
108 #define YY_USE_CONST
109
110 #endif  /* defined (__STDC__) */
111 #endif  /* ! __cplusplus */
112
113 #ifdef YY_USE_CONST
114 #define yyconst const
115 #else
116 #define yyconst
117 #endif
118
119 /* Returned upon end-of-file. */
120 #define YY_NULL 0
121
122 /* Promotes a possibly negative, possibly signed char to an unsigned
123  * integer for use as an array index.  If the signed char is negative,
124  * we want to instead treat it as an 8-bit unsigned char, hence the
125  * double cast.
126  */
127 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
128
129 /* An opaque pointer. */
130 #ifndef YY_TYPEDEF_YY_SCANNER_T
131 #define YY_TYPEDEF_YY_SCANNER_T
132 typedef void* yyscan_t;
133 #endif
134
135 /* For convenience, these vars (plus the bison vars far below)
136    are macros in the reentrant scanner. */
137 #define yyin yyg->yyin_r
138 #define yyout yyg->yyout_r
139 #define yyextra yyg->yyextra_r
140 #define yyleng yyg->yyleng_r
141 #define yytext yyg->yytext_r
142 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
143 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
144 #define yy_flex_debug yyg->yy_flex_debug_r
145
146 /* Enter a start condition.  This macro really ought to take a parameter,
147  * but we do it the disgusting crufty way forced on us by the ()-less
148  * definition of BEGIN.
149  */
150 #define BEGIN yyg->yy_start = 1 + 2 *
151
152 /* Translate the current start state into a value that can be later handed
153  * to BEGIN to return to the state.  The YYSTATE alias is for lex
154  * compatibility.
155  */
156 #define YY_START ((yyg->yy_start - 1) / 2)
157 #define YYSTATE YY_START
158
159 /* Action number for EOF rule of a given start state. */
160 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
161
162 /* Special action meaning "start processing a new file". */
163 #define YY_NEW_FILE _gmx_sel_yyrestart(yyin ,yyscanner )
164
165 #define YY_END_OF_BUFFER_CHAR 0
166
167 /* Size of default input buffer. */
168 #ifndef YY_BUF_SIZE
169 #define YY_BUF_SIZE 16384
170 #endif
171
172 /* The state buf must be large enough to hold one state per character in the main buffer.
173  */
174 #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
175
176 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
177 #define YY_TYPEDEF_YY_BUFFER_STATE
178 typedef struct yy_buffer_state *YY_BUFFER_STATE;
179 #endif
180
181 #ifndef YY_TYPEDEF_YY_SIZE_T
182 #define YY_TYPEDEF_YY_SIZE_T
183 typedef size_t yy_size_t;
184 #endif
185
186 #define EOB_ACT_CONTINUE_SCAN 0
187 #define EOB_ACT_END_OF_FILE 1
188 #define EOB_ACT_LAST_MATCH 2
189
190     #define YY_LESS_LINENO(n)
191     
192 /* Return all but the first "n" matched characters back to the input stream. */
193 #define yyless(n) \
194         do \
195                 { \
196                 /* Undo effects of setting up yytext. */ \
197         int yyless_macro_arg = (n); \
198         YY_LESS_LINENO(yyless_macro_arg);\
199                 *yy_cp = yyg->yy_hold_char; \
200                 YY_RESTORE_YY_MORE_OFFSET \
201                 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
202                 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
203                 } \
204         while ( 0 )
205
206 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
207
208 #ifndef YY_STRUCT_YY_BUFFER_STATE
209 #define YY_STRUCT_YY_BUFFER_STATE
210 struct yy_buffer_state
211         {
212         FILE *yy_input_file;
213
214         char *yy_ch_buf;                /* input buffer */
215         char *yy_buf_pos;               /* current position in input buffer */
216
217         /* Size of input buffer in bytes, not including room for EOB
218          * characters.
219          */
220         yy_size_t yy_buf_size;
221
222         /* Number of characters read into yy_ch_buf, not including EOB
223          * characters.
224          */
225         yy_size_t yy_n_chars;
226
227         /* Whether we "own" the buffer - i.e., we know we created it,
228          * and can realloc() it to grow it, and should free() it to
229          * delete it.
230          */
231         int yy_is_our_buffer;
232
233         /* Whether this is an "interactive" input source; if so, and
234          * if we're using stdio for input, then we want to use getc()
235          * instead of fread(), to make sure we stop fetching input after
236          * each newline.
237          */
238         int yy_is_interactive;
239
240         /* Whether we're considered to be at the beginning of a line.
241          * If so, '^' rules will be active on the next match, otherwise
242          * not.
243          */
244         int yy_at_bol;
245
246     int yy_bs_lineno; /**< The line count. */
247     int yy_bs_column; /**< The column count. */
248     
249         /* Whether to try to fill the input buffer when we reach the
250          * end of it.
251          */
252         int yy_fill_buffer;
253
254         int yy_buffer_status;
255
256 #define YY_BUFFER_NEW 0
257 #define YY_BUFFER_NORMAL 1
258         /* When an EOF's been seen but there's still some text to process
259          * then we mark the buffer as YY_EOF_PENDING, to indicate that we
260          * shouldn't try reading from the input source any more.  We might
261          * still have a bunch of tokens to match, though, because of
262          * possible backing-up.
263          *
264          * When we actually see the EOF, we change the status to "new"
265          * (via _gmx_sel_yyrestart()), so that the user can continue scanning by
266          * just pointing yyin at a new input file.
267          */
268 #define YY_BUFFER_EOF_PENDING 2
269
270         };
271 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
272
273 /* We provide macros for accessing buffer states in case in the
274  * future we want to put the buffer states in a more general
275  * "scanner state".
276  *
277  * Returns the top of the stack, or NULL.
278  */
279 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
280                           ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
281                           : NULL)
282
283 /* Same as previous macro, but useful when we know that the buffer stack is not
284  * NULL or when we need an lvalue. For internal use only.
285  */
286 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
287
288 void _gmx_sel_yyrestart (FILE *input_file ,yyscan_t yyscanner );
289 void _gmx_sel_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
290 YY_BUFFER_STATE _gmx_sel_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
291 void _gmx_sel_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
292 void _gmx_sel_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
293 void _gmx_sel_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
294 void _gmx_sel_yypop_buffer_state (yyscan_t yyscanner );
295
296 static void _gmx_sel_yyensure_buffer_stack (yyscan_t yyscanner );
297 static void _gmx_sel_yy_load_buffer_state (yyscan_t yyscanner );
298 static void _gmx_sel_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
299
300 #define YY_FLUSH_BUFFER _gmx_sel_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
301
302 YY_BUFFER_STATE _gmx_sel_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
303 YY_BUFFER_STATE _gmx_sel_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
304 YY_BUFFER_STATE _gmx_sel_yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner );
305
306 void *_gmx_sel_yyalloc (yy_size_t ,yyscan_t yyscanner );
307 void *_gmx_sel_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
308 void _gmx_sel_yyfree (void * ,yyscan_t yyscanner );
309
310 #define yy_new_buffer _gmx_sel_yy_create_buffer
311
312 #define yy_set_interactive(is_interactive) \
313         { \
314         if ( ! YY_CURRENT_BUFFER ){ \
315         _gmx_sel_yyensure_buffer_stack (yyscanner); \
316                 YY_CURRENT_BUFFER_LVALUE =    \
317             _gmx_sel_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
318         } \
319         YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
320         }
321
322 #define yy_set_bol(at_bol) \
323         { \
324         if ( ! YY_CURRENT_BUFFER ){\
325         _gmx_sel_yyensure_buffer_stack (yyscanner); \
326                 YY_CURRENT_BUFFER_LVALUE =    \
327             _gmx_sel_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
328         } \
329         YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
330         }
331
332 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
333
334 #define _gmx_sel_yywrap(yyscanner) 1
335 #define YY_SKIP_YYWRAP
336
337 typedef unsigned char YY_CHAR;
338
339 typedef int yy_state_type;
340
341 #define yytext_ptr yytext_r
342
343 static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
344 static yy_state_type yy_try_NUL_trans (yy_state_type current_state  ,yyscan_t yyscanner);
345 static int yy_get_next_buffer (yyscan_t yyscanner );
346 static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
347
348 /* Done after the current pattern has been matched and before the
349  * corresponding action - sets up yytext.
350  */
351 #define YY_DO_BEFORE_ACTION \
352         yyg->yytext_ptr = yy_bp; \
353         yyleng = (size_t) (yy_cp - yy_bp); \
354         yyg->yy_hold_char = *yy_cp; \
355         *yy_cp = '\0'; \
356         yyg->yy_c_buf_p = yy_cp;
357
358 #define YY_NUM_RULES 26
359 #define YY_END_OF_BUFFER 27
360 /* This struct is not used in this scanner,
361    but its presence is necessary. */
362 struct yy_trans_info
363         {
364         flex_int32_t yy_verify;
365         flex_int32_t yy_nxt;
366         };
367 static yyconst flex_int16_t yy_accept[89] =
368     {   0,
369         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
370        27,   25,   23,    6,   20,   25,    1,   25,   25,    2,
371         6,   21,   25,   22,   25,   24,   22,   22,   22,   22,
372        22,   22,   22,   25,   22,   22,   22,   22,   11,    8,
373        10,   10,    9,   23,   21,    0,    4,    0,    1,   17,
374         3,    3,    2,   24,   24,   22,    5,   22,   22,   22,
375        22,   18,   15,   22,   18,   16,   13,   22,   12,   22,
376         8,    9,    0,    0,    3,   17,   22,   22,   20,   19,
377        13,    0,    3,    3,   22,    7,   14,    0
378     } ;
379
380 static yyconst flex_int32_t yy_ec[256] =
381     {   0,
382         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
383         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
384         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
385         1,    2,    4,    5,    6,    1,    1,    7,    1,    1,
386         1,    1,    8,    1,    8,    9,    1,   10,   10,   10,
387        10,   10,   10,   10,   10,   10,   10,    1,   11,   12,
388        13,   12,    1,    1,   14,   14,   14,   14,   15,   14,
389        14,   14,   14,   14,   14,   14,   14,   14,   14,   14,
390        14,   14,   14,   14,   14,   14,   14,   14,   14,   14,
391         1,   16,    1,    1,   17,    1,   18,   14,   14,   19,
392
393        20,   21,   22,   23,   14,   14,   14,   24,   14,   25,
394        26,   27,   14,   28,   29,   30,   31,   14,   14,   32,
395        33,   14,    1,   34,    1,    1,    1,    1,    1,    1,
396         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
397         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
398         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
399         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
400         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
401         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
402         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
403
404         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
405         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
406         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
407         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
408         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
409         1,    1,    1,    1,    1
410     } ;
411
412 static yyconst flex_int32_t yy_meta[35] =
413     {   0,
414         1,    1,    2,    1,    1,    1,    1,    1,    3,    4,
415         1,    1,    1,    4,    4,    1,    4,    4,    4,    4,
416         4,    4,    4,    4,    4,    4,    4,    4,    4,    4,
417         4,    4,    4,    1
418     } ;
419
420 static yyconst flex_int16_t yy_base[94] =
421     {   0,
422         0,    0,  129,  128,   10,   12,    0,    0,   45,    0,
423       153,  156,  150,  156,  138,   75,    0,  143,  139,   72,
424       156,  135,  134,    0,  143,  136,  119,  115,  122,  115,
425       112,  113,  112,  103,   62,  110,   68,  115,  156,  132,
426       156,  156,    0,  131,  156,   79,  156,  127,    0,  156,
427        84,   87,   91,  122,   31,    0,  156,  111,  103,  104,
428        97,    0,    0,   98,  156,    0,   95,  103,    0,   94,
429       120,    0,   34,  107,   76,    0,   82,   83,    0,    0,
430         0,   99,   98,   95,   76,    0,    0,  156,  111,  115,
431       117,   94,   84
432
433     } ;
434
435 static yyconst flex_int16_t yy_def[94] =
436     {   0,
437        88,    1,    1,    1,    1,    1,    1,    1,   88,    9,
438        88,   88,   88,   88,   88,   89,   90,   88,   88,   91,
439        88,   88,   88,   92,   88,   91,   92,   92,   92,   92,
440        92,   92,   92,   88,   92,   92,   92,   92,   88,   88,
441        88,   88,   93,   88,   88,   89,   88,   88,   90,   88,
442        88,   88,   91,   91,   91,   92,   88,   92,   92,   92,
443        92,   92,   92,   92,   88,   92,   92,   92,   92,   92,
444        88,   93,   88,   88,   91,   92,   92,   92,   92,   92,
445        92,   88,   88,   88,   92,   92,   92,    0,   88,   88,
446        88,   88,   88
447
448     } ;
449
450 static yyconst flex_int16_t yy_nxt[191] =
451     {   0,
452        12,   13,   14,   15,   16,   17,   18,   12,   19,   20,
453        21,   22,   23,   24,   24,   25,   26,   27,   24,   24,
454        24,   28,   29,   24,   30,   31,   24,   24,   24,   32,
455        24,   33,   24,   34,   36,   37,   36,   37,   74,   88,
456        75,   82,   38,   83,   38,   39,   40,   41,   39,   39,
457        39,   39,   39,   39,   39,   42,   39,   39,   43,   43,
458        39,   39,   43,   43,   43,   43,   43,   43,   43,   43,
459        43,   43,   43,   43,   43,   43,   43,   43,   39,   47,
460        52,   53,   66,   47,   88,   75,   55,   72,   68,   62,
461        48,   55,   69,   51,   48,   62,   51,   56,   73,   52,
462
463        53,   73,   87,   73,   84,   55,   73,   83,   83,   86,
464        55,   46,   85,   46,   46,   49,   84,   49,   49,   54,
465        54,   71,   69,   81,   79,   80,   79,   78,   77,   76,
466        88,   46,   44,   71,   70,   67,   65,   64,   63,   62,
467        61,   60,   59,   58,   88,   57,   45,   45,   51,   50,
468        45,   44,   88,   35,   35,   11,   88,   88,   88,   88,
469        88,   88,   88,   88,   88,   88,   88,   88,   88,   88,
470        88,   88,   88,   88,   88,   88,   88,   88,   88,   88,
471        88,   88,   88,   88,   88,   88,   88,   88,   88,   88
472     } ;
473
474 static yyconst flex_int16_t yy_chk[191] =
475     {   0,
476         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
477         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
478         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
479         1,    1,    1,    1,    5,    5,    6,    6,   55,   55,
480        55,   73,    5,   73,    6,    9,    9,    9,    9,    9,
481         9,    9,    9,    9,    9,    9,    9,    9,    9,    9,
482         9,    9,    9,    9,    9,    9,    9,    9,    9,    9,
483         9,    9,    9,    9,    9,    9,    9,    9,    9,   16,
484        20,   20,   35,   46,   75,   75,   20,   93,   37,   35,
485        16,   20,   37,   51,   46,   37,   52,   92,   51,   53,
486
487        53,   52,   85,   51,   84,   53,   52,   83,   82,   78,
488        53,   89,   77,   89,   89,   90,   74,   90,   90,   91,
489        91,   71,   70,   68,   67,   64,   61,   60,   59,   58,
490        54,   48,   44,   40,   38,   36,   34,   33,   32,   31,
491        30,   29,   28,   27,   26,   25,   23,   22,   19,   18,
492        15,   13,   11,    4,    3,   88,   88,   88,   88,   88,
493        88,   88,   88,   88,   88,   88,   88,   88,   88,   88,
494        88,   88,   88,   88,   88,   88,   88,   88,   88,   88,
495        88,   88,   88,   88,   88,   88,   88,   88,   88,   88
496     } ;
497
498 /* The intent behind this definition is that it'll catch
499  * any uses of REJECT which flex missed.
500  */
501 #define REJECT reject_used_but_not_detected
502 #define yymore() yymore_used_but_not_detected
503 #define YY_MORE_ADJ 0
504 #define YY_RESTORE_YY_MORE_OFFSET
505 #line 1 "scanner.l"
506 /*
507  * This file is part of the GROMACS molecular simulation package.
508  *
509  * Copyright (c) 2009,2010,2011,2012,2013, by the GROMACS development team, led by
510  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
511  * and including many others, as listed in the AUTHORS file in the
512  * top-level source directory and at http://www.gromacs.org.
513  *
514  * GROMACS is free software; you can redistribute it and/or
515  * modify it under the terms of the GNU Lesser General Public License
516  * as published by the Free Software Foundation; either version 2.1
517  * of the License, or (at your option) any later version.
518  *
519  * GROMACS is distributed in the hope that it will be useful,
520  * but WITHOUT ANY WARRANTY; without even the implied warranty of
521  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
522  * Lesser General Public License for more details.
523  *
524  * You should have received a copy of the GNU Lesser General Public
525  * License along with GROMACS; if not, see
526  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
527  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
528  *
529  * If you want to redistribute modifications to GROMACS, please
530  * consider that scientific software is very special. Version
531  * control is crucial - bugs must be traceable. We will be happy to
532  * consider code for inclusion in the official distribution, but
533  * derived work must not be called official GROMACS. Details are found
534  * in the README & COPYING files - if they are missing, get the
535  * official version at http://www.gromacs.org.
536  *
537  * To help us fund GROMACS development, we humbly ask that you cite
538  * the research papers on the package. Check out http://www.gromacs.org.
539  */
540 /*! \cond \internal \file scanner.l
541  * \brief
542  * Tokenizer for the selection language.
543  *
544  * \author Teemu Murtola <teemu.murtola@gmail.com>
545  * \ingroup module_selection
546  * \endcond
547  */
548 /*! \internal \file scanner.cpp
549  * \brief
550  * Generated (from scanner.l by Flex) tokenizer for the selection language.
551  *
552  * \ingroup module_selection
553  */
554
555 #line 56 "scanner.l"
556 #include "gromacs/legacyheaders/string2.h"
557
558 #include "parser.h"
559 #include "scanner.h"
560 #include "scanner_internal.h"
561
562 // This macro makes the actions a bit shorter, since nearly every action needs
563 // this call.
564 #define ADD_TOKEN _gmx_sel_lexer_add_token(yytext, yyleng, state)
565
566 #define YY_NO_UNISTD_H 1
567
568
569
570
571 #line 572 "scanner.cpp"
572
573 #define INITIAL 0
574 #define matchof 1
575 #define matchbool 2
576 #define cmdstart 3
577 #define help 4
578
579 #ifndef YY_NO_UNISTD_H
580 /* Special case for "unistd.h", since it is non-ANSI. We include it way
581  * down here because we want the user's section 1 to have been scanned first.
582  * The user has a chance to override it with an option.
583  */
584 #include <unistd.h>
585 #endif
586
587 #ifndef YY_EXTRA_TYPE
588 #define YY_EXTRA_TYPE void *
589 #endif
590
591 /* Holds the entire state of the reentrant scanner. */
592 struct yyguts_t
593     {
594
595     /* User-defined. Not touched by flex. */
596     YY_EXTRA_TYPE yyextra_r;
597
598     /* The rest are the same as the globals declared in the non-reentrant scanner. */
599     FILE *yyin_r, *yyout_r;
600     size_t yy_buffer_stack_top; /**< index of top of stack. */
601     size_t yy_buffer_stack_max; /**< capacity of stack. */
602     YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
603     char yy_hold_char;
604     yy_size_t yy_n_chars;
605     yy_size_t yyleng_r;
606     char *yy_c_buf_p;
607     int yy_init;
608     int yy_start;
609     int yy_did_buffer_switch_on_eof;
610     int yy_start_stack_ptr;
611     int yy_start_stack_depth;
612     int *yy_start_stack;
613     yy_state_type yy_last_accepting_state;
614     char* yy_last_accepting_cpos;
615
616     int yylineno_r;
617     int yy_flex_debug_r;
618
619     char *yytext_r;
620     int yy_more_flag;
621     int yy_more_len;
622
623     }; /* end struct yyguts_t */
624
625 static int yy_init_globals (yyscan_t yyscanner );
626
627 int _gmx_sel_yylex_init (yyscan_t* scanner);
628
629 int _gmx_sel_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
630
631 /* Accessor methods to globals.
632    These are made visible to non-reentrant scanners for convenience. */
633
634 int _gmx_sel_yylex_destroy (yyscan_t yyscanner );
635
636 int _gmx_sel_yyget_debug (yyscan_t yyscanner );
637
638 void _gmx_sel_yyset_debug (int debug_flag ,yyscan_t yyscanner );
639
640 YY_EXTRA_TYPE _gmx_sel_yyget_extra (yyscan_t yyscanner );
641
642 void _gmx_sel_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
643
644 FILE *_gmx_sel_yyget_in (yyscan_t yyscanner );
645
646 void _gmx_sel_yyset_in  (FILE * in_str ,yyscan_t yyscanner );
647
648 FILE *_gmx_sel_yyget_out (yyscan_t yyscanner );
649
650 void _gmx_sel_yyset_out  (FILE * out_str ,yyscan_t yyscanner );
651
652 yy_size_t _gmx_sel_yyget_leng (yyscan_t yyscanner );
653
654 char *_gmx_sel_yyget_text (yyscan_t yyscanner );
655
656 int _gmx_sel_yyget_lineno (yyscan_t yyscanner );
657
658 void _gmx_sel_yyset_lineno (int line_number ,yyscan_t yyscanner );
659
660 int _gmx_sel_yyget_column  (yyscan_t yyscanner );
661
662 void _gmx_sel_yyset_column (int column_no ,yyscan_t yyscanner );
663
664 /* Macros after this point can all be overridden by user definitions in
665  * section 1.
666  */
667
668 #ifndef YY_SKIP_YYWRAP
669 #ifdef __cplusplus
670 extern "C" int _gmx_sel_yywrap (yyscan_t yyscanner );
671 #else
672 extern int _gmx_sel_yywrap (yyscan_t yyscanner );
673 #endif
674 #endif
675
676     static void yyunput (int c,char *buf_ptr  ,yyscan_t yyscanner);
677     
678 #ifndef yytext_ptr
679 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
680 #endif
681
682 #ifdef YY_NEED_STRLEN
683 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
684 #endif
685
686 #ifndef YY_NO_INPUT
687
688 #ifdef __cplusplus
689 static int yyinput (yyscan_t yyscanner );
690 #else
691 static int input (yyscan_t yyscanner );
692 #endif
693
694 #endif
695
696 /* Amount of stuff to slurp up with each read. */
697 #ifndef YY_READ_BUF_SIZE
698 #define YY_READ_BUF_SIZE 8192
699 #endif
700
701 /* Copy whatever the last rule matched to the standard output. */
702 #ifndef ECHO
703 /* This used to be an fputs(), but since the string might contain NUL's,
704  * we now use fwrite().
705  */
706 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
707 #endif
708
709 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
710  * is returned in "result".
711  */
712 #ifndef YY_INPUT
713 #define YY_INPUT(buf,result,max_size) \
714         if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
715                 { \
716                 int c = '*'; \
717                 size_t n; \
718                 for ( n = 0; n < max_size && \
719                              (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
720                         buf[n] = (char) c; \
721                 if ( c == '\n' ) \
722                         buf[n++] = (char) c; \
723                 if ( c == EOF && ferror( yyin ) ) \
724                         YY_FATAL_ERROR( "input in flex scanner failed" ); \
725                 result = n; \
726                 } \
727         else \
728                 { \
729                 errno=0; \
730                 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
731                         { \
732                         if( errno != EINTR) \
733                                 { \
734                                 YY_FATAL_ERROR( "input in flex scanner failed" ); \
735                                 break; \
736                                 } \
737                         errno=0; \
738                         clearerr(yyin); \
739                         } \
740                 }\
741 \
742
743 #endif
744
745 /* No semi-colon after return; correct usage is to write "yyterminate();" -
746  * we don't want an extra ';' after the "return" because that will cause
747  * some compilers to complain about unreachable statements.
748  */
749 #ifndef yyterminate
750 #define yyterminate() return YY_NULL
751 #endif
752
753 /* Number of entries by which start-condition stack grows. */
754 #ifndef YY_START_STACK_INCR
755 #define YY_START_STACK_INCR 25
756 #endif
757
758 /* Report a fatal error. */
759 #ifndef YY_FATAL_ERROR
760 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
761 #endif
762
763 /* end tables serialization structures and prototypes */
764
765 /* Default declaration of generated scanner - a define so the user can
766  * easily add parameters.
767  */
768 #ifndef YY_DECL
769 #define YY_DECL_IS_OURS 1
770
771 extern int _gmx_sel_yylex (yyscan_t yyscanner);
772
773 #define YY_DECL int _gmx_sel_yylex (yyscan_t yyscanner)
774 #endif /* !YY_DECL */
775
776 /* Code executed at the beginning of each rule, after yytext and yyleng
777  * have been set up.
778  */
779 #ifndef YY_USER_ACTION
780 #define YY_USER_ACTION
781 #endif
782
783 /* Code executed at the end of each rule. */
784 #ifndef YY_BREAK
785 #define YY_BREAK break;
786 #endif
787
788 #define YY_RULE_SETUP \
789         YY_USER_ACTION
790
791 /** The main scanner function which does all the work.
792  */
793 YY_DECL
794 {
795         register yy_state_type yy_current_state;
796         register char *yy_cp, *yy_bp;
797         register int yy_act;
798     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
799
800 #line 91 "scanner.l"
801
802
803
804     gmx_sel_lexer_t *state = _gmx_sel_yyget_extra(yyscanner);
805     int              retval;
806     /* Return a token if one is pending */
807     retval = _gmx_sel_lexer_process_pending(yylval, state);
808     if (retval != 0)
809     {
810         return retval;
811     }
812     /* Handle the start conditions for 'of' matching */
813     if (state->bMatchOf)
814     {
815         BEGIN(matchof);
816         state->bMatchOf = false;
817     }
818     else if (state->bMatchBool)
819     {
820         BEGIN(matchbool);
821         state->bMatchBool = false;
822     }
823     else if (state->bCmdStart)
824     {
825         BEGIN(cmdstart);
826         state->bCmdStart = false;
827     }
828     else if (YYSTATE != help)
829     {
830         BEGIN(0);
831     }
832
833
834 #line 835 "scanner.cpp"
835
836         if ( !yyg->yy_init )
837                 {
838                 yyg->yy_init = 1;
839
840 #ifdef YY_USER_INIT
841                 YY_USER_INIT;
842 #endif
843
844                 if ( ! yyg->yy_start )
845                         yyg->yy_start = 1;      /* first start state */
846
847                 if ( ! yyin )
848                         yyin = stdin;
849
850                 if ( ! yyout )
851                         yyout = stdout;
852
853                 if ( ! YY_CURRENT_BUFFER ) {
854                         _gmx_sel_yyensure_buffer_stack (yyscanner);
855                         YY_CURRENT_BUFFER_LVALUE =
856                                 _gmx_sel_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
857                 }
858
859                 _gmx_sel_yy_load_buffer_state(yyscanner );
860                 }
861
862         while ( 1 )             /* loops until end-of-file is reached */
863                 {
864                 yy_cp = yyg->yy_c_buf_p;
865
866                 /* Support of yytext. */
867                 *yy_cp = yyg->yy_hold_char;
868
869                 /* yy_bp points to the position in yy_ch_buf of the start of
870                  * the current run.
871                  */
872                 yy_bp = yy_cp;
873
874                 yy_current_state = yyg->yy_start;
875 yy_match:
876                 do
877                         {
878                         register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
879                         if ( yy_accept[yy_current_state] )
880                                 {
881                                 yyg->yy_last_accepting_state = yy_current_state;
882                                 yyg->yy_last_accepting_cpos = yy_cp;
883                                 }
884                         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
885                                 {
886                                 yy_current_state = (int) yy_def[yy_current_state];
887                                 if ( yy_current_state >= 89 )
888                                         yy_c = yy_meta[(unsigned int) yy_c];
889                                 }
890                         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
891                         ++yy_cp;
892                         }
893                 while ( yy_current_state != 88 );
894                 yy_cp = yyg->yy_last_accepting_cpos;
895                 yy_current_state = yyg->yy_last_accepting_state;
896
897 yy_find_action:
898                 yy_act = yy_accept[yy_current_state];
899
900                 YY_DO_BEFORE_ACTION;
901
902 do_action:      /* This label is used only to access EOF actions. */
903
904                 switch ( yy_act )
905         { /* beginning of action switch */
906                         case 0: /* must back up */
907                         /* undo the effects of YY_DO_BEFORE_ACTION */
908                         *yy_cp = yyg->yy_hold_char;
909                         yy_cp = yyg->yy_last_accepting_cpos;
910                         yy_current_state = yyg->yy_last_accepting_state;
911                         goto yy_find_action;
912
913 case 1:
914 YY_RULE_SETUP
915 #line 124 "scanner.l"
916
917         YY_BREAK
918 case 2:
919 YY_RULE_SETUP
920 #line 125 "scanner.l"
921 { yylval->i   = strtol(yytext, NULL, 10);    ADD_TOKEN; return TOK_INT; }
922         YY_BREAK
923 case 3:
924 YY_RULE_SETUP
925 #line 126 "scanner.l"
926 { yylval->r   = strtod(yytext, NULL);        ADD_TOKEN; return TOK_REAL; }
927         YY_BREAK
928 case 4:
929 YY_RULE_SETUP
930 #line 127 "scanner.l"
931 { yylval->str = gmx_strndup(yytext+1, yyleng-2); ADD_TOKEN; return STR;  }
932         YY_BREAK
933 case 5:
934 /* rule 5 can match eol */
935 YY_RULE_SETUP
936 #line 129 "scanner.l"
937 { _gmx_sel_lexer_add_token(" ", 1, state); }
938         YY_BREAK
939 case 6:
940 /* rule 6 can match eol */
941 YY_RULE_SETUP
942 #line 130 "scanner.l"
943 {
944                     if (yytext[0] == ';' || state->bInteractive)
945                     {
946                         rtrim(state->pselstr);
947                         state->bCmdStart = true;
948                         return CMD_SEP;
949                     }
950                     else
951                     {
952                         _gmx_sel_lexer_add_token(" ", 1, state);
953                     }
954                 }
955         YY_BREAK
956 case YY_STATE_EOF(cmdstart):
957 #line 143 "scanner.l"
958 { state->bCmdStart = true; yyterminate(); }
959         YY_BREAK
960 case YY_STATE_EOF(INITIAL):
961 case YY_STATE_EOF(matchof):
962 case YY_STATE_EOF(matchbool):
963 case YY_STATE_EOF(help):
964 #line 144 "scanner.l"
965 { state->bCmdStart = true; return CMD_SEP; }
966         YY_BREAK
967 case 7:
968 YY_RULE_SETUP
969 #line 146 "scanner.l"
970 { if (YYSTATE == cmdstart) { BEGIN(help); } return HELP; }
971         YY_BREAK
972
973 case 8:
974 YY_RULE_SETUP
975 #line 148 "scanner.l"
976
977         YY_BREAK
978 case 9:
979 YY_RULE_SETUP
980 #line 149 "scanner.l"
981 { yylval->str = gmx_strndup(yytext, yyleng); return HELP_TOPIC; }
982         YY_BREAK
983 case 10:
984 /* rule 10 can match eol */
985 YY_RULE_SETUP
986 #line 150 "scanner.l"
987 { state->bCmdStart = true; return CMD_SEP; }
988         YY_BREAK
989 case 11:
990 YY_RULE_SETUP
991 #line 151 "scanner.l"
992 { return INVALID; }
993         YY_BREAK
994
995
996 case 12:
997 YY_RULE_SETUP
998 #line 155 "scanner.l"
999 { ADD_TOKEN; yylval->i = 1; return TOK_INT; }
1000         YY_BREAK
1001 case 13:
1002 YY_RULE_SETUP
1003 #line 156 "scanner.l"
1004 { ADD_TOKEN; yylval->i = 0; return TOK_INT; }
1005         YY_BREAK
1006
1007 case 14:
1008 YY_RULE_SETUP
1009 #line 158 "scanner.l"
1010 { ADD_TOKEN; return GROUP; }
1011         YY_BREAK
1012 case 15:
1013 YY_RULE_SETUP
1014 #line 159 "scanner.l"
1015 { ADD_TOKEN; return TO; }
1016         YY_BREAK
1017 case 16:
1018 YY_RULE_SETUP
1019 #line 160 "scanner.l"
1020 { ADD_TOKEN; BEGIN(0); return OF; }
1021         YY_BREAK
1022 case 17:
1023 YY_RULE_SETUP
1024 #line 161 "scanner.l"
1025 { ADD_TOKEN; return AND; }
1026         YY_BREAK
1027 case 18:
1028 YY_RULE_SETUP
1029 #line 162 "scanner.l"
1030 { ADD_TOKEN; return OR; }
1031         YY_BREAK
1032 case 19:
1033 YY_RULE_SETUP
1034 #line 163 "scanner.l"
1035 { ADD_TOKEN; return XOR; }
1036         YY_BREAK
1037 case 20:
1038 YY_RULE_SETUP
1039 #line 164 "scanner.l"
1040 { ADD_TOKEN; return NOT; }
1041         YY_BREAK
1042 case 21:
1043 YY_RULE_SETUP
1044 #line 165 "scanner.l"
1045 { yylval->str = gmx_strndup(yytext, yyleng); ADD_TOKEN; return CMP_OP; }
1046         YY_BREAK
1047 case 22:
1048 YY_RULE_SETUP
1049 #line 167 "scanner.l"
1050 { return _gmx_sel_lexer_process_identifier(yylval, yytext, yyleng, state); }
1051         YY_BREAK
1052 case 23:
1053 YY_RULE_SETUP
1054 #line 169 "scanner.l"
1055 { _gmx_sel_lexer_add_token(" ", 1, state); }
1056         YY_BREAK
1057 case 24:
1058 YY_RULE_SETUP
1059 #line 170 "scanner.l"
1060 { yylval->str = gmx_strndup(yytext, yyleng); ADD_TOKEN; return STR; }
1061         YY_BREAK
1062 case 25:
1063 YY_RULE_SETUP
1064 #line 171 "scanner.l"
1065 { ADD_TOKEN; return yytext[0]; }
1066         YY_BREAK
1067 case 26:
1068 YY_RULE_SETUP
1069 #line 172 "scanner.l"
1070 YY_FATAL_ERROR( "flex scanner jammed" );
1071         YY_BREAK
1072 #line 1073 "scanner.cpp"
1073
1074         case YY_END_OF_BUFFER:
1075                 {
1076                 /* Amount of text matched not including the EOB char. */
1077                 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
1078
1079                 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1080                 *yy_cp = yyg->yy_hold_char;
1081                 YY_RESTORE_YY_MORE_OFFSET
1082
1083                 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1084                         {
1085                         /* We're scanning a new file or input source.  It's
1086                          * possible that this happened because the user
1087                          * just pointed yyin at a new source and called
1088                          * _gmx_sel_yylex().  If so, then we have to assure
1089                          * consistency between YY_CURRENT_BUFFER and our
1090                          * globals.  Here is the right place to do so, because
1091                          * this is the first action (other than possibly a
1092                          * back-up) that will match for the new input source.
1093                          */
1094                         yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1095                         YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1096                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1097                         }
1098
1099                 /* Note that here we test for yy_c_buf_p "<=" to the position
1100                  * of the first EOB in the buffer, since yy_c_buf_p will
1101                  * already have been incremented past the NUL character
1102                  * (since all states make transitions on EOB to the
1103                  * end-of-buffer state).  Contrast this with the test
1104                  * in input().
1105                  */
1106                 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1107                         { /* This was really a NUL. */
1108                         yy_state_type yy_next_state;
1109
1110                         yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
1111
1112                         yy_current_state = yy_get_previous_state( yyscanner );
1113
1114                         /* Okay, we're now positioned to make the NUL
1115                          * transition.  We couldn't have
1116                          * yy_get_previous_state() go ahead and do it
1117                          * for us because it doesn't know how to deal
1118                          * with the possibility of jamming (and we don't
1119                          * want to build jamming into it because then it
1120                          * will run more slowly).
1121                          */
1122
1123                         yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
1124
1125                         yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1126
1127                         if ( yy_next_state )
1128                                 {
1129                                 /* Consume the NUL. */
1130                                 yy_cp = ++yyg->yy_c_buf_p;
1131                                 yy_current_state = yy_next_state;
1132                                 goto yy_match;
1133                                 }
1134
1135                         else
1136                                 {
1137                                 yy_cp = yyg->yy_last_accepting_cpos;
1138                                 yy_current_state = yyg->yy_last_accepting_state;
1139                                 goto yy_find_action;
1140                                 }
1141                         }
1142
1143                 else switch ( yy_get_next_buffer( yyscanner ) )
1144                         {
1145                         case EOB_ACT_END_OF_FILE:
1146                                 {
1147                                 yyg->yy_did_buffer_switch_on_eof = 0;
1148
1149                                 if ( _gmx_sel_yywrap(yyscanner ) )
1150                                         {
1151                                         /* Note: because we've taken care in
1152                                          * yy_get_next_buffer() to have set up
1153                                          * yytext, we can now set up
1154                                          * yy_c_buf_p so that if some total
1155                                          * hoser (like flex itself) wants to
1156                                          * call the scanner after we return the
1157                                          * YY_NULL, it'll still work - another
1158                                          * YY_NULL will get returned.
1159                                          */
1160                                         yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
1161
1162                                         yy_act = YY_STATE_EOF(YY_START);
1163                                         goto do_action;
1164                                         }
1165
1166                                 else
1167                                         {
1168                                         if ( ! yyg->yy_did_buffer_switch_on_eof )
1169                                                 YY_NEW_FILE;
1170                                         }
1171                                 break;
1172                                 }
1173
1174                         case EOB_ACT_CONTINUE_SCAN:
1175                                 yyg->yy_c_buf_p =
1176                                         yyg->yytext_ptr + yy_amount_of_matched_text;
1177
1178                                 yy_current_state = yy_get_previous_state( yyscanner );
1179
1180                                 yy_cp = yyg->yy_c_buf_p;
1181                                 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1182                                 goto yy_match;
1183
1184                         case EOB_ACT_LAST_MATCH:
1185                                 yyg->yy_c_buf_p =
1186                                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
1187
1188                                 yy_current_state = yy_get_previous_state( yyscanner );
1189
1190                                 yy_cp = yyg->yy_c_buf_p;
1191                                 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1192                                 goto yy_find_action;
1193                         }
1194                 break;
1195                 }
1196
1197         default:
1198                 YY_FATAL_ERROR(
1199                         "fatal flex scanner internal error--no action found" );
1200         } /* end of action switch */
1201                 } /* end of scanning one token */
1202 } /* end of _gmx_sel_yylex */
1203
1204 /* yy_get_next_buffer - try to read in a new buffer
1205  *
1206  * Returns a code representing an action:
1207  *      EOB_ACT_LAST_MATCH -
1208  *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1209  *      EOB_ACT_END_OF_FILE - end of file
1210  */
1211 static int yy_get_next_buffer (yyscan_t yyscanner)
1212 {
1213     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1214         register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1215         register char *source = yyg->yytext_ptr;
1216         register int number_to_move, i;
1217         int ret_val;
1218
1219         if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1220                 YY_FATAL_ERROR(
1221                 "fatal flex scanner internal error--end of buffer missed" );
1222
1223         if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1224                 { /* Don't try to fill the buffer, so this is an EOF. */
1225                 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
1226                         {
1227                         /* We matched a single character, the EOB, so
1228                          * treat this as a final EOF.
1229                          */
1230                         return EOB_ACT_END_OF_FILE;
1231                         }
1232
1233                 else
1234                         {
1235                         /* We matched some text prior to the EOB, first
1236                          * process it.
1237                          */
1238                         return EOB_ACT_LAST_MATCH;
1239                         }
1240                 }
1241
1242         /* Try to read more data. */
1243
1244         /* First move last chars to start of buffer. */
1245         number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
1246
1247         for ( i = 0; i < number_to_move; ++i )
1248                 *(dest++) = *(source++);
1249
1250         if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1251                 /* don't do the read, it's not guaranteed to return an EOF,
1252                  * just force an EOF
1253                  */
1254                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1255
1256         else
1257                 {
1258                         yy_size_t num_to_read =
1259                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1260
1261                 while ( num_to_read <= 0 )
1262                         { /* Not enough room in the buffer - grow it. */
1263
1264                         /* just a shorter name for the current buffer */
1265                         YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1266
1267                         int yy_c_buf_p_offset =
1268                                 (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
1269
1270                         if ( b->yy_is_our_buffer )
1271                                 {
1272                                 yy_size_t new_size = b->yy_buf_size * 2;
1273
1274                                 if ( new_size <= 0 )
1275                                         b->yy_buf_size += b->yy_buf_size / 8;
1276                                 else
1277                                         b->yy_buf_size *= 2;
1278
1279                                 b->yy_ch_buf = (char *)
1280                                         /* Include room in for 2 EOB chars. */
1281                                         _gmx_sel_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
1282                                 }
1283                         else
1284                                 /* Can't grow it, we don't own it. */
1285                                 b->yy_ch_buf = 0;
1286
1287                         if ( ! b->yy_ch_buf )
1288                                 YY_FATAL_ERROR(
1289                                 "fatal error - scanner input buffer overflow" );
1290
1291                         yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1292
1293                         num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1294                                                 number_to_move - 1;
1295
1296                         }
1297
1298                 if ( num_to_read > YY_READ_BUF_SIZE )
1299                         num_to_read = YY_READ_BUF_SIZE;
1300
1301                 /* Read in more data. */
1302                 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1303                         yyg->yy_n_chars, num_to_read );
1304
1305                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1306                 }
1307
1308         if ( yyg->yy_n_chars == 0 )
1309                 {
1310                 if ( number_to_move == YY_MORE_ADJ )
1311                         {
1312                         ret_val = EOB_ACT_END_OF_FILE;
1313                         _gmx_sel_yyrestart(yyin  ,yyscanner);
1314                         }
1315
1316                 else
1317                         {
1318                         ret_val = EOB_ACT_LAST_MATCH;
1319                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1320                                 YY_BUFFER_EOF_PENDING;
1321                         }
1322                 }
1323
1324         else
1325                 ret_val = EOB_ACT_CONTINUE_SCAN;
1326
1327         if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1328                 /* Extend the array by 50%, plus the number we really need. */
1329                 yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
1330                 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) _gmx_sel_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
1331                 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1332                         YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1333         }
1334
1335         yyg->yy_n_chars += number_to_move;
1336         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1337         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1338
1339         yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1340
1341         return ret_val;
1342 }
1343
1344 /* yy_get_previous_state - get the state just before the EOB char was reached */
1345
1346     static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
1347 {
1348         register yy_state_type yy_current_state;
1349         register char *yy_cp;
1350     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1351
1352         yy_current_state = yyg->yy_start;
1353
1354         for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
1355                 {
1356                 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1357                 if ( yy_accept[yy_current_state] )
1358                         {
1359                         yyg->yy_last_accepting_state = yy_current_state;
1360                         yyg->yy_last_accepting_cpos = yy_cp;
1361                         }
1362                 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1363                         {
1364                         yy_current_state = (int) yy_def[yy_current_state];
1365                         if ( yy_current_state >= 89 )
1366                                 yy_c = yy_meta[(unsigned int) yy_c];
1367                         }
1368                 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1369                 }
1370
1371         return yy_current_state;
1372 }
1373
1374 /* yy_try_NUL_trans - try to make a transition on the NUL character
1375  *
1376  * synopsis
1377  *      next_state = yy_try_NUL_trans( current_state );
1378  */
1379     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state , yyscan_t yyscanner)
1380 {
1381         register int yy_is_jam;
1382     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
1383         register char *yy_cp = yyg->yy_c_buf_p;
1384
1385         register YY_CHAR yy_c = 1;
1386         if ( yy_accept[yy_current_state] )
1387                 {
1388                 yyg->yy_last_accepting_state = yy_current_state;
1389                 yyg->yy_last_accepting_cpos = yy_cp;
1390                 }
1391         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1392                 {
1393                 yy_current_state = (int) yy_def[yy_current_state];
1394                 if ( yy_current_state >= 89 )
1395                         yy_c = yy_meta[(unsigned int) yy_c];
1396                 }
1397         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1398         yy_is_jam = (yy_current_state == 88);
1399
1400         (void)yyg;
1401         return yy_is_jam ? 0 : yy_current_state;
1402 }
1403
1404     static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner)
1405 {
1406         register char *yy_cp;
1407     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1408
1409     yy_cp = yyg->yy_c_buf_p;
1410
1411         /* undo effects of setting up yytext */
1412         *yy_cp = yyg->yy_hold_char;
1413
1414         if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1415                 { /* need to shift things up to make room */
1416                 /* +2 for EOB chars. */
1417                 register yy_size_t number_to_move = yyg->yy_n_chars + 2;
1418                 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1419                                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1420                 register char *source =
1421                                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1422
1423                 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1424                         *--dest = *--source;
1425
1426                 yy_cp += (int) (dest - source);
1427                 yy_bp += (int) (dest - source);
1428                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1429                         yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1430
1431                 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1432                         YY_FATAL_ERROR( "flex scanner push-back overflow" );
1433                 }
1434
1435         *--yy_cp = (char) c;
1436
1437         yyg->yytext_ptr = yy_bp;
1438         yyg->yy_hold_char = *yy_cp;
1439         yyg->yy_c_buf_p = yy_cp;
1440 }
1441
1442 #ifndef YY_NO_INPUT
1443 #ifdef __cplusplus
1444     static int yyinput (yyscan_t yyscanner)
1445 #else
1446     static int input  (yyscan_t yyscanner)
1447 #endif
1448
1449 {
1450         int c;
1451     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1452
1453         *yyg->yy_c_buf_p = yyg->yy_hold_char;
1454
1455         if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1456                 {
1457                 /* yy_c_buf_p now points to the character we want to return.
1458                  * If this occurs *before* the EOB characters, then it's a
1459                  * valid NUL; if not, then we've hit the end of the buffer.
1460                  */
1461                 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1462                         /* This was really a NUL. */
1463                         *yyg->yy_c_buf_p = '\0';
1464
1465                 else
1466                         { /* need more input */
1467                         yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
1468                         ++yyg->yy_c_buf_p;
1469
1470                         switch ( yy_get_next_buffer( yyscanner ) )
1471                                 {
1472                                 case EOB_ACT_LAST_MATCH:
1473                                         /* This happens because yy_g_n_b()
1474                                          * sees that we've accumulated a
1475                                          * token and flags that we need to
1476                                          * try matching the token before
1477                                          * proceeding.  But for input(),
1478                                          * there's no matching to consider.
1479                                          * So convert the EOB_ACT_LAST_MATCH
1480                                          * to EOB_ACT_END_OF_FILE.
1481                                          */
1482
1483                                         /* Reset buffer status. */
1484                                         _gmx_sel_yyrestart(yyin ,yyscanner);
1485
1486                                         /*FALLTHROUGH*/
1487
1488                                 case EOB_ACT_END_OF_FILE:
1489                                         {
1490                                         if ( _gmx_sel_yywrap(yyscanner ) )
1491                                                 return EOF;
1492
1493                                         if ( ! yyg->yy_did_buffer_switch_on_eof )
1494                                                 YY_NEW_FILE;
1495 #ifdef __cplusplus
1496                                         return yyinput(yyscanner);
1497 #else
1498                                         return input(yyscanner);
1499 #endif
1500                                         }
1501
1502                                 case EOB_ACT_CONTINUE_SCAN:
1503                                         yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
1504                                         break;
1505                                 }
1506                         }
1507                 }
1508
1509         c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
1510         *yyg->yy_c_buf_p = '\0';        /* preserve yytext */
1511         yyg->yy_hold_char = *++yyg->yy_c_buf_p;
1512
1513         return c;
1514 }
1515 #endif  /* ifndef YY_NO_INPUT */
1516
1517 /** Immediately switch to a different input stream.
1518  * @param input_file A readable stream.
1519  * @param yyscanner The scanner object.
1520  * @note This function does not reset the start condition to @c INITIAL .
1521  */
1522     void _gmx_sel_yyrestart  (FILE * input_file , yyscan_t yyscanner)
1523 {
1524     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1525
1526         if ( ! YY_CURRENT_BUFFER ){
1527         _gmx_sel_yyensure_buffer_stack (yyscanner);
1528                 YY_CURRENT_BUFFER_LVALUE =
1529             _gmx_sel_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
1530         }
1531
1532         _gmx_sel_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
1533         _gmx_sel_yy_load_buffer_state(yyscanner );
1534 }
1535
1536 /** Switch to a different input buffer.
1537  * @param new_buffer The new input buffer.
1538  * @param yyscanner The scanner object.
1539  */
1540     void _gmx_sel_yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)
1541 {
1542     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1543
1544         /* TODO. We should be able to replace this entire function body
1545          * with
1546          *              _gmx_sel_yypop_buffer_state();
1547          *              _gmx_sel_yypush_buffer_state(new_buffer);
1548      */
1549         _gmx_sel_yyensure_buffer_stack (yyscanner);
1550         if ( YY_CURRENT_BUFFER == new_buffer )
1551                 return;
1552
1553         if ( YY_CURRENT_BUFFER )
1554                 {
1555                 /* Flush out information for old buffer. */
1556                 *yyg->yy_c_buf_p = yyg->yy_hold_char;
1557                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1558                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1559                 }
1560
1561         YY_CURRENT_BUFFER_LVALUE = new_buffer;
1562         _gmx_sel_yy_load_buffer_state(yyscanner );
1563
1564         /* We don't actually know whether we did this switch during
1565          * EOF (_gmx_sel_yywrap()) processing, but the only time this flag
1566          * is looked at is after _gmx_sel_yywrap() is called, so it's safe
1567          * to go ahead and always set it.
1568          */
1569         yyg->yy_did_buffer_switch_on_eof = 1;
1570 }
1571
1572 static void _gmx_sel_yy_load_buffer_state  (yyscan_t yyscanner)
1573 {
1574     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1575         yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1576         yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1577         yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1578         yyg->yy_hold_char = *yyg->yy_c_buf_p;
1579 }
1580
1581 /** Allocate and initialize an input buffer state.
1582  * @param file A readable stream.
1583  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1584  * @param yyscanner The scanner object.
1585  * @return the allocated buffer state.
1586  */
1587     YY_BUFFER_STATE _gmx_sel_yy_create_buffer  (FILE * file, int  size , yyscan_t yyscanner)
1588 {
1589         YY_BUFFER_STATE b;
1590     
1591         b = (YY_BUFFER_STATE) _gmx_sel_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1592         if ( ! b )
1593                 YY_FATAL_ERROR( "out of dynamic memory in _gmx_sel_yy_create_buffer()" );
1594
1595         b->yy_buf_size = size;
1596
1597         /* yy_ch_buf has to be 2 characters longer than the size given because
1598          * we need to put in 2 end-of-buffer characters.
1599          */
1600         b->yy_ch_buf = (char *) _gmx_sel_yyalloc(b->yy_buf_size + 2 ,yyscanner );
1601         if ( ! b->yy_ch_buf )
1602                 YY_FATAL_ERROR( "out of dynamic memory in _gmx_sel_yy_create_buffer()" );
1603
1604         b->yy_is_our_buffer = 1;
1605
1606         _gmx_sel_yy_init_buffer(b,file ,yyscanner);
1607
1608         return b;
1609 }
1610
1611 /** Destroy the buffer.
1612  * @param b a buffer created with _gmx_sel_yy_create_buffer()
1613  * @param yyscanner The scanner object.
1614  */
1615     void _gmx_sel_yy_delete_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
1616 {
1617     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1618
1619         if ( ! b )
1620                 return;
1621
1622         if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1623                 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1624
1625         if ( b->yy_is_our_buffer )
1626                 _gmx_sel_yyfree((void *) b->yy_ch_buf ,yyscanner );
1627
1628         _gmx_sel_yyfree((void *) b ,yyscanner );
1629 }
1630
1631 /* Initializes or reinitializes a buffer.
1632  * This function is sometimes called more than once on the same buffer,
1633  * such as during a _gmx_sel_yyrestart() or at EOF.
1634  */
1635     static void _gmx_sel_yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)
1636
1637 {
1638         int oerrno = errno;
1639     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1640
1641         _gmx_sel_yy_flush_buffer(b ,yyscanner);
1642
1643         b->yy_input_file = file;
1644         b->yy_fill_buffer = 1;
1645
1646     /* If b is the current buffer, then _gmx_sel_yy_init_buffer was _probably_
1647      * called from _gmx_sel_yyrestart() or through yy_get_next_buffer.
1648      * In that case, we don't want to reset the lineno or column.
1649      */
1650     if (b != YY_CURRENT_BUFFER){
1651         b->yy_bs_lineno = 1;
1652         b->yy_bs_column = 0;
1653     }
1654
1655         b->yy_is_interactive = 0;
1656     
1657         errno = oerrno;
1658 }
1659
1660 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1661  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1662  * @param yyscanner The scanner object.
1663  */
1664     void _gmx_sel_yy_flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
1665 {
1666     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1667         if ( ! b )
1668                 return;
1669
1670         b->yy_n_chars = 0;
1671
1672         /* We always need two end-of-buffer characters.  The first causes
1673          * a transition to the end-of-buffer state.  The second causes
1674          * a jam in that state.
1675          */
1676         b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1677         b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1678
1679         b->yy_buf_pos = &b->yy_ch_buf[0];
1680
1681         b->yy_at_bol = 1;
1682         b->yy_buffer_status = YY_BUFFER_NEW;
1683
1684         if ( b == YY_CURRENT_BUFFER )
1685                 _gmx_sel_yy_load_buffer_state(yyscanner );
1686 }
1687
1688 /** Pushes the new state onto the stack. The new state becomes
1689  *  the current state. This function will allocate the stack
1690  *  if necessary.
1691  *  @param new_buffer The new state.
1692  *  @param yyscanner The scanner object.
1693  */
1694 void _gmx_sel_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1695 {
1696     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1697         if (new_buffer == NULL)
1698                 return;
1699
1700         _gmx_sel_yyensure_buffer_stack(yyscanner);
1701
1702         /* This block is copied from _gmx_sel_yy_switch_to_buffer. */
1703         if ( YY_CURRENT_BUFFER )
1704                 {
1705                 /* Flush out information for old buffer. */
1706                 *yyg->yy_c_buf_p = yyg->yy_hold_char;
1707                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1708                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1709                 }
1710
1711         /* Only push if top exists. Otherwise, replace top. */
1712         if (YY_CURRENT_BUFFER)
1713                 yyg->yy_buffer_stack_top++;
1714         YY_CURRENT_BUFFER_LVALUE = new_buffer;
1715
1716         /* copied from _gmx_sel_yy_switch_to_buffer. */
1717         _gmx_sel_yy_load_buffer_state(yyscanner );
1718         yyg->yy_did_buffer_switch_on_eof = 1;
1719 }
1720
1721 /** Removes and deletes the top of the stack, if present.
1722  *  The next element becomes the new top.
1723  *  @param yyscanner The scanner object.
1724  */
1725 void _gmx_sel_yypop_buffer_state (yyscan_t yyscanner)
1726 {
1727     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1728         if (!YY_CURRENT_BUFFER)
1729                 return;
1730
1731         _gmx_sel_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
1732         YY_CURRENT_BUFFER_LVALUE = NULL;
1733         if (yyg->yy_buffer_stack_top > 0)
1734                 --yyg->yy_buffer_stack_top;
1735
1736         if (YY_CURRENT_BUFFER) {
1737                 _gmx_sel_yy_load_buffer_state(yyscanner );
1738                 yyg->yy_did_buffer_switch_on_eof = 1;
1739         }
1740 }
1741
1742 /* Allocates the stack if it does not exist.
1743  *  Guarantees space for at least one push.
1744  */
1745 static void _gmx_sel_yyensure_buffer_stack (yyscan_t yyscanner)
1746 {
1747         yy_size_t num_to_alloc;
1748     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1749
1750         if (!yyg->yy_buffer_stack) {
1751
1752                 /* First allocation is just for 2 elements, since we don't know if this
1753                  * scanner will even need a stack. We use 2 instead of 1 to avoid an
1754                  * immediate realloc on the next call.
1755          */
1756                 num_to_alloc = 1;
1757                 yyg->yy_buffer_stack = (struct yy_buffer_state**)_gmx_sel_yyalloc
1758                                                                 (num_to_alloc * sizeof(struct yy_buffer_state*)
1759                                                                 , yyscanner);
1760                 if ( ! yyg->yy_buffer_stack )
1761                         YY_FATAL_ERROR( "out of dynamic memory in _gmx_sel_yyensure_buffer_stack()" );
1762                                                                   
1763                 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1764                                 
1765                 yyg->yy_buffer_stack_max = num_to_alloc;
1766                 yyg->yy_buffer_stack_top = 0;
1767                 return;
1768         }
1769
1770         if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
1771
1772                 /* Increase the buffer to prepare for a possible push. */
1773                 int grow_size = 8 /* arbitrary grow size */;
1774
1775                 num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
1776                 yyg->yy_buffer_stack = (struct yy_buffer_state**)_gmx_sel_yyrealloc
1777                                                                 (yyg->yy_buffer_stack,
1778                                                                 num_to_alloc * sizeof(struct yy_buffer_state*)
1779                                                                 , yyscanner);
1780                 if ( ! yyg->yy_buffer_stack )
1781                         YY_FATAL_ERROR( "out of dynamic memory in _gmx_sel_yyensure_buffer_stack()" );
1782
1783                 /* zero only the new slots.*/
1784                 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
1785                 yyg->yy_buffer_stack_max = num_to_alloc;
1786         }
1787 }
1788
1789 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1790  * @param base the character buffer
1791  * @param size the size in bytes of the character buffer
1792  * @param yyscanner The scanner object.
1793  * @return the newly allocated buffer state object. 
1794  */
1795 YY_BUFFER_STATE _gmx_sel_yy_scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)
1796 {
1797         YY_BUFFER_STATE b;
1798     
1799         if ( size < 2 ||
1800              base[size-2] != YY_END_OF_BUFFER_CHAR ||
1801              base[size-1] != YY_END_OF_BUFFER_CHAR )
1802                 /* They forgot to leave room for the EOB's. */
1803                 return 0;
1804
1805         b = (YY_BUFFER_STATE) _gmx_sel_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1806         if ( ! b )
1807                 YY_FATAL_ERROR( "out of dynamic memory in _gmx_sel_yy_scan_buffer()" );
1808
1809         b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
1810         b->yy_buf_pos = b->yy_ch_buf = base;
1811         b->yy_is_our_buffer = 0;
1812         b->yy_input_file = 0;
1813         b->yy_n_chars = b->yy_buf_size;
1814         b->yy_is_interactive = 0;
1815         b->yy_at_bol = 1;
1816         b->yy_fill_buffer = 0;
1817         b->yy_buffer_status = YY_BUFFER_NEW;
1818
1819         _gmx_sel_yy_switch_to_buffer(b ,yyscanner );
1820
1821         return b;
1822 }
1823
1824 /** Setup the input buffer state to scan a string. The next call to _gmx_sel_yylex() will
1825  * scan from a @e copy of @a str.
1826  * @param yystr a NUL-terminated string to scan
1827  * @param yyscanner The scanner object.
1828  * @return the newly allocated buffer state object.
1829  * @note If you want to scan bytes that may contain NUL values, then use
1830  *       _gmx_sel_yy_scan_bytes() instead.
1831  */
1832 YY_BUFFER_STATE _gmx_sel_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
1833 {
1834     
1835         return _gmx_sel_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
1836 }
1837
1838 /** Setup the input buffer state to scan the given bytes. The next call to _gmx_sel_yylex() will
1839  * scan from a @e copy of @a bytes.
1840  * @param yybytes the byte buffer to scan
1841  * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1842  * @param yyscanner The scanner object.
1843  * @return the newly allocated buffer state object.
1844  */
1845 YY_BUFFER_STATE _gmx_sel_yy_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len , yyscan_t yyscanner)
1846 {
1847         YY_BUFFER_STATE b;
1848         char *buf;
1849         yy_size_t n;
1850         yy_size_t i;
1851     
1852         /* Get memory for full buffer, including space for trailing EOB's. */
1853         n = _yybytes_len + 2;
1854         buf = (char *) _gmx_sel_yyalloc(n ,yyscanner );
1855         if ( ! buf )
1856                 YY_FATAL_ERROR( "out of dynamic memory in _gmx_sel_yy_scan_bytes()" );
1857
1858         for ( i = 0; i < _yybytes_len; ++i )
1859                 buf[i] = yybytes[i];
1860
1861         buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1862
1863         b = _gmx_sel_yy_scan_buffer(buf,n ,yyscanner);
1864         if ( ! b )
1865                 YY_FATAL_ERROR( "bad buffer in _gmx_sel_yy_scan_bytes()" );
1866
1867         /* It's okay to grow etc. this buffer, and we should throw it
1868          * away when we're done.
1869          */
1870         b->yy_is_our_buffer = 1;
1871
1872         return b;
1873 }
1874
1875 #ifndef YY_EXIT_FAILURE
1876 #define YY_EXIT_FAILURE 2
1877 #endif
1878
1879 static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
1880 {
1881         (void) fprintf( stderr, "%s\n", msg );
1882         exit( YY_EXIT_FAILURE );
1883 }
1884
1885 /* Redefine yyless() so it works in section 3 code. */
1886
1887 #undef yyless
1888 #define yyless(n) \
1889         do \
1890                 { \
1891                 /* Undo effects of setting up yytext. */ \
1892         int yyless_macro_arg = (n); \
1893         YY_LESS_LINENO(yyless_macro_arg);\
1894                 yytext[yyleng] = yyg->yy_hold_char; \
1895                 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
1896                 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
1897                 *yyg->yy_c_buf_p = '\0'; \
1898                 yyleng = yyless_macro_arg; \
1899                 } \
1900         while ( 0 )
1901
1902 /* Accessor  methods (get/set functions) to struct members. */
1903
1904 /** Get the user-defined data for this scanner.
1905  * @param yyscanner The scanner object.
1906  */
1907 YY_EXTRA_TYPE _gmx_sel_yyget_extra  (yyscan_t yyscanner)
1908 {
1909     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1910     return yyextra;
1911 }
1912
1913 /** Get the current line number.
1914  * @param yyscanner The scanner object.
1915  */
1916 int _gmx_sel_yyget_lineno  (yyscan_t yyscanner)
1917 {
1918     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1919     
1920         if (! YY_CURRENT_BUFFER)
1921             return 0;
1922     
1923     return yylineno;
1924 }
1925
1926 /** Get the current column number.
1927  * @param yyscanner The scanner object.
1928  */
1929 int _gmx_sel_yyget_column  (yyscan_t yyscanner)
1930 {
1931     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1932     
1933         if (! YY_CURRENT_BUFFER)
1934             return 0;
1935     
1936     return yycolumn;
1937 }
1938
1939 /** Get the input stream.
1940  * @param yyscanner The scanner object.
1941  */
1942 FILE *_gmx_sel_yyget_in  (yyscan_t yyscanner)
1943 {
1944     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1945     return yyin;
1946 }
1947
1948 /** Get the output stream.
1949  * @param yyscanner The scanner object.
1950  */
1951 FILE *_gmx_sel_yyget_out  (yyscan_t yyscanner)
1952 {
1953     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1954     return yyout;
1955 }
1956
1957 /** Get the length of the current token.
1958  * @param yyscanner The scanner object.
1959  */
1960 yy_size_t _gmx_sel_yyget_leng  (yyscan_t yyscanner)
1961 {
1962     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1963     return yyleng;
1964 }
1965
1966 /** Get the current token.
1967  * @param yyscanner The scanner object.
1968  */
1969
1970 char *_gmx_sel_yyget_text  (yyscan_t yyscanner)
1971 {
1972     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1973     return yytext;
1974 }
1975
1976 /** Set the user-defined data. This data is never touched by the scanner.
1977  * @param user_defined The data to be associated with this scanner.
1978  * @param yyscanner The scanner object.
1979  */
1980 void _gmx_sel_yyset_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)
1981 {
1982     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1983     yyextra = user_defined ;
1984 }
1985
1986 /** Set the current line number.
1987  * @param line_number
1988  * @param yyscanner The scanner object.
1989  */
1990 void _gmx_sel_yyset_lineno (int  line_number , yyscan_t yyscanner)
1991 {
1992     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1993
1994         /* lineno is only valid if an input buffer exists. */
1995         if (! YY_CURRENT_BUFFER )
1996            YY_FATAL_ERROR( "_gmx_sel_yyset_lineno called with no buffer" );
1997     
1998     yylineno = line_number;
1999 }
2000
2001 /** Set the current column.
2002  * @param line_number
2003  * @param yyscanner The scanner object.
2004  */
2005 void _gmx_sel_yyset_column (int  column_no , yyscan_t yyscanner)
2006 {
2007     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2008
2009         /* column is only valid if an input buffer exists. */
2010         if (! YY_CURRENT_BUFFER )
2011            YY_FATAL_ERROR( "_gmx_sel_yyset_column called with no buffer" );
2012     
2013     yycolumn = column_no;
2014 }
2015
2016 /** Set the input stream. This does not discard the current
2017  * input buffer.
2018  * @param in_str A readable stream.
2019  * @param yyscanner The scanner object.
2020  * @see _gmx_sel_yy_switch_to_buffer
2021  */
2022 void _gmx_sel_yyset_in (FILE *  in_str , yyscan_t yyscanner)
2023 {
2024     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2025     yyin = in_str ;
2026 }
2027
2028 void _gmx_sel_yyset_out (FILE *  out_str , yyscan_t yyscanner)
2029 {
2030     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2031     yyout = out_str ;
2032 }
2033
2034 int _gmx_sel_yyget_debug  (yyscan_t yyscanner)
2035 {
2036     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2037     return yy_flex_debug;
2038 }
2039
2040 void _gmx_sel_yyset_debug (int  bdebug , yyscan_t yyscanner)
2041 {
2042     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2043     yy_flex_debug = bdebug ;
2044 }
2045
2046 /* Accessor methods for yylval and yylloc */
2047
2048 /* User-visible API */
2049
2050 /* _gmx_sel_yylex_init is special because it creates the scanner itself, so it is
2051  * the ONLY reentrant function that doesn't take the scanner as the last argument.
2052  * That's why we explicitly handle the declaration, instead of using our macros.
2053  */
2054
2055 int _gmx_sel_yylex_init(yyscan_t* ptr_yy_globals)
2056
2057 {
2058     if (ptr_yy_globals == NULL){
2059         errno = EINVAL;
2060         return 1;
2061     }
2062
2063     *ptr_yy_globals = (yyscan_t) _gmx_sel_yyalloc ( sizeof( struct yyguts_t ), NULL );
2064
2065     if (*ptr_yy_globals == NULL){
2066         errno = ENOMEM;
2067         return 1;
2068     }
2069
2070     /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2071     memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2072
2073     return yy_init_globals ( *ptr_yy_globals );
2074 }
2075
2076 /* _gmx_sel_yylex_init_extra has the same functionality as _gmx_sel_yylex_init, but follows the
2077  * convention of taking the scanner as the last argument. Note however, that
2078  * this is a *pointer* to a scanner, as it will be allocated by this call (and
2079  * is the reason, too, why this function also must handle its own declaration).
2080  * The user defined value in the first argument will be available to _gmx_sel_yyalloc in
2081  * the yyextra field.
2082  */
2083
2084 int _gmx_sel_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
2085
2086 {
2087     struct yyguts_t dummy_yyguts;
2088
2089     _gmx_sel_yyset_extra (yy_user_defined, &dummy_yyguts);
2090
2091     if (ptr_yy_globals == NULL){
2092         errno = EINVAL;
2093         return 1;
2094     }
2095         
2096     *ptr_yy_globals = (yyscan_t) _gmx_sel_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2097         
2098     if (*ptr_yy_globals == NULL){
2099         errno = ENOMEM;
2100         return 1;
2101     }
2102     
2103     /* By setting to 0xAA, we expose bugs in
2104     yy_init_globals. Leave at 0x00 for releases. */
2105     memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2106     
2107     _gmx_sel_yyset_extra (yy_user_defined, *ptr_yy_globals);
2108     
2109     return yy_init_globals ( *ptr_yy_globals );
2110 }
2111
2112 static int yy_init_globals (yyscan_t yyscanner)
2113 {
2114     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2115     /* Initialization is the same as for the non-reentrant scanner.
2116      * This function is called from _gmx_sel_yylex_destroy(), so don't allocate here.
2117      */
2118
2119     yyg->yy_buffer_stack = 0;
2120     yyg->yy_buffer_stack_top = 0;
2121     yyg->yy_buffer_stack_max = 0;
2122     yyg->yy_c_buf_p = (char *) 0;
2123     yyg->yy_init = 0;
2124     yyg->yy_start = 0;
2125
2126     yyg->yy_start_stack_ptr = 0;
2127     yyg->yy_start_stack_depth = 0;
2128     yyg->yy_start_stack =  NULL;
2129
2130 /* Defined in main.c */
2131 #ifdef YY_STDINIT
2132     yyin = stdin;
2133     yyout = stdout;
2134 #else
2135     yyin = (FILE *) 0;
2136     yyout = (FILE *) 0;
2137 #endif
2138
2139     /* For future reference: Set errno on error, since we are called by
2140      * _gmx_sel_yylex_init()
2141      */
2142     return 0;
2143 }
2144
2145 /* _gmx_sel_yylex_destroy is for both reentrant and non-reentrant scanners. */
2146 int _gmx_sel_yylex_destroy  (yyscan_t yyscanner)
2147 {
2148     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2149
2150     /* Pop the buffer stack, destroying each element. */
2151         while(YY_CURRENT_BUFFER){
2152                 _gmx_sel_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
2153                 YY_CURRENT_BUFFER_LVALUE = NULL;
2154                 _gmx_sel_yypop_buffer_state(yyscanner);
2155         }
2156
2157         /* Destroy the stack itself. */
2158         _gmx_sel_yyfree(yyg->yy_buffer_stack ,yyscanner);
2159         yyg->yy_buffer_stack = NULL;
2160
2161     /* Destroy the start condition stack. */
2162         _gmx_sel_yyfree(yyg->yy_start_stack ,yyscanner );
2163         yyg->yy_start_stack = NULL;
2164
2165     /* Reset the globals. This is important in a non-reentrant scanner so the next time
2166      * _gmx_sel_yylex() is called, initialization will occur. */
2167     yy_init_globals( yyscanner);
2168
2169     /* Destroy the main struct (reentrant only). */
2170     _gmx_sel_yyfree ( yyscanner , yyscanner );
2171     yyscanner = NULL;
2172     return 0;
2173 }
2174
2175 /*
2176  * Internal utility routines.
2177  */
2178
2179 #ifndef yytext_ptr
2180 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
2181 {
2182         register int i;
2183         for ( i = 0; i < n; ++i )
2184                 s1[i] = s2[i];
2185 }
2186 #endif
2187
2188 #ifdef YY_NEED_STRLEN
2189 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
2190 {
2191         register int n;
2192         for ( n = 0; s[n]; ++n )
2193                 ;
2194
2195         return n;
2196 }
2197 #endif
2198
2199 void *_gmx_sel_yyalloc (yy_size_t  size , yyscan_t yyscanner)
2200 {
2201         return (void *) malloc( size );
2202 }
2203
2204 void *_gmx_sel_yyrealloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)
2205 {
2206         /* The cast to (char *) in the following accommodates both
2207          * implementations that use char* generic pointers, and those
2208          * that use void* generic pointers.  It works with the latter
2209          * because both ANSI C and C++ allow castless assignment from
2210          * any pointer type to void*, and deal with argument conversions
2211          * as though doing an assignment.
2212          */
2213         return (void *) realloc( (char *) ptr, size );
2214 }
2215
2216 void _gmx_sel_yyfree (void * ptr , yyscan_t yyscanner)
2217 {
2218         free( (char *) ptr );   /* see _gmx_sel_yyrealloc() for (char *) cast */
2219 }
2220
2221 #define YYTABLES_NAME "yytables"
2222
2223 #line 172 "scanner.l"