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