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