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