/src/rdkit/Code/GraphMol/SmilesParse/smarts.tab.cpp
Line | Count | Source |
1 | | /* A Bison parser, made by GNU Bison 3.8.2. */ |
2 | | |
3 | | /* Bison implementation for Yacc-like parsers in C |
4 | | |
5 | | Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, |
6 | | Inc. |
7 | | |
8 | | This program is free software: you can redistribute it and/or modify |
9 | | it under the terms of the GNU General Public License as published by |
10 | | the Free Software Foundation, either version 3 of the License, or |
11 | | (at your option) any later version. |
12 | | |
13 | | This program is distributed in the hope that it will be useful, |
14 | | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | | GNU General Public License for more details. |
17 | | |
18 | | You should have received a copy of the GNU General Public License |
19 | | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
20 | | |
21 | | /* As a special exception, you may create a larger work that contains |
22 | | part or all of the Bison parser skeleton and distribute that work |
23 | | under terms of your choice, so long as that work isn't itself a |
24 | | parser generator using the skeleton or a modified version thereof |
25 | | as a parser skeleton. Alternatively, if you modify or redistribute |
26 | | the parser skeleton itself, you may (at your option) remove this |
27 | | special exception, which will cause the skeleton and the resulting |
28 | | Bison output files to be licensed under the GNU General Public |
29 | | License without this special exception. |
30 | | |
31 | | This special exception was added by the Free Software Foundation in |
32 | | version 2.2 of Bison. */ |
33 | | |
34 | | /* C LALR(1) parser skeleton written by Richard Stallman, by |
35 | | simplifying the original so-called "semantic" parser. */ |
36 | | |
37 | | /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, |
38 | | especially those whose name start with YY_ or yy_. They are |
39 | | private implementation details that can be changed or removed. */ |
40 | | |
41 | | /* All symbols defined below should begin with yy or YY, to avoid |
42 | | infringing on user name space. This should be done even for local |
43 | | variables, as they might otherwise be expanded by user macros. |
44 | | There are some unavoidable exceptions within include files to |
45 | | define necessary library symbols; they are noted "INFRINGES ON |
46 | | USER NAME SPACE" below. */ |
47 | | |
48 | | /* Identify Bison output, and Bison version. */ |
49 | | #define YYBISON 30802 |
50 | | |
51 | | /* Bison version string. */ |
52 | | #define YYBISON_VERSION "3.8.2" |
53 | | |
54 | | /* Skeleton name. */ |
55 | | #define YYSKELETON_NAME "yacc.c" |
56 | | |
57 | | /* Pure parsers. */ |
58 | | #define YYPURE 2 |
59 | | |
60 | | /* Push parsers. */ |
61 | | #define YYPUSH 0 |
62 | | |
63 | | /* Pull parsers. */ |
64 | | #define YYPULL 1 |
65 | | |
66 | | |
67 | | /* Substitute the variable and function names. */ |
68 | | #define yyparse yysmarts_parse |
69 | 15.4M | #define yylex yysmarts_lex |
70 | 1.79k | #define yyerror yysmarts_error |
71 | 154M | #define yydebug yysmarts_debug |
72 | 1.60k | #define yynerrs yysmarts_nerrs |
73 | | |
74 | | /* First part of user prologue. */ |
75 | | |
76 | | |
77 | | // |
78 | | // Copyright (C) 2003-2025 Greg Landrum and other RDKit contributors |
79 | | // |
80 | | // @@ All Rights Reserved @@ |
81 | | // |
82 | | #include <cstring> |
83 | | #include <string> |
84 | | #include <string_view> |
85 | | #include <utility> |
86 | | #include <vector> |
87 | | |
88 | | #include <GraphMol/RDKitBase.h> |
89 | | #include <GraphMol/RDKitQueries.h> |
90 | | #include <GraphMol/SmilesParse/SmilesParse.h> |
91 | | #include <GraphMol/SmilesParse/SmilesParseOps.h> |
92 | | #include <RDGeneral/RDLog.h> |
93 | | |
94 | | #define YYDEBUG 1 |
95 | | #include "smarts.tab.hpp" |
96 | | |
97 | | extern int yysmarts_lex(YYSTYPE *,void *, int &, unsigned int&); |
98 | | |
99 | | using namespace RDKit; |
100 | | namespace { |
101 | 3.60k | void yyErrorCleanup(std::vector<RDKit::RWMol *> *molList){ |
102 | 3.60k | for(std::vector<RDKit::RWMol *>::iterator iter=molList->begin(); |
103 | 11.3k | iter != molList->end(); ++iter){ |
104 | 7.75k | SmilesParseOps::CleanupAfterParseError(*iter); |
105 | 7.75k | delete *iter; |
106 | 7.75k | } |
107 | 3.60k | molList->clear(); |
108 | 3.60k | molList->resize(0); |
109 | 3.60k | } |
110 | | const std::uint64_t SMARTS_H_MASK = 0x1; |
111 | | const std::uint64_t SMARTS_CHARGE_MASK = 0x2; |
112 | | |
113 | 1.06M | void atom_expr_and_point_query(QueryAtom *atom_expr, QueryAtom *point_query) { |
114 | 1.06M | atom_expr->expandQuery(point_query->getQuery()->copy(), Queries::COMPOSITE_AND, true); |
115 | 1.06M | if (atom_expr->getChiralTag() == Atom::CHI_UNSPECIFIED) { |
116 | 863k | atom_expr->setChiralTag(point_query->getChiralTag()); |
117 | 863k | int perm; |
118 | 863k | if (point_query->getPropIfPresent(common_properties::_chiralPermutation, perm)) { |
119 | 574 | atom_expr->setProp(common_properties::_chiralPermutation, perm); |
120 | 574 | } |
121 | 863k | } |
122 | 1.06M | if (point_query->getFlags() & SMARTS_H_MASK) { |
123 | 224k | if (!(atom_expr->getFlags() & SMARTS_H_MASK)) { |
124 | 8.72k | atom_expr->setNumExplicitHs(point_query->getNumExplicitHs()); |
125 | 8.72k | atom_expr->setNoImplicit(true); |
126 | 8.72k | atom_expr->getFlags() |= SMARTS_H_MASK; |
127 | 216k | } else if (atom_expr->getNumExplicitHs() != point_query->getNumExplicitHs()) { |
128 | | // conflicting queries... |
129 | 155k | atom_expr->setNumExplicitHs(0); |
130 | 155k | atom_expr->setNoImplicit(true); |
131 | 155k | } |
132 | 224k | } |
133 | 1.06M | if (point_query->getFlags() & SMARTS_CHARGE_MASK) { |
134 | 17.3k | if (!(atom_expr->getFlags() & SMARTS_CHARGE_MASK)) { |
135 | 6.94k | atom_expr->setFormalCharge(point_query->getFormalCharge()); |
136 | 6.94k | atom_expr->getFlags() |= SMARTS_CHARGE_MASK; |
137 | 10.3k | } else if (atom_expr->getFormalCharge() != point_query->getFormalCharge()) { |
138 | | // conflicting queries... |
139 | 6.73k | atom_expr->setFormalCharge(0); |
140 | 6.73k | } |
141 | 17.3k | } |
142 | 1.06M | } |
143 | | |
144 | | } |
145 | | void |
146 | | yysmarts_error( const char *input, |
147 | | std::vector<RDKit::RWMol *> *ms, |
148 | | RDKit::Atom* &, |
149 | | RDKit::Bond* &, |
150 | | unsigned int &, |
151 | | unsigned int &, |
152 | | std::vector<std::pair<unsigned int, unsigned int>>&, |
153 | | void *, |
154 | | int, |
155 | | unsigned int bad_token_position, |
156 | | const char *msg ) |
157 | 1.63k | { |
158 | 1.63k | yyErrorCleanup(ms); |
159 | 1.63k | SmilesParseOps::detail::printSyntaxErrorMessage(input, |
160 | 1.63k | msg, |
161 | 1.63k | bad_token_position, |
162 | 1.63k | "SMARTS"); |
163 | 1.63k | } |
164 | | |
165 | | void |
166 | | yysmarts_error( const char *input, |
167 | | std::vector<RDKit::RWMol *> *ms, |
168 | | std::vector<std::pair<unsigned int, unsigned int>>&, |
169 | | void *, |
170 | | int, |
171 | | unsigned int bad_token_position, |
172 | | const char * msg ) |
173 | 2 | { |
174 | 2 | yyErrorCleanup(ms); |
175 | 2 | SmilesParseOps::detail::printSyntaxErrorMessage(input, |
176 | 2 | msg, |
177 | 2 | bad_token_position, |
178 | 2 | "SMARTS"); |
179 | 2 | } |
180 | | |
181 | | void |
182 | | yysmarts_error( const char *input, |
183 | | std::vector<RDKit::RWMol *> *ms, |
184 | | unsigned int bad_token_position, const char * msg ) |
185 | 178 | { |
186 | 178 | yyErrorCleanup(ms); |
187 | 178 | SmilesParseOps::detail::printSyntaxErrorMessage(input, |
188 | 178 | msg, |
189 | 178 | bad_token_position, |
190 | 178 | "SMARTS"); |
191 | 178 | } |
192 | | |
193 | | |
194 | | |
195 | | |
196 | | # ifndef YY_CAST |
197 | | # ifdef __cplusplus |
198 | 65.8M | # define YY_CAST(Type, Val) static_cast<Type> (Val) |
199 | | # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val) |
200 | | # else |
201 | | # define YY_CAST(Type, Val) ((Type) (Val)) |
202 | | # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) |
203 | | # endif |
204 | | # endif |
205 | | # ifndef YY_NULLPTR |
206 | | # if defined __cplusplus |
207 | | # if 201103L <= __cplusplus |
208 | | # define YY_NULLPTR nullptr |
209 | | # else |
210 | | # define YY_NULLPTR 0 |
211 | | # endif |
212 | | # else |
213 | | # define YY_NULLPTR ((void*)0) |
214 | | # endif |
215 | | # endif |
216 | | |
217 | | #include "smarts.tab.hpp" |
218 | | /* Symbol kind. */ |
219 | | enum yysymbol_kind_t |
220 | | { |
221 | | YYSYMBOL_YYEMPTY = -2, |
222 | | YYSYMBOL_YYEOF = 0, /* "end of file" */ |
223 | | YYSYMBOL_YYerror = 1, /* error */ |
224 | | YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ |
225 | | YYSYMBOL_START_MOL = 3, /* START_MOL */ |
226 | | YYSYMBOL_START_ATOM = 4, /* START_ATOM */ |
227 | | YYSYMBOL_START_BOND = 5, /* START_BOND */ |
228 | | YYSYMBOL_AROMATIC_ATOM_TOKEN = 6, /* AROMATIC_ATOM_TOKEN */ |
229 | | YYSYMBOL_ORGANIC_ATOM_TOKEN = 7, /* ORGANIC_ATOM_TOKEN */ |
230 | | YYSYMBOL_ATOM_TOKEN = 8, /* ATOM_TOKEN */ |
231 | | YYSYMBOL_SIMPLE_ATOM_QUERY_TOKEN = 9, /* SIMPLE_ATOM_QUERY_TOKEN */ |
232 | | YYSYMBOL_COMPLEX_ATOM_QUERY_TOKEN = 10, /* COMPLEX_ATOM_QUERY_TOKEN */ |
233 | | YYSYMBOL_MIN_RINGSIZE_ATOM_QUERY_TOKEN = 11, /* MIN_RINGSIZE_ATOM_QUERY_TOKEN */ |
234 | | YYSYMBOL_RINGSIZE_ATOM_QUERY_TOKEN = 12, /* RINGSIZE_ATOM_QUERY_TOKEN */ |
235 | | YYSYMBOL_RINGBOND_ATOM_QUERY_TOKEN = 13, /* RINGBOND_ATOM_QUERY_TOKEN */ |
236 | | YYSYMBOL_IMPLICIT_H_ATOM_QUERY_TOKEN = 14, /* IMPLICIT_H_ATOM_QUERY_TOKEN */ |
237 | | YYSYMBOL_HYB_TOKEN = 15, /* HYB_TOKEN */ |
238 | | YYSYMBOL_HETERONEIGHBOR_ATOM_QUERY_TOKEN = 16, /* HETERONEIGHBOR_ATOM_QUERY_TOKEN */ |
239 | | YYSYMBOL_ALIPHATIC = 17, /* ALIPHATIC */ |
240 | | YYSYMBOL_ALIPHATICHETERONEIGHBOR_ATOM_QUERY_TOKEN = 18, /* ALIPHATICHETERONEIGHBOR_ATOM_QUERY_TOKEN */ |
241 | | YYSYMBOL_ZERO_TOKEN = 19, /* ZERO_TOKEN */ |
242 | | YYSYMBOL_NONZERO_DIGIT_TOKEN = 20, /* NONZERO_DIGIT_TOKEN */ |
243 | | YYSYMBOL_GROUP_OPEN_TOKEN = 21, /* GROUP_OPEN_TOKEN */ |
244 | | YYSYMBOL_GROUP_CLOSE_TOKEN = 22, /* GROUP_CLOSE_TOKEN */ |
245 | | YYSYMBOL_SEPARATOR_TOKEN = 23, /* SEPARATOR_TOKEN */ |
246 | | YYSYMBOL_RANGE_OPEN_TOKEN = 24, /* RANGE_OPEN_TOKEN */ |
247 | | YYSYMBOL_RANGE_CLOSE_TOKEN = 25, /* RANGE_CLOSE_TOKEN */ |
248 | | YYSYMBOL_HASH_TOKEN = 26, /* HASH_TOKEN */ |
249 | | YYSYMBOL_MINUS_TOKEN = 27, /* MINUS_TOKEN */ |
250 | | YYSYMBOL_PLUS_TOKEN = 28, /* PLUS_TOKEN */ |
251 | | YYSYMBOL_H_TOKEN = 29, /* H_TOKEN */ |
252 | | YYSYMBOL_AT_TOKEN = 30, /* AT_TOKEN */ |
253 | | YYSYMBOL_PERCENT_TOKEN = 31, /* PERCENT_TOKEN */ |
254 | | YYSYMBOL_ATOM_OPEN_TOKEN = 32, /* ATOM_OPEN_TOKEN */ |
255 | | YYSYMBOL_ATOM_CLOSE_TOKEN = 33, /* ATOM_CLOSE_TOKEN */ |
256 | | YYSYMBOL_NOT_TOKEN = 34, /* NOT_TOKEN */ |
257 | | YYSYMBOL_AND_TOKEN = 35, /* AND_TOKEN */ |
258 | | YYSYMBOL_OR_TOKEN = 36, /* OR_TOKEN */ |
259 | | YYSYMBOL_SEMI_TOKEN = 37, /* SEMI_TOKEN */ |
260 | | YYSYMBOL_BEGIN_RECURSE = 38, /* BEGIN_RECURSE */ |
261 | | YYSYMBOL_END_RECURSE = 39, /* END_RECURSE */ |
262 | | YYSYMBOL_COLON_TOKEN = 40, /* COLON_TOKEN */ |
263 | | YYSYMBOL_UNDERSCORE_TOKEN = 41, /* UNDERSCORE_TOKEN */ |
264 | | YYSYMBOL_BOND_TOKEN = 42, /* BOND_TOKEN */ |
265 | | YYSYMBOL_CHI_CLASS_TOKEN = 43, /* CHI_CLASS_TOKEN */ |
266 | | YYSYMBOL_BAD_CHARACTER = 44, /* BAD_CHARACTER */ |
267 | | YYSYMBOL_EOS_TOKEN = 45, /* EOS_TOKEN */ |
268 | | YYSYMBOL_YYACCEPT = 46, /* $accept */ |
269 | | YYSYMBOL_meta_start = 47, /* meta_start */ |
270 | | YYSYMBOL_bad_atom_def = 48, /* bad_atom_def */ |
271 | | YYSYMBOL_mol = 49, /* mol */ |
272 | | YYSYMBOL_atomd = 50, /* atomd */ |
273 | | YYSYMBOL_hydrogen_atom = 51, /* hydrogen_atom */ |
274 | | YYSYMBOL_atom_expr = 52, /* atom_expr */ |
275 | | YYSYMBOL_point_query = 53, /* point_query */ |
276 | | YYSYMBOL_recursive_query = 54, /* recursive_query */ |
277 | | YYSYMBOL_atom_query = 55, /* atom_query */ |
278 | | YYSYMBOL_possible_range_query = 56, /* possible_range_query */ |
279 | | YYSYMBOL_simple_atom = 57, /* simple_atom */ |
280 | | YYSYMBOL_bond_expr = 58, /* bond_expr */ |
281 | | YYSYMBOL_bond_query = 59, /* bond_query */ |
282 | | YYSYMBOL_bondd = 60, /* bondd */ |
283 | | YYSYMBOL_charge_spec = 61, /* charge_spec */ |
284 | | YYSYMBOL_ring_number = 62, /* ring_number */ |
285 | | YYSYMBOL_number = 63, /* number */ |
286 | | YYSYMBOL_nonzero_number = 64, /* nonzero_number */ |
287 | | YYSYMBOL_digit = 65, /* digit */ |
288 | | YYSYMBOL_branch_open_token = 66 /* branch_open_token */ |
289 | | }; |
290 | | typedef enum yysymbol_kind_t yysymbol_kind_t; |
291 | | |
292 | | |
293 | | |
294 | | |
295 | | #ifdef short |
296 | | # undef short |
297 | | #endif |
298 | | |
299 | | /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure |
300 | | <limits.h> and (if available) <stdint.h> are included |
301 | | so that the code can choose integer types of a good width. */ |
302 | | |
303 | | #ifndef __PTRDIFF_MAX__ |
304 | | # include <limits.h> /* INFRINGES ON USER NAME SPACE */ |
305 | | # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ |
306 | | # include <stdint.h> /* INFRINGES ON USER NAME SPACE */ |
307 | | # define YY_STDINT_H |
308 | | # endif |
309 | | #endif |
310 | | |
311 | | /* Narrow types that promote to a signed type and that can represent a |
312 | | signed or unsigned integer of at least N bits. In tables they can |
313 | | save space and decrease cache pressure. Promoting to a signed type |
314 | | helps avoid bugs in integer arithmetic. */ |
315 | | |
316 | | #ifdef __INT_LEAST8_MAX__ |
317 | | typedef __INT_LEAST8_TYPE__ yytype_int8; |
318 | | #elif defined YY_STDINT_H |
319 | | typedef int_least8_t yytype_int8; |
320 | | #else |
321 | | typedef signed char yytype_int8; |
322 | | #endif |
323 | | |
324 | | #ifdef __INT_LEAST16_MAX__ |
325 | | typedef __INT_LEAST16_TYPE__ yytype_int16; |
326 | | #elif defined YY_STDINT_H |
327 | | typedef int_least16_t yytype_int16; |
328 | | #else |
329 | | typedef short yytype_int16; |
330 | | #endif |
331 | | |
332 | | /* Work around bug in HP-UX 11.23, which defines these macros |
333 | | incorrectly for preprocessor constants. This workaround can likely |
334 | | be removed in 2023, as HPE has promised support for HP-UX 11.23 |
335 | | (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of |
336 | | <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */ |
337 | | #ifdef __hpux |
338 | | # undef UINT_LEAST8_MAX |
339 | | # undef UINT_LEAST16_MAX |
340 | | # define UINT_LEAST8_MAX 255 |
341 | | # define UINT_LEAST16_MAX 65535 |
342 | | #endif |
343 | | |
344 | | #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ |
345 | | typedef __UINT_LEAST8_TYPE__ yytype_uint8; |
346 | | #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ |
347 | | && UINT_LEAST8_MAX <= INT_MAX) |
348 | | typedef uint_least8_t yytype_uint8; |
349 | | #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX |
350 | | typedef unsigned char yytype_uint8; |
351 | | #else |
352 | | typedef short yytype_uint8; |
353 | | #endif |
354 | | |
355 | | #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ |
356 | | typedef __UINT_LEAST16_TYPE__ yytype_uint16; |
357 | | #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ |
358 | | && UINT_LEAST16_MAX <= INT_MAX) |
359 | | typedef uint_least16_t yytype_uint16; |
360 | | #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX |
361 | | typedef unsigned short yytype_uint16; |
362 | | #else |
363 | | typedef int yytype_uint16; |
364 | | #endif |
365 | | |
366 | | #ifndef YYPTRDIFF_T |
367 | | # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ |
368 | 25.3k | # define YYPTRDIFF_T __PTRDIFF_TYPE__ |
369 | | # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ |
370 | | # elif defined PTRDIFF_MAX |
371 | | # ifndef ptrdiff_t |
372 | | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
373 | | # endif |
374 | | # define YYPTRDIFF_T ptrdiff_t |
375 | | # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX |
376 | | # else |
377 | | # define YYPTRDIFF_T long |
378 | | # define YYPTRDIFF_MAXIMUM LONG_MAX |
379 | | # endif |
380 | | #endif |
381 | | |
382 | | #ifndef YYSIZE_T |
383 | | # ifdef __SIZE_TYPE__ |
384 | | # define YYSIZE_T __SIZE_TYPE__ |
385 | | # elif defined size_t |
386 | | # define YYSIZE_T size_t |
387 | | # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ |
388 | | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
389 | | # define YYSIZE_T size_t |
390 | | # else |
391 | | # define YYSIZE_T unsigned |
392 | | # endif |
393 | | #endif |
394 | | |
395 | | #define YYSIZE_MAXIMUM \ |
396 | | YY_CAST (YYPTRDIFF_T, \ |
397 | | (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ |
398 | | ? YYPTRDIFF_MAXIMUM \ |
399 | | : YY_CAST (YYSIZE_T, -1))) |
400 | | |
401 | 282 | #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) |
402 | | |
403 | | |
404 | | /* Stored state numbers (used for stacks). */ |
405 | | typedef yytype_uint8 yy_state_t; |
406 | | |
407 | | /* State numbers in computations. */ |
408 | | typedef int yy_state_fast_t; |
409 | | |
410 | | #ifndef YY_ |
411 | | # if defined YYENABLE_NLS && YYENABLE_NLS |
412 | | # if ENABLE_NLS |
413 | | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
414 | | # define YY_(Msgid) dgettext ("bison-runtime", Msgid) |
415 | | # endif |
416 | | # endif |
417 | | # ifndef YY_ |
418 | 1.61k | # define YY_(Msgid) Msgid |
419 | | # endif |
420 | | #endif |
421 | | |
422 | | |
423 | | #ifndef YY_ATTRIBUTE_PURE |
424 | | # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) |
425 | | # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) |
426 | | # else |
427 | | # define YY_ATTRIBUTE_PURE |
428 | | # endif |
429 | | #endif |
430 | | |
431 | | #ifndef YY_ATTRIBUTE_UNUSED |
432 | | # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) |
433 | | # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) |
434 | | # else |
435 | | # define YY_ATTRIBUTE_UNUSED |
436 | | # endif |
437 | | #endif |
438 | | |
439 | | /* Suppress unused-variable warnings by "using" E. */ |
440 | | #if ! defined lint || defined __GNUC__ |
441 | 269M | # define YY_USE(E) ((void) (E)) |
442 | | #else |
443 | | # define YY_USE(E) /* empty */ |
444 | | #endif |
445 | | |
446 | | /* Suppress an incorrect diagnostic about yylval being uninitialized. */ |
447 | | #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ |
448 | | # if __GNUC__ * 100 + __GNUC_MINOR__ < 407 |
449 | | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ |
450 | | _Pragma ("GCC diagnostic push") \ |
451 | | _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") |
452 | | # else |
453 | | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ |
454 | | _Pragma ("GCC diagnostic push") \ |
455 | | _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ |
456 | | _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") |
457 | | # endif |
458 | | # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ |
459 | | _Pragma ("GCC diagnostic pop") |
460 | | #else |
461 | 50.3k | # define YY_INITIAL_VALUE(Value) Value |
462 | | #endif |
463 | | #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
464 | | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
465 | | # define YY_IGNORE_MAYBE_UNINITIALIZED_END |
466 | | #endif |
467 | | #ifndef YY_INITIAL_VALUE |
468 | | # define YY_INITIAL_VALUE(Value) /* Nothing. */ |
469 | | #endif |
470 | | |
471 | | #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ |
472 | | # define YY_IGNORE_USELESS_CAST_BEGIN \ |
473 | | _Pragma ("GCC diagnostic push") \ |
474 | | _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") |
475 | | # define YY_IGNORE_USELESS_CAST_END \ |
476 | | _Pragma ("GCC diagnostic pop") |
477 | | #endif |
478 | | #ifndef YY_IGNORE_USELESS_CAST_BEGIN |
479 | | # define YY_IGNORE_USELESS_CAST_BEGIN |
480 | | # define YY_IGNORE_USELESS_CAST_END |
481 | | #endif |
482 | | |
483 | | |
484 | 25.3M | #define YY_ASSERT(E) ((void) (0 && (E))) |
485 | | |
486 | | #if !defined yyoverflow |
487 | | |
488 | | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
489 | | |
490 | | # ifdef YYSTACK_USE_ALLOCA |
491 | | # if YYSTACK_USE_ALLOCA |
492 | | # ifdef __GNUC__ |
493 | | # define YYSTACK_ALLOC __builtin_alloca |
494 | | # elif defined __BUILTIN_VA_ARG_INCR |
495 | | # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ |
496 | | # elif defined _AIX |
497 | | # define YYSTACK_ALLOC __alloca |
498 | | # elif defined _MSC_VER |
499 | | # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ |
500 | | # define alloca _alloca |
501 | | # else |
502 | | # define YYSTACK_ALLOC alloca |
503 | | # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS |
504 | | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
505 | | /* Use EXIT_SUCCESS as a witness for stdlib.h. */ |
506 | | # ifndef EXIT_SUCCESS |
507 | | # define EXIT_SUCCESS 0 |
508 | | # endif |
509 | | # endif |
510 | | # endif |
511 | | # endif |
512 | | # endif |
513 | | |
514 | | # ifdef YYSTACK_ALLOC |
515 | | /* Pacify GCC's 'empty if-body' warning. */ |
516 | | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
517 | | # ifndef YYSTACK_ALLOC_MAXIMUM |
518 | | /* The OS might guarantee only one guard page at the bottom of the stack, |
519 | | and a page size can be as small as 4096 bytes. So we cannot safely |
520 | | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
521 | | to allow for a few compiler-allocated temporary stack slots. */ |
522 | | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ |
523 | | # endif |
524 | | # else |
525 | | # define YYSTACK_ALLOC YYMALLOC |
526 | 46 | # define YYSTACK_FREE YYFREE |
527 | | # ifndef YYSTACK_ALLOC_MAXIMUM |
528 | | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
529 | | # endif |
530 | | # if (defined __cplusplus && ! defined EXIT_SUCCESS \ |
531 | | && ! ((defined YYMALLOC || defined malloc) \ |
532 | | && (defined YYFREE || defined free))) |
533 | | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
534 | | # ifndef EXIT_SUCCESS |
535 | | # define EXIT_SUCCESS 0 |
536 | | # endif |
537 | | # endif |
538 | | # ifndef YYMALLOC |
539 | | # define YYMALLOC malloc |
540 | | # if ! defined malloc && ! defined EXIT_SUCCESS |
541 | | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
542 | | # endif |
543 | | # endif |
544 | | # ifndef YYFREE |
545 | 46 | # define YYFREE free |
546 | | # if ! defined free && ! defined EXIT_SUCCESS |
547 | | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
548 | | # endif |
549 | | # endif |
550 | | # endif |
551 | | #endif /* !defined yyoverflow */ |
552 | | |
553 | | #if (! defined yyoverflow \ |
554 | | && (! defined __cplusplus \ |
555 | | || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
556 | | |
557 | | /* A type that is properly aligned for any stack member. */ |
558 | | union yyalloc |
559 | | { |
560 | | yy_state_t yyss_alloc; |
561 | | YYSTYPE yyvs_alloc; |
562 | | }; |
563 | | |
564 | | /* The size of the maximum gap between one aligned stack and the next. */ |
565 | 94 | # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) |
566 | | |
567 | | /* The size of an array large to enough to hold all stacks, each with |
568 | | N elements. */ |
569 | | # define YYSTACK_BYTES(N) \ |
570 | | ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ |
571 | | + YYSTACK_GAP_MAXIMUM) |
572 | | |
573 | | # define YYCOPY_NEEDED 1 |
574 | | |
575 | | /* Relocate STACK from its old location to the new one. The |
576 | | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
577 | | elements in the stack, and YYPTR gives the new location of the |
578 | | stack. Advance YYPTR to a properly aligned location for the next |
579 | | stack. */ |
580 | | # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ |
581 | 94 | do \ |
582 | 94 | { \ |
583 | 94 | YYPTRDIFF_T yynewbytes; \ |
584 | 94 | YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ |
585 | 94 | Stack = &yyptr->Stack_alloc; \ |
586 | 94 | yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
587 | 94 | yyptr += yynewbytes / YYSIZEOF (*yyptr); \ |
588 | 94 | } \ |
589 | 94 | while (0) |
590 | | |
591 | | #endif |
592 | | |
593 | | #if defined YYCOPY_NEEDED && YYCOPY_NEEDED |
594 | | /* Copy COUNT objects from SRC to DST. The source and destination do |
595 | | not overlap. */ |
596 | | # ifndef YYCOPY |
597 | | # if defined __GNUC__ && 1 < __GNUC__ |
598 | | # define YYCOPY(Dst, Src, Count) \ |
599 | 94 | __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) |
600 | | # else |
601 | | # define YYCOPY(Dst, Src, Count) \ |
602 | | do \ |
603 | | { \ |
604 | | YYPTRDIFF_T yyi; \ |
605 | | for (yyi = 0; yyi < (Count); yyi++) \ |
606 | | (Dst)[yyi] = (Src)[yyi]; \ |
607 | | } \ |
608 | | while (0) |
609 | | # endif |
610 | | # endif |
611 | | #endif /* !YYCOPY_NEEDED */ |
612 | | |
613 | | /* YYFINAL -- State number of the termination state. */ |
614 | 25.3M | #define YYFINAL 57 |
615 | | /* YYLAST -- Last index in YYTABLE. */ |
616 | 67.3M | #define YYLAST 606 |
617 | | |
618 | | /* YYNTOKENS -- Number of terminals. */ |
619 | 9.79M | #define YYNTOKENS 46 |
620 | | /* YYNNTS -- Number of nonterminals. */ |
621 | | #define YYNNTS 21 |
622 | | /* YYNRULES -- Number of rules. */ |
623 | | #define YYNRULES 128 |
624 | | /* YYNSTATES -- Number of states. */ |
625 | | #define YYNSTATES 189 |
626 | | |
627 | | /* YYMAXUTOK -- Last valid token kind. */ |
628 | 28.2M | #define YYMAXUTOK 300 |
629 | | |
630 | | |
631 | | /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM |
632 | | as returned by yylex, with out-of-bounds checking. */ |
633 | | #define YYTRANSLATE(YYX) \ |
634 | 40.5M | (0 <= (YYX) && (YYX) <= YYMAXUTOK \ |
635 | 40.5M | ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ |
636 | 40.5M | : YYSYMBOL_YYUNDEF) |
637 | | |
638 | | /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM |
639 | | as returned by yylex. */ |
640 | | static const yytype_int8 yytranslate[] = |
641 | | { |
642 | | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
643 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
644 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
645 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
646 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
647 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
648 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
649 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
650 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
651 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
652 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
653 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
654 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
655 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
656 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
657 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
658 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
659 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
660 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
661 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
662 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
663 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
664 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
665 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
666 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
667 | | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
668 | | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
669 | | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
670 | | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
671 | | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
672 | | 45 |
673 | | }; |
674 | | |
675 | | #if YYDEBUG |
676 | | /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ |
677 | | static const yytype_int16 yyrline[] = |
678 | | { |
679 | | 0, 190, 190, 193, 197, 200, 203, 207, 211, 214, |
680 | | 220, 225, 228, 236, 237, 238, 239, 247, 256, 270, |
681 | | 291, 297, 321, 342, 359, 382, 396, 397, 398, 402, |
682 | | 425, 429, 434, 440, 449, 456, 465, 474, 488, 495, |
683 | | 503, 510, 515, 520, 523, 529, 530, 534, 551, 575, |
684 | | 576, 581, 582, 587, 588, 593, 594, 595, 596, 597, |
685 | | 598, 599, 600, 604, 608, 612, 616, 620, 624, 628, |
686 | | 635, 642, 651, 660, 669, 679, 689, 699, 708, 716, |
687 | | 723, 729, 735, 742, 756, 757, 764, 765, 769, 773, |
688 | | 777, 781, 785, 790, 798, 810, 815, 820, 825, 830, |
689 | | 835, 838, 839, 847, 848, 854, 860, 866, 871, 878, |
690 | | 879, 880, 881, 882, 883, 887, 888, 889, 890, 891, |
691 | | 892, 893, 898, 899, 903, 904, 913, 914, 918 |
692 | | }; |
693 | | #endif |
694 | | |
695 | | /** Accessing symbol of state STATE. */ |
696 | 12.2M | #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) |
697 | | |
698 | | #if YYDEBUG || 0 |
699 | | /* The user-facing name of the symbol whose (internal) number is |
700 | | YYSYMBOL. No bounds checking. */ |
701 | | static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; |
702 | | |
703 | | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
704 | | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
705 | | static const char *const yytname[] = |
706 | | { |
707 | | "\"end of file\"", "error", "\"invalid token\"", "START_MOL", |
708 | | "START_ATOM", "START_BOND", "AROMATIC_ATOM_TOKEN", "ORGANIC_ATOM_TOKEN", |
709 | | "ATOM_TOKEN", "SIMPLE_ATOM_QUERY_TOKEN", "COMPLEX_ATOM_QUERY_TOKEN", |
710 | | "MIN_RINGSIZE_ATOM_QUERY_TOKEN", "RINGSIZE_ATOM_QUERY_TOKEN", |
711 | | "RINGBOND_ATOM_QUERY_TOKEN", "IMPLICIT_H_ATOM_QUERY_TOKEN", "HYB_TOKEN", |
712 | | "HETERONEIGHBOR_ATOM_QUERY_TOKEN", "ALIPHATIC", |
713 | | "ALIPHATICHETERONEIGHBOR_ATOM_QUERY_TOKEN", "ZERO_TOKEN", |
714 | | "NONZERO_DIGIT_TOKEN", "GROUP_OPEN_TOKEN", "GROUP_CLOSE_TOKEN", |
715 | | "SEPARATOR_TOKEN", "RANGE_OPEN_TOKEN", "RANGE_CLOSE_TOKEN", "HASH_TOKEN", |
716 | | "MINUS_TOKEN", "PLUS_TOKEN", "H_TOKEN", "AT_TOKEN", "PERCENT_TOKEN", |
717 | | "ATOM_OPEN_TOKEN", "ATOM_CLOSE_TOKEN", "NOT_TOKEN", "AND_TOKEN", |
718 | | "OR_TOKEN", "SEMI_TOKEN", "BEGIN_RECURSE", "END_RECURSE", "COLON_TOKEN", |
719 | | "UNDERSCORE_TOKEN", "BOND_TOKEN", "CHI_CLASS_TOKEN", "BAD_CHARACTER", |
720 | | "EOS_TOKEN", "$accept", "meta_start", "bad_atom_def", "mol", "atomd", |
721 | | "hydrogen_atom", "atom_expr", "point_query", "recursive_query", |
722 | | "atom_query", "possible_range_query", "simple_atom", "bond_expr", |
723 | | "bond_query", "bondd", "charge_spec", "ring_number", "number", |
724 | | "nonzero_number", "digit", "branch_open_token", YY_NULLPTR |
725 | | }; |
726 | | |
727 | | static const char * |
728 | | yysymbol_name (yysymbol_kind_t yysymbol) |
729 | 0 | { |
730 | 0 | return yytname[yysymbol]; |
731 | 0 | } |
732 | | #endif |
733 | | |
734 | 49.7M | #define YYPACT_NINF (-61) |
735 | | |
736 | | #define yypact_value_is_default(Yyn) \ |
737 | 49.7M | ((Yyn) == YYPACT_NINF) |
738 | | |
739 | | #define YYTABLE_NINF (-94) |
740 | | |
741 | | #define yytable_value_is_error(Yyn) \ |
742 | 25 | 0 |
743 | | |
744 | | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
745 | | STATE-NUM. */ |
746 | | static const yytype_int16 yypact[] = |
747 | | { |
748 | | 55, -31, 46, 195, 533, 3, -61, -61, -61, -61, |
749 | | 423, 516, -61, -61, -61, -61, 250, 288, 360, 397, |
750 | | 435, -61, 478, 481, -61, -61, 80, 19, 5, 80, |
751 | | 0, 233, 271, 461, 46, 271, 80, -61, -9, 309, |
752 | | -61, -61, -61, 21, 40, -61, 64, 92, -61, -61, |
753 | | -61, 533, -61, -61, 143, 533, -61, -61, 42, -61, |
754 | | -61, 551, 157, -61, 342, -61, -61, -61, -61, 46, |
755 | | 137, -61, 545, -61, -61, 35, -61, -61, 126, -61, |
756 | | -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, |
757 | | -61, 271, -61, 157, -61, -61, 487, -61, -61, -61, |
758 | | 461, 461, 461, -61, 162, -61, 80, 80, -61, -61, |
759 | | -61, 533, 533, 533, -61, -61, -61, 199, 60, -61, |
760 | | 80, -13, -61, 80, 566, -61, 92, 92, -61, -61, |
761 | | -61, 96, 80, 23, 33, 461, -61, 385, 347, 80, |
762 | | 88, -61, -61, -61, 56, 163, 93, -61, 80, 97, |
763 | | -61, 80, 43, -61, 117, -61, 109, 129, 101, 127, |
764 | | 211, -61, 122, -61, 141, -61, 80, -61, 235, -61, |
765 | | -61, 171, 92, -61, -61, 187, -61, -61, 183, -61, |
766 | | 273, -61, -61, -61, -61, 311, -61, 198, -61 |
767 | | }; |
768 | | |
769 | | /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. |
770 | | Performed when YYTABLE does not specify something else to do. Zero |
771 | | means the default is an error. */ |
772 | | static const yytype_uint8 yydefact[] = |
773 | | { |
774 | | 0, 0, 0, 5, 8, 0, 12, 95, 94, 96, |
775 | | 0, 2, 17, 27, 26, 51, 55, 58, 59, 60, |
776 | | 61, 84, 56, 57, 122, 124, 0, 114, 111, 78, |
777 | | 81, 0, 0, 0, 0, 0, 82, 4, 0, 16, |
778 | | 43, 45, 46, 0, 49, 79, 85, 123, 105, 104, |
779 | | 107, 0, 106, 103, 7, 100, 101, 1, 0, 9, |
780 | | 11, 78, 0, 49, 85, 127, 126, 128, 25, 0, |
781 | | 0, 18, 0, 21, 115, 0, 62, 65, 0, 66, |
782 | | 67, 68, 63, 64, 53, 112, 113, 109, 110, 77, |
783 | | 80, 0, 13, 16, 14, 44, 0, 15, 83, 3, |
784 | | 0, 0, 0, 41, 0, 52, 0, 75, 50, 125, |
785 | | 108, 0, 0, 0, 6, 102, 10, 114, 111, 30, |
786 | | 0, 0, 28, 0, 75, 20, 0, 0, 19, 22, |
787 | | 23, 0, 0, 0, 47, 38, 42, 39, 40, 0, |
788 | | 0, 54, 76, 97, 98, 99, 0, 34, 0, 0, |
789 | | 32, 0, 0, 116, 0, 24, 0, 0, 0, 0, |
790 | | 0, 31, 0, 29, 0, 36, 0, 117, 0, 72, |
791 | | 73, 0, 48, 69, 70, 0, 35, 33, 0, 118, |
792 | | 0, 74, 71, 37, 119, 0, 120, 0, 121 |
793 | | }; |
794 | | |
795 | | /* YYPGOTO[NTERM-NUM]. */ |
796 | | static const yytype_int16 yypgoto[] = |
797 | | { |
798 | | -61, -61, 2, 200, 29, -61, 18, 24, -61, -61, |
799 | | -61, 20, 31, -61, -40, -60, 145, -10, 74, -45, |
800 | | -61 |
801 | | }; |
802 | | |
803 | | /* YYDEFGOTO[NTERM-NUM]. */ |
804 | | static const yytype_int8 yydefgoto[] = |
805 | | { |
806 | | 0, 5, 92, 11, 12, 13, 39, 40, 41, 42, |
807 | | 43, 63, 72, 55, 56, 45, 73, 46, 47, 74, |
808 | | 75 |
809 | | }; |
810 | | |
811 | | /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If |
812 | | positive, shift that token. If negative, reduce the rule whose |
813 | | number is the opposite. If YYTABLE_NINF, syntax error. */ |
814 | | static const yytype_int16 yytable[] = |
815 | | { |
816 | | 64, 121, 109, 57, 58, 37, 76, 77, 79, 80, |
817 | | 81, 110, 82, 83, 6, 115, 84, 86, 88, 89, |
818 | | 147, 64, 14, 44, 24, 25, 98, 148, 62, -92, |
819 | | 90, 14, 38, 87, 94, 54, 99, 97, 24, 25, |
820 | | 71, 7, 8, -93, 9, 104, 85, 59, 60, 93, |
821 | | 157, 89, 7, 8, 14, 9, 1, 95, 2, 3, |
822 | | 4, 48, 49, 103, 152, 50, 108, 10, 133, 51, |
823 | | 7, 8, 105, 9, 158, 52, 165, 53, 10, 24, |
824 | | 25, 153, 154, 166, 108, -26, 103, 116, 87, 14, |
825 | | 106, 111, 14, 107, 140, 14, 141, 142, 125, 24, |
826 | | 25, 128, 7, 8, 130, 9, 131, 86, 88, 168, |
827 | | 146, 65, 66, 149, 142, 160, 14, 103, 135, 137, |
828 | | 138, 25, 156, 180, 136, 71, 161, 109, 10, 159, |
829 | | 163, 111, 112, 113, 169, 185, 65, 66, 162, 167, |
830 | | 187, 164, 143, 144, 145, 24, 25, 171, 24, 25, |
831 | | 175, 14, 173, 132, 170, 176, 178, 126, 127, 103, |
832 | | 155, 103, 103, 7, 8, 15, 9, 16, 17, 18, |
833 | | 19, 20, 21, 22, 177, 23, 24, 25, 111, 112, |
834 | | 113, 24, 25, 26, 27, 28, 29, 30, 114, 139, |
835 | | 122, 33, 100, 101, 102, 34, 181, 123, 111, 112, |
836 | | 36, 7, 8, 15, 9, 16, 17, 18, 19, 20, |
837 | | 21, 22, 182, 23, 24, 25, 183, 129, 24, 25, |
838 | | 188, 26, 27, 28, 29, 30, 85, 31, 32, 33, |
839 | | 24, 25, 172, 34, 96, 35, 174, 0, 36, 7, |
840 | | 8, 15, 9, 16, 17, 18, 19, 20, 21, 22, |
841 | | 0, 23, 24, 25, 65, 66, 0, 179, 0, 26, |
842 | | 27, 28, 61, 30, 0, 91, 32, 33, 0, 24, |
843 | | 25, 34, 0, 35, -86, 0, 36, 7, 8, 15, |
844 | | 9, 16, 17, 18, 19, 20, 21, 22, 0, 23, |
845 | | 24, 25, 65, 66, 0, 184, 0, 26, 27, 28, |
846 | | 29, 30, 0, 91, 32, 33, 0, 24, 25, 34, |
847 | | 0, 35, -89, 0, 36, 7, 8, 15, 9, 16, |
848 | | 17, 18, 19, 20, 21, 22, 0, 23, 24, 25, |
849 | | 65, 66, 0, 186, 0, 26, 27, 28, 29, 30, |
850 | | 0, 0, 0, 33, 100, 101, 102, 34, 7, 8, |
851 | | 105, 9, 36, 7, 8, 15, 9, 16, 17, 18, |
852 | | 19, 20, 21, 22, 0, 23, 24, 25, 106, 0, |
853 | | 0, 124, 0, 26, 27, 28, 29, 30, 0, 24, |
854 | | 25, 33, 100, 101, 78, 34, 0, 0, 0, 0, |
855 | | 36, 7, 8, 15, 9, 16, 17, 18, 19, 20, |
856 | | 21, 22, 0, 23, 24, 25, 0, 0, 0, 0, |
857 | | 0, 26, 27, 28, 29, 30, 24, 25, 0, 33, |
858 | | 100, -90, 0, 34, 0, 0, 0, 0, 36, 7, |
859 | | 8, 15, 9, 16, 17, 18, 19, 20, 21, 22, |
860 | | 0, 23, 24, 25, 0, 0, 0, 0, 0, 26, |
861 | | 27, 28, 61, 30, 24, 25, 0, 33, 0, -91, |
862 | | 0, 34, 0, 0, 0, 0, 36, 7, 8, 15, |
863 | | 9, 16, 17, 18, 19, 20, 21, 22, 0, 23, |
864 | | 24, 25, 0, 0, 0, 0, 0, 26, 27, 28, |
865 | | 29, 30, 0, 7, 8, 33, 9, 24, 25, 34, |
866 | | 24, 25, -87, 0, 36, -88, 65, 66, 67, 68, |
867 | | 69, 0, 0, 48, 49, 0, 0, 50, 70, 10, |
868 | | 0, 51, 7, 8, 0, 9, 134, 52, 0, 53, |
869 | | 0, 0, 0, 0, 0, 65, 66, 67, 68, 69, |
870 | | 0, 0, 48, 49, 0, 0, 50, 70, 10, 0, |
871 | | 51, 7, 8, 0, 9, 0, 52, 0, 53, 48, |
872 | | 49, 0, 0, 50, 65, 66, 0, 51, 0, 0, |
873 | | 24, 25, 0, 52, 0, 53, 70, 10, 117, 118, |
874 | | 111, 112, 113, 0, 119, 24, 25, 0, 0, 0, |
875 | | 0, 120, 0, 117, 118, 0, 0, 0, 0, 150, |
876 | | 0, 0, 0, 0, 0, 0, 151 |
877 | | }; |
878 | | |
879 | | static const yytype_int16 yycheck[] = |
880 | | { |
881 | | 10, 61, 47, 0, 1, 3, 16, 17, 18, 19, |
882 | | 20, 51, 22, 23, 45, 55, 26, 27, 28, 29, |
883 | | 33, 31, 2, 3, 19, 20, 36, 40, 10, 24, |
884 | | 30, 11, 3, 28, 32, 4, 45, 35, 19, 20, |
885 | | 11, 6, 7, 24, 9, 24, 27, 44, 45, 31, |
886 | | 27, 61, 6, 7, 34, 9, 1, 33, 3, 4, |
887 | | 5, 26, 27, 39, 124, 30, 46, 32, 78, 34, |
888 | | 6, 7, 8, 9, 41, 40, 33, 42, 32, 19, |
889 | | 20, 126, 127, 40, 64, 45, 62, 45, 28, 69, |
890 | | 26, 35, 72, 29, 104, 75, 106, 107, 69, 19, |
891 | | 20, 72, 6, 7, 75, 9, 75, 117, 118, 154, |
892 | | 120, 19, 20, 123, 124, 27, 96, 93, 100, 101, |
893 | | 102, 20, 132, 168, 100, 96, 33, 172, 32, 139, |
894 | | 33, 35, 36, 37, 25, 180, 19, 20, 148, 22, |
895 | | 185, 151, 111, 112, 113, 19, 20, 157, 19, 20, |
896 | | 160, 131, 25, 27, 25, 33, 166, 20, 21, 135, |
897 | | 131, 137, 138, 6, 7, 8, 9, 10, 11, 12, |
898 | | 13, 14, 15, 16, 33, 18, 19, 20, 35, 36, |
899 | | 37, 19, 20, 26, 27, 28, 29, 30, 45, 27, |
900 | | 33, 34, 35, 36, 37, 38, 25, 40, 35, 36, |
901 | | 43, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
902 | | 15, 16, 25, 18, 19, 20, 33, 72, 19, 20, |
903 | | 22, 26, 27, 28, 29, 30, 27, 32, 33, 34, |
904 | | 19, 20, 158, 38, 34, 40, 25, -1, 43, 6, |
905 | | 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, |
906 | | -1, 18, 19, 20, 19, 20, -1, 22, -1, 26, |
907 | | 27, 28, 29, 30, -1, 32, 33, 34, -1, 19, |
908 | | 20, 38, -1, 40, 24, -1, 43, 6, 7, 8, |
909 | | 9, 10, 11, 12, 13, 14, 15, 16, -1, 18, |
910 | | 19, 20, 19, 20, -1, 22, -1, 26, 27, 28, |
911 | | 29, 30, -1, 32, 33, 34, -1, 19, 20, 38, |
912 | | -1, 40, 24, -1, 43, 6, 7, 8, 9, 10, |
913 | | 11, 12, 13, 14, 15, 16, -1, 18, 19, 20, |
914 | | 19, 20, -1, 22, -1, 26, 27, 28, 29, 30, |
915 | | -1, -1, -1, 34, 35, 36, 37, 38, 6, 7, |
916 | | 8, 9, 43, 6, 7, 8, 9, 10, 11, 12, |
917 | | 13, 14, 15, 16, -1, 18, 19, 20, 26, -1, |
918 | | -1, 29, -1, 26, 27, 28, 29, 30, -1, 19, |
919 | | 20, 34, 35, 36, 24, 38, -1, -1, -1, -1, |
920 | | 43, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
921 | | 15, 16, -1, 18, 19, 20, -1, -1, -1, -1, |
922 | | -1, 26, 27, 28, 29, 30, 19, 20, -1, 34, |
923 | | 35, 24, -1, 38, -1, -1, -1, -1, 43, 6, |
924 | | 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, |
925 | | -1, 18, 19, 20, -1, -1, -1, -1, -1, 26, |
926 | | 27, 28, 29, 30, 19, 20, -1, 34, -1, 24, |
927 | | -1, 38, -1, -1, -1, -1, 43, 6, 7, 8, |
928 | | 9, 10, 11, 12, 13, 14, 15, 16, -1, 18, |
929 | | 19, 20, -1, -1, -1, -1, -1, 26, 27, 28, |
930 | | 29, 30, -1, 6, 7, 34, 9, 19, 20, 38, |
931 | | 19, 20, 24, -1, 43, 24, 19, 20, 21, 22, |
932 | | 23, -1, -1, 26, 27, -1, -1, 30, 31, 32, |
933 | | -1, 34, 6, 7, -1, 9, 39, 40, -1, 42, |
934 | | -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, |
935 | | -1, -1, 26, 27, -1, -1, 30, 31, 32, -1, |
936 | | 34, 6, 7, -1, 9, -1, 40, -1, 42, 26, |
937 | | 27, -1, -1, 30, 19, 20, -1, 34, -1, -1, |
938 | | 19, 20, -1, 40, -1, 42, 31, 32, 27, 28, |
939 | | 35, 36, 37, -1, 33, 19, 20, -1, -1, -1, |
940 | | -1, 40, -1, 27, 28, -1, -1, -1, -1, 33, |
941 | | -1, -1, -1, -1, -1, -1, 40 |
942 | | }; |
943 | | |
944 | | /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of |
945 | | state STATE-NUM. */ |
946 | | static const yytype_int8 yystos[] = |
947 | | { |
948 | | 0, 1, 3, 4, 5, 47, 45, 6, 7, 9, |
949 | | 32, 49, 50, 51, 57, 8, 10, 11, 12, 13, |
950 | | 14, 15, 16, 18, 19, 20, 26, 27, 28, 29, |
951 | | 30, 32, 33, 34, 38, 40, 43, 48, 50, 52, |
952 | | 53, 54, 55, 56, 57, 61, 63, 64, 26, 27, |
953 | | 30, 34, 40, 42, 58, 59, 60, 0, 1, 44, |
954 | | 45, 29, 52, 57, 63, 19, 20, 21, 22, 23, |
955 | | 31, 50, 58, 62, 65, 66, 63, 63, 24, 63, |
956 | | 63, 63, 63, 63, 63, 27, 63, 28, 63, 63, |
957 | | 30, 32, 48, 52, 48, 53, 49, 48, 63, 45, |
958 | | 35, 36, 37, 53, 24, 8, 26, 29, 57, 65, |
959 | | 60, 35, 36, 37, 45, 60, 45, 27, 28, 33, |
960 | | 40, 61, 33, 40, 29, 50, 20, 21, 50, 62, |
961 | | 50, 58, 27, 63, 39, 52, 53, 52, 52, 27, |
962 | | 63, 63, 63, 58, 58, 58, 63, 33, 40, 63, |
963 | | 33, 40, 61, 65, 65, 50, 63, 27, 41, 63, |
964 | | 27, 33, 63, 33, 63, 33, 40, 22, 65, 25, |
965 | | 25, 63, 64, 25, 25, 63, 33, 33, 63, 22, |
966 | | 65, 25, 25, 33, 22, 65, 22, 65, 22 |
967 | | }; |
968 | | |
969 | | /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ |
970 | | static const yytype_int8 yyr1[] = |
971 | | { |
972 | | 0, 46, 47, 47, 47, 47, 47, 47, 47, 47, |
973 | | 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, |
974 | | 49, 49, 49, 49, 49, 49, 50, 50, 50, 50, |
975 | | 51, 51, 51, 51, 51, 51, 51, 51, 52, 52, |
976 | | 52, 52, 52, 52, 53, 53, 53, 54, 54, 55, |
977 | | 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, |
978 | | 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, |
979 | | 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, |
980 | | 55, 55, 55, 55, 55, 55, 56, 56, 56, 56, |
981 | | 56, 56, 56, 56, 57, 57, 57, 58, 58, 58, |
982 | | 58, 59, 59, 60, 60, 60, 60, 60, 60, 61, |
983 | | 61, 61, 61, 61, 61, 62, 62, 62, 62, 62, |
984 | | 62, 62, 63, 63, 64, 64, 65, 65, 66 |
985 | | }; |
986 | | |
987 | | /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ |
988 | | static const yytype_int8 yyr2[] = |
989 | | { |
990 | | 0, 2, 2, 3, 2, 1, 3, 2, 1, 2, |
991 | | 3, 2, 2, 2, 2, 2, 1, 1, 2, 3, |
992 | | 3, 2, 3, 3, 4, 2, 1, 1, 3, 5, |
993 | | 3, 5, 4, 6, 4, 6, 5, 7, 3, 3, |
994 | | 3, 2, 3, 1, 2, 1, 1, 3, 5, 1, |
995 | | 2, 1, 2, 2, 3, 1, 1, 1, 1, 1, |
996 | | 1, 1, 2, 2, 2, 2, 2, 2, 2, 5, |
997 | | 5, 6, 5, 5, 6, 2, 3, 2, 1, 1, |
998 | | 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, |
999 | | 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, |
1000 | | 1, 1, 2, 1, 1, 1, 1, 1, 2, 2, |
1001 | | 2, 1, 2, 2, 1, 1, 3, 4, 5, 6, |
1002 | | 7, 8, 1, 1, 1, 2, 1, 1, 1 |
1003 | | }; |
1004 | | |
1005 | | |
1006 | | enum { YYENOMEM = -2 }; |
1007 | | |
1008 | 1.78k | #define yyerrok (yyerrstatus = 0) |
1009 | | #define yyclearin (yychar = YYEMPTY) |
1010 | | |
1011 | 23.3k | #define YYACCEPT goto yyacceptlab |
1012 | 1.81k | #define YYABORT goto yyabortlab |
1013 | 0 | #define YYERROR goto yyerrorlab |
1014 | 2 | #define YYNOMEM goto yyexhaustedlab |
1015 | | |
1016 | | |
1017 | | #define YYRECOVERING() (!!yyerrstatus) |
1018 | | |
1019 | | #define YYBACKUP(Token, Value) \ |
1020 | | do \ |
1021 | | if (yychar == YYEMPTY) \ |
1022 | | { \ |
1023 | | yychar = (Token); \ |
1024 | | yylval = (Value); \ |
1025 | | YYPOPSTACK (yylen); \ |
1026 | | yystate = *yyssp; \ |
1027 | | goto yybackup; \ |
1028 | | } \ |
1029 | | else \ |
1030 | | { \ |
1031 | | yyerror (input, molList, lastAtom, lastBond, numAtomsParsed, numBondsParsed, branchPoints, scanner, start_token, current_token_position, YY_("syntax error: cannot back up")); \ |
1032 | | YYERROR; \ |
1033 | | } \ |
1034 | | while (0) |
1035 | | |
1036 | | /* Backward compatibility with an undocumented macro. |
1037 | | Use YYerror or YYUNDEF. */ |
1038 | | #define YYERRCODE YYUNDEF |
1039 | | |
1040 | | |
1041 | | /* Enable debugging if requested. */ |
1042 | | #if YYDEBUG |
1043 | | |
1044 | | # ifndef YYFPRINTF |
1045 | | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
1046 | 0 | # define YYFPRINTF fprintf |
1047 | | # endif |
1048 | | |
1049 | 40.8M | # define YYDPRINTF(Args) \ |
1050 | 40.8M | do { \ |
1051 | 40.8M | if (yydebug) \ |
1052 | 40.8M | YYFPRINTF Args; \ |
1053 | 40.8M | } while (0) |
1054 | | |
1055 | | |
1056 | | |
1057 | | |
1058 | 65.8M | # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ |
1059 | 65.8M | do { \ |
1060 | 65.8M | if (yydebug) \ |
1061 | 65.8M | { \ |
1062 | 0 | YYFPRINTF (stderr, "%s ", Title); \ |
1063 | 0 | yy_symbol_print (stderr, \ |
1064 | 0 | Kind, Value, input, molList, lastAtom, lastBond, numAtomsParsed, numBondsParsed, branchPoints, scanner, start_token, current_token_position); \ |
1065 | 0 | YYFPRINTF (stderr, "\n"); \ |
1066 | 0 | } \ |
1067 | 65.8M | } while (0) |
1068 | | |
1069 | | |
1070 | | /*-----------------------------------. |
1071 | | | Print this symbol's value on YYO. | |
1072 | | `-----------------------------------*/ |
1073 | | |
1074 | | static void |
1075 | | yy_symbol_value_print (FILE *yyo, |
1076 | | yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, const char *input, std::vector<RDKit::RWMol *> *molList, RDKit::Atom* &lastAtom, RDKit::Bond* &lastBond, unsigned &numAtomsParsed, unsigned &numBondsParsed, std::vector<std::pair<unsigned int, unsigned int>>& branchPoints, void *scanner, int& start_token, unsigned int& current_token_position) |
1077 | 0 | { |
1078 | 0 | FILE *yyoutput = yyo; |
1079 | 0 | YY_USE (yyoutput); |
1080 | 0 | YY_USE (input); |
1081 | 0 | YY_USE (molList); |
1082 | 0 | YY_USE (lastAtom); |
1083 | 0 | YY_USE (lastBond); |
1084 | 0 | YY_USE (numAtomsParsed); |
1085 | 0 | YY_USE (numBondsParsed); |
1086 | 0 | YY_USE (branchPoints); |
1087 | 0 | YY_USE (scanner); |
1088 | 0 | YY_USE (start_token); |
1089 | 0 | YY_USE (current_token_position); |
1090 | 0 | if (!yyvaluep) |
1091 | 0 | return; |
1092 | 0 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
1093 | 0 | YY_USE (yykind); |
1094 | 0 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
1095 | 0 | } |
1096 | | |
1097 | | |
1098 | | /*---------------------------. |
1099 | | | Print this symbol on YYO. | |
1100 | | `---------------------------*/ |
1101 | | |
1102 | | static void |
1103 | | yy_symbol_print (FILE *yyo, |
1104 | | yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, const char *input, std::vector<RDKit::RWMol *> *molList, RDKit::Atom* &lastAtom, RDKit::Bond* &lastBond, unsigned &numAtomsParsed, unsigned &numBondsParsed, std::vector<std::pair<unsigned int, unsigned int>>& branchPoints, void *scanner, int& start_token, unsigned int& current_token_position) |
1105 | 0 | { |
1106 | 0 | YYFPRINTF (yyo, "%s %s (", |
1107 | 0 | yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); |
1108 | |
|
1109 | 0 | yy_symbol_value_print (yyo, yykind, yyvaluep, input, molList, lastAtom, lastBond, numAtomsParsed, numBondsParsed, branchPoints, scanner, start_token, current_token_position); |
1110 | 0 | YYFPRINTF (yyo, ")"); |
1111 | 0 | } |
1112 | | |
1113 | | /*------------------------------------------------------------------. |
1114 | | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
1115 | | | TOP (included). | |
1116 | | `------------------------------------------------------------------*/ |
1117 | | |
1118 | | static void |
1119 | | yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) |
1120 | 0 | { |
1121 | 0 | YYFPRINTF (stderr, "Stack now"); |
1122 | 0 | for (; yybottom <= yytop; yybottom++) |
1123 | 0 | { |
1124 | 0 | int yybot = *yybottom; |
1125 | 0 | YYFPRINTF (stderr, " %d", yybot); |
1126 | 0 | } |
1127 | 0 | YYFPRINTF (stderr, "\n"); |
1128 | 0 | } |
1129 | | |
1130 | 37.5M | # define YY_STACK_PRINT(Bottom, Top) \ |
1131 | 37.5M | do { \ |
1132 | 37.5M | if (yydebug) \ |
1133 | 37.5M | yy_stack_print ((Bottom), (Top)); \ |
1134 | 37.5M | } while (0) |
1135 | | |
1136 | | |
1137 | | /*------------------------------------------------. |
1138 | | | Report that the YYRULE is going to be reduced. | |
1139 | | `------------------------------------------------*/ |
1140 | | |
1141 | | static void |
1142 | | yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, |
1143 | | int yyrule, const char *input, std::vector<RDKit::RWMol *> *molList, RDKit::Atom* &lastAtom, RDKit::Bond* &lastBond, unsigned &numAtomsParsed, unsigned &numBondsParsed, std::vector<std::pair<unsigned int, unsigned int>>& branchPoints, void *scanner, int& start_token, unsigned int& current_token_position) |
1144 | 0 | { |
1145 | 0 | int yylno = yyrline[yyrule]; |
1146 | 0 | int yynrhs = yyr2[yyrule]; |
1147 | 0 | int yyi; |
1148 | 0 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", |
1149 | 0 | yyrule - 1, yylno); |
1150 | | /* The symbols being reduced. */ |
1151 | 0 | for (yyi = 0; yyi < yynrhs; yyi++) |
1152 | 0 | { |
1153 | 0 | YYFPRINTF (stderr, " $%d = ", yyi + 1); |
1154 | 0 | yy_symbol_print (stderr, |
1155 | 0 | YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), |
1156 | 0 | &yyvsp[(yyi + 1) - (yynrhs)], input, molList, lastAtom, lastBond, numAtomsParsed, numBondsParsed, branchPoints, scanner, start_token, current_token_position); |
1157 | 0 | YYFPRINTF (stderr, "\n"); |
1158 | 0 | } |
1159 | 0 | } |
1160 | | |
1161 | 9.81M | # define YY_REDUCE_PRINT(Rule) \ |
1162 | 9.81M | do { \ |
1163 | 9.81M | if (yydebug) \ |
1164 | 9.81M | yy_reduce_print (yyssp, yyvsp, Rule, input, molList, lastAtom, lastBond, numAtomsParsed, numBondsParsed, branchPoints, scanner, start_token, current_token_position); \ |
1165 | 9.81M | } while (0) |
1166 | | |
1167 | | /* Nonzero means print parse trace. It is left uninitialized so that |
1168 | | multiple parsers can coexist. */ |
1169 | | int yydebug; |
1170 | | #else /* !YYDEBUG */ |
1171 | | # define YYDPRINTF(Args) ((void) 0) |
1172 | | # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) |
1173 | | # define YY_STACK_PRINT(Bottom, Top) |
1174 | | # define YY_REDUCE_PRINT(Rule) |
1175 | | #endif /* !YYDEBUG */ |
1176 | | |
1177 | | |
1178 | | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
1179 | | #ifndef YYINITDEPTH |
1180 | 25.1k | # define YYINITDEPTH 200 |
1181 | | #endif |
1182 | | |
1183 | | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
1184 | | if the built-in stack extension method is used). |
1185 | | |
1186 | | Do not make this value too large; the results are undefined if |
1187 | | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
1188 | | evaluated with infinite-precision integer arithmetic. */ |
1189 | | |
1190 | | #ifndef YYMAXDEPTH |
1191 | 99 | # define YYMAXDEPTH 10000 |
1192 | | #endif |
1193 | | |
1194 | | |
1195 | | |
1196 | | |
1197 | | |
1198 | | |
1199 | | /*-----------------------------------------------. |
1200 | | | Release the memory associated to this symbol. | |
1201 | | `-----------------------------------------------*/ |
1202 | | |
1203 | | static void |
1204 | | yydestruct (const char *yymsg, |
1205 | | yysymbol_kind_t yykind, YYSTYPE *yyvaluep, const char *input, std::vector<RDKit::RWMol *> *molList, RDKit::Atom* &lastAtom, RDKit::Bond* &lastBond, unsigned &numAtomsParsed, unsigned &numBondsParsed, std::vector<std::pair<unsigned int, unsigned int>>& branchPoints, void *scanner, int& start_token, unsigned int& current_token_position) |
1206 | 24.5M | { |
1207 | 24.5M | YY_USE (yyvaluep); |
1208 | 24.5M | YY_USE (input); |
1209 | 24.5M | YY_USE (molList); |
1210 | 24.5M | YY_USE (lastAtom); |
1211 | 24.5M | YY_USE (lastBond); |
1212 | 24.5M | YY_USE (numAtomsParsed); |
1213 | 24.5M | YY_USE (numBondsParsed); |
1214 | 24.5M | YY_USE (branchPoints); |
1215 | 24.5M | YY_USE (scanner); |
1216 | 24.5M | YY_USE (start_token); |
1217 | 24.5M | YY_USE (current_token_position); |
1218 | 24.5M | if (!yymsg) |
1219 | 0 | yymsg = "Deleting"; |
1220 | 24.5M | YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); |
1221 | | |
1222 | 24.5M | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
1223 | 24.5M | switch (yykind) |
1224 | 24.5M | { |
1225 | 162k | case YYSYMBOL_ATOM_TOKEN: /* ATOM_TOKEN */ |
1226 | 162k | { delete ((*yyvaluep).atom); } |
1227 | 162k | break; |
1228 | | |
1229 | 414k | case YYSYMBOL_SIMPLE_ATOM_QUERY_TOKEN: /* SIMPLE_ATOM_QUERY_TOKEN */ |
1230 | 414k | { delete ((*yyvaluep).atom); } |
1231 | 414k | break; |
1232 | | |
1233 | 78.0k | case YYSYMBOL_COMPLEX_ATOM_QUERY_TOKEN: /* COMPLEX_ATOM_QUERY_TOKEN */ |
1234 | 78.0k | { delete ((*yyvaluep).atom); } |
1235 | 78.0k | break; |
1236 | | |
1237 | 13.2k | case YYSYMBOL_MIN_RINGSIZE_ATOM_QUERY_TOKEN: /* MIN_RINGSIZE_ATOM_QUERY_TOKEN */ |
1238 | 13.2k | { delete ((*yyvaluep).atom); } |
1239 | 13.2k | break; |
1240 | | |
1241 | 6.41k | case YYSYMBOL_RINGSIZE_ATOM_QUERY_TOKEN: /* RINGSIZE_ATOM_QUERY_TOKEN */ |
1242 | 6.41k | { delete ((*yyvaluep).atom); } |
1243 | 6.41k | break; |
1244 | | |
1245 | 3.85k | case YYSYMBOL_RINGBOND_ATOM_QUERY_TOKEN: /* RINGBOND_ATOM_QUERY_TOKEN */ |
1246 | 3.85k | { delete ((*yyvaluep).atom); } |
1247 | 3.85k | break; |
1248 | | |
1249 | 2.99k | case YYSYMBOL_IMPLICIT_H_ATOM_QUERY_TOKEN: /* IMPLICIT_H_ATOM_QUERY_TOKEN */ |
1250 | 2.99k | { delete ((*yyvaluep).atom); } |
1251 | 2.99k | break; |
1252 | | |
1253 | 9.85k | case YYSYMBOL_HYB_TOKEN: /* HYB_TOKEN */ |
1254 | 9.85k | { delete ((*yyvaluep).atom); } |
1255 | 9.85k | break; |
1256 | | |
1257 | 6.32k | case YYSYMBOL_HETERONEIGHBOR_ATOM_QUERY_TOKEN: /* HETERONEIGHBOR_ATOM_QUERY_TOKEN */ |
1258 | 6.32k | { delete ((*yyvaluep).atom); } |
1259 | 6.32k | break; |
1260 | | |
1261 | 0 | case YYSYMBOL_ALIPHATIC: /* ALIPHATIC */ |
1262 | 0 | { delete ((*yyvaluep).atom); } |
1263 | 0 | break; |
1264 | | |
1265 | 13.0k | case YYSYMBOL_ALIPHATICHETERONEIGHBOR_ATOM_QUERY_TOKEN: /* ALIPHATICHETERONEIGHBOR_ATOM_QUERY_TOKEN */ |
1266 | 13.0k | { delete ((*yyvaluep).atom); } |
1267 | 13.0k | break; |
1268 | | |
1269 | 1.30M | case YYSYMBOL_BOND_TOKEN: /* BOND_TOKEN */ |
1270 | 1.30M | { delete ((*yyvaluep).bond); } |
1271 | 1.30M | break; |
1272 | | |
1273 | 0 | case YYSYMBOL_atomd: /* atomd */ |
1274 | 0 | { delete ((*yyvaluep).atom); } |
1275 | 0 | break; |
1276 | | |
1277 | 0 | case YYSYMBOL_hydrogen_atom: /* hydrogen_atom */ |
1278 | 0 | { delete ((*yyvaluep).atom); } |
1279 | 0 | break; |
1280 | | |
1281 | 7.96k | case YYSYMBOL_atom_expr: /* atom_expr */ |
1282 | 7.96k | { delete ((*yyvaluep).atom); } |
1283 | 7.96k | break; |
1284 | | |
1285 | 0 | case YYSYMBOL_point_query: /* point_query */ |
1286 | 0 | { delete ((*yyvaluep).atom); } |
1287 | 0 | break; |
1288 | | |
1289 | 0 | case YYSYMBOL_recursive_query: /* recursive_query */ |
1290 | 0 | { delete ((*yyvaluep).atom); } |
1291 | 0 | break; |
1292 | | |
1293 | 0 | case YYSYMBOL_atom_query: /* atom_query */ |
1294 | 0 | { delete ((*yyvaluep).atom); } |
1295 | 0 | break; |
1296 | | |
1297 | 19 | case YYSYMBOL_possible_range_query: /* possible_range_query */ |
1298 | 19 | { delete ((*yyvaluep).atom); } |
1299 | 19 | break; |
1300 | | |
1301 | 0 | case YYSYMBOL_simple_atom: /* simple_atom */ |
1302 | 0 | { delete ((*yyvaluep).atom); } |
1303 | 0 | break; |
1304 | | |
1305 | 200 | case YYSYMBOL_bond_expr: /* bond_expr */ |
1306 | 200 | { delete ((*yyvaluep).bond); } |
1307 | 200 | break; |
1308 | | |
1309 | 6 | case YYSYMBOL_bond_query: /* bond_query */ |
1310 | 6 | { delete ((*yyvaluep).bond); } |
1311 | 6 | break; |
1312 | | |
1313 | 0 | case YYSYMBOL_bondd: /* bondd */ |
1314 | 0 | { delete ((*yyvaluep).bond); } |
1315 | 0 | break; |
1316 | | |
1317 | 22.4M | default: |
1318 | 22.4M | break; |
1319 | 24.5M | } |
1320 | 24.5M | YY_IGNORE_MAYBE_UNINITIALIZED_END |
1321 | 24.5M | } |
1322 | | |
1323 | | |
1324 | | |
1325 | | |
1326 | | |
1327 | | |
1328 | | /*----------. |
1329 | | | yyparse. | |
1330 | | `----------*/ |
1331 | | |
1332 | | int |
1333 | | yyparse (const char *input, std::vector<RDKit::RWMol *> *molList, RDKit::Atom* &lastAtom, RDKit::Bond* &lastBond, unsigned &numAtomsParsed, unsigned &numBondsParsed, std::vector<std::pair<unsigned int, unsigned int>>& branchPoints, void *scanner, int& start_token, unsigned int& current_token_position) |
1334 | 25.1k | { |
1335 | | /* Lookahead token kind. */ |
1336 | 25.1k | int yychar; |
1337 | | |
1338 | | |
1339 | | /* The semantic value of the lookahead symbol. */ |
1340 | | /* Default value used for initialization, for pacifying older GCCs |
1341 | | or non-GCC compilers. */ |
1342 | 25.1k | YY_INITIAL_VALUE (static YYSTYPE yyval_default;) |
1343 | 25.1k | YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); |
1344 | | |
1345 | | /* Number of syntax errors so far. */ |
1346 | 25.1k | int yynerrs = 0; |
1347 | | |
1348 | 25.1k | yy_state_fast_t yystate = 0; |
1349 | | /* Number of tokens to shift before error messages enabled. */ |
1350 | 25.1k | int yyerrstatus = 0; |
1351 | | |
1352 | | /* Refer to the stacks through separate pointers, to allow yyoverflow |
1353 | | to reallocate them elsewhere. */ |
1354 | | |
1355 | | /* Their size. */ |
1356 | 25.1k | YYPTRDIFF_T yystacksize = YYINITDEPTH; |
1357 | | |
1358 | | /* The state stack: array, bottom, top. */ |
1359 | 25.1k | yy_state_t yyssa[YYINITDEPTH]; |
1360 | 25.1k | yy_state_t *yyss = yyssa; |
1361 | 25.1k | yy_state_t *yyssp = yyss; |
1362 | | |
1363 | | /* The semantic value stack: array, bottom, top. */ |
1364 | 25.1k | YYSTYPE yyvsa[YYINITDEPTH]; |
1365 | 25.1k | YYSTYPE *yyvs = yyvsa; |
1366 | 25.1k | YYSTYPE *yyvsp = yyvs; |
1367 | | |
1368 | 25.1k | int yyn; |
1369 | | /* The return value of yyparse. */ |
1370 | 25.1k | int yyresult; |
1371 | | /* Lookahead symbol kind. */ |
1372 | 25.1k | yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; |
1373 | | /* The variables used to return semantic value and location from the |
1374 | | action routines. */ |
1375 | 25.1k | YYSTYPE yyval; |
1376 | | |
1377 | | |
1378 | | |
1379 | 22.0M | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) |
1380 | | |
1381 | | /* The number of symbols on the RHS of the reduced rule. |
1382 | | Keep to zero when no symbol should be popped. */ |
1383 | 25.1k | int yylen = 0; |
1384 | | |
1385 | 25.1k | YYDPRINTF ((stderr, "Starting parse\n")); |
1386 | | |
1387 | 25.1k | yychar = YYEMPTY; /* Cause a token to be read. */ |
1388 | | |
1389 | 25.1k | goto yysetstate; |
1390 | | |
1391 | | |
1392 | | /*------------------------------------------------------------. |
1393 | | | yynewstate -- push a new state, which is found in yystate. | |
1394 | | `------------------------------------------------------------*/ |
1395 | 25.2M | yynewstate: |
1396 | | /* In all cases, when you get here, the value and location stacks |
1397 | | have just been pushed. So pushing a state here evens the stacks. */ |
1398 | 25.2M | yyssp++; |
1399 | | |
1400 | | |
1401 | | /*--------------------------------------------------------------------. |
1402 | | | yysetstate -- set current state (the top of the stack) to yystate. | |
1403 | | `--------------------------------------------------------------------*/ |
1404 | 25.3M | yysetstate: |
1405 | 25.3M | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
1406 | 25.3M | YY_ASSERT (0 <= yystate && yystate < YYNSTATES); |
1407 | 25.3M | YY_IGNORE_USELESS_CAST_BEGIN |
1408 | 25.3M | *yyssp = YY_CAST (yy_state_t, yystate); |
1409 | 25.3M | YY_IGNORE_USELESS_CAST_END |
1410 | 25.3M | YY_STACK_PRINT (yyss, yyssp); |
1411 | | |
1412 | 25.3M | if (yyss + yystacksize - 1 <= yyssp) |
1413 | | #if !defined yyoverflow && !defined YYSTACK_RELOCATE |
1414 | | YYNOMEM; |
1415 | | #else |
1416 | 49 | { |
1417 | | /* Get the current used size of the three stacks, in elements. */ |
1418 | 49 | YYPTRDIFF_T yysize = yyssp - yyss + 1; |
1419 | | |
1420 | | # if defined yyoverflow |
1421 | | { |
1422 | | /* Give user a chance to reallocate the stack. Use copies of |
1423 | | these so that the &'s don't force the real ones into |
1424 | | memory. */ |
1425 | | yy_state_t *yyss1 = yyss; |
1426 | | YYSTYPE *yyvs1 = yyvs; |
1427 | | |
1428 | | /* Each stack pointer address is followed by the size of the |
1429 | | data in use in that stack, in bytes. This used to be a |
1430 | | conditional around just the two extra args, but that might |
1431 | | be undefined if yyoverflow is a macro. */ |
1432 | | yyoverflow (YY_("memory exhausted"), |
1433 | | &yyss1, yysize * YYSIZEOF (*yyssp), |
1434 | | &yyvs1, yysize * YYSIZEOF (*yyvsp), |
1435 | | &yystacksize); |
1436 | | yyss = yyss1; |
1437 | | yyvs = yyvs1; |
1438 | | } |
1439 | | # else /* defined YYSTACK_RELOCATE */ |
1440 | | /* Extend the stack our own way. */ |
1441 | 49 | if (YYMAXDEPTH <= yystacksize) |
1442 | 2 | YYNOMEM; |
1443 | 47 | yystacksize *= 2; |
1444 | 47 | if (YYMAXDEPTH < yystacksize) |
1445 | 3 | yystacksize = YYMAXDEPTH; |
1446 | | |
1447 | 47 | { |
1448 | 47 | yy_state_t *yyss1 = yyss; |
1449 | 47 | union yyalloc *yyptr = |
1450 | 47 | YY_CAST (union yyalloc *, |
1451 | 47 | YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); |
1452 | 47 | if (! yyptr) |
1453 | 0 | YYNOMEM; |
1454 | 47 | YYSTACK_RELOCATE (yyss_alloc, yyss); |
1455 | 47 | YYSTACK_RELOCATE (yyvs_alloc, yyvs); |
1456 | 47 | # undef YYSTACK_RELOCATE |
1457 | 47 | if (yyss1 != yyssa) |
1458 | 30 | YYSTACK_FREE (yyss1); |
1459 | 47 | } |
1460 | 0 | # endif |
1461 | | |
1462 | 0 | yyssp = yyss + yysize - 1; |
1463 | 47 | yyvsp = yyvs + yysize - 1; |
1464 | | |
1465 | 47 | YY_IGNORE_USELESS_CAST_BEGIN |
1466 | 47 | YYDPRINTF ((stderr, "Stack size increased to %ld\n", |
1467 | 47 | YY_CAST (long, yystacksize))); |
1468 | 47 | YY_IGNORE_USELESS_CAST_END |
1469 | | |
1470 | 47 | if (yyss + yystacksize - 1 <= yyssp) |
1471 | 0 | YYABORT; |
1472 | 47 | } |
1473 | 25.3M | #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ |
1474 | | |
1475 | | |
1476 | 25.3M | if (yystate == YYFINAL) |
1477 | 0 | YYACCEPT; |
1478 | | |
1479 | 25.3M | goto yybackup; |
1480 | | |
1481 | | |
1482 | | /*-----------. |
1483 | | | yybackup. | |
1484 | | `-----------*/ |
1485 | 25.3M | yybackup: |
1486 | | /* Do appropriate processing given the current state. Read a |
1487 | | lookahead token if we need one and don't already have one. */ |
1488 | | |
1489 | | /* First try to decide what to do without reference to lookahead token. */ |
1490 | 25.3M | yyn = yypact[yystate]; |
1491 | 25.3M | if (yypact_value_is_default (yyn)) |
1492 | 9.25M | goto yydefault; |
1493 | | |
1494 | | /* Not known => get a lookahead token if don't already have one. */ |
1495 | | |
1496 | | /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ |
1497 | 16.0M | if (yychar == YYEMPTY) |
1498 | 15.4M | { |
1499 | 15.4M | YYDPRINTF ((stderr, "Reading a token\n")); |
1500 | 15.4M | yychar = yylex (&yylval, scanner, start_token, current_token_position); |
1501 | 15.4M | } |
1502 | | |
1503 | 16.0M | if (yychar <= YYEOF) |
1504 | 0 | { |
1505 | 0 | yychar = YYEOF; |
1506 | 0 | yytoken = YYSYMBOL_YYEOF; |
1507 | 0 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
1508 | 0 | } |
1509 | 16.0M | else if (yychar == YYerror) |
1510 | 0 | { |
1511 | | /* The scanner already issued an error message, process directly |
1512 | | to error recovery. But do not keep the error token as |
1513 | | lookahead, it is too special and may lead us to an endless |
1514 | | loop in error recovery. */ |
1515 | 0 | yychar = YYUNDEF; |
1516 | 0 | yytoken = YYSYMBOL_YYerror; |
1517 | 0 | goto yyerrlab1; |
1518 | 0 | } |
1519 | 16.0M | else |
1520 | 16.0M | { |
1521 | 16.0M | yytoken = YYTRANSLATE (yychar); |
1522 | 16.0M | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
1523 | 16.0M | } |
1524 | | |
1525 | | /* If the proper action on seeing token YYTOKEN is to reduce or to |
1526 | | detect an error, take that action. */ |
1527 | 16.0M | yyn += yytoken; |
1528 | 16.0M | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
1529 | 12.7M | goto yydefault; |
1530 | 3.25M | yyn = yytable[yyn]; |
1531 | 3.25M | if (yyn <= 0) |
1532 | 25 | { |
1533 | 25 | if (yytable_value_is_error (yyn)) |
1534 | 0 | goto yyerrlab; |
1535 | 25 | yyn = -yyn; |
1536 | 25 | goto yyreduce; |
1537 | 25 | } |
1538 | | |
1539 | | /* Count tokens shifted since error; after three, turn off error |
1540 | | status. */ |
1541 | 3.25M | if (yyerrstatus) |
1542 | 1.60k | yyerrstatus--; |
1543 | | |
1544 | | /* Shift the lookahead token. */ |
1545 | 3.25M | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
1546 | 3.25M | yystate = yyn; |
1547 | 3.25M | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
1548 | 3.25M | *++yyvsp = yylval; |
1549 | 3.25M | YY_IGNORE_MAYBE_UNINITIALIZED_END |
1550 | | |
1551 | | /* Discard the shifted token. */ |
1552 | 3.25M | yychar = YYEMPTY; |
1553 | 3.25M | goto yynewstate; |
1554 | | |
1555 | | |
1556 | | /*-----------------------------------------------------------. |
1557 | | | yydefault -- do the default action for the current state. | |
1558 | | `-----------------------------------------------------------*/ |
1559 | 22.0M | yydefault: |
1560 | 22.0M | yyn = yydefact[yystate]; |
1561 | 22.0M | if (yyn == 0) |
1562 | 12.2M | goto yyerrlab; |
1563 | 9.81M | goto yyreduce; |
1564 | | |
1565 | | |
1566 | | /*-----------------------------. |
1567 | | | yyreduce -- do a reduction. | |
1568 | | `-----------------------------*/ |
1569 | 9.81M | yyreduce: |
1570 | | /* yyn is the number of a rule to reduce with. */ |
1571 | 9.81M | yylen = yyr2[yyn]; |
1572 | | |
1573 | | /* If YYLEN is nonzero, implement the default value of the action: |
1574 | | '$$ = $1'. |
1575 | | |
1576 | | Otherwise, the following line sets YYVAL to garbage. |
1577 | | This behavior is undocumented and Bison |
1578 | | users should not rely upon it. Assigning to YYVAL |
1579 | | unconditionally makes the parser a bit smaller, and it avoids a |
1580 | | GCC warning that YYVAL may be used uninitialized. */ |
1581 | 9.81M | yyval = yyvsp[1-yylen]; |
1582 | | |
1583 | | |
1584 | 9.81M | YY_REDUCE_PRINT (yyn); |
1585 | 9.81M | switch (yyn) |
1586 | 9.81M | { |
1587 | 23.5k | case 2: /* meta_start: START_MOL mol */ |
1588 | 23.5k | { |
1589 | | // the molList has already been updated, no need to do anything |
1590 | 23.5k | } |
1591 | 23.5k | break; |
1592 | | |
1593 | 0 | case 3: /* meta_start: START_ATOM atomd EOS_TOKEN */ |
1594 | 0 | { |
1595 | 0 | lastAtom = (yyvsp[-1].atom); |
1596 | 0 | YYACCEPT; |
1597 | 0 | } |
1598 | 0 | break; |
1599 | | |
1600 | 0 | case 4: /* meta_start: START_ATOM bad_atom_def */ |
1601 | 0 | { |
1602 | 0 | YYABORT; |
1603 | 0 | } |
1604 | 0 | break; |
1605 | | |
1606 | 0 | case 5: /* meta_start: START_ATOM */ |
1607 | 0 | { |
1608 | 0 | YYABORT; |
1609 | 0 | } |
1610 | 0 | break; |
1611 | | |
1612 | 0 | case 6: /* meta_start: START_BOND bond_expr EOS_TOKEN */ |
1613 | 0 | { |
1614 | 0 | lastBond = (yyvsp[-1].bond); |
1615 | 0 | YYACCEPT; |
1616 | 0 | } |
1617 | 0 | break; |
1618 | | |
1619 | 0 | case 7: /* meta_start: START_BOND bond_expr */ |
1620 | 0 | { |
1621 | 0 | delete (yyvsp[0].bond); |
1622 | 0 | YYABORT; |
1623 | 0 | } |
1624 | 0 | break; |
1625 | | |
1626 | 0 | case 8: /* meta_start: START_BOND */ |
1627 | 0 | { |
1628 | 0 | YYABORT; |
1629 | 0 | } |
1630 | 0 | break; |
1631 | | |
1632 | 178 | case 9: /* meta_start: meta_start BAD_CHARACTER */ |
1633 | 178 | { |
1634 | 178 | yyerrok; |
1635 | 178 | yyErrorCleanup(molList); |
1636 | 178 | yyerror(input, molList, current_token_position, "syntax error"); |
1637 | 178 | YYABORT; |
1638 | 0 | } |
1639 | 0 | break; |
1640 | | |
1641 | 49 | case 10: /* meta_start: meta_start error EOS_TOKEN */ |
1642 | 49 | { |
1643 | 49 | yyerrok; |
1644 | 49 | yyErrorCleanup(molList); |
1645 | 49 | YYABORT; |
1646 | 0 | } |
1647 | 0 | break; |
1648 | | |
1649 | 23.3k | case 11: /* meta_start: meta_start EOS_TOKEN */ |
1650 | 23.3k | { |
1651 | 23.3k | YYACCEPT; |
1652 | 0 | } |
1653 | 0 | break; |
1654 | | |
1655 | 1.55k | case 12: /* meta_start: error EOS_TOKEN */ |
1656 | 1.55k | { |
1657 | 1.55k | yyerrok; |
1658 | 1.55k | yyErrorCleanup(molList); |
1659 | 1.55k | YYABORT; |
1660 | 0 | } |
1661 | 0 | break; |
1662 | | |
1663 | 0 | case 16: /* bad_atom_def: atom_expr */ |
1664 | 0 | { |
1665 | 0 | delete (yyvsp[0].atom); |
1666 | 0 | YYABORT; |
1667 | 0 | } |
1668 | 0 | break; |
1669 | | |
1670 | 32.7k | case 17: /* mol: atomd */ |
1671 | 32.7k | { |
1672 | 32.7k | int sz = molList->size(); |
1673 | 32.7k | molList->resize( sz + 1); |
1674 | 32.7k | (*molList)[ sz ] = new RWMol(); |
1675 | 32.7k | (yyvsp[0].atom)->setProp(RDKit::common_properties::_SmilesStart,1); |
1676 | 32.7k | (*molList)[ sz ]->addAtom((yyvsp[0].atom),true,true); |
1677 | | //delete $1; |
1678 | 32.7k | (yyval.moli) = sz; |
1679 | 32.7k | } |
1680 | 32.7k | break; |
1681 | | |
1682 | 1.51M | case 18: /* mol: mol atomd */ |
1683 | 1.51M | { |
1684 | 1.51M | RWMol *mp = (*molList)[(yyval.moli)]; |
1685 | 1.51M | Atom *a1 = mp->getActiveAtom(); |
1686 | 1.51M | int atomIdx1=a1->getIdx(); |
1687 | 1.51M | int atomIdx2=mp->addAtom((yyvsp[0].atom),true,true); |
1688 | | |
1689 | 1.51M | QueryBond *newB = SmilesParseOps::getUnspecifiedQueryBond(a1,mp->getAtomWithIdx(atomIdx2)); |
1690 | 1.51M | newB->setOwningMol(mp); |
1691 | 1.51M | newB->setBeginAtomIdx(atomIdx1); |
1692 | 1.51M | newB->setEndAtomIdx(atomIdx2); |
1693 | 1.51M | newB->setProp("_cxsmilesBondIdx",numBondsParsed++); |
1694 | 1.51M | mp->addBond(newB,true); |
1695 | 1.51M | } |
1696 | 1.51M | break; |
1697 | | |
1698 | 25.0k | case 19: /* mol: mol bond_expr atomd */ |
1699 | 25.0k | { |
1700 | 25.0k | RWMol *mp = (*molList)[(yyval.moli)]; |
1701 | 25.0k | int atomIdx1 = mp->getActiveAtom()->getIdx(); |
1702 | 25.0k | int atomIdx2 = mp->addAtom((yyvsp[0].atom),true,true); |
1703 | 25.0k | if( (yyvsp[-1].bond)->getBondType() == Bond::DATIVER ){ |
1704 | 4.48k | (yyvsp[-1].bond)->setBeginAtomIdx(atomIdx1); |
1705 | 4.48k | (yyvsp[-1].bond)->setEndAtomIdx(atomIdx2); |
1706 | 4.48k | (yyvsp[-1].bond)->setBondType(Bond::DATIVE); |
1707 | 20.5k | }else if ( (yyvsp[-1].bond)->getBondType() == Bond::DATIVEL ){ |
1708 | 4.14k | (yyvsp[-1].bond)->setBeginAtomIdx(atomIdx2); |
1709 | 4.14k | (yyvsp[-1].bond)->setEndAtomIdx(atomIdx1); |
1710 | 4.14k | (yyvsp[-1].bond)->setBondType(Bond::DATIVE); |
1711 | 16.3k | } else { |
1712 | 16.3k | (yyvsp[-1].bond)->setBeginAtomIdx(atomIdx1); |
1713 | 16.3k | (yyvsp[-1].bond)->setEndAtomIdx(atomIdx2); |
1714 | 16.3k | } |
1715 | 25.0k | (yyvsp[-1].bond)->setProp("_cxsmilesBondIdx",numBondsParsed++); |
1716 | 25.0k | mp->addBond((yyvsp[-1].bond)); |
1717 | 25.0k | delete (yyvsp[-1].bond); |
1718 | 25.0k | } |
1719 | 25.0k | break; |
1720 | | |
1721 | 3.27k | case 20: /* mol: mol SEPARATOR_TOKEN atomd */ |
1722 | 3.27k | { |
1723 | 3.27k | RWMol *mp = (*molList)[(yyval.moli)]; |
1724 | 3.27k | (yyvsp[0].atom)->setProp(RDKit::common_properties::_SmilesStart,1,true); |
1725 | 3.27k | mp->addAtom((yyvsp[0].atom),true,true); |
1726 | 3.27k | } |
1727 | 3.27k | break; |
1728 | | |
1729 | 90.7k | case 21: /* mol: mol ring_number */ |
1730 | 90.7k | { |
1731 | 90.7k | RWMol * mp = (*molList)[(yyval.moli)]; |
1732 | 90.7k | Atom *atom=mp->getActiveAtom(); |
1733 | | |
1734 | 90.7k | QueryBond *newB = SmilesParseOps::getUnspecifiedQueryBond(atom, nullptr); |
1735 | 90.7k | newB->setOwningMol(mp); |
1736 | 90.7k | newB->setBeginAtomIdx(atom->getIdx()); |
1737 | 90.7k | mp->setBondBookmark(newB,(yyvsp[0].ival)); |
1738 | 90.7k | if(!(mp->getAllBondsWithBookmark((yyvsp[0].ival)).size()%2)){ |
1739 | 22.1k | newB->setProp("_cxsmilesBondIdx",numBondsParsed++); |
1740 | 22.1k | } |
1741 | 90.7k | mp->setAtomBookmark(atom,(yyvsp[0].ival)); |
1742 | | |
1743 | 90.7k | SmilesParseOps::CheckRingClosureBranchStatus(atom,mp); |
1744 | | |
1745 | 90.7k | INT_VECT tmp; |
1746 | 90.7k | if(atom->hasProp(RDKit::common_properties::_RingClosures)){ |
1747 | 71.2k | atom->getProp(RDKit::common_properties::_RingClosures,tmp); |
1748 | 71.2k | } |
1749 | 90.7k | tmp.push_back(-((yyvsp[0].ival)+1)); |
1750 | 90.7k | atom->setProp(RDKit::common_properties::_RingClosures,tmp); |
1751 | | |
1752 | 90.7k | } |
1753 | 90.7k | break; |
1754 | | |
1755 | 19.0k | case 22: /* mol: mol bond_expr ring_number */ |
1756 | 19.0k | { |
1757 | 19.0k | RWMol * mp = (*molList)[(yyval.moli)]; |
1758 | 19.0k | Atom *atom=mp->getActiveAtom(); |
1759 | | |
1760 | 19.0k | mp->setBondBookmark((yyvsp[-1].bond),(yyvsp[0].ival)); |
1761 | 19.0k | (yyvsp[-1].bond)->setOwningMol(mp); |
1762 | 19.0k | (yyvsp[-1].bond)->setBeginAtomIdx(atom->getIdx()); |
1763 | 19.0k | (yyvsp[-1].bond)->setProp("_cxsmilesBondIdx",numBondsParsed++); |
1764 | 19.0k | mp->setAtomBookmark(atom,(yyvsp[0].ival)); |
1765 | | |
1766 | 19.0k | SmilesParseOps::CheckRingClosureBranchStatus(atom,mp); |
1767 | | |
1768 | 19.0k | INT_VECT tmp; |
1769 | 19.0k | if(atom->hasProp(RDKit::common_properties::_RingClosures)){ |
1770 | 2.86k | atom->getProp(RDKit::common_properties::_RingClosures,tmp); |
1771 | 2.86k | } |
1772 | 19.0k | tmp.push_back(-((yyvsp[0].ival)+1)); |
1773 | 19.0k | atom->setProp(RDKit::common_properties::_RingClosures,tmp); |
1774 | | |
1775 | 19.0k | } |
1776 | 19.0k | break; |
1777 | | |
1778 | 14.4k | case 23: /* mol: mol branch_open_token atomd */ |
1779 | 14.4k | { |
1780 | 14.4k | RWMol *mp = (*molList)[(yyval.moli)]; |
1781 | 14.4k | Atom *a1 = mp->getActiveAtom(); |
1782 | 14.4k | int atomIdx1=a1->getIdx(); |
1783 | 14.4k | int atomIdx2=mp->addAtom((yyvsp[0].atom),true,true); |
1784 | | |
1785 | 14.4k | QueryBond *newB = SmilesParseOps::getUnspecifiedQueryBond(a1,mp->getAtomWithIdx(atomIdx2)); |
1786 | 14.4k | newB->setOwningMol(mp); |
1787 | 14.4k | newB->setBeginAtomIdx(atomIdx1); |
1788 | 14.4k | newB->setEndAtomIdx(atomIdx2); |
1789 | 14.4k | newB->setProp("_cxsmilesBondIdx",numBondsParsed++); |
1790 | 14.4k | mp->addBond(newB); |
1791 | 14.4k | delete newB; |
1792 | | |
1793 | 14.4k | branchPoints.push_back({atomIdx1, (yyvsp[-1].ival)}); |
1794 | 14.4k | } |
1795 | 14.4k | break; |
1796 | | |
1797 | 7.25k | case 24: /* mol: mol branch_open_token bond_expr atomd */ |
1798 | 7.25k | { |
1799 | 7.25k | RWMol *mp = (*molList)[(yyval.moli)]; |
1800 | 7.25k | int atomIdx1 = mp->getActiveAtom()->getIdx(); |
1801 | 7.25k | int atomIdx2 = mp->addAtom((yyvsp[0].atom),true,true); |
1802 | 7.25k | if( (yyvsp[-1].bond)->getBondType() == Bond::DATIVER ){ |
1803 | 11 | (yyvsp[-1].bond)->setBeginAtomIdx(atomIdx1); |
1804 | 11 | (yyvsp[-1].bond)->setEndAtomIdx(atomIdx2); |
1805 | 11 | (yyvsp[-1].bond)->setBondType(Bond::DATIVE); |
1806 | 7.23k | }else if ( (yyvsp[-1].bond)->getBondType() == Bond::DATIVEL ){ |
1807 | 15 | (yyvsp[-1].bond)->setBeginAtomIdx(atomIdx2); |
1808 | 15 | (yyvsp[-1].bond)->setEndAtomIdx(atomIdx1); |
1809 | 15 | (yyvsp[-1].bond)->setBondType(Bond::DATIVE); |
1810 | 7.22k | } else { |
1811 | 7.22k | (yyvsp[-1].bond)->setBeginAtomIdx(atomIdx1); |
1812 | 7.22k | (yyvsp[-1].bond)->setEndAtomIdx(atomIdx2); |
1813 | 7.22k | } |
1814 | 7.25k | (yyvsp[-1].bond)->setProp("_cxsmilesBondIdx",numBondsParsed++); |
1815 | 7.25k | mp->addBond((yyvsp[-1].bond),true); |
1816 | 7.25k | branchPoints.push_back({atomIdx1, (yyvsp[-2].ival)}); |
1817 | | |
1818 | 7.25k | } |
1819 | 7.25k | break; |
1820 | | |
1821 | 21.1k | case 25: /* mol: mol GROUP_CLOSE_TOKEN */ |
1822 | 21.1k | { |
1823 | 21.1k | if(branchPoints.empty()){ |
1824 | 0 | yyerror(input,molList,branchPoints,scanner,start_token, current_token_position, "extra close parentheses"); |
1825 | 0 | yyErrorCleanup(molList); |
1826 | 0 | YYABORT; |
1827 | 0 | } |
1828 | 21.1k | RWMol *mp = (*molList)[(yyval.moli)]; |
1829 | 21.1k | mp->setActiveAtom(branchPoints.back().first); |
1830 | 21.1k | branchPoints.pop_back(); |
1831 | 21.1k | } |
1832 | 0 | break; |
1833 | | |
1834 | 17.4k | case 28: /* atomd: ATOM_OPEN_TOKEN atom_expr ATOM_CLOSE_TOKEN */ |
1835 | 17.4k | { |
1836 | 17.4k | (yyval.atom) = (yyvsp[-1].atom); |
1837 | 17.4k | } |
1838 | 17.4k | break; |
1839 | | |
1840 | 2.08k | case 29: /* atomd: ATOM_OPEN_TOKEN atom_expr COLON_TOKEN number ATOM_CLOSE_TOKEN */ |
1841 | 2.08k | { |
1842 | 2.08k | (yyval.atom) = (yyvsp[-3].atom); |
1843 | 2.08k | (yyval.atom)->setProp(RDKit::common_properties::molAtomMapNumber,(yyvsp[-1].ival)); |
1844 | 2.08k | } |
1845 | 2.08k | break; |
1846 | | |
1847 | 50 | case 30: /* hydrogen_atom: ATOM_OPEN_TOKEN H_TOKEN ATOM_CLOSE_TOKEN */ |
1848 | 50 | { |
1849 | 50 | (yyval.atom) = new QueryAtom(1); |
1850 | 50 | } |
1851 | 50 | break; |
1852 | | |
1853 | 2.25k | case 31: /* hydrogen_atom: ATOM_OPEN_TOKEN H_TOKEN COLON_TOKEN number ATOM_CLOSE_TOKEN */ |
1854 | 2.25k | { |
1855 | 2.25k | (yyval.atom) = new QueryAtom(1); |
1856 | 2.25k | (yyval.atom)->setProp(RDKit::common_properties::molAtomMapNumber,(yyvsp[-1].ival)); |
1857 | 2.25k | } |
1858 | 2.25k | break; |
1859 | | |
1860 | 90 | case 32: /* hydrogen_atom: ATOM_OPEN_TOKEN number H_TOKEN ATOM_CLOSE_TOKEN */ |
1861 | 90 | { |
1862 | 90 | QueryAtom *newQ = new QueryAtom(1); |
1863 | 90 | newQ->setIsotope((yyvsp[-2].ival)); |
1864 | 90 | newQ->expandQuery(makeAtomIsotopeQuery((yyvsp[-2].ival)),Queries::COMPOSITE_AND,true); |
1865 | 90 | (yyval.atom)=newQ; |
1866 | 90 | } |
1867 | 90 | break; |
1868 | | |
1869 | 16 | case 33: /* hydrogen_atom: ATOM_OPEN_TOKEN number H_TOKEN COLON_TOKEN number ATOM_CLOSE_TOKEN */ |
1870 | 16 | { |
1871 | 16 | QueryAtom *newQ = new QueryAtom(1); |
1872 | 16 | newQ->setIsotope((yyvsp[-4].ival)); |
1873 | 16 | newQ->expandQuery(makeAtomIsotopeQuery((yyvsp[-4].ival)),Queries::COMPOSITE_AND,true); |
1874 | 16 | newQ->setProp(RDKit::common_properties::molAtomMapNumber,(yyvsp[-1].ival)); |
1875 | | |
1876 | 16 | (yyval.atom)=newQ; |
1877 | 16 | } |
1878 | 16 | break; |
1879 | | |
1880 | 105 | case 34: /* hydrogen_atom: ATOM_OPEN_TOKEN H_TOKEN charge_spec ATOM_CLOSE_TOKEN */ |
1881 | 105 | { |
1882 | 105 | QueryAtom *newQ = new QueryAtom(1); |
1883 | 105 | newQ->setFormalCharge((yyvsp[-1].ival)); |
1884 | 105 | newQ->getFlags() |= SMARTS_CHARGE_MASK; |
1885 | 105 | newQ->expandQuery(makeAtomFormalChargeQuery((yyvsp[-1].ival)),Queries::COMPOSITE_AND,true); |
1886 | 105 | (yyval.atom)=newQ; |
1887 | 105 | } |
1888 | 105 | break; |
1889 | | |
1890 | 73 | case 35: /* hydrogen_atom: ATOM_OPEN_TOKEN H_TOKEN charge_spec COLON_TOKEN number ATOM_CLOSE_TOKEN */ |
1891 | 73 | { |
1892 | 73 | QueryAtom *newQ = new QueryAtom(1); |
1893 | 73 | newQ->setFormalCharge((yyvsp[-3].ival)); |
1894 | 73 | newQ->getFlags() |= SMARTS_CHARGE_MASK; |
1895 | 73 | newQ->expandQuery(makeAtomFormalChargeQuery((yyvsp[-3].ival)),Queries::COMPOSITE_AND,true); |
1896 | 73 | newQ->setProp(RDKit::common_properties::molAtomMapNumber,(yyvsp[-1].ival)); |
1897 | | |
1898 | 73 | (yyval.atom)=newQ; |
1899 | 73 | } |
1900 | 73 | break; |
1901 | | |
1902 | 1.17k | case 36: /* hydrogen_atom: ATOM_OPEN_TOKEN number H_TOKEN charge_spec ATOM_CLOSE_TOKEN */ |
1903 | 1.17k | { |
1904 | 1.17k | QueryAtom *newQ = new QueryAtom(1); |
1905 | 1.17k | newQ->setIsotope((yyvsp[-3].ival)); |
1906 | 1.17k | newQ->setFormalCharge((yyvsp[-1].ival)); |
1907 | 1.17k | newQ->getFlags() |= SMARTS_CHARGE_MASK; |
1908 | 1.17k | newQ->expandQuery(makeAtomIsotopeQuery((yyvsp[-3].ival)),Queries::COMPOSITE_AND,true); |
1909 | 1.17k | newQ->expandQuery(makeAtomFormalChargeQuery((yyvsp[-1].ival)),Queries::COMPOSITE_AND,true); |
1910 | 1.17k | (yyval.atom)=newQ; |
1911 | 1.17k | } |
1912 | 1.17k | break; |
1913 | | |
1914 | 111 | case 37: /* hydrogen_atom: ATOM_OPEN_TOKEN number H_TOKEN charge_spec COLON_TOKEN number ATOM_CLOSE_TOKEN */ |
1915 | 111 | { |
1916 | 111 | QueryAtom *newQ = new QueryAtom(1); |
1917 | 111 | newQ->setIsotope((yyvsp[-5].ival)); |
1918 | 111 | newQ->setFormalCharge((yyvsp[-3].ival)); |
1919 | 111 | newQ->getFlags() |= SMARTS_CHARGE_MASK; |
1920 | 111 | newQ->expandQuery(makeAtomIsotopeQuery((yyvsp[-5].ival)),Queries::COMPOSITE_AND,true); |
1921 | 111 | newQ->expandQuery(makeAtomFormalChargeQuery((yyvsp[-3].ival)),Queries::COMPOSITE_AND,true); |
1922 | 111 | newQ->setProp(RDKit::common_properties::molAtomMapNumber,(yyvsp[-1].ival)); |
1923 | | |
1924 | 111 | (yyval.atom)=newQ; |
1925 | 111 | } |
1926 | 111 | break; |
1927 | | |
1928 | 0 | case 38: /* atom_expr: atom_expr AND_TOKEN atom_expr */ |
1929 | 0 | { |
1930 | 0 | (yyvsp[-2].atom)->expandQuery((yyvsp[0].atom)->getQuery()->copy(),Queries::COMPOSITE_AND,true); |
1931 | 0 | if ((yyvsp[-2].atom)->getChiralTag()==Atom::CHI_UNSPECIFIED) { (yyvsp[-2].atom)->setChiralTag((yyvsp[0].atom)->getChiralTag()); } |
1932 | 0 | SmilesParseOps::ClearAtomChemicalProps((yyvsp[-2].atom)); |
1933 | 0 | delete (yyvsp[0].atom); |
1934 | 0 | (yyval.atom) = (yyvsp[-2].atom); |
1935 | 0 | } |
1936 | 0 | break; |
1937 | | |
1938 | 18.2k | case 39: /* atom_expr: atom_expr OR_TOKEN atom_expr */ |
1939 | 18.2k | { |
1940 | 18.2k | (yyvsp[-2].atom)->expandQuery((yyvsp[0].atom)->getQuery()->copy(),Queries::COMPOSITE_OR,true); |
1941 | 18.2k | if ((yyvsp[-2].atom)->getChiralTag()==Atom::CHI_UNSPECIFIED) { (yyvsp[-2].atom)->setChiralTag((yyvsp[0].atom)->getChiralTag()); } |
1942 | 18.2k | SmilesParseOps::ClearAtomChemicalProps((yyvsp[-2].atom)); |
1943 | 18.2k | (yyvsp[-2].atom)->setAtomicNum(0); |
1944 | 18.2k | delete (yyvsp[0].atom); |
1945 | 18.2k | (yyval.atom) = (yyvsp[-2].atom); |
1946 | 18.2k | } |
1947 | 18.2k | break; |
1948 | | |
1949 | 7.33k | case 40: /* atom_expr: atom_expr SEMI_TOKEN atom_expr */ |
1950 | 7.33k | { |
1951 | 7.33k | (yyvsp[-2].atom)->expandQuery((yyvsp[0].atom)->getQuery()->copy(),Queries::COMPOSITE_AND,true); |
1952 | 7.33k | if ((yyvsp[-2].atom)->getChiralTag()==Atom::CHI_UNSPECIFIED) { (yyvsp[-2].atom)->setChiralTag((yyvsp[0].atom)->getChiralTag()); } |
1953 | 7.33k | SmilesParseOps::ClearAtomChemicalProps((yyvsp[-2].atom)); |
1954 | 7.33k | delete (yyvsp[0].atom); |
1955 | 7.33k | (yyval.atom) = (yyvsp[-2].atom); |
1956 | 7.33k | } |
1957 | 7.33k | break; |
1958 | | |
1959 | 1.06M | case 41: /* atom_expr: atom_expr point_query */ |
1960 | 1.06M | { |
1961 | 1.06M | atom_expr_and_point_query((yyvsp[-1].atom), (yyvsp[0].atom)); |
1962 | 1.06M | delete (yyvsp[0].atom); |
1963 | 1.06M | (yyval.atom) = (yyvsp[-1].atom); |
1964 | 1.06M | } |
1965 | 1.06M | break; |
1966 | | |
1967 | 4.24k | case 42: /* atom_expr: atom_expr AND_TOKEN point_query */ |
1968 | 4.24k | { |
1969 | 4.24k | atom_expr_and_point_query((yyvsp[-2].atom), (yyvsp[0].atom)); |
1970 | 4.24k | delete (yyvsp[0].atom); |
1971 | 4.24k | (yyval.atom) = (yyvsp[-2].atom); |
1972 | 4.24k | } |
1973 | 4.24k | break; |
1974 | | |
1975 | 10.3k | case 44: /* point_query: NOT_TOKEN point_query */ |
1976 | 10.3k | { |
1977 | 10.3k | (yyvsp[0].atom)->getQuery()->setNegation(!((yyvsp[0].atom)->getQuery()->getNegation())); |
1978 | 10.3k | (yyvsp[0].atom)->setAtomicNum(0); |
1979 | 10.3k | SmilesParseOps::ClearAtomChemicalProps((yyvsp[0].atom)); |
1980 | 10.3k | (yyval.atom) = (yyvsp[0].atom); |
1981 | 10.3k | } |
1982 | 10.3k | break; |
1983 | | |
1984 | 226 | case 47: /* recursive_query: BEGIN_RECURSE mol END_RECURSE */ |
1985 | 226 | { |
1986 | | // this is a recursive SMARTS expression |
1987 | 226 | QueryAtom *qA = new QueryAtom(); |
1988 | | // FIX: there's maybe a leak here |
1989 | 226 | RWMol *molP = (*molList)[(yyvsp[-1].moli)]; |
1990 | | // close any rings in the molecule: |
1991 | 226 | SmilesParseOps::CloseMolRings(molP,0); |
1992 | | |
1993 | | //molP->debugMol(std::cout); |
1994 | 226 | qA->setQuery(new RecursiveStructureQuery(molP)); |
1995 | | //std::cout << "qA: " << qA << " " << qA->getQuery() << std::endl; |
1996 | 226 | int sz = molList->size(); |
1997 | 226 | if ( sz==(yyvsp[-1].moli)+1) { |
1998 | 217 | molList->resize( sz-1 ); |
1999 | 217 | } |
2000 | 226 | (yyval.atom) = qA; |
2001 | 226 | } |
2002 | 226 | break; |
2003 | | |
2004 | 1.23k | case 48: /* recursive_query: BEGIN_RECURSE mol END_RECURSE UNDERSCORE_TOKEN nonzero_number */ |
2005 | 1.23k | { |
2006 | | // UNDOCUMENTED EXTENSION: |
2007 | | // this is a recursive SMARTS expression with a serial number |
2008 | | // please don't write your own SMARTS that include this extension: |
2009 | | // the RDKit smarts parsing code will automatically insert serial |
2010 | | // numbers for recursive smarts patterns. |
2011 | 1.23k | QueryAtom *qA = new QueryAtom(); |
2012 | | // FIX: there's maybe a leak here |
2013 | 1.23k | RWMol *molP = (*molList)[(yyvsp[-3].moli)]; |
2014 | | // close any rings in the molecule: |
2015 | 1.23k | SmilesParseOps::CloseMolRings(molP,0); |
2016 | | |
2017 | | //molP->debugMol(std::cout); |
2018 | 1.23k | qA->setQuery(new RecursiveStructureQuery(molP,(yyvsp[0].ival))); |
2019 | | //std::cout << "qA: " << qA << " " << qA->getQuery() << std::endl; |
2020 | 1.23k | int sz = molList->size(); |
2021 | 1.23k | if ( sz==(yyvsp[-3].moli)+1) { |
2022 | 1.22k | molList->resize( sz-1 ); |
2023 | 1.22k | } |
2024 | 1.23k | (yyval.atom) = qA; |
2025 | 1.23k | } |
2026 | 1.23k | break; |
2027 | | |
2028 | 786 | case 50: /* atom_query: number simple_atom */ |
2029 | 786 | { |
2030 | 786 | (yyvsp[0].atom)->setIsotope((yyvsp[-1].ival)); |
2031 | 786 | (yyvsp[0].atom)->expandQuery(makeAtomIsotopeQuery((yyvsp[-1].ival)),Queries::COMPOSITE_AND,true); |
2032 | 786 | (yyval.atom)=(yyvsp[0].atom); |
2033 | 786 | } |
2034 | 786 | break; |
2035 | | |
2036 | 143 | case 52: /* atom_query: number ATOM_TOKEN */ |
2037 | 143 | { |
2038 | 143 | (yyvsp[0].atom)->setIsotope((yyvsp[-1].ival)); |
2039 | 143 | (yyvsp[0].atom)->expandQuery(makeAtomIsotopeQuery((yyvsp[-1].ival)),Queries::COMPOSITE_AND,true); |
2040 | 143 | (yyval.atom)=(yyvsp[0].atom); |
2041 | 143 | } |
2042 | 143 | break; |
2043 | | |
2044 | 183 | case 53: /* atom_query: HASH_TOKEN number */ |
2045 | 183 | { (yyval.atom) = new QueryAtom((yyvsp[0].ival)); } |
2046 | 183 | break; |
2047 | | |
2048 | 127 | case 54: /* atom_query: number HASH_TOKEN number */ |
2049 | 127 | { |
2050 | 127 | (yyval.atom) = new QueryAtom((yyvsp[0].ival)); |
2051 | 127 | (yyval.atom)->setIsotope((yyvsp[-2].ival)); |
2052 | 127 | (yyval.atom)->expandQuery(makeAtomIsotopeQuery((yyvsp[-2].ival)),Queries::COMPOSITE_AND,true); |
2053 | 127 | } |
2054 | 127 | break; |
2055 | | |
2056 | 4.05k | case 62: /* atom_query: COMPLEX_ATOM_QUERY_TOKEN number */ |
2057 | 4.05k | { |
2058 | 4.05k | static_cast<ATOM_EQUALS_QUERY *>((yyvsp[-1].atom)->getQuery())->setVal((yyvsp[0].ival)); |
2059 | 4.05k | (yyval.atom) = (yyvsp[-1].atom); |
2060 | 4.05k | } |
2061 | 4.05k | break; |
2062 | | |
2063 | 107 | case 63: /* atom_query: HETERONEIGHBOR_ATOM_QUERY_TOKEN number */ |
2064 | 107 | { |
2065 | 107 | (yyvsp[-1].atom)->setQuery(makeAtomNumHeteroatomNbrsQuery((yyvsp[0].ival))); |
2066 | 107 | (yyval.atom) = (yyvsp[-1].atom); |
2067 | 107 | } |
2068 | 107 | break; |
2069 | | |
2070 | 5.45k | case 64: /* atom_query: ALIPHATICHETERONEIGHBOR_ATOM_QUERY_TOKEN number */ |
2071 | 5.45k | { |
2072 | 5.45k | (yyvsp[-1].atom)->setQuery(makeAtomNumAliphaticHeteroatomNbrsQuery((yyvsp[0].ival))); |
2073 | 5.45k | (yyval.atom) = (yyvsp[-1].atom); |
2074 | 5.45k | } |
2075 | 5.45k | break; |
2076 | | |
2077 | 1.34k | case 65: /* atom_query: MIN_RINGSIZE_ATOM_QUERY_TOKEN number */ |
2078 | 1.34k | { |
2079 | 1.34k | (yyvsp[-1].atom)->setQuery(makeAtomMinRingSizeQuery((yyvsp[0].ival))); |
2080 | 1.34k | (yyval.atom) = (yyvsp[-1].atom); |
2081 | 1.34k | } |
2082 | 1.34k | break; |
2083 | | |
2084 | 27 | case 66: /* atom_query: RINGSIZE_ATOM_QUERY_TOKEN number */ |
2085 | 27 | { |
2086 | 27 | (yyvsp[-1].atom)->setQuery(makeAtomInRingOfSizeQuery((yyvsp[0].ival))); |
2087 | 27 | (yyval.atom) = (yyvsp[-1].atom); |
2088 | 27 | } |
2089 | 27 | break; |
2090 | | |
2091 | 49 | case 67: /* atom_query: RINGBOND_ATOM_QUERY_TOKEN number */ |
2092 | 49 | { |
2093 | 49 | (yyvsp[-1].atom)->setQuery(makeAtomRingBondCountQuery((yyvsp[0].ival))); |
2094 | 49 | (yyval.atom) = (yyvsp[-1].atom); |
2095 | 49 | } |
2096 | 49 | break; |
2097 | | |
2098 | 135 | case 68: /* atom_query: IMPLICIT_H_ATOM_QUERY_TOKEN number */ |
2099 | 135 | { |
2100 | 135 | (yyvsp[-1].atom)->setQuery(makeAtomImplicitHCountQuery((yyvsp[0].ival))); |
2101 | 135 | (yyval.atom) = (yyvsp[-1].atom); |
2102 | 135 | } |
2103 | 135 | break; |
2104 | | |
2105 | 6 | case 69: /* atom_query: possible_range_query RANGE_OPEN_TOKEN MINUS_TOKEN number RANGE_CLOSE_TOKEN */ |
2106 | 6 | { |
2107 | 6 | ATOM_EQUALS_QUERY *oq = static_cast<ATOM_EQUALS_QUERY *>((yyvsp[-4].atom)->getQuery()); |
2108 | 6 | ATOM_GREATEREQUAL_QUERY *nq = makeAtomSimpleQuery<ATOM_GREATEREQUAL_QUERY>((yyvsp[-1].ival),oq->getDataFunc(), |
2109 | 6 | std::string("greater_")+oq->getDescription()); |
2110 | 6 | (yyvsp[-4].atom)->setQuery(nq); |
2111 | 6 | (yyval.atom) = (yyvsp[-4].atom); |
2112 | 6 | } |
2113 | 6 | break; |
2114 | | |
2115 | 0 | case 70: /* atom_query: possible_range_query RANGE_OPEN_TOKEN number MINUS_TOKEN RANGE_CLOSE_TOKEN */ |
2116 | 0 | { |
2117 | 0 | ATOM_EQUALS_QUERY *oq = static_cast<ATOM_EQUALS_QUERY *>((yyvsp[-4].atom)->getQuery()); |
2118 | 0 | ATOM_LESSEQUAL_QUERY *nq = makeAtomSimpleQuery<ATOM_LESSEQUAL_QUERY>((yyvsp[-2].ival),oq->getDataFunc(), |
2119 | 0 | std::string("less_")+oq->getDescription()); |
2120 | 0 | (yyvsp[-4].atom)->setQuery(nq); |
2121 | 0 | (yyval.atom) = (yyvsp[-4].atom); |
2122 | 0 | } |
2123 | 0 | break; |
2124 | | |
2125 | 0 | case 71: /* atom_query: possible_range_query RANGE_OPEN_TOKEN number MINUS_TOKEN number RANGE_CLOSE_TOKEN */ |
2126 | 0 | { |
2127 | 0 | ATOM_EQUALS_QUERY *oq = static_cast<ATOM_EQUALS_QUERY *>((yyvsp[-5].atom)->getQuery()); |
2128 | 0 | ATOM_RANGE_QUERY *nq = makeAtomRangeQuery((yyvsp[-3].ival),(yyvsp[-1].ival),false,false, |
2129 | 0 | oq->getDataFunc(), |
2130 | 0 | std::string("range_")+oq->getDescription()); |
2131 | 0 | (yyvsp[-5].atom)->setQuery(nq); |
2132 | 0 | (yyval.atom) = (yyvsp[-5].atom); |
2133 | 0 | } |
2134 | 0 | break; |
2135 | | |
2136 | 24 | case 72: /* atom_query: RINGSIZE_ATOM_QUERY_TOKEN RANGE_OPEN_TOKEN MINUS_TOKEN number RANGE_CLOSE_TOKEN */ |
2137 | 24 | { |
2138 | 24 | int lv = -1; |
2139 | 24 | int uv = (yyvsp[-1].ival); |
2140 | 24 | ATOM_GREATEREQUAL_QUERY *nq = makeAtomSimpleQuery<ATOM_GREATEREQUAL_QUERY>(uv,[lv,uv](Atom const *at) { |
2141 | 0 | return queryAtomIsInRingOfSize(at, lv, uv); |
2142 | 0 | },std::string("greater_AtomRingSize")); |
2143 | 24 | (yyvsp[-4].atom)->setQuery(nq); |
2144 | 24 | (yyval.atom) = (yyvsp[-4].atom); |
2145 | 24 | } |
2146 | 24 | break; |
2147 | | |
2148 | 0 | case 73: /* atom_query: RINGSIZE_ATOM_QUERY_TOKEN RANGE_OPEN_TOKEN number MINUS_TOKEN RANGE_CLOSE_TOKEN */ |
2149 | 0 | { |
2150 | 0 | int lv = (yyvsp[-2].ival); |
2151 | 0 | int uv = -1; |
2152 | 0 | ATOM_LESSEQUAL_QUERY *nq = makeAtomSimpleQuery<ATOM_LESSEQUAL_QUERY>(lv,[lv,uv](Atom const *at) { |
2153 | 0 | return queryAtomIsInRingOfSize(at, lv, uv); |
2154 | 0 | },std::string("less_AtomRingSize")); |
2155 | 0 | (yyvsp[-4].atom)->setQuery(nq); |
2156 | 0 | (yyval.atom) = (yyvsp[-4].atom); |
2157 | 0 | } |
2158 | 0 | break; |
2159 | | |
2160 | 0 | case 74: /* atom_query: RINGSIZE_ATOM_QUERY_TOKEN RANGE_OPEN_TOKEN number MINUS_TOKEN number RANGE_CLOSE_TOKEN */ |
2161 | 0 | { |
2162 | 0 | int lv = (yyvsp[-3].ival); |
2163 | 0 | int uv = (yyvsp[-1].ival); |
2164 | 0 | ATOM_RANGE_QUERY *nq = makeAtomRangeQuery(lv,uv,false,false,[lv,uv](Atom const *at) { |
2165 | 0 | return queryAtomIsInRingOfSize(at, lv, uv); |
2166 | 0 | },std::string("range_AtomRingSize")); |
2167 | 0 | (yyvsp[-5].atom)->setQuery(nq); |
2168 | 0 | (yyval.atom) = (yyvsp[-5].atom); |
2169 | 0 | } |
2170 | 0 | break; |
2171 | | |
2172 | 313 | case 75: /* atom_query: number H_TOKEN */ |
2173 | 313 | { |
2174 | 313 | QueryAtom *newQ = new QueryAtom(); |
2175 | 313 | newQ->setQuery(makeAtomIsotopeQuery((yyvsp[-1].ival))); |
2176 | 313 | newQ->setIsotope((yyvsp[-1].ival)); |
2177 | 313 | newQ->expandQuery(makeAtomHCountQuery(1),Queries::COMPOSITE_AND,true); |
2178 | 313 | newQ->setNumExplicitHs(1); |
2179 | 313 | newQ->setNoImplicit(true); |
2180 | 313 | newQ->getFlags() |= SMARTS_H_MASK; |
2181 | 313 | (yyval.atom)=newQ; |
2182 | 313 | } |
2183 | 313 | break; |
2184 | | |
2185 | 7.31k | case 76: /* atom_query: number H_TOKEN number */ |
2186 | 7.31k | { |
2187 | 7.31k | QueryAtom *newQ = new QueryAtom(); |
2188 | 7.31k | newQ->setQuery(makeAtomIsotopeQuery((yyvsp[-2].ival))); |
2189 | 7.31k | newQ->setIsotope((yyvsp[-2].ival)); |
2190 | 7.31k | newQ->expandQuery(makeAtomHCountQuery((yyvsp[0].ival)),Queries::COMPOSITE_AND,true); |
2191 | 7.31k | newQ->setNumExplicitHs((yyvsp[0].ival)); |
2192 | 7.31k | newQ->setNoImplicit(true); |
2193 | 7.31k | newQ->getFlags() |= SMARTS_H_MASK; |
2194 | 7.31k | (yyval.atom)=newQ; |
2195 | 7.31k | } |
2196 | 7.31k | break; |
2197 | | |
2198 | 3.02k | case 77: /* atom_query: H_TOKEN number */ |
2199 | 3.02k | { |
2200 | 3.02k | QueryAtom *newQ = new QueryAtom(); |
2201 | 3.02k | newQ->setQuery(makeAtomHCountQuery((yyvsp[0].ival))); |
2202 | 3.02k | newQ->setNumExplicitHs((yyvsp[0].ival)); |
2203 | 3.02k | newQ->setNoImplicit(true); |
2204 | 3.02k | newQ->getFlags() |= SMARTS_H_MASK; |
2205 | 3.02k | (yyval.atom)=newQ; |
2206 | | |
2207 | 3.02k | } |
2208 | 3.02k | break; |
2209 | | |
2210 | 214k | case 78: /* atom_query: H_TOKEN */ |
2211 | 214k | { |
2212 | 214k | QueryAtom *newQ = new QueryAtom(); |
2213 | 214k | newQ->setQuery(makeAtomHCountQuery(1)); |
2214 | 214k | newQ->setNumExplicitHs(1); |
2215 | 214k | newQ->setNoImplicit(true); |
2216 | 214k | newQ->getFlags() |= SMARTS_H_MASK; |
2217 | 214k | (yyval.atom)=newQ; |
2218 | 214k | } |
2219 | 214k | break; |
2220 | | |
2221 | 18.0k | case 79: /* atom_query: charge_spec */ |
2222 | 18.0k | { |
2223 | 18.0k | QueryAtom *newQ = new QueryAtom(); |
2224 | 18.0k | newQ->setQuery(makeAtomFormalChargeQuery((yyvsp[0].ival))); |
2225 | 18.0k | newQ->setFormalCharge((yyvsp[0].ival)); |
2226 | 18.0k | newQ->getFlags() |= SMARTS_CHARGE_MASK; |
2227 | 18.0k | (yyval.atom)=newQ; |
2228 | 18.0k | } |
2229 | 18.0k | break; |
2230 | | |
2231 | 7.95k | case 80: /* atom_query: AT_TOKEN AT_TOKEN */ |
2232 | 7.95k | { |
2233 | 7.95k | QueryAtom *newQ = new QueryAtom(); |
2234 | 7.95k | newQ->setQuery(makeAtomNullQuery()); |
2235 | 7.95k | newQ->setChiralTag(Atom::CHI_TETRAHEDRAL_CW); |
2236 | 7.95k | (yyval.atom)=newQ; |
2237 | 7.95k | } |
2238 | 7.95k | break; |
2239 | | |
2240 | 39.0k | case 81: /* atom_query: AT_TOKEN */ |
2241 | 39.0k | { |
2242 | 39.0k | QueryAtom *newQ = new QueryAtom(); |
2243 | 39.0k | newQ->setQuery(makeAtomNullQuery()); |
2244 | 39.0k | newQ->setChiralTag(Atom::CHI_TETRAHEDRAL_CCW); |
2245 | 39.0k | (yyval.atom)=newQ; |
2246 | 39.0k | } |
2247 | 39.0k | break; |
2248 | | |
2249 | 2.60k | case 82: /* atom_query: CHI_CLASS_TOKEN */ |
2250 | 2.60k | { |
2251 | 2.60k | QueryAtom *newQ = new QueryAtom(); |
2252 | 2.60k | newQ->setQuery(makeAtomNullQuery()); |
2253 | 2.60k | newQ->setChiralTag((yyvsp[0].chiraltype)); |
2254 | 2.60k | newQ->setProp(common_properties::_chiralPermutation,0); |
2255 | 2.60k | (yyval.atom)=newQ; |
2256 | 2.60k | } |
2257 | 2.60k | break; |
2258 | | |
2259 | 1.03k | case 83: /* atom_query: CHI_CLASS_TOKEN number */ |
2260 | 1.03k | { |
2261 | 1.03k | if((yyvsp[0].ival)==0){ |
2262 | 2 | yyerror(input,molList,branchPoints,scanner,start_token, current_token_position, |
2263 | 2 | "chiral permutation cannot be zero"); |
2264 | 2 | yyErrorCleanup(molList); |
2265 | 2 | YYABORT; |
2266 | 2 | } |
2267 | | |
2268 | 1.02k | QueryAtom *newQ = new QueryAtom(); |
2269 | 1.02k | newQ->setQuery(makeAtomNullQuery()); |
2270 | 1.02k | newQ->setChiralTag((yyvsp[-1].chiraltype)); |
2271 | 1.02k | newQ->setProp(common_properties::_chiralPermutation,(yyvsp[0].ival)); |
2272 | 1.02k | (yyval.atom)=newQ; |
2273 | 1.02k | } |
2274 | 0 | break; |
2275 | | |
2276 | 58.3k | case 85: /* atom_query: number */ |
2277 | 58.3k | { |
2278 | 58.3k | QueryAtom *newQ = new QueryAtom(); |
2279 | 58.3k | newQ->setQuery(makeAtomIsotopeQuery((yyvsp[0].ival))); |
2280 | 58.3k | (yyval.atom)=newQ; |
2281 | 58.3k | } |
2282 | 58.3k | break; |
2283 | | |
2284 | 1 | case 87: /* possible_range_query: HETERONEIGHBOR_ATOM_QUERY_TOKEN */ |
2285 | 1 | { |
2286 | 1 | (yyvsp[0].atom)->setQuery(makeAtomNumHeteroatomNbrsQuery(0)); |
2287 | 1 | (yyval.atom) = (yyvsp[0].atom); |
2288 | 1 | } |
2289 | 1 | break; |
2290 | | |
2291 | 2 | case 88: /* possible_range_query: ALIPHATICHETERONEIGHBOR_ATOM_QUERY_TOKEN */ |
2292 | 2 | { |
2293 | 2 | (yyvsp[0].atom)->setQuery(makeAtomNumAliphaticHeteroatomNbrsQuery(0)); |
2294 | 2 | (yyval.atom) = (yyvsp[0].atom); |
2295 | 2 | } |
2296 | 2 | break; |
2297 | | |
2298 | 2 | case 89: /* possible_range_query: MIN_RINGSIZE_ATOM_QUERY_TOKEN */ |
2299 | 2 | { |
2300 | 2 | (yyvsp[0].atom)->setQuery(makeAtomMinRingSizeQuery(5)); // this is going to be ignored anyway |
2301 | 2 | (yyval.atom) = (yyvsp[0].atom); |
2302 | 2 | } |
2303 | 2 | break; |
2304 | | |
2305 | 1 | case 90: /* possible_range_query: RINGBOND_ATOM_QUERY_TOKEN */ |
2306 | 1 | { |
2307 | 1 | (yyvsp[0].atom)->setQuery(makeAtomRingBondCountQuery(0)); |
2308 | 1 | (yyval.atom) = (yyvsp[0].atom); |
2309 | 1 | } |
2310 | 1 | break; |
2311 | | |
2312 | 1 | case 91: /* possible_range_query: IMPLICIT_H_ATOM_QUERY_TOKEN */ |
2313 | 1 | { |
2314 | 1 | (yyvsp[0].atom)->setQuery(makeAtomImplicitHCountQuery(0)); |
2315 | 1 | (yyval.atom) = (yyvsp[0].atom); |
2316 | 1 | } |
2317 | 1 | break; |
2318 | | |
2319 | 6 | case 92: /* possible_range_query: PLUS_TOKEN */ |
2320 | 6 | { |
2321 | 6 | QueryAtom *newQ = new QueryAtom(); |
2322 | 6 | newQ->setQuery(makeAtomFormalChargeQuery(0)); |
2323 | 6 | (yyval.atom) = newQ; |
2324 | 6 | } |
2325 | 6 | break; |
2326 | | |
2327 | 3 | case 93: /* possible_range_query: MINUS_TOKEN */ |
2328 | 3 | { |
2329 | 3 | QueryAtom *newQ = new QueryAtom(); |
2330 | 3 | newQ->setQuery(makeAtomNegativeFormalChargeQuery(0)); |
2331 | 3 | (yyval.atom) = newQ; |
2332 | 3 | } |
2333 | 3 | break; |
2334 | | |
2335 | 85.8k | case 94: /* simple_atom: ORGANIC_ATOM_TOKEN */ |
2336 | 85.8k | { |
2337 | | // |
2338 | | // This construction (and some others) may seem odd, but the |
2339 | | // SMARTS definition requires that an atom which is aliphatic on |
2340 | | // input (i.e. something in the "organic subset" that is given with |
2341 | | // a capital letter) only match aliphatic atoms. |
2342 | | // |
2343 | | // The following rule applies a similar logic to aromatic atoms. |
2344 | | // |
2345 | 85.8k | (yyval.atom) = new QueryAtom((yyvsp[0].ival)); |
2346 | 85.8k | (yyval.atom)->setQuery(makeAtomTypeQuery((yyvsp[0].ival),false)); |
2347 | 85.8k | } |
2348 | 85.8k | break; |
2349 | | |
2350 | 114k | case 95: /* simple_atom: AROMATIC_ATOM_TOKEN */ |
2351 | 114k | { |
2352 | 114k | (yyval.atom) = new QueryAtom((yyvsp[0].ival)); |
2353 | 114k | (yyval.atom)->setIsAromatic(true); |
2354 | 114k | (yyval.atom)->setQuery(makeAtomTypeQuery((yyvsp[0].ival),true)); |
2355 | 114k | } |
2356 | 114k | break; |
2357 | | |
2358 | 3.77k | case 97: /* bond_expr: bond_expr AND_TOKEN bond_expr */ |
2359 | 3.77k | { |
2360 | 3.77k | (yyvsp[-2].bond)->expandQuery((yyvsp[0].bond)->getQuery()->copy(),Queries::COMPOSITE_AND,true); |
2361 | 3.77k | delete (yyvsp[0].bond); |
2362 | 3.77k | (yyval.bond) = (yyvsp[-2].bond); |
2363 | 3.77k | } |
2364 | 3.77k | break; |
2365 | | |
2366 | 6.59k | case 98: /* bond_expr: bond_expr OR_TOKEN bond_expr */ |
2367 | 6.59k | { |
2368 | 6.59k | (yyvsp[-2].bond)->expandQuery((yyvsp[0].bond)->getQuery()->copy(),Queries::COMPOSITE_OR,true); |
2369 | 6.59k | delete (yyvsp[0].bond); |
2370 | 6.59k | (yyval.bond) = (yyvsp[-2].bond); |
2371 | 6.59k | } |
2372 | 6.59k | break; |
2373 | | |
2374 | 1.77k | case 99: /* bond_expr: bond_expr SEMI_TOKEN bond_expr */ |
2375 | 1.77k | { |
2376 | 1.77k | (yyvsp[-2].bond)->expandQuery((yyvsp[0].bond)->getQuery()->copy(),Queries::COMPOSITE_AND,true); |
2377 | 1.77k | delete (yyvsp[0].bond); |
2378 | 1.77k | (yyval.bond) = (yyvsp[-2].bond); |
2379 | 1.77k | } |
2380 | 1.77k | break; |
2381 | | |
2382 | 42.5k | case 102: /* bond_query: bond_query bondd */ |
2383 | 42.5k | { |
2384 | 42.5k | (yyvsp[-1].bond)->expandQuery((yyvsp[0].bond)->getQuery()->copy(),Queries::COMPOSITE_AND,true); |
2385 | 42.5k | delete (yyvsp[0].bond); |
2386 | 42.5k | (yyval.bond) = (yyvsp[-1].bond); |
2387 | 42.5k | } |
2388 | 42.5k | break; |
2389 | | |
2390 | 25.4k | case 104: /* bondd: MINUS_TOKEN */ |
2391 | 25.4k | { |
2392 | 25.4k | QueryBond *newB= new QueryBond(); |
2393 | 25.4k | newB->setBondType(Bond::SINGLE); |
2394 | 25.4k | newB->setQuery(makeBondOrderEqualsQuery(Bond::SINGLE)); |
2395 | 25.4k | (yyval.bond) = newB; |
2396 | 25.4k | } |
2397 | 25.4k | break; |
2398 | | |
2399 | 3.78k | case 105: /* bondd: HASH_TOKEN */ |
2400 | 3.78k | { |
2401 | 3.78k | QueryBond *newB= new QueryBond(); |
2402 | 3.78k | newB->setBondType(Bond::TRIPLE); |
2403 | 3.78k | newB->setQuery(makeBondOrderEqualsQuery(Bond::TRIPLE)); |
2404 | 3.78k | (yyval.bond) = newB; |
2405 | 3.78k | } |
2406 | 3.78k | break; |
2407 | | |
2408 | 8.20k | case 106: /* bondd: COLON_TOKEN */ |
2409 | 8.20k | { |
2410 | 8.20k | QueryBond *newB= new QueryBond(); |
2411 | 8.20k | newB->setBondType(Bond::AROMATIC); |
2412 | 8.20k | newB->setQuery(makeBondOrderEqualsQuery(Bond::AROMATIC)); |
2413 | 8.20k | (yyval.bond) = newB; |
2414 | 8.20k | } |
2415 | 8.20k | break; |
2416 | | |
2417 | 1.56k | case 107: /* bondd: AT_TOKEN */ |
2418 | 1.56k | { |
2419 | 1.56k | QueryBond *newB= new QueryBond(); |
2420 | 1.56k | newB->setQuery(makeBondIsInRingQuery()); |
2421 | 1.56k | (yyval.bond) = newB; |
2422 | 1.56k | } |
2423 | 1.56k | break; |
2424 | | |
2425 | 1.44k | case 108: /* bondd: NOT_TOKEN bondd */ |
2426 | 1.44k | { |
2427 | 1.44k | (yyvsp[0].bond)->getQuery()->setNegation(!((yyvsp[0].bond)->getQuery()->getNegation())); |
2428 | 1.44k | (yyval.bond) = (yyvsp[0].bond); |
2429 | 1.44k | } |
2430 | 1.44k | break; |
2431 | | |
2432 | 3.12k | case 109: /* charge_spec: PLUS_TOKEN PLUS_TOKEN */ |
2433 | 3.12k | { (yyval.ival)=2; } |
2434 | 3.12k | break; |
2435 | | |
2436 | 1.90k | case 110: /* charge_spec: PLUS_TOKEN number */ |
2437 | 1.90k | { (yyval.ival)=(yyvsp[0].ival); } |
2438 | 1.90k | break; |
2439 | | |
2440 | 2.22k | case 111: /* charge_spec: PLUS_TOKEN */ |
2441 | 2.22k | { (yyval.ival)=1; } |
2442 | 2.22k | break; |
2443 | | |
2444 | 692 | case 112: /* charge_spec: MINUS_TOKEN MINUS_TOKEN */ |
2445 | 692 | { (yyval.ival)=-2; } |
2446 | 692 | break; |
2447 | | |
2448 | 2.96k | case 113: /* charge_spec: MINUS_TOKEN number */ |
2449 | 2.96k | { (yyval.ival)=-(yyvsp[0].ival); } |
2450 | 2.96k | break; |
2451 | | |
2452 | 8.61k | case 114: /* charge_spec: MINUS_TOKEN */ |
2453 | 8.61k | { (yyval.ival)=-1; } |
2454 | 8.61k | break; |
2455 | | |
2456 | 134 | case 116: /* ring_number: PERCENT_TOKEN NONZERO_DIGIT_TOKEN digit */ |
2457 | 134 | { (yyval.ival) = (yyvsp[-1].ival)*10+(yyvsp[0].ival); } |
2458 | 134 | break; |
2459 | | |
2460 | 99 | case 117: /* ring_number: PERCENT_TOKEN GROUP_OPEN_TOKEN digit GROUP_CLOSE_TOKEN */ |
2461 | 99 | { (yyval.ival) = (yyvsp[-1].ival); } |
2462 | 99 | break; |
2463 | | |
2464 | 9 | case 118: /* ring_number: PERCENT_TOKEN GROUP_OPEN_TOKEN digit digit GROUP_CLOSE_TOKEN */ |
2465 | 9 | { (yyval.ival) = (yyvsp[-2].ival)*10+(yyvsp[-1].ival); } |
2466 | 9 | break; |
2467 | | |
2468 | 26 | case 119: /* ring_number: PERCENT_TOKEN GROUP_OPEN_TOKEN digit digit digit GROUP_CLOSE_TOKEN */ |
2469 | 26 | { (yyval.ival) = (yyvsp[-3].ival)*100+(yyvsp[-2].ival)*10+(yyvsp[-1].ival); } |
2470 | 26 | break; |
2471 | | |
2472 | 16 | case 120: /* ring_number: PERCENT_TOKEN GROUP_OPEN_TOKEN digit digit digit digit GROUP_CLOSE_TOKEN */ |
2473 | 16 | { (yyval.ival) = (yyvsp[-4].ival)*1000+(yyvsp[-3].ival)*100+(yyvsp[-2].ival)*10+(yyvsp[-1].ival); } |
2474 | 16 | break; |
2475 | | |
2476 | 66 | case 121: /* ring_number: PERCENT_TOKEN GROUP_OPEN_TOKEN digit digit digit digit digit GROUP_CLOSE_TOKEN */ |
2477 | 66 | { (yyval.ival) = (yyvsp[-5].ival)*10000+(yyvsp[-4].ival)*1000+(yyvsp[-3].ival)*100+(yyvsp[-2].ival)*10+(yyvsp[-1].ival); } |
2478 | 66 | break; |
2479 | | |
2480 | 45.0k | case 125: /* nonzero_number: nonzero_number digit */ |
2481 | 45.0k | { |
2482 | 45.0k | if((yyvsp[-1].ival) >= std::numeric_limits<std::int32_t>::max()/10 || |
2483 | 45.0k | (yyvsp[-1].ival)*10 >= std::numeric_limits<std::int32_t>::max()-(yyvsp[0].ival) ){ |
2484 | 25 | yysmarts_error(input,molList,lastAtom,lastBond,numAtomsParsed,numBondsParsed,branchPoints,scanner,start_token, current_token_position, "number too large"); |
2485 | 25 | YYABORT; |
2486 | 25 | } |
2487 | 45.0k | (yyval.ival) = (yyvsp[-1].ival)*10 + (yyvsp[0].ival); } |
2488 | 0 | break; |
2489 | | |
2490 | 28.0k | case 128: /* branch_open_token: GROUP_OPEN_TOKEN */ |
2491 | 28.0k | { (yyval.ival) = current_token_position; } |
2492 | 28.0k | break; |
2493 | | |
2494 | | |
2495 | | |
2496 | 6.15M | default: break; |
2497 | 9.81M | } |
2498 | | /* User semantic actions sometimes alter yychar, and that requires |
2499 | | that yytoken be updated with the new translation. We take the |
2500 | | approach of translating immediately before every use of yytoken. |
2501 | | One alternative is translating here after every semantic action, |
2502 | | but that translation would be missed if the semantic action invokes |
2503 | | YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or |
2504 | | if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an |
2505 | | incorrect destructor might then be invoked immediately. In the |
2506 | | case of YYERROR or YYBACKUP, subsequent parser actions might lead |
2507 | | to an incorrect destructor call or verbose syntax error message |
2508 | | before the lookahead is translated. */ |
2509 | 9.79M | YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); |
2510 | | |
2511 | 9.79M | YYPOPSTACK (yylen); |
2512 | 9.79M | yylen = 0; |
2513 | | |
2514 | 9.79M | *++yyvsp = yyval; |
2515 | | |
2516 | | /* Now 'shift' the result of the reduction. Determine what state |
2517 | | that goes to, based on the state we popped back to and the rule |
2518 | | number reduced by. */ |
2519 | 9.79M | { |
2520 | 9.79M | const int yylhs = yyr1[yyn] - YYNTOKENS; |
2521 | 9.79M | const int yyi = yypgoto[yylhs] + *yyssp; |
2522 | 9.79M | yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp |
2523 | 9.79M | ? yytable[yyi] |
2524 | 9.79M | : yydefgoto[yylhs]); |
2525 | 9.79M | } |
2526 | | |
2527 | 9.79M | goto yynewstate; |
2528 | | |
2529 | | |
2530 | | /*--------------------------------------. |
2531 | | | yyerrlab -- here on detecting error. | |
2532 | | `--------------------------------------*/ |
2533 | 12.2M | yyerrlab: |
2534 | | /* Make sure we have latest lookahead translation. See comments at |
2535 | | user semantic actions for why this is necessary. */ |
2536 | 12.2M | yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); |
2537 | | /* If not already recovering from an error, report this error. */ |
2538 | 12.2M | if (!yyerrstatus) |
2539 | 1.60k | { |
2540 | 1.60k | ++yynerrs; |
2541 | 1.60k | yyerror (input, molList, lastAtom, lastBond, numAtomsParsed, numBondsParsed, branchPoints, scanner, start_token, current_token_position, YY_("syntax error")); |
2542 | 1.60k | } |
2543 | | |
2544 | 12.2M | if (yyerrstatus == 3) |
2545 | 12.2M | { |
2546 | | /* If just tried and failed to reuse lookahead token after an |
2547 | | error, discard it. */ |
2548 | | |
2549 | 12.2M | if (yychar <= YYEOF) |
2550 | 0 | { |
2551 | | /* Return failure if at end of input. */ |
2552 | 0 | if (yychar == YYEOF) |
2553 | 0 | YYABORT; |
2554 | 0 | } |
2555 | 12.2M | else |
2556 | 12.2M | { |
2557 | 12.2M | yydestruct ("Error: discarding", |
2558 | 12.2M | yytoken, &yylval, input, molList, lastAtom, lastBond, numAtomsParsed, numBondsParsed, branchPoints, scanner, start_token, current_token_position); |
2559 | 12.2M | yychar = YYEMPTY; |
2560 | 12.2M | } |
2561 | 12.2M | } |
2562 | | |
2563 | | /* Else will try to reuse lookahead token after shifting the error |
2564 | | token. */ |
2565 | 12.2M | goto yyerrlab1; |
2566 | | |
2567 | | |
2568 | | /*---------------------------------------------------. |
2569 | | | yyerrorlab -- error raised explicitly by YYERROR. | |
2570 | | `---------------------------------------------------*/ |
2571 | 12.2M | yyerrorlab: |
2572 | | /* Pacify compilers when the user code never invokes YYERROR and the |
2573 | | label yyerrorlab therefore never appears in user code. */ |
2574 | 0 | if (0) |
2575 | 0 | YYERROR; |
2576 | 0 | ++yynerrs; |
2577 | | |
2578 | | /* Do not reclaim the symbols of the rule whose action triggered |
2579 | | this YYERROR. */ |
2580 | 0 | YYPOPSTACK (yylen); |
2581 | 0 | yylen = 0; |
2582 | 0 | YY_STACK_PRINT (yyss, yyssp); |
2583 | 0 | yystate = *yyssp; |
2584 | 0 | goto yyerrlab1; |
2585 | | |
2586 | | |
2587 | | /*-------------------------------------------------------------. |
2588 | | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
2589 | | `-------------------------------------------------------------*/ |
2590 | 12.2M | yyerrlab1: |
2591 | 12.2M | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
2592 | | |
2593 | | /* Pop stack until we find a state that shifts the error token. */ |
2594 | 12.2M | for (;;) |
2595 | 24.4M | { |
2596 | 24.4M | yyn = yypact[yystate]; |
2597 | 24.4M | if (!yypact_value_is_default (yyn)) |
2598 | 24.4M | { |
2599 | 24.4M | yyn += YYSYMBOL_YYerror; |
2600 | 24.4M | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) |
2601 | 12.2M | { |
2602 | 12.2M | yyn = yytable[yyn]; |
2603 | 12.2M | if (0 < yyn) |
2604 | 12.2M | break; |
2605 | 12.2M | } |
2606 | 24.4M | } |
2607 | | |
2608 | | /* Pop the current state because it cannot handle the error token. */ |
2609 | 12.2M | if (yyssp == yyss) |
2610 | 0 | YYABORT; |
2611 | | |
2612 | | |
2613 | 12.2M | yydestruct ("Error: popping", |
2614 | 12.2M | YY_ACCESSING_SYMBOL (yystate), yyvsp, input, molList, lastAtom, lastBond, numAtomsParsed, numBondsParsed, branchPoints, scanner, start_token, current_token_position); |
2615 | 12.2M | YYPOPSTACK (1); |
2616 | 12.2M | yystate = *yyssp; |
2617 | 12.2M | YY_STACK_PRINT (yyss, yyssp); |
2618 | 12.2M | } |
2619 | | |
2620 | 12.2M | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
2621 | 12.2M | *++yyvsp = yylval; |
2622 | 12.2M | YY_IGNORE_MAYBE_UNINITIALIZED_END |
2623 | | |
2624 | | |
2625 | | /* Shift the error token. */ |
2626 | 12.2M | YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); |
2627 | | |
2628 | 12.2M | yystate = yyn; |
2629 | 12.2M | goto yynewstate; |
2630 | | |
2631 | | |
2632 | | /*-------------------------------------. |
2633 | | | yyacceptlab -- YYACCEPT comes here. | |
2634 | | `-------------------------------------*/ |
2635 | 23.3k | yyacceptlab: |
2636 | 23.3k | yyresult = 0; |
2637 | 23.3k | goto yyreturnlab; |
2638 | | |
2639 | | |
2640 | | /*-----------------------------------. |
2641 | | | yyabortlab -- YYABORT comes here. | |
2642 | | `-----------------------------------*/ |
2643 | 1.81k | yyabortlab: |
2644 | 1.81k | yyresult = 1; |
2645 | 1.81k | goto yyreturnlab; |
2646 | | |
2647 | | |
2648 | | /*-----------------------------------------------------------. |
2649 | | | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | |
2650 | | `-----------------------------------------------------------*/ |
2651 | 2 | yyexhaustedlab: |
2652 | 2 | yyerror (input, molList, lastAtom, lastBond, numAtomsParsed, numBondsParsed, branchPoints, scanner, start_token, current_token_position, YY_("memory exhausted")); |
2653 | 2 | yyresult = 2; |
2654 | 2 | goto yyreturnlab; |
2655 | | |
2656 | | |
2657 | | /*----------------------------------------------------------. |
2658 | | | yyreturnlab -- parsing is finished, clean up and return. | |
2659 | | `----------------------------------------------------------*/ |
2660 | 25.1k | yyreturnlab: |
2661 | 25.1k | if (yychar != YYEMPTY) |
2662 | 0 | { |
2663 | | /* Make sure we have latest lookahead translation. See comments at |
2664 | | user semantic actions for why this is necessary. */ |
2665 | 0 | yytoken = YYTRANSLATE (yychar); |
2666 | 0 | yydestruct ("Cleanup: discarding lookahead", |
2667 | 0 | yytoken, &yylval, input, molList, lastAtom, lastBond, numAtomsParsed, numBondsParsed, branchPoints, scanner, start_token, current_token_position); |
2668 | 0 | } |
2669 | | /* Do not reclaim the symbols of the rule whose action triggered |
2670 | | this YYABORT or YYACCEPT. */ |
2671 | 25.1k | YYPOPSTACK (yylen); |
2672 | 25.1k | YY_STACK_PRINT (yyss, yyssp); |
2673 | 45.3k | while (yyssp != yyss) |
2674 | 20.2k | { |
2675 | 20.2k | yydestruct ("Cleanup: popping", |
2676 | 20.2k | YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, input, molList, lastAtom, lastBond, numAtomsParsed, numBondsParsed, branchPoints, scanner, start_token, current_token_position); |
2677 | 20.2k | YYPOPSTACK (1); |
2678 | 20.2k | } |
2679 | 25.1k | #ifndef yyoverflow |
2680 | 25.1k | if (yyss != yyssa) |
2681 | 16 | YYSTACK_FREE (yyss); |
2682 | 25.1k | #endif |
2683 | | |
2684 | 25.1k | return yyresult; |
2685 | 12.2M | } |
2686 | | |
2687 | | |