Merge branch release-2016
[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,2014,2015,2016, by the GROMACS development team, led by
511  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
512  * and including many others, as listed in the AUTHORS file in the
513  * top-level source directory and at http://www.gromacs.org.
514  *
515  * GROMACS is free software; you can redistribute it and/or
516  * modify it under the terms of the GNU Lesser General Public License
517  * as published by the Free Software Foundation; either version 2.1
518  * of the License, or (at your option) any later version.
519  *
520  * GROMACS is distributed in the hope that it will be useful,
521  * but WITHOUT ANY WARRANTY; without even the implied warranty of
522  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
523  * Lesser General Public License for more details.
524  *
525  * You should have received a copy of the GNU Lesser General Public
526  * License along with GROMACS; if not, see
527  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
528  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
529  *
530  * If you want to redistribute modifications to GROMACS, please
531  * consider that scientific software is very special. Version
532  * control is crucial - bugs must be traceable. We will be happy to
533  * consider code for inclusion in the official distribution, but
534  * derived work must not be called official GROMACS. Details are found
535  * in the README & COPYING files - if they are missing, get the
536  * official version at http://www.gromacs.org.
537  *
538  * To help us fund GROMACS development, we humbly ask that you cite
539  * the research papers on the package. Check out http://www.gromacs.org.
540  */
541 /*! \cond \internal \file scanner.l
542  * \brief
543  * Tokenizer for the selection language.
544  *
545  * \author Teemu Murtola <teemu.murtola@gmail.com>
546  * \ingroup module_selection
547  * \endcond
548  */
549 /*! \internal \file scanner.cpp
550  * \brief
551  * Generated (from scanner.l by Flex) tokenizer for the selection language.
552  *
553  * \ingroup module_selection
554  */
555
556 #line 60 "scanner.l"
557 #include "gromacs/utility/cstringutil.h"
558 #include "gromacs/utility/stringutil.h"
559
560 #include "parser.h"
561 #include "scanner.h"
562 #include "scanner_internal.h"
563
564 // This macro makes the actions a bit shorter, since nearly every action needs
565 // this call.
566 #define ADD_TOKEN _gmx_sel_lexer_add_token(yylloc, yytext, yyleng, state)
567
568 // Set YY_BREAK to an empty value to avoid warnings (for the PGI compiler)
569 // when we have return statements followed by break. Instead, we add breaks
570 // manually.
571 #define YY_BREAK
572
573 #ifdef __INTEL_COMPILER
574 // Ignore unused variables in generated code.
575 #pragma warning(disable:593)
576 #endif
577 #define YY_NO_UNISTD_H 1
578
579
580
581 #line 582 "scanner.cpp"
582
583 #define INITIAL 0
584 #define matchof 1
585 #define matchbool 2
586 #define cmdstart 3
587
588 #ifndef YY_NO_UNISTD_H
589 /* Special case for "unistd.h", since it is non-ANSI. We include it way
590  * down here because we want the user's section 1 to have been scanned first.
591  * The user has a chance to override it with an option.
592  */
593 #include <unistd.h>
594 #endif
595
596 #ifndef YY_EXTRA_TYPE
597 #define YY_EXTRA_TYPE void *
598 #endif
599
600 /* Holds the entire state of the reentrant scanner. */
601 struct yyguts_t
602     {
603
604     /* User-defined. Not touched by flex. */
605     YY_EXTRA_TYPE yyextra_r;
606
607     /* The rest are the same as the globals declared in the non-reentrant scanner. */
608     FILE *yyin_r, *yyout_r;
609     size_t yy_buffer_stack_top; /**< index of top of stack. */
610     size_t yy_buffer_stack_max; /**< capacity of stack. */
611     YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
612     char yy_hold_char;
613     yy_size_t yy_n_chars;
614     yy_size_t yyleng_r;
615     char *yy_c_buf_p;
616     int yy_init;
617     int yy_start;
618     int yy_did_buffer_switch_on_eof;
619     int yy_start_stack_ptr;
620     int yy_start_stack_depth;
621     int *yy_start_stack;
622     yy_state_type yy_last_accepting_state;
623     char* yy_last_accepting_cpos;
624
625     int yylineno_r;
626     int yy_flex_debug_r;
627
628     char *yytext_r;
629     int yy_more_flag;
630     int yy_more_len;
631
632     }; /* end struct yyguts_t */
633
634 static int yy_init_globals (yyscan_t yyscanner );
635
636 int _gmx_sel_yylex_init (yyscan_t* scanner);
637
638 int _gmx_sel_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
639
640 /* Accessor methods to globals.
641    These are made visible to non-reentrant scanners for convenience. */
642
643 int _gmx_sel_yylex_destroy (yyscan_t yyscanner );
644
645 int _gmx_sel_yyget_debug (yyscan_t yyscanner );
646
647 void _gmx_sel_yyset_debug (int debug_flag ,yyscan_t yyscanner );
648
649 YY_EXTRA_TYPE _gmx_sel_yyget_extra (yyscan_t yyscanner );
650
651 void _gmx_sel_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
652
653 FILE *_gmx_sel_yyget_in (yyscan_t yyscanner );
654
655 void _gmx_sel_yyset_in  (FILE * _in_str ,yyscan_t yyscanner );
656
657 FILE *_gmx_sel_yyget_out (yyscan_t yyscanner );
658
659 void _gmx_sel_yyset_out  (FILE * _out_str ,yyscan_t yyscanner );
660
661 yy_size_t _gmx_sel_yyget_leng (yyscan_t yyscanner );
662
663 char *_gmx_sel_yyget_text (yyscan_t yyscanner );
664
665 int _gmx_sel_yyget_lineno (yyscan_t yyscanner );
666
667 void _gmx_sel_yyset_lineno (int _line_number ,yyscan_t yyscanner );
668
669 int _gmx_sel_yyget_column  (yyscan_t yyscanner );
670
671 void _gmx_sel_yyset_column (int _column_no ,yyscan_t yyscanner );
672
673 /* Macros after this point can all be overridden by user definitions in
674  * section 1.
675  */
676
677 #ifndef YY_SKIP_YYWRAP
678 #ifdef __cplusplus
679 extern "C" int _gmx_sel_yywrap (yyscan_t yyscanner );
680 #else
681 extern int _gmx_sel_yywrap (yyscan_t yyscanner );
682 #endif
683 #endif
684
685 #ifndef YY_NO_UNPUT
686     
687     static void yyunput (int c,char *buf_ptr  ,yyscan_t yyscanner);
688     
689 #endif
690
691 #ifndef yytext_ptr
692 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
693 #endif
694
695 #ifdef YY_NEED_STRLEN
696 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
697 #endif
698
699 #ifndef YY_NO_INPUT
700
701 #ifdef __cplusplus
702 static int yyinput (yyscan_t yyscanner );
703 #else
704 static int input (yyscan_t yyscanner );
705 #endif
706
707 #endif
708
709 /* Amount of stuff to slurp up with each read. */
710 #ifndef YY_READ_BUF_SIZE
711 #ifdef __ia64__
712 /* On IA-64, the buffer size is 16k, not 8k */
713 #define YY_READ_BUF_SIZE 16384
714 #else
715 #define YY_READ_BUF_SIZE 8192
716 #endif /* __ia64__ */
717 #endif
718
719 /* Copy whatever the last rule matched to the standard output. */
720 #ifndef ECHO
721 /* This used to be an fputs(), but since the string might contain NUL's,
722  * we now use fwrite().
723  */
724 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
725 #endif
726
727 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
728  * is returned in "result".
729  */
730 #ifndef YY_INPUT
731 #define YY_INPUT(buf,result,max_size) \
732         if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
733                 { \
734                 int c = '*'; \
735                 size_t n; \
736                 for ( n = 0; n < max_size && \
737                              (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
738                         buf[n] = (char) c; \
739                 if ( c == '\n' ) \
740                         buf[n++] = (char) c; \
741                 if ( c == EOF && ferror( yyin ) ) \
742                         YY_FATAL_ERROR( "input in flex scanner failed" ); \
743                 result = n; \
744                 } \
745         else \
746                 { \
747                 errno=0; \
748                 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
749                         { \
750                         if( errno != EINTR) \
751                                 { \
752                                 YY_FATAL_ERROR( "input in flex scanner failed" ); \
753                                 break; \
754                                 } \
755                         errno=0; \
756                         clearerr(yyin); \
757                         } \
758                 }\
759 \
760
761 #endif
762
763 /* No semi-colon after return; correct usage is to write "yyterminate();" -
764  * we don't want an extra ';' after the "return" because that will cause
765  * some compilers to complain about unreachable statements.
766  */
767 #ifndef yyterminate
768 #define yyterminate() return YY_NULL
769 #endif
770
771 /* Number of entries by which start-condition stack grows. */
772 #ifndef YY_START_STACK_INCR
773 #define YY_START_STACK_INCR 25
774 #endif
775
776 /* Report a fatal error. */
777 #ifndef YY_FATAL_ERROR
778 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
779 #endif
780
781 /* end tables serialization structures and prototypes */
782
783 /* Default declaration of generated scanner - a define so the user can
784  * easily add parameters.
785  */
786 #ifndef YY_DECL
787 #define YY_DECL_IS_OURS 1
788
789 extern int _gmx_sel_yylex (yyscan_t yyscanner);
790
791 #define YY_DECL int _gmx_sel_yylex (yyscan_t yyscanner)
792 #endif /* !YY_DECL */
793
794 /* Code executed at the beginning of each rule, after yytext and yyleng
795  * have been set up.
796  */
797 #ifndef YY_USER_ACTION
798 #define YY_USER_ACTION
799 #endif
800
801 /* Code executed at the end of each rule. */
802 #ifndef YY_BREAK
803 #define YY_BREAK /*LINTED*/break;
804 #endif
805
806 #define YY_RULE_SETUP \
807         YY_USER_ACTION
808
809 /** The main scanner function which does all the work.
810  */
811 YY_DECL
812 {
813         yy_state_type yy_current_state;
814         char *yy_cp, *yy_bp;
815         int yy_act;
816     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
817
818         if ( !yyg->yy_init )
819                 {
820                 yyg->yy_init = 1;
821
822 #ifdef YY_USER_INIT
823                 YY_USER_INIT;
824 #endif
825
826                 if ( ! yyg->yy_start )
827                         yyg->yy_start = 1;      /* first start state */
828
829                 if ( ! yyin )
830                         yyin = stdin;
831
832                 if ( ! yyout )
833                         yyout = stdout;
834
835                 if ( ! YY_CURRENT_BUFFER ) {
836                         _gmx_sel_yyensure_buffer_stack (yyscanner);
837                         YY_CURRENT_BUFFER_LVALUE =
838                                 _gmx_sel_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
839                 }
840
841                 _gmx_sel_yy_load_buffer_state(yyscanner );
842                 }
843
844         {
845 #line 104 "scanner.l"
846
847
848
849     gmx_sel_lexer_t *state = _gmx_sel_yyget_extra(yyscanner);
850     int              retval;
851     /* Return a token if one is pending */
852     retval = _gmx_sel_lexer_process_pending(yylval, yylloc, state);
853     if (retval != 0)
854     {
855         return retval;
856     }
857     /* Handle the start conditions for 'of' matching */
858     if (state->bMatchOf)
859     {
860         BEGIN(matchof);
861         state->bMatchOf = false;
862     }
863     else if (state->bMatchBool)
864     {
865         BEGIN(matchbool);
866         state->bMatchBool = false;
867     }
868     else if (state->bCmdStart)
869     {
870         BEGIN(cmdstart);
871         state->bCmdStart = false;
872     }
873     else
874     {
875         BEGIN(0);
876     }
877
878
879 #line 880 "scanner.cpp"
880
881         while ( /*CONSTCOND*/1 )                /* loops until end-of-file is reached */
882                 {
883                 yy_cp = yyg->yy_c_buf_p;
884
885                 /* Support of yytext. */
886                 *yy_cp = yyg->yy_hold_char;
887
888                 /* yy_bp points to the position in yy_ch_buf of the start of
889                  * the current run.
890                  */
891                 yy_bp = yy_cp;
892
893                 yy_current_state = yyg->yy_start;
894 yy_match:
895                 do
896                         {
897                         YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
898                         if ( yy_accept[yy_current_state] )
899                                 {
900                                 yyg->yy_last_accepting_state = yy_current_state;
901                                 yyg->yy_last_accepting_cpos = yy_cp;
902                                 }
903                         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
904                                 {
905                                 yy_current_state = (int) yy_def[yy_current_state];
906                                 if ( yy_current_state >= 76 )
907                                         yy_c = yy_meta[(unsigned int) yy_c];
908                                 }
909                         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
910                         ++yy_cp;
911                         }
912                 while ( yy_current_state != 75 );
913                 yy_cp = yyg->yy_last_accepting_cpos;
914                 yy_current_state = yyg->yy_last_accepting_state;
915
916 yy_find_action:
917                 yy_act = yy_accept[yy_current_state];
918
919                 YY_DO_BEFORE_ACTION;
920
921 do_action:      /* This label is used only to access EOF actions. */
922
923                 switch ( yy_act )
924         { /* beginning of action switch */
925                         case 0: /* must back up */
926                         /* undo the effects of YY_DO_BEFORE_ACTION */
927                         *yy_cp = yyg->yy_hold_char;
928                         yy_cp = yyg->yy_last_accepting_cpos;
929                         yy_current_state = yyg->yy_last_accepting_state;
930                         goto yy_find_action;
931
932 case 1:
933 YY_RULE_SETUP
934 #line 137 "scanner.l"
935 break;
936         YY_BREAK
937 case 2:
938 YY_RULE_SETUP
939 #line 138 "scanner.l"
940 { yylval->i   = strtol(yytext, NULL, 10);    ADD_TOKEN; return TOK_INT; }
941         YY_BREAK
942 case 3:
943 YY_RULE_SETUP
944 #line 139 "scanner.l"
945 { yylval->r   = strtod(yytext, NULL);        ADD_TOKEN; return TOK_REAL; }
946         YY_BREAK
947 case 4:
948 YY_RULE_SETUP
949 #line 140 "scanner.l"
950 { yylval->str = gmx_strndup(yytext+1, yyleng-2); ADD_TOKEN; return STR;  }
951         YY_BREAK
952 case 5:
953 /* rule 5 can match eol */
954 YY_RULE_SETUP
955 #line 142 "scanner.l"
956 { _gmx_sel_lexer_add_token(yylloc, " ", 1, state); break; }
957         YY_BREAK
958 case 6:
959 /* rule 6 can match eol */
960 YY_RULE_SETUP
961 #line 143 "scanner.l"
962 {
963                     if (yytext[0] == ';' || state->statusWriter != NULL)
964                     {
965                         state->pselstr = gmx::stripString(state->pselstr);
966                         state->bCmdStart = true;
967                         return CMD_SEP;
968                     }
969                     else
970                     {
971                         _gmx_sel_lexer_add_token(yylloc, " ", 1, state);
972                     }
973                     break;
974                 }
975         YY_BREAK
976 case YY_STATE_EOF(cmdstart):
977 #line 157 "scanner.l"
978 { state->bCmdStart = true; yyterminate(); }
979         YY_BREAK
980 case YY_STATE_EOF(INITIAL):
981 case YY_STATE_EOF(matchof):
982 case YY_STATE_EOF(matchbool):
983 #line 158 "scanner.l"
984 { state->bCmdStart = true; return CMD_SEP; }
985         YY_BREAK
986
987 case 7:
988 YY_RULE_SETUP
989 #line 161 "scanner.l"
990 { ADD_TOKEN; yylval->i = 1; return TOK_INT; }
991         YY_BREAK
992 case 8:
993 YY_RULE_SETUP
994 #line 162 "scanner.l"
995 { ADD_TOKEN; yylval->i = 0; return TOK_INT; }
996         YY_BREAK
997
998 case 9:
999 YY_RULE_SETUP
1000 #line 164 "scanner.l"
1001 { ADD_TOKEN; return GROUP; }
1002         YY_BREAK
1003 case 10:
1004 YY_RULE_SETUP
1005 #line 165 "scanner.l"
1006 { ADD_TOKEN; return TO; }
1007         YY_BREAK
1008 case 11:
1009 YY_RULE_SETUP
1010 #line 166 "scanner.l"
1011 { ADD_TOKEN; BEGIN(0); return OF; }
1012         YY_BREAK
1013 case 12:
1014 YY_RULE_SETUP
1015 #line 167 "scanner.l"
1016 { ADD_TOKEN; return AND; }
1017         YY_BREAK
1018 case 13:
1019 YY_RULE_SETUP
1020 #line 168 "scanner.l"
1021 { ADD_TOKEN; return OR; }
1022         YY_BREAK
1023 case 14:
1024 YY_RULE_SETUP
1025 #line 169 "scanner.l"
1026 { ADD_TOKEN; return XOR; }
1027         YY_BREAK
1028 case 15:
1029 YY_RULE_SETUP
1030 #line 170 "scanner.l"
1031 { ADD_TOKEN; return NOT; }
1032         YY_BREAK
1033 case 16:
1034 YY_RULE_SETUP
1035 #line 171 "scanner.l"
1036 { yylval->str = gmx_strndup(yytext, yyleng); ADD_TOKEN; return CMP_OP; }
1037         YY_BREAK
1038 case 17:
1039 YY_RULE_SETUP
1040 #line 173 "scanner.l"
1041 { return _gmx_sel_lexer_process_identifier(yylval, yylloc, yytext, yyleng, state); }
1042         YY_BREAK
1043 case 18:
1044 /* rule 18 can match eol */
1045 YY_RULE_SETUP
1046 #line 175 "scanner.l"
1047 { _gmx_sel_lexer_add_token(yylloc, " ", 1, state); break; }
1048         YY_BREAK
1049 case 19:
1050 YY_RULE_SETUP
1051 #line 176 "scanner.l"
1052 { yylval->str = gmx_strndup(yytext, yyleng); ADD_TOKEN; return STR; }
1053         YY_BREAK
1054 case 20:
1055 YY_RULE_SETUP
1056 #line 177 "scanner.l"
1057 { ADD_TOKEN; return yytext[0]; }
1058         YY_BREAK
1059 case 21:
1060 YY_RULE_SETUP
1061 #line 178 "scanner.l"
1062 YY_FATAL_ERROR( "flex scanner jammed" );
1063         YY_BREAK
1064 #line 1065 "scanner.cpp"
1065
1066         case YY_END_OF_BUFFER:
1067                 {
1068                 /* Amount of text matched not including the EOB char. */
1069                 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
1070
1071                 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1072                 *yy_cp = yyg->yy_hold_char;
1073                 YY_RESTORE_YY_MORE_OFFSET
1074
1075                 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1076                         {
1077                         /* We're scanning a new file or input source.  It's
1078                          * possible that this happened because the user
1079                          * just pointed yyin at a new source and called
1080                          * _gmx_sel_yylex().  If so, then we have to assure
1081                          * consistency between YY_CURRENT_BUFFER and our
1082                          * globals.  Here is the right place to do so, because
1083                          * this is the first action (other than possibly a
1084                          * back-up) that will match for the new input source.
1085                          */
1086                         yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1087                         YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1088                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1089                         }
1090
1091                 /* Note that here we test for yy_c_buf_p "<=" to the position
1092                  * of the first EOB in the buffer, since yy_c_buf_p will
1093                  * already have been incremented past the NUL character
1094                  * (since all states make transitions on EOB to the
1095                  * end-of-buffer state).  Contrast this with the test
1096                  * in input().
1097                  */
1098                 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1099                         { /* This was really a NUL. */
1100                         yy_state_type yy_next_state;
1101
1102                         yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
1103
1104                         yy_current_state = yy_get_previous_state( yyscanner );
1105
1106                         /* Okay, we're now positioned to make the NUL
1107                          * transition.  We couldn't have
1108                          * yy_get_previous_state() go ahead and do it
1109                          * for us because it doesn't know how to deal
1110                          * with the possibility of jamming (and we don't
1111                          * want to build jamming into it because then it
1112                          * will run more slowly).
1113                          */
1114
1115                         yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
1116
1117                         yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1118
1119                         if ( yy_next_state )
1120                                 {
1121                                 /* Consume the NUL. */
1122                                 yy_cp = ++yyg->yy_c_buf_p;
1123                                 yy_current_state = yy_next_state;
1124                                 goto yy_match;
1125                                 }
1126
1127                         else
1128                                 {
1129                                 yy_cp = yyg->yy_last_accepting_cpos;
1130                                 yy_current_state = yyg->yy_last_accepting_state;
1131                                 goto yy_find_action;
1132                                 }
1133                         }
1134
1135                 else switch ( yy_get_next_buffer( yyscanner ) )
1136                         {
1137                         case EOB_ACT_END_OF_FILE:
1138                                 {
1139                                 yyg->yy_did_buffer_switch_on_eof = 0;
1140
1141                                 if ( _gmx_sel_yywrap(yyscanner ) )
1142                                         {
1143                                         /* Note: because we've taken care in
1144                                          * yy_get_next_buffer() to have set up
1145                                          * yytext, we can now set up
1146                                          * yy_c_buf_p so that if some total
1147                                          * hoser (like flex itself) wants to
1148                                          * call the scanner after we return the
1149                                          * YY_NULL, it'll still work - another
1150                                          * YY_NULL will get returned.
1151                                          */
1152                                         yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
1153
1154                                         yy_act = YY_STATE_EOF(YY_START);
1155                                         goto do_action;
1156                                         }
1157
1158                                 else
1159                                         {
1160                                         if ( ! yyg->yy_did_buffer_switch_on_eof )
1161                                                 YY_NEW_FILE;
1162                                         }
1163                                 break;
1164                                 }
1165
1166                         case EOB_ACT_CONTINUE_SCAN:
1167                                 yyg->yy_c_buf_p =
1168                                         yyg->yytext_ptr + yy_amount_of_matched_text;
1169
1170                                 yy_current_state = yy_get_previous_state( yyscanner );
1171
1172                                 yy_cp = yyg->yy_c_buf_p;
1173                                 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1174                                 goto yy_match;
1175
1176                         case EOB_ACT_LAST_MATCH:
1177                                 yyg->yy_c_buf_p =
1178                                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
1179
1180                                 yy_current_state = yy_get_previous_state( yyscanner );
1181
1182                                 yy_cp = yyg->yy_c_buf_p;
1183                                 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1184                                 goto yy_find_action;
1185                         }
1186                 break;
1187                 }
1188
1189         default:
1190                 YY_FATAL_ERROR(
1191                         "fatal flex scanner internal error--no action found" );
1192         } /* end of action switch */
1193                 } /* end of scanning one token */
1194         } /* end of user's declarations */
1195 } /* end of _gmx_sel_yylex */
1196
1197 /* yy_get_next_buffer - try to read in a new buffer
1198  *
1199  * Returns a code representing an action:
1200  *      EOB_ACT_LAST_MATCH -
1201  *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1202  *      EOB_ACT_END_OF_FILE - end of file
1203  */
1204 static int yy_get_next_buffer (yyscan_t yyscanner)
1205 {
1206     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1207         char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1208         char *source = yyg->yytext_ptr;
1209         yy_size_t number_to_move, i;
1210         int ret_val;
1211
1212         if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1213                 YY_FATAL_ERROR(
1214                 "fatal flex scanner internal error--end of buffer missed" );
1215
1216         if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1217                 { /* Don't try to fill the buffer, so this is an EOF. */
1218                 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
1219                         {
1220                         /* We matched a single character, the EOB, so
1221                          * treat this as a final EOF.
1222                          */
1223                         return EOB_ACT_END_OF_FILE;
1224                         }
1225
1226                 else
1227                         {
1228                         /* We matched some text prior to the EOB, first
1229                          * process it.
1230                          */
1231                         return EOB_ACT_LAST_MATCH;
1232                         }
1233                 }
1234
1235         /* Try to read more data. */
1236
1237         /* First move last chars to start of buffer. */
1238         number_to_move = (yy_size_t) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
1239
1240         for ( i = 0; i < number_to_move; ++i )
1241                 *(dest++) = *(source++);
1242
1243         if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1244                 /* don't do the read, it's not guaranteed to return an EOF,
1245                  * just force an EOF
1246                  */
1247                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1248
1249         else
1250                 {
1251                         yy_size_t num_to_read =
1252                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1253
1254                 while ( num_to_read <= 0 )
1255                         { /* Not enough room in the buffer - grow it. */
1256
1257                         /* just a shorter name for the current buffer */
1258                         YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1259
1260                         int yy_c_buf_p_offset =
1261                                 (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
1262
1263                         if ( b->yy_is_our_buffer )
1264                                 {
1265                                 yy_size_t new_size = b->yy_buf_size * 2;
1266
1267                                 if ( new_size <= 0 )
1268                                         b->yy_buf_size += b->yy_buf_size / 8;
1269                                 else
1270                                         b->yy_buf_size *= 2;
1271
1272                                 b->yy_ch_buf = (char *)
1273                                         /* Include room in for 2 EOB chars. */
1274                                         _gmx_sel_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
1275                                 }
1276                         else
1277                                 /* Can't grow it, we don't own it. */
1278                                 b->yy_ch_buf = 0;
1279
1280                         if ( ! b->yy_ch_buf )
1281                                 YY_FATAL_ERROR(
1282                                 "fatal error - scanner input buffer overflow" );
1283
1284                         yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1285
1286                         num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1287                                                 number_to_move - 1;
1288
1289                         }
1290
1291                 if ( num_to_read > YY_READ_BUF_SIZE )
1292                         num_to_read = YY_READ_BUF_SIZE;
1293
1294                 /* Read in more data. */
1295                 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1296                         yyg->yy_n_chars, num_to_read );
1297
1298                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1299                 }
1300
1301         if ( yyg->yy_n_chars == 0 )
1302                 {
1303                 if ( number_to_move == YY_MORE_ADJ )
1304                         {
1305                         ret_val = EOB_ACT_END_OF_FILE;
1306                         _gmx_sel_yyrestart(yyin  ,yyscanner);
1307                         }
1308
1309                 else
1310                         {
1311                         ret_val = EOB_ACT_LAST_MATCH;
1312                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1313                                 YY_BUFFER_EOF_PENDING;
1314                         }
1315                 }
1316
1317         else
1318                 ret_val = EOB_ACT_CONTINUE_SCAN;
1319
1320         if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1321                 /* Extend the array by 50%, plus the number we really need. */
1322                 yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
1323                 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) _gmx_sel_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
1324                 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1325                         YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1326         }
1327
1328         yyg->yy_n_chars += number_to_move;
1329         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1330         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1331
1332         yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1333
1334         return ret_val;
1335 }
1336
1337 /* yy_get_previous_state - get the state just before the EOB char was reached */
1338
1339     static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
1340 {
1341         yy_state_type yy_current_state;
1342         char *yy_cp;
1343     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1344
1345         yy_current_state = yyg->yy_start;
1346
1347         for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
1348                 {
1349                 YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1350                 if ( yy_accept[yy_current_state] )
1351                         {
1352                         yyg->yy_last_accepting_state = yy_current_state;
1353                         yyg->yy_last_accepting_cpos = yy_cp;
1354                         }
1355                 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1356                         {
1357                         yy_current_state = (int) yy_def[yy_current_state];
1358                         if ( yy_current_state >= 76 )
1359                                 yy_c = yy_meta[(unsigned int) yy_c];
1360                         }
1361                 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1362                 }
1363
1364         return yy_current_state;
1365 }
1366
1367 /* yy_try_NUL_trans - try to make a transition on the NUL character
1368  *
1369  * synopsis
1370  *      next_state = yy_try_NUL_trans( current_state );
1371  */
1372     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state , yyscan_t yyscanner)
1373 {
1374         int yy_is_jam;
1375     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
1376         char *yy_cp = yyg->yy_c_buf_p;
1377
1378         YY_CHAR yy_c = 1;
1379         if ( yy_accept[yy_current_state] )
1380                 {
1381                 yyg->yy_last_accepting_state = yy_current_state;
1382                 yyg->yy_last_accepting_cpos = yy_cp;
1383                 }
1384         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1385                 {
1386                 yy_current_state = (int) yy_def[yy_current_state];
1387                 if ( yy_current_state >= 76 )
1388                         yy_c = yy_meta[(unsigned int) yy_c];
1389                 }
1390         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1391         yy_is_jam = (yy_current_state == 75);
1392
1393         (void)yyg;
1394         return yy_is_jam ? 0 : yy_current_state;
1395 }
1396
1397 #ifndef YY_NO_UNPUT
1398
1399     static void yyunput (int c, char * yy_bp , yyscan_t yyscanner)
1400 {
1401         char *yy_cp;
1402     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1403
1404     yy_cp = yyg->yy_c_buf_p;
1405
1406         /* undo effects of setting up yytext */
1407         *yy_cp = yyg->yy_hold_char;
1408
1409         if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1410                 { /* need to shift things up to make room */
1411                 /* +2 for EOB chars. */
1412                 yy_size_t number_to_move = yyg->yy_n_chars + 2;
1413                 char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1414                                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1415                 char *source =
1416                                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1417
1418                 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1419                         *--dest = *--source;
1420
1421                 yy_cp += (int) (dest - source);
1422                 yy_bp += (int) (dest - source);
1423                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1424                         yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1425
1426                 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1427                         YY_FATAL_ERROR( "flex scanner push-back overflow" );
1428                 }
1429
1430         *--yy_cp = (char) c;
1431
1432         yyg->yytext_ptr = yy_bp;
1433         yyg->yy_hold_char = *yy_cp;
1434         yyg->yy_c_buf_p = yy_cp;
1435 }
1436
1437 #endif
1438
1439 #ifndef YY_NO_INPUT
1440 #ifdef __cplusplus
1441     static int yyinput (yyscan_t yyscanner)
1442 #else
1443     static int input  (yyscan_t yyscanner)
1444 #endif
1445
1446 {
1447         int c;
1448     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1449
1450         *yyg->yy_c_buf_p = yyg->yy_hold_char;
1451
1452         if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1453                 {
1454                 /* yy_c_buf_p now points to the character we want to return.
1455                  * If this occurs *before* the EOB characters, then it's a
1456                  * valid NUL; if not, then we've hit the end of the buffer.
1457                  */
1458                 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1459                         /* This was really a NUL. */
1460                         *yyg->yy_c_buf_p = '\0';
1461
1462                 else
1463                         { /* need more input */
1464                         yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
1465                         ++yyg->yy_c_buf_p;
1466
1467                         switch ( yy_get_next_buffer( yyscanner ) )
1468                                 {
1469                                 case EOB_ACT_LAST_MATCH:
1470                                         /* This happens because yy_g_n_b()
1471                                          * sees that we've accumulated a
1472                                          * token and flags that we need to
1473                                          * try matching the token before
1474                                          * proceeding.  But for input(),
1475                                          * there's no matching to consider.
1476                                          * So convert the EOB_ACT_LAST_MATCH
1477                                          * to EOB_ACT_END_OF_FILE.
1478                                          */
1479
1480                                         /* Reset buffer status. */
1481                                         _gmx_sel_yyrestart(yyin ,yyscanner);
1482
1483                                         /*FALLTHROUGH*/
1484
1485                                 case EOB_ACT_END_OF_FILE:
1486                                         {
1487                                         if ( _gmx_sel_yywrap(yyscanner ) )
1488                                                 return EOF;
1489
1490                                         if ( ! yyg->yy_did_buffer_switch_on_eof )
1491                                                 YY_NEW_FILE;
1492 #ifdef __cplusplus
1493                                         return yyinput(yyscanner);
1494 #else
1495                                         return input(yyscanner);
1496 #endif
1497                                         }
1498
1499                                 case EOB_ACT_CONTINUE_SCAN:
1500                                         yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
1501                                         break;
1502                                 }
1503                         }
1504                 }
1505
1506         c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
1507         *yyg->yy_c_buf_p = '\0';        /* preserve yytext */
1508         yyg->yy_hold_char = *++yyg->yy_c_buf_p;
1509
1510         return c;
1511 }
1512 #endif  /* ifndef YY_NO_INPUT */
1513
1514 /** Immediately switch to a different input stream.
1515  * @param input_file A readable stream.
1516  * @param yyscanner The scanner object.
1517  * @note This function does not reset the start condition to @c INITIAL .
1518  */
1519     void _gmx_sel_yyrestart  (FILE * input_file , yyscan_t yyscanner)
1520 {
1521     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1522
1523         if ( ! YY_CURRENT_BUFFER ){
1524         _gmx_sel_yyensure_buffer_stack (yyscanner);
1525                 YY_CURRENT_BUFFER_LVALUE =
1526             _gmx_sel_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
1527         }
1528
1529         _gmx_sel_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
1530         _gmx_sel_yy_load_buffer_state(yyscanner );
1531 }
1532
1533 /** Switch to a different input buffer.
1534  * @param new_buffer The new input buffer.
1535  * @param yyscanner The scanner object.
1536  */
1537     void _gmx_sel_yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)
1538 {
1539     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1540
1541         /* TODO. We should be able to replace this entire function body
1542          * with
1543          *              _gmx_sel_yypop_buffer_state();
1544          *              _gmx_sel_yypush_buffer_state(new_buffer);
1545      */
1546         _gmx_sel_yyensure_buffer_stack (yyscanner);
1547         if ( YY_CURRENT_BUFFER == new_buffer )
1548                 return;
1549
1550         if ( YY_CURRENT_BUFFER )
1551                 {
1552                 /* Flush out information for old buffer. */
1553                 *yyg->yy_c_buf_p = yyg->yy_hold_char;
1554                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1555                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1556                 }
1557
1558         YY_CURRENT_BUFFER_LVALUE = new_buffer;
1559         _gmx_sel_yy_load_buffer_state(yyscanner );
1560
1561         /* We don't actually know whether we did this switch during
1562          * EOF (_gmx_sel_yywrap()) processing, but the only time this flag
1563          * is looked at is after _gmx_sel_yywrap() is called, so it's safe
1564          * to go ahead and always set it.
1565          */
1566         yyg->yy_did_buffer_switch_on_eof = 1;
1567 }
1568
1569 static void _gmx_sel_yy_load_buffer_state  (yyscan_t yyscanner)
1570 {
1571     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1572         yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1573         yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1574         yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1575         yyg->yy_hold_char = *yyg->yy_c_buf_p;
1576 }
1577
1578 /** Allocate and initialize an input buffer state.
1579  * @param file A readable stream.
1580  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1581  * @param yyscanner The scanner object.
1582  * @return the allocated buffer state.
1583  */
1584     YY_BUFFER_STATE _gmx_sel_yy_create_buffer  (FILE * file, int  size , yyscan_t yyscanner)
1585 {
1586         YY_BUFFER_STATE b;
1587     
1588         b = (YY_BUFFER_STATE) _gmx_sel_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1589         if ( ! b )
1590                 YY_FATAL_ERROR( "out of dynamic memory in _gmx_sel_yy_create_buffer()" );
1591
1592         b->yy_buf_size = (yy_size_t)size;
1593
1594         /* yy_ch_buf has to be 2 characters longer than the size given because
1595          * we need to put in 2 end-of-buffer characters.
1596          */
1597         b->yy_ch_buf = (char *) _gmx_sel_yyalloc(b->yy_buf_size + 2 ,yyscanner );
1598         if ( ! b->yy_ch_buf )
1599                 YY_FATAL_ERROR( "out of dynamic memory in _gmx_sel_yy_create_buffer()" );
1600
1601         b->yy_is_our_buffer = 1;
1602
1603         _gmx_sel_yy_init_buffer(b,file ,yyscanner);
1604
1605         return b;
1606 }
1607
1608 /** Destroy the buffer.
1609  * @param b a buffer created with _gmx_sel_yy_create_buffer()
1610  * @param yyscanner The scanner object.
1611  */
1612     void _gmx_sel_yy_delete_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
1613 {
1614     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1615
1616         if ( ! b )
1617                 return;
1618
1619         if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1620                 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1621
1622         if ( b->yy_is_our_buffer )
1623                 _gmx_sel_yyfree((void *) b->yy_ch_buf ,yyscanner );
1624
1625         _gmx_sel_yyfree((void *) b ,yyscanner );
1626 }
1627
1628 /* Initializes or reinitializes a buffer.
1629  * This function is sometimes called more than once on the same buffer,
1630  * such as during a _gmx_sel_yyrestart() or at EOF.
1631  */
1632     static void _gmx_sel_yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)
1633
1634 {
1635         int oerrno = errno;
1636     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1637
1638         _gmx_sel_yy_flush_buffer(b ,yyscanner);
1639
1640         b->yy_input_file = file;
1641         b->yy_fill_buffer = 1;
1642
1643     /* If b is the current buffer, then _gmx_sel_yy_init_buffer was _probably_
1644      * called from _gmx_sel_yyrestart() or through yy_get_next_buffer.
1645      * In that case, we don't want to reset the lineno or column.
1646      */
1647     if (b != YY_CURRENT_BUFFER){
1648         b->yy_bs_lineno = 1;
1649         b->yy_bs_column = 0;
1650     }
1651
1652         b->yy_is_interactive = 0;
1653     
1654         errno = oerrno;
1655 }
1656
1657 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1658  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1659  * @param yyscanner The scanner object.
1660  */
1661     void _gmx_sel_yy_flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
1662 {
1663     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1664         if ( ! b )
1665                 return;
1666
1667         b->yy_n_chars = 0;
1668
1669         /* We always need two end-of-buffer characters.  The first causes
1670          * a transition to the end-of-buffer state.  The second causes
1671          * a jam in that state.
1672          */
1673         b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1674         b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1675
1676         b->yy_buf_pos = &b->yy_ch_buf[0];
1677
1678         b->yy_at_bol = 1;
1679         b->yy_buffer_status = YY_BUFFER_NEW;
1680
1681         if ( b == YY_CURRENT_BUFFER )
1682                 _gmx_sel_yy_load_buffer_state(yyscanner );
1683 }
1684
1685 /** Pushes the new state onto the stack. The new state becomes
1686  *  the current state. This function will allocate the stack
1687  *  if necessary.
1688  *  @param new_buffer The new state.
1689  *  @param yyscanner The scanner object.
1690  */
1691 void _gmx_sel_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1692 {
1693     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1694         if (new_buffer == NULL)
1695                 return;
1696
1697         _gmx_sel_yyensure_buffer_stack(yyscanner);
1698
1699         /* This block is copied from _gmx_sel_yy_switch_to_buffer. */
1700         if ( YY_CURRENT_BUFFER )
1701                 {
1702                 /* Flush out information for old buffer. */
1703                 *yyg->yy_c_buf_p = yyg->yy_hold_char;
1704                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1705                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1706                 }
1707
1708         /* Only push if top exists. Otherwise, replace top. */
1709         if (YY_CURRENT_BUFFER)
1710                 yyg->yy_buffer_stack_top++;
1711         YY_CURRENT_BUFFER_LVALUE = new_buffer;
1712
1713         /* copied from _gmx_sel_yy_switch_to_buffer. */
1714         _gmx_sel_yy_load_buffer_state(yyscanner );
1715         yyg->yy_did_buffer_switch_on_eof = 1;
1716 }
1717
1718 /** Removes and deletes the top of the stack, if present.
1719  *  The next element becomes the new top.
1720  *  @param yyscanner The scanner object.
1721  */
1722 void _gmx_sel_yypop_buffer_state (yyscan_t yyscanner)
1723 {
1724     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1725         if (!YY_CURRENT_BUFFER)
1726                 return;
1727
1728         _gmx_sel_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
1729         YY_CURRENT_BUFFER_LVALUE = NULL;
1730         if (yyg->yy_buffer_stack_top > 0)
1731                 --yyg->yy_buffer_stack_top;
1732
1733         if (YY_CURRENT_BUFFER) {
1734                 _gmx_sel_yy_load_buffer_state(yyscanner );
1735                 yyg->yy_did_buffer_switch_on_eof = 1;
1736         }
1737 }
1738
1739 /* Allocates the stack if it does not exist.
1740  *  Guarantees space for at least one push.
1741  */
1742 static void _gmx_sel_yyensure_buffer_stack (yyscan_t yyscanner)
1743 {
1744         yy_size_t num_to_alloc;
1745     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1746
1747         if (!yyg->yy_buffer_stack) {
1748
1749                 /* First allocation is just for 2 elements, since we don't know if this
1750                  * scanner will even need a stack. We use 2 instead of 1 to avoid an
1751                  * immediate realloc on the next call.
1752          */
1753                 num_to_alloc = 1; // After all that talk, this was set to 1 anyways...
1754                 yyg->yy_buffer_stack = (struct yy_buffer_state**)_gmx_sel_yyalloc
1755                                                                 (num_to_alloc * sizeof(struct yy_buffer_state*)
1756                                                                 , yyscanner);
1757                 if ( ! yyg->yy_buffer_stack )
1758                         YY_FATAL_ERROR( "out of dynamic memory in _gmx_sel_yyensure_buffer_stack()" );
1759                                                                   
1760                 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1761                                 
1762                 yyg->yy_buffer_stack_max = num_to_alloc;
1763                 yyg->yy_buffer_stack_top = 0;
1764                 return;
1765         }
1766
1767         if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
1768
1769                 /* Increase the buffer to prepare for a possible push. */
1770                 yy_size_t grow_size = 8 /* arbitrary grow size */;
1771
1772                 num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
1773                 yyg->yy_buffer_stack = (struct yy_buffer_state**)_gmx_sel_yyrealloc
1774                                                                 (yyg->yy_buffer_stack,
1775                                                                 num_to_alloc * sizeof(struct yy_buffer_state*)
1776                                                                 , yyscanner);
1777                 if ( ! yyg->yy_buffer_stack )
1778                         YY_FATAL_ERROR( "out of dynamic memory in _gmx_sel_yyensure_buffer_stack()" );
1779
1780                 /* zero only the new slots.*/
1781                 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
1782                 yyg->yy_buffer_stack_max = num_to_alloc;
1783         }
1784 }
1785
1786 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1787  * @param base the character buffer
1788  * @param size the size in bytes of the character buffer
1789  * @param yyscanner The scanner object.
1790  * @return the newly allocated buffer state object. 
1791  */
1792 YY_BUFFER_STATE _gmx_sel_yy_scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)
1793 {
1794         YY_BUFFER_STATE b;
1795     
1796         if ( size < 2 ||
1797              base[size-2] != YY_END_OF_BUFFER_CHAR ||
1798              base[size-1] != YY_END_OF_BUFFER_CHAR )
1799                 /* They forgot to leave room for the EOB's. */
1800                 return 0;
1801
1802         b = (YY_BUFFER_STATE) _gmx_sel_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1803         if ( ! b )
1804                 YY_FATAL_ERROR( "out of dynamic memory in _gmx_sel_yy_scan_buffer()" );
1805
1806         b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
1807         b->yy_buf_pos = b->yy_ch_buf = base;
1808         b->yy_is_our_buffer = 0;
1809         b->yy_input_file = 0;
1810         b->yy_n_chars = b->yy_buf_size;
1811         b->yy_is_interactive = 0;
1812         b->yy_at_bol = 1;
1813         b->yy_fill_buffer = 0;
1814         b->yy_buffer_status = YY_BUFFER_NEW;
1815
1816         _gmx_sel_yy_switch_to_buffer(b ,yyscanner );
1817
1818         return b;
1819 }
1820
1821 /** Setup the input buffer state to scan a string. The next call to _gmx_sel_yylex() will
1822  * scan from a @e copy of @a str.
1823  * @param yystr a NUL-terminated string to scan
1824  * @param yyscanner The scanner object.
1825  * @return the newly allocated buffer state object.
1826  * @note If you want to scan bytes that may contain NUL values, then use
1827  *       _gmx_sel_yy_scan_bytes() instead.
1828  */
1829 YY_BUFFER_STATE _gmx_sel_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
1830 {
1831     
1832         return _gmx_sel_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
1833 }
1834
1835 /** Setup the input buffer state to scan the given bytes. The next call to _gmx_sel_yylex() will
1836  * scan from a @e copy of @a bytes.
1837  * @param yybytes the byte buffer to scan
1838  * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1839  * @param yyscanner The scanner object.
1840  * @return the newly allocated buffer state object.
1841  */
1842 YY_BUFFER_STATE _gmx_sel_yy_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len , yyscan_t yyscanner)
1843 {
1844         YY_BUFFER_STATE b;
1845         char *buf;
1846         yy_size_t n;
1847         yy_size_t i;
1848     
1849         /* Get memory for full buffer, including space for trailing EOB's. */
1850         n = _yybytes_len + 2;
1851         buf = (char *) _gmx_sel_yyalloc(n ,yyscanner );
1852         if ( ! buf )
1853                 YY_FATAL_ERROR( "out of dynamic memory in _gmx_sel_yy_scan_bytes()" );
1854
1855         for ( i = 0; i < _yybytes_len; ++i )
1856                 buf[i] = yybytes[i];
1857
1858         buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1859
1860         b = _gmx_sel_yy_scan_buffer(buf,n ,yyscanner);
1861         if ( ! b )
1862                 YY_FATAL_ERROR( "bad buffer in _gmx_sel_yy_scan_bytes()" );
1863
1864         /* It's okay to grow etc. this buffer, and we should throw it
1865          * away when we're done.
1866          */
1867         b->yy_is_our_buffer = 1;
1868
1869         return b;
1870 }
1871
1872 #ifndef YY_EXIT_FAILURE
1873 #define YY_EXIT_FAILURE 2
1874 #endif
1875
1876 static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
1877 {
1878         struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1879         (void)yyg;
1880         (void) fprintf( stderr, "%s\n", msg );
1881         exit( YY_EXIT_FAILURE );
1882 }
1883
1884 /* Redefine yyless() so it works in section 3 code. */
1885
1886 #undef yyless
1887 #define yyless(n) \
1888         do \
1889                 { \
1890                 /* Undo effects of setting up yytext. */ \
1891         int yyless_macro_arg = (n); \
1892         YY_LESS_LINENO(yyless_macro_arg);\
1893                 yytext[yyleng] = yyg->yy_hold_char; \
1894                 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
1895                 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
1896                 *yyg->yy_c_buf_p = '\0'; \
1897                 yyleng = yyless_macro_arg; \
1898                 } \
1899         while ( 0 )
1900
1901 /* Accessor  methods (get/set functions) to struct members. */
1902
1903 /** Get the user-defined data for this scanner.
1904  * @param yyscanner The scanner object.
1905  */
1906 YY_EXTRA_TYPE _gmx_sel_yyget_extra  (yyscan_t yyscanner)
1907 {
1908     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1909     return yyextra;
1910 }
1911
1912 /** Get the current line number.
1913  * @param yyscanner The scanner object.
1914  */
1915 int _gmx_sel_yyget_lineno  (yyscan_t yyscanner)
1916 {
1917     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1918     
1919         if (! YY_CURRENT_BUFFER)
1920             return 0;
1921     
1922     return yylineno;
1923 }
1924
1925 /** Get the current column number.
1926  * @param yyscanner The scanner object.
1927  */
1928 int _gmx_sel_yyget_column  (yyscan_t yyscanner)
1929 {
1930     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1931     
1932         if (! YY_CURRENT_BUFFER)
1933             return 0;
1934     
1935     return yycolumn;
1936 }
1937
1938 /** Get the input stream.
1939  * @param yyscanner The scanner object.
1940  */
1941 FILE *_gmx_sel_yyget_in  (yyscan_t yyscanner)
1942 {
1943     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1944     return yyin;
1945 }
1946
1947 /** Get the output stream.
1948  * @param yyscanner The scanner object.
1949  */
1950 FILE *_gmx_sel_yyget_out  (yyscan_t yyscanner)
1951 {
1952     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1953     return yyout;
1954 }
1955
1956 /** Get the length of the current token.
1957  * @param yyscanner The scanner object.
1958  */
1959 yy_size_t _gmx_sel_yyget_leng  (yyscan_t yyscanner)
1960 {
1961     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1962     return yyleng;
1963 }
1964
1965 /** Get the current token.
1966  * @param yyscanner The scanner object.
1967  */
1968
1969 char *_gmx_sel_yyget_text  (yyscan_t yyscanner)
1970 {
1971     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1972     return yytext;
1973 }
1974
1975 /** Set the user-defined data. This data is never touched by the scanner.
1976  * @param user_defined The data to be associated with this scanner.
1977  * @param yyscanner The scanner object.
1978  */
1979 void _gmx_sel_yyset_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)
1980 {
1981     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1982     yyextra = user_defined ;
1983 }
1984
1985 /** Set the current line number.
1986  * @param _line_number line number
1987  * @param yyscanner The scanner object.
1988  */
1989 void _gmx_sel_yyset_lineno (int  _line_number , yyscan_t yyscanner)
1990 {
1991     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1992
1993         /* lineno is only valid if an input buffer exists. */
1994         if (! YY_CURRENT_BUFFER )
1995            YY_FATAL_ERROR( "_gmx_sel_yyset_lineno called with no buffer" );
1996     
1997     yylineno = _line_number;
1998 }
1999
2000 /** Set the current column.
2001  * @param _column_no column number
2002  * @param yyscanner The scanner object.
2003  */
2004 void _gmx_sel_yyset_column (int  _column_no , yyscan_t yyscanner)
2005 {
2006     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2007
2008         /* column is only valid if an input buffer exists. */
2009         if (! YY_CURRENT_BUFFER )
2010            YY_FATAL_ERROR( "_gmx_sel_yyset_column called with no buffer" );
2011     
2012     yycolumn = _column_no;
2013 }
2014
2015 /** Set the input stream. This does not discard the current
2016  * input buffer.
2017  * @param _in_str A readable stream.
2018  * @param yyscanner The scanner object.
2019  * @see _gmx_sel_yy_switch_to_buffer
2020  */
2021 void _gmx_sel_yyset_in (FILE *  _in_str , yyscan_t yyscanner)
2022 {
2023     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2024     yyin = _in_str ;
2025 }
2026
2027 void _gmx_sel_yyset_out (FILE *  _out_str , yyscan_t yyscanner)
2028 {
2029     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2030     yyout = _out_str ;
2031 }
2032
2033 int _gmx_sel_yyget_debug  (yyscan_t yyscanner)
2034 {
2035     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2036     return yy_flex_debug;
2037 }
2038
2039 void _gmx_sel_yyset_debug (int  _bdebug , yyscan_t yyscanner)
2040 {
2041     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2042     yy_flex_debug = _bdebug ;
2043 }
2044
2045 /* Accessor methods for yylval and yylloc */
2046
2047 /* User-visible API */
2048
2049 /* _gmx_sel_yylex_init is special because it creates the scanner itself, so it is
2050  * the ONLY reentrant function that doesn't take the scanner as the last argument.
2051  * That's why we explicitly handle the declaration, instead of using our macros.
2052  */
2053
2054 int _gmx_sel_yylex_init(yyscan_t* ptr_yy_globals)
2055
2056 {
2057     if (ptr_yy_globals == NULL){
2058         errno = EINVAL;
2059         return 1;
2060     }
2061
2062     *ptr_yy_globals = (yyscan_t) _gmx_sel_yyalloc ( sizeof( struct yyguts_t ), NULL );
2063
2064     if (*ptr_yy_globals == NULL){
2065         errno = ENOMEM;
2066         return 1;
2067     }
2068
2069     /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2070     memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2071
2072     return yy_init_globals ( *ptr_yy_globals );
2073 }
2074
2075 /* _gmx_sel_yylex_init_extra has the same functionality as _gmx_sel_yylex_init, but follows the
2076  * convention of taking the scanner as the last argument. Note however, that
2077  * this is a *pointer* to a scanner, as it will be allocated by this call (and
2078  * is the reason, too, why this function also must handle its own declaration).
2079  * The user defined value in the first argument will be available to _gmx_sel_yyalloc in
2080  * the yyextra field.
2081  */
2082
2083 int _gmx_sel_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
2084
2085 {
2086     struct yyguts_t dummy_yyguts;
2087
2088     _gmx_sel_yyset_extra (yy_user_defined, &dummy_yyguts);
2089
2090     if (ptr_yy_globals == NULL){
2091         errno = EINVAL;
2092         return 1;
2093     }
2094         
2095     *ptr_yy_globals = (yyscan_t) _gmx_sel_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2096         
2097     if (*ptr_yy_globals == NULL){
2098         errno = ENOMEM;
2099         return 1;
2100     }
2101     
2102     /* By setting to 0xAA, we expose bugs in
2103     yy_init_globals. Leave at 0x00 for releases. */
2104     memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2105     
2106     _gmx_sel_yyset_extra (yy_user_defined, *ptr_yy_globals);
2107     
2108     return yy_init_globals ( *ptr_yy_globals );
2109 }
2110
2111 static int yy_init_globals (yyscan_t yyscanner)
2112 {
2113     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2114     /* Initialization is the same as for the non-reentrant scanner.
2115      * This function is called from _gmx_sel_yylex_destroy(), so don't allocate here.
2116      */
2117
2118     yyg->yy_buffer_stack = 0;
2119     yyg->yy_buffer_stack_top = 0;
2120     yyg->yy_buffer_stack_max = 0;
2121     yyg->yy_c_buf_p = (char *) 0;
2122     yyg->yy_init = 0;
2123     yyg->yy_start = 0;
2124
2125     yyg->yy_start_stack_ptr = 0;
2126     yyg->yy_start_stack_depth = 0;
2127     yyg->yy_start_stack =  NULL;
2128
2129 /* Defined in main.c */
2130 #ifdef YY_STDINIT
2131     yyin = stdin;
2132     yyout = stdout;
2133 #else
2134     yyin = (FILE *) 0;
2135     yyout = (FILE *) 0;
2136 #endif
2137
2138     /* For future reference: Set errno on error, since we are called by
2139      * _gmx_sel_yylex_init()
2140      */
2141     return 0;
2142 }
2143
2144 /* _gmx_sel_yylex_destroy is for both reentrant and non-reentrant scanners. */
2145 int _gmx_sel_yylex_destroy  (yyscan_t yyscanner)
2146 {
2147     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2148
2149     /* Pop the buffer stack, destroying each element. */
2150         while(YY_CURRENT_BUFFER){
2151                 _gmx_sel_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
2152                 YY_CURRENT_BUFFER_LVALUE = NULL;
2153                 _gmx_sel_yypop_buffer_state(yyscanner);
2154         }
2155
2156         /* Destroy the stack itself. */
2157         _gmx_sel_yyfree(yyg->yy_buffer_stack ,yyscanner);
2158         yyg->yy_buffer_stack = NULL;
2159
2160     /* Destroy the start condition stack. */
2161         _gmx_sel_yyfree(yyg->yy_start_stack ,yyscanner );
2162         yyg->yy_start_stack = NULL;
2163
2164     /* Reset the globals. This is important in a non-reentrant scanner so the next time
2165      * _gmx_sel_yylex() is called, initialization will occur. */
2166     yy_init_globals( yyscanner);
2167
2168     /* Destroy the main struct (reentrant only). */
2169     _gmx_sel_yyfree ( yyscanner , yyscanner );
2170     yyscanner = NULL;
2171     return 0;
2172 }
2173
2174 /*
2175  * Internal utility routines.
2176  */
2177
2178 #ifndef yytext_ptr
2179 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
2180 {
2181         struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2182         (void)yyg;
2183
2184         int i;
2185         for ( i = 0; i < n; ++i )
2186                 s1[i] = s2[i];
2187 }
2188 #endif
2189
2190 #ifdef YY_NEED_STRLEN
2191 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
2192 {
2193         int n;
2194         for ( n = 0; s[n]; ++n )
2195                 ;
2196
2197         return n;
2198 }
2199 #endif
2200
2201 void *_gmx_sel_yyalloc (yy_size_t  size , yyscan_t yyscanner)
2202 {
2203         struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2204         (void)yyg;
2205         return (void *) malloc( size );
2206 }
2207
2208 void *_gmx_sel_yyrealloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)
2209 {
2210         struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2211         (void)yyg;
2212
2213         /* The cast to (char *) in the following accommodates both
2214          * implementations that use char* generic pointers, and those
2215          * that use void* generic pointers.  It works with the latter
2216          * because both ANSI C and C++ allow castless assignment from
2217          * any pointer type to void*, and deal with argument conversions
2218          * as though doing an assignment.
2219          */
2220         return (void *) realloc( (char *) ptr, size );
2221 }
2222
2223 void _gmx_sel_yyfree (void * ptr , yyscan_t yyscanner)
2224 {
2225         struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2226         (void)yyg;
2227         free( (char *) ptr );   /* see _gmx_sel_yyrealloc() for (char *) cast */
2228 }
2229
2230 #define YYTABLES_NAME "yytables"
2231
2232 #line 178 "scanner.l"