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