2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5 * Copyright (c) 2001-2009, The GROMACS development team,
6 * check out http://www.gromacs.org for more information.
7 * Copyright (c) 2012,2013, by the GROMACS development team, led by
8 * David van der Spoel, Berk Hess, Erik Lindahl, and including many
9 * others, as listed in the AUTHORS file in the top-level source
10 * directory and at http://www.gromacs.org.
12 * GROMACS is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public License
14 * as published by the Free Software Foundation; either version 2.1
15 * of the License, or (at your option) any later version.
17 * GROMACS is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with GROMACS; if not, see
24 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
25 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 * If you want to redistribute modifications to GROMACS, please
28 * consider that scientific software is very special. Version
29 * control is crucial - bugs must be traceable. We will be happy to
30 * consider code for inclusion in the official distribution, but
31 * derived work must not be called official GROMACS. Details are found
32 * in the README & COPYING files - if they are missing, get the
33 * official version at http://www.gromacs.org.
35 * To help us fund GROMACS development, we humbly ask that you cite
36 * the research papers on the package. Check out http://www.gromacs.org.
39 * \brief Internal header file used by the selection tokenizer.
41 #ifndef SELECTION_SCANNER_INTERNAL_H
42 #define SELECTION_SCANNER_INTERNAL_H
46 /** The scanning function generated by Flex. */
47 #define YY_DECL int _gmx_sel_yylex(YYSTYPE *yylval, yyscan_t yyscanner)
50 /* These need to be defined before including scanner_flex.h, because it
51 * uses YY_EXTRA_TYPE. But we also need to include it before defining
52 * gmx_sel_lexer_t; hence the forward declaration. */
53 struct gmx_sel_lexer_t;
54 #define YY_EXTRA_TYPE struct gmx_sel_lexer_t *
56 /* We cannot include scanner_flex.h from the scanner itself, because it
57 * seems to break everything. */
58 /* And we need to define YY_NO_UNISTD_H here as well, otherwise unistd.h
59 * gets included in other files than scanner.c... */
61 #define YY_NO_UNISTD_H
62 #include "scanner_flex.h"
66 * Internal data structure for the selection tokenizer state.
68 typedef struct gmx_sel_lexer_t
70 struct gmx_ana_selcollection_t *sc;
71 struct gmx_ana_indexgrps_t *grps;
74 gmx_bool bInteractive;
82 struct gmx_ana_selmethod_t **mstack;
87 struct gmx_ana_selparam_t *nextparam;
89 struct gmx_ana_selmethod_t *nextmethod;
97 YY_BUFFER_STATE buffer;
100 /* Because Flex defines yylval, yytext, and yyleng as macros,
101 * and this file is included from scanner.l,
102 * we cannot have them here as parameter names... */
103 /** Internal function for cases where several tokens need to be returned. */
105 _gmx_sel_lexer_process_pending(YYSTYPE *, gmx_sel_lexer_t *state);
106 /** Internal function that processes identifier tokens. */
108 _gmx_sel_lexer_process_identifier(YYSTYPE *, char *, size_t,
109 gmx_sel_lexer_t *state);
110 /** Internal function to add a token to the pretty-printed selection text. */
112 _gmx_sel_lexer_add_token(const char *str, int len, gmx_sel_lexer_t *state);