bison_BPredicate.c 57 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148
  1. /* A Bison parser, made by GNU Bison 2.5.1. */
  2. /* Bison implementation for Yacc-like parsers in C
  3. Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  14. /* As a special exception, you may create a larger work that contains
  15. part or all of the Bison parser skeleton and distribute that work
  16. under terms of your choice, so long as that work isn't itself a
  17. parser generator using the skeleton or a modified version thereof
  18. as a parser skeleton. Alternatively, if you modify or redistribute
  19. the parser skeleton itself, you may (at your option) remove this
  20. special exception, which will cause the skeleton and the resulting
  21. Bison output files to be licensed under the GNU General Public
  22. License without this special exception.
  23. This special exception was added by the Free Software Foundation in
  24. version 2.2 of Bison. */
  25. /* C LALR(1) parser skeleton written by Richard Stallman, by
  26. simplifying the original so-called "semantic" parser. */
  27. /* All symbols defined below should begin with yy or YY, to avoid
  28. infringing on user name space. This should be done even for local
  29. variables, as they might otherwise be expanded by user macros.
  30. There are some unavoidable exceptions within include files to
  31. define necessary library symbols; they are noted "INFRINGES ON
  32. USER NAME SPACE" below. */
  33. /* Identify Bison output. */
  34. #define YYBISON 1
  35. /* Bison version. */
  36. #define YYBISON_VERSION "2.5.1"
  37. /* Skeleton name. */
  38. #define YYSKELETON_NAME "yacc.c"
  39. /* Pure parsers. */
  40. #define YYPURE 1
  41. /* Push parsers. */
  42. #define YYPUSH 0
  43. /* Pull parsers. */
  44. #define YYPULL 1
  45. /* Using locations. */
  46. #define YYLSP_NEEDED 1
  47. /* Copy the first part of user declarations. */
  48. /* Line 268 of yacc.c */
  49. #line 34 "predicate/BPredicate.y"
  50. #include <stdlib.h>
  51. #include <predicate/BPredicate_internal.h>
  52. #include <predicate/BPredicate_parser.h>
  53. #define YYLEX_PARAM scanner
  54. static struct predicate_node * make_constant (int val)
  55. {
  56. struct predicate_node *n = malloc(sizeof(*n));
  57. if (!n) {
  58. return NULL;
  59. }
  60. n->type = NODE_CONSTANT;
  61. n->constant.val = val;
  62. return n;
  63. }
  64. static struct predicate_node * make_negation (struct predicate_node *op)
  65. {
  66. if (!op) {
  67. goto fail;
  68. }
  69. struct predicate_node *n = malloc(sizeof(*n));
  70. if (!n) {
  71. goto fail;
  72. }
  73. n->type = NODE_NEG;
  74. n->neg.op = op;
  75. return n;
  76. fail:
  77. if (op) {
  78. free_predicate_node(op);
  79. }
  80. return NULL;
  81. }
  82. static struct predicate_node * make_conjunction (struct predicate_node *op1, struct predicate_node *op2)
  83. {
  84. if (!op1 || !op2) {
  85. goto fail;
  86. }
  87. struct predicate_node *n = malloc(sizeof(*n));
  88. if (!n) {
  89. goto fail;
  90. }
  91. n->type = NODE_CONJUNCT;
  92. n->conjunct.op1 = op1;
  93. n->conjunct.op2 = op2;
  94. return n;
  95. fail:
  96. if (op1) {
  97. free_predicate_node(op1);
  98. }
  99. if (op2) {
  100. free_predicate_node(op2);
  101. }
  102. return NULL;
  103. }
  104. static struct predicate_node * make_disjunction (struct predicate_node *op1, struct predicate_node *op2)
  105. {
  106. if (!op1 || !op2) {
  107. goto fail;
  108. }
  109. struct predicate_node *n = malloc(sizeof(*n));
  110. if (!n) {
  111. goto fail;
  112. }
  113. n->type = NODE_DISJUNCT;
  114. n->disjunct.op1 = op1;
  115. n->disjunct.op2 = op2;
  116. return n;
  117. fail:
  118. if (op1) {
  119. free_predicate_node(op1);
  120. }
  121. if (op2) {
  122. free_predicate_node(op2);
  123. }
  124. return NULL;
  125. }
  126. static struct predicate_node * make_function (char *name, struct arguments_node *args, int need_args)
  127. {
  128. if (!name || (!args && need_args)) {
  129. goto fail;
  130. }
  131. struct predicate_node *n = malloc(sizeof(*n));
  132. if (!n) {
  133. goto fail;
  134. }
  135. n->type = NODE_FUNCTION;
  136. n->function.name = name;
  137. n->function.args = args;
  138. return n;
  139. fail:
  140. if (name) {
  141. free(name);
  142. }
  143. if (args) {
  144. free_arguments_node(args);
  145. }
  146. return NULL;
  147. }
  148. static struct arguments_node * make_arguments (struct arguments_arg arg, struct arguments_node *next, int need_next)
  149. {
  150. if (arg.type == ARGUMENT_INVALID || (!next && need_next)) {
  151. goto fail;
  152. }
  153. struct arguments_node *n = malloc(sizeof(*n));
  154. if (!n) {
  155. goto fail;
  156. }
  157. n->arg = arg;
  158. n->next = next;
  159. return n;
  160. fail:
  161. free_argument(arg);
  162. if (next) {
  163. free_arguments_node(next);
  164. }
  165. return NULL;
  166. }
  167. static struct arguments_arg make_argument_predicate (struct predicate_node *pr)
  168. {
  169. struct arguments_arg ret;
  170. if (!pr) {
  171. goto fail;
  172. }
  173. ret.type = ARGUMENT_PREDICATE;
  174. ret.predicate = pr;
  175. return ret;
  176. fail:
  177. ret.type = ARGUMENT_INVALID;
  178. return ret;
  179. }
  180. static struct arguments_arg make_argument_string (char *string)
  181. {
  182. struct arguments_arg ret;
  183. if (!string) {
  184. goto fail;
  185. }
  186. ret.type = ARGUMENT_STRING;
  187. ret.string = string;
  188. return ret;
  189. fail:
  190. ret.type = ARGUMENT_INVALID;
  191. return ret;
  192. }
  193. /* Line 268 of yacc.c */
  194. #line 260 "generated//bison_BPredicate.c"
  195. # ifndef YY_NULL
  196. # if defined __cplusplus && 201103L <= __cplusplus
  197. # define YY_NULL nullptr
  198. # else
  199. # define YY_NULL 0
  200. # endif
  201. # endif
  202. /* Enabling traces. */
  203. #ifndef YYDEBUG
  204. # define YYDEBUG 0
  205. #endif
  206. /* Enabling verbose error messages. */
  207. #ifdef YYERROR_VERBOSE
  208. # undef YYERROR_VERBOSE
  209. # define YYERROR_VERBOSE 1
  210. #else
  211. # define YYERROR_VERBOSE 0
  212. #endif
  213. /* Enabling the token table. */
  214. #ifndef YYTOKEN_TABLE
  215. # define YYTOKEN_TABLE 0
  216. #endif
  217. /* Tokens. */
  218. #ifndef YYTOKENTYPE
  219. # define YYTOKENTYPE
  220. /* Put the tokens into the symbol table, so that GDB and other debuggers
  221. know about them. */
  222. enum yytokentype {
  223. STRING = 258,
  224. NAME = 259,
  225. PEER1_NAME = 260,
  226. PEER2_NAME = 261,
  227. AND = 262,
  228. OR = 263,
  229. NOT = 264,
  230. SPAR = 265,
  231. EPAR = 266,
  232. CONSTANT_TRUE = 267,
  233. CONSTANT_FALSE = 268,
  234. COMMA = 269
  235. };
  236. #endif
  237. #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
  238. typedef union YYSTYPE
  239. {
  240. /* Line 295 of yacc.c */
  241. #line 227 "predicate/BPredicate.y"
  242. char *text;
  243. struct predicate_node *node;
  244. struct arguments_node *arg_node;
  245. struct predicate_node nfaw;
  246. struct arguments_arg arg_arg;
  247. /* Line 295 of yacc.c */
  248. #line 328 "generated//bison_BPredicate.c"
  249. } YYSTYPE;
  250. # define YYSTYPE_IS_TRIVIAL 1
  251. # define yystype YYSTYPE /* obsolescent; will be withdrawn */
  252. # define YYSTYPE_IS_DECLARED 1
  253. #endif
  254. #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
  255. typedef struct YYLTYPE
  256. {
  257. int first_line;
  258. int first_column;
  259. int last_line;
  260. int last_column;
  261. } YYLTYPE;
  262. # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
  263. # define YYLTYPE_IS_DECLARED 1
  264. # define YYLTYPE_IS_TRIVIAL 1
  265. #endif
  266. /* Copy the second part of user declarations. */
  267. /* Line 345 of yacc.c */
  268. #line 353 "generated//bison_BPredicate.c"
  269. #ifdef short
  270. # undef short
  271. #endif
  272. #ifdef YYTYPE_UINT8
  273. typedef YYTYPE_UINT8 yytype_uint8;
  274. #else
  275. typedef unsigned char yytype_uint8;
  276. #endif
  277. #ifdef YYTYPE_INT8
  278. typedef YYTYPE_INT8 yytype_int8;
  279. #elif (defined __STDC__ || defined __C99__FUNC__ \
  280. || defined __cplusplus || defined _MSC_VER)
  281. typedef signed char yytype_int8;
  282. #else
  283. typedef short int yytype_int8;
  284. #endif
  285. #ifdef YYTYPE_UINT16
  286. typedef YYTYPE_UINT16 yytype_uint16;
  287. #else
  288. typedef unsigned short int yytype_uint16;
  289. #endif
  290. #ifdef YYTYPE_INT16
  291. typedef YYTYPE_INT16 yytype_int16;
  292. #else
  293. typedef short int yytype_int16;
  294. #endif
  295. #ifndef YYSIZE_T
  296. # ifdef __SIZE_TYPE__
  297. # define YYSIZE_T __SIZE_TYPE__
  298. # elif defined size_t
  299. # define YYSIZE_T size_t
  300. # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
  301. || defined __cplusplus || defined _MSC_VER)
  302. # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  303. # define YYSIZE_T size_t
  304. # else
  305. # define YYSIZE_T unsigned int
  306. # endif
  307. #endif
  308. #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
  309. #ifndef YY_
  310. # if defined YYENABLE_NLS && YYENABLE_NLS
  311. # if ENABLE_NLS
  312. # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
  313. # define YY_(msgid) dgettext ("bison-runtime", msgid)
  314. # endif
  315. # endif
  316. # ifndef YY_
  317. # define YY_(msgid) msgid
  318. # endif
  319. #endif
  320. /* Suppress unused-variable warnings by "using" E. */
  321. #if ! defined lint || defined __GNUC__
  322. # define YYUSE(e) ((void) (e))
  323. #else
  324. # define YYUSE(e) /* empty */
  325. #endif
  326. /* Identity function, used to suppress warnings about constant conditions. */
  327. #ifndef lint
  328. # define YYID(n) (n)
  329. #else
  330. #if (defined __STDC__ || defined __C99__FUNC__ \
  331. || defined __cplusplus || defined _MSC_VER)
  332. static int
  333. YYID (int yyi)
  334. #else
  335. static int
  336. YYID (yyi)
  337. int yyi;
  338. #endif
  339. {
  340. return yyi;
  341. }
  342. #endif
  343. #if ! defined yyoverflow || YYERROR_VERBOSE
  344. /* The parser invokes alloca or malloc; define the necessary symbols. */
  345. # ifdef YYSTACK_USE_ALLOCA
  346. # if YYSTACK_USE_ALLOCA
  347. # ifdef __GNUC__
  348. # define YYSTACK_ALLOC __builtin_alloca
  349. # elif defined __BUILTIN_VA_ARG_INCR
  350. # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
  351. # elif defined _AIX
  352. # define YYSTACK_ALLOC __alloca
  353. # elif defined _MSC_VER
  354. # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
  355. # define alloca _alloca
  356. # else
  357. # define YYSTACK_ALLOC alloca
  358. # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
  359. || defined __cplusplus || defined _MSC_VER)
  360. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  361. /* Use EXIT_SUCCESS as a witness for stdlib.h. */
  362. # ifndef EXIT_SUCCESS
  363. # define EXIT_SUCCESS 0
  364. # endif
  365. # endif
  366. # endif
  367. # endif
  368. # endif
  369. # ifdef YYSTACK_ALLOC
  370. /* Pacify GCC's `empty if-body' warning. */
  371. # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
  372. # ifndef YYSTACK_ALLOC_MAXIMUM
  373. /* The OS might guarantee only one guard page at the bottom of the stack,
  374. and a page size can be as small as 4096 bytes. So we cannot safely
  375. invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
  376. to allow for a few compiler-allocated temporary stack slots. */
  377. # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
  378. # endif
  379. # else
  380. # define YYSTACK_ALLOC YYMALLOC
  381. # define YYSTACK_FREE YYFREE
  382. # ifndef YYSTACK_ALLOC_MAXIMUM
  383. # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
  384. # endif
  385. # if (defined __cplusplus && ! defined EXIT_SUCCESS \
  386. && ! ((defined YYMALLOC || defined malloc) \
  387. && (defined YYFREE || defined free)))
  388. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  389. # ifndef EXIT_SUCCESS
  390. # define EXIT_SUCCESS 0
  391. # endif
  392. # endif
  393. # ifndef YYMALLOC
  394. # define YYMALLOC malloc
  395. # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
  396. || defined __cplusplus || defined _MSC_VER)
  397. void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
  398. # endif
  399. # endif
  400. # ifndef YYFREE
  401. # define YYFREE free
  402. # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
  403. || defined __cplusplus || defined _MSC_VER)
  404. void free (void *); /* INFRINGES ON USER NAME SPACE */
  405. # endif
  406. # endif
  407. # endif
  408. #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
  409. #if (! defined yyoverflow \
  410. && (! defined __cplusplus \
  411. || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
  412. && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
  413. /* A type that is properly aligned for any stack member. */
  414. union yyalloc
  415. {
  416. yytype_int16 yyss_alloc;
  417. YYSTYPE yyvs_alloc;
  418. YYLTYPE yyls_alloc;
  419. };
  420. /* The size of the maximum gap between one aligned stack and the next. */
  421. # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
  422. /* The size of an array large to enough to hold all stacks, each with
  423. N elements. */
  424. # define YYSTACK_BYTES(N) \
  425. ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
  426. + 2 * YYSTACK_GAP_MAXIMUM)
  427. # define YYCOPY_NEEDED 1
  428. /* Relocate STACK from its old location to the new one. The
  429. local variables YYSIZE and YYSTACKSIZE give the old and new number of
  430. elements in the stack, and YYPTR gives the new location of the
  431. stack. Advance YYPTR to a properly aligned location for the next
  432. stack. */
  433. # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
  434. do \
  435. { \
  436. YYSIZE_T yynewbytes; \
  437. YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
  438. Stack = &yyptr->Stack_alloc; \
  439. yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
  440. yyptr += yynewbytes / sizeof (*yyptr); \
  441. } \
  442. while (YYID (0))
  443. #endif
  444. #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
  445. /* Copy COUNT objects from SRC to DST. The source and destination do
  446. not overlap. */
  447. # ifndef YYCOPY
  448. # if defined __GNUC__ && 1 < __GNUC__
  449. # define YYCOPY(Dst, Src, Count) \
  450. __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
  451. # else
  452. # define YYCOPY(Dst, Src, Count) \
  453. do \
  454. { \
  455. YYSIZE_T yyi; \
  456. for (yyi = 0; yyi < (Count); yyi++) \
  457. (Dst)[yyi] = (Src)[yyi]; \
  458. } \
  459. while (YYID (0))
  460. # endif
  461. # endif
  462. #endif /* !YYCOPY_NEEDED */
  463. /* YYFINAL -- State number of the termination state. */
  464. #define YYFINAL 17
  465. /* YYLAST -- Last index in YYTABLE. */
  466. #define YYLAST 37
  467. /* YYNTOKENS -- Number of terminals. */
  468. #define YYNTOKENS 15
  469. /* YYNNTS -- Number of nonterminals. */
  470. #define YYNNTS 11
  471. /* YYNRULES -- Number of rules. */
  472. #define YYNRULES 20
  473. /* YYNRULES -- Number of states. */
  474. #define YYNSTATES 31
  475. /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
  476. #define YYUNDEFTOK 2
  477. #define YYMAXUTOK 269
  478. #define YYTRANSLATE(YYX) \
  479. ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
  480. /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
  481. static const yytype_uint8 yytranslate[] =
  482. {
  483. 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  484. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  485. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  486. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  487. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  488. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  489. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  490. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  491. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  492. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  493. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  494. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  495. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  496. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  497. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  498. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  499. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  500. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  501. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  502. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  503. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  504. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  505. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  506. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  507. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  508. 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
  509. 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
  510. };
  511. #if YYDEBUG
  512. /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
  513. YYRHS. */
  514. static const yytype_uint8 yyprhs[] =
  515. {
  516. 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
  517. 19, 21, 25, 28, 32, 36, 40, 45, 47, 51,
  518. 53
  519. };
  520. /* YYRHS -- A `-1'-separated list of the rules' RHS. */
  521. static const yytype_int8 yyrhs[] =
  522. {
  523. 16, 0, -1, 17, -1, 18, -1, 19, -1, 20,
  524. -1, 21, -1, 22, -1, 23, -1, 12, -1, 13,
  525. -1, 10, 17, 11, -1, 9, 17, -1, 17, 7,
  526. 17, -1, 17, 8, 17, -1, 4, 10, 11, -1,
  527. 4, 10, 24, 11, -1, 25, -1, 25, 14, 24,
  528. -1, 17, -1, 3, -1
  529. };
  530. /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
  531. static const yytype_uint16 yyrline[] =
  532. {
  533. 0, 276, 276, 281, 281, 281, 281, 281, 281, 284,
  534. 288, 294, 300, 306, 312, 318, 322, 328, 332, 338,
  535. 342
  536. };
  537. #endif
  538. #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
  539. /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
  540. First, the terminals, then, starting at YYNTOKENS, nonterminals. */
  541. static const char *const yytname[] =
  542. {
  543. "$end", "error", "$undefined", "STRING", "NAME", "PEER1_NAME",
  544. "PEER2_NAME", "AND", "OR", "NOT", "SPAR", "EPAR", "CONSTANT_TRUE",
  545. "CONSTANT_FALSE", "COMMA", "$accept", "input", "predicate", "constant",
  546. "parentheses", "neg", "conjunct", "disjunct", "function", "arguments",
  547. "argument", YY_NULL
  548. };
  549. #endif
  550. # ifdef YYPRINT
  551. /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
  552. token YYLEX-NUM. */
  553. static const yytype_uint16 yytoknum[] =
  554. {
  555. 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
  556. 265, 266, 267, 268, 269
  557. };
  558. # endif
  559. /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
  560. static const yytype_uint8 yyr1[] =
  561. {
  562. 0, 15, 16, 17, 17, 17, 17, 17, 17, 18,
  563. 18, 19, 20, 21, 22, 23, 23, 24, 24, 25,
  564. 25
  565. };
  566. /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
  567. static const yytype_uint8 yyr2[] =
  568. {
  569. 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
  570. 1, 3, 2, 3, 3, 3, 4, 1, 3, 1,
  571. 1
  572. };
  573. /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
  574. Performed when YYTABLE doesn't specify something else to do. Zero
  575. means the default is an error. */
  576. static const yytype_uint8 yydefact[] =
  577. {
  578. 0, 0, 0, 0, 9, 10, 0, 2, 3, 4,
  579. 5, 6, 7, 8, 0, 12, 0, 1, 0, 0,
  580. 20, 15, 19, 0, 17, 11, 13, 14, 16, 0,
  581. 18
  582. };
  583. /* YYDEFGOTO[NTERM-NUM]. */
  584. static const yytype_int8 yydefgoto[] =
  585. {
  586. -1, 6, 22, 8, 9, 10, 11, 12, 13, 23,
  587. 24
  588. };
  589. /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
  590. STATE-NUM. */
  591. #define YYPACT_NINF -10
  592. static const yytype_int8 yypact[] =
  593. {
  594. 19, -9, 19, 19, -10, -10, 8, -1, -10, -10,
  595. -10, -10, -10, -10, 1, -10, 26, -10, 19, 19,
  596. -10, -10, -1, -2, 3, -10, -10, 13, -10, 12,
  597. -10
  598. };
  599. /* YYPGOTO[NTERM-NUM]. */
  600. static const yytype_int8 yypgoto[] =
  601. {
  602. -10, -10, 0, -10, -10, -10, -10, -10, -10, -3,
  603. -10
  604. };
  605. /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
  606. positive, shift that token. If negative, reduce the rule which
  607. number is the opposite. If YYTABLE_NINF, syntax error. */
  608. #define YYTABLE_NINF -1
  609. static const yytype_uint8 yytable[] =
  610. {
  611. 7, 14, 15, 16, 20, 1, 18, 19, 17, 28,
  612. 2, 3, 21, 4, 5, 20, 1, 29, 26, 27,
  613. 18, 2, 3, 1, 4, 5, 30, 0, 2, 3,
  614. 0, 4, 5, 18, 19, 0, 0, 25
  615. };
  616. #define yypact_value_is_default(yystate) \
  617. ((yystate) == (-10))
  618. #define yytable_value_is_error(yytable_value) \
  619. YYID (0)
  620. static const yytype_int8 yycheck[] =
  621. {
  622. 0, 10, 2, 3, 3, 4, 7, 8, 0, 11,
  623. 9, 10, 11, 12, 13, 3, 4, 14, 18, 19,
  624. 7, 9, 10, 4, 12, 13, 29, -1, 9, 10,
  625. -1, 12, 13, 7, 8, -1, -1, 11
  626. };
  627. /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
  628. symbol of state STATE-NUM. */
  629. static const yytype_uint8 yystos[] =
  630. {
  631. 0, 4, 9, 10, 12, 13, 16, 17, 18, 19,
  632. 20, 21, 22, 23, 10, 17, 17, 0, 7, 8,
  633. 3, 11, 17, 24, 25, 11, 17, 17, 11, 14,
  634. 24
  635. };
  636. #define yyerrok (yyerrstatus = 0)
  637. #define yyclearin (yychar = YYEMPTY)
  638. #define YYEMPTY (-2)
  639. #define YYEOF 0
  640. #define YYACCEPT goto yyacceptlab
  641. #define YYABORT goto yyabortlab
  642. #define YYERROR goto yyerrorlab
  643. /* Like YYERROR except do call yyerror. This remains here temporarily
  644. to ease the transition to the new meaning of YYERROR, for GCC.
  645. Once GCC version 2 has supplanted version 1, this can go. However,
  646. YYFAIL appears to be in use. Nevertheless, it is formally deprecated
  647. in Bison 2.4.2's NEWS entry, where a plan to phase it out is
  648. discussed. */
  649. #define YYFAIL goto yyerrlab
  650. #if defined YYFAIL
  651. /* This is here to suppress warnings from the GCC cpp's
  652. -Wunused-macros. Normally we don't worry about that warning, but
  653. some users do, and we want to make it easy for users to remove
  654. YYFAIL uses, which will produce warnings from Bison 2.5. */
  655. #endif
  656. #define YYRECOVERING() (!!yyerrstatus)
  657. #define YYBACKUP(Token, Value) \
  658. do \
  659. if (yychar == YYEMPTY) \
  660. { \
  661. yychar = (Token); \
  662. yylval = (Value); \
  663. YYPOPSTACK (yylen); \
  664. yystate = *yyssp; \
  665. goto yybackup; \
  666. } \
  667. else \
  668. { \
  669. yyerror (&yylloc, scanner, result, YY_("syntax error: cannot back up")); \
  670. YYERROR; \
  671. } \
  672. while (YYID (0))
  673. #define YYTERROR 1
  674. #define YYERRCODE 256
  675. /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
  676. If N is 0, then set CURRENT to the empty location which ends
  677. the previous symbol: RHS[0] (always defined). */
  678. #define YYRHSLOC(Rhs, K) ((Rhs)[K])
  679. #ifndef YYLLOC_DEFAULT
  680. # define YYLLOC_DEFAULT(Current, Rhs, N) \
  681. do \
  682. if (YYID (N)) \
  683. { \
  684. (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
  685. (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
  686. (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
  687. (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
  688. } \
  689. else \
  690. { \
  691. (Current).first_line = (Current).last_line = \
  692. YYRHSLOC (Rhs, 0).last_line; \
  693. (Current).first_column = (Current).last_column = \
  694. YYRHSLOC (Rhs, 0).last_column; \
  695. } \
  696. while (YYID (0))
  697. #endif
  698. /* YY_LOCATION_PRINT -- Print the location on the stream.
  699. This macro was not mandated originally: define only if we know
  700. we won't break user code: when these are the locations we know. */
  701. #ifndef YY_LOCATION_PRINT
  702. # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
  703. # define YY_LOCATION_PRINT(File, Loc) \
  704. fprintf (File, "%d.%d-%d.%d", \
  705. (Loc).first_line, (Loc).first_column, \
  706. (Loc).last_line, (Loc).last_column)
  707. # else
  708. # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
  709. # endif
  710. #endif
  711. /* YYLEX -- calling `yylex' with the right arguments. */
  712. #ifdef YYLEX_PARAM
  713. # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
  714. #else
  715. # define YYLEX yylex (&yylval, &yylloc)
  716. #endif
  717. /* Enable debugging if requested. */
  718. #if YYDEBUG
  719. # ifndef YYFPRINTF
  720. # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
  721. # define YYFPRINTF fprintf
  722. # endif
  723. # define YYDPRINTF(Args) \
  724. do { \
  725. if (yydebug) \
  726. YYFPRINTF Args; \
  727. } while (YYID (0))
  728. # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
  729. do { \
  730. if (yydebug) \
  731. { \
  732. YYFPRINTF (stderr, "%s ", Title); \
  733. yy_symbol_print (stderr, \
  734. Type, Value, Location, scanner, result); \
  735. YYFPRINTF (stderr, "\n"); \
  736. } \
  737. } while (YYID (0))
  738. /*--------------------------------.
  739. | Print this symbol on YYOUTPUT. |
  740. `--------------------------------*/
  741. /*ARGSUSED*/
  742. #if (defined __STDC__ || defined __C99__FUNC__ \
  743. || defined __cplusplus || defined _MSC_VER)
  744. static void
  745. yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, void *scanner, struct predicate_node **result)
  746. #else
  747. static void
  748. yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, scanner, result)
  749. FILE *yyoutput;
  750. int yytype;
  751. YYSTYPE const * const yyvaluep;
  752. YYLTYPE const * const yylocationp;
  753. void *scanner;
  754. struct predicate_node **result;
  755. #endif
  756. {
  757. FILE *yyo = yyoutput;
  758. YYUSE (yyo);
  759. if (!yyvaluep)
  760. return;
  761. YYUSE (yylocationp);
  762. YYUSE (scanner);
  763. YYUSE (result);
  764. # ifdef YYPRINT
  765. if (yytype < YYNTOKENS)
  766. YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
  767. # else
  768. YYUSE (yyoutput);
  769. # endif
  770. switch (yytype)
  771. {
  772. default:
  773. break;
  774. }
  775. }
  776. /*--------------------------------.
  777. | Print this symbol on YYOUTPUT. |
  778. `--------------------------------*/
  779. #if (defined __STDC__ || defined __C99__FUNC__ \
  780. || defined __cplusplus || defined _MSC_VER)
  781. static void
  782. yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, void *scanner, struct predicate_node **result)
  783. #else
  784. static void
  785. yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, scanner, result)
  786. FILE *yyoutput;
  787. int yytype;
  788. YYSTYPE const * const yyvaluep;
  789. YYLTYPE const * const yylocationp;
  790. void *scanner;
  791. struct predicate_node **result;
  792. #endif
  793. {
  794. if (yytype < YYNTOKENS)
  795. YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
  796. else
  797. YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
  798. YY_LOCATION_PRINT (yyoutput, *yylocationp);
  799. YYFPRINTF (yyoutput, ": ");
  800. yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, scanner, result);
  801. YYFPRINTF (yyoutput, ")");
  802. }
  803. /*------------------------------------------------------------------.
  804. | yy_stack_print -- Print the state stack from its BOTTOM up to its |
  805. | TOP (included). |
  806. `------------------------------------------------------------------*/
  807. #if (defined __STDC__ || defined __C99__FUNC__ \
  808. || defined __cplusplus || defined _MSC_VER)
  809. static void
  810. yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
  811. #else
  812. static void
  813. yy_stack_print (yybottom, yytop)
  814. yytype_int16 *yybottom;
  815. yytype_int16 *yytop;
  816. #endif
  817. {
  818. YYFPRINTF (stderr, "Stack now");
  819. for (; yybottom <= yytop; yybottom++)
  820. {
  821. int yybot = *yybottom;
  822. YYFPRINTF (stderr, " %d", yybot);
  823. }
  824. YYFPRINTF (stderr, "\n");
  825. }
  826. # define YY_STACK_PRINT(Bottom, Top) \
  827. do { \
  828. if (yydebug) \
  829. yy_stack_print ((Bottom), (Top)); \
  830. } while (YYID (0))
  831. /*------------------------------------------------.
  832. | Report that the YYRULE is going to be reduced. |
  833. `------------------------------------------------*/
  834. #if (defined __STDC__ || defined __C99__FUNC__ \
  835. || defined __cplusplus || defined _MSC_VER)
  836. static void
  837. yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, void *scanner, struct predicate_node **result)
  838. #else
  839. static void
  840. yy_reduce_print (yyvsp, yylsp, yyrule, scanner, result)
  841. YYSTYPE *yyvsp;
  842. YYLTYPE *yylsp;
  843. int yyrule;
  844. void *scanner;
  845. struct predicate_node **result;
  846. #endif
  847. {
  848. int yynrhs = yyr2[yyrule];
  849. int yyi;
  850. unsigned long int yylno = yyrline[yyrule];
  851. YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
  852. yyrule - 1, yylno);
  853. /* The symbols being reduced. */
  854. for (yyi = 0; yyi < yynrhs; yyi++)
  855. {
  856. YYFPRINTF (stderr, " $%d = ", yyi + 1);
  857. yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
  858. &(yyvsp[(yyi + 1) - (yynrhs)])
  859. , &(yylsp[(yyi + 1) - (yynrhs)]) , scanner, result);
  860. YYFPRINTF (stderr, "\n");
  861. }
  862. }
  863. # define YY_REDUCE_PRINT(Rule) \
  864. do { \
  865. if (yydebug) \
  866. yy_reduce_print (yyvsp, yylsp, Rule, scanner, result); \
  867. } while (YYID (0))
  868. /* Nonzero means print parse trace. It is left uninitialized so that
  869. multiple parsers can coexist. */
  870. int yydebug;
  871. #else /* !YYDEBUG */
  872. # define YYDPRINTF(Args)
  873. # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
  874. # define YY_STACK_PRINT(Bottom, Top)
  875. # define YY_REDUCE_PRINT(Rule)
  876. #endif /* !YYDEBUG */
  877. /* YYINITDEPTH -- initial size of the parser's stacks. */
  878. #ifndef YYINITDEPTH
  879. # define YYINITDEPTH 200
  880. #endif
  881. /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
  882. if the built-in stack extension method is used).
  883. Do not make this value too large; the results are undefined if
  884. YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
  885. evaluated with infinite-precision integer arithmetic. */
  886. #ifndef YYMAXDEPTH
  887. # define YYMAXDEPTH 10000
  888. #endif
  889. #if YYERROR_VERBOSE
  890. # ifndef yystrlen
  891. # if defined __GLIBC__ && defined _STRING_H
  892. # define yystrlen strlen
  893. # else
  894. /* Return the length of YYSTR. */
  895. #if (defined __STDC__ || defined __C99__FUNC__ \
  896. || defined __cplusplus || defined _MSC_VER)
  897. static YYSIZE_T
  898. yystrlen (const char *yystr)
  899. #else
  900. static YYSIZE_T
  901. yystrlen (yystr)
  902. const char *yystr;
  903. #endif
  904. {
  905. YYSIZE_T yylen;
  906. for (yylen = 0; yystr[yylen]; yylen++)
  907. continue;
  908. return yylen;
  909. }
  910. # endif
  911. # endif
  912. # ifndef yystpcpy
  913. # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
  914. # define yystpcpy stpcpy
  915. # else
  916. /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
  917. YYDEST. */
  918. #if (defined __STDC__ || defined __C99__FUNC__ \
  919. || defined __cplusplus || defined _MSC_VER)
  920. static char *
  921. yystpcpy (char *yydest, const char *yysrc)
  922. #else
  923. static char *
  924. yystpcpy (yydest, yysrc)
  925. char *yydest;
  926. const char *yysrc;
  927. #endif
  928. {
  929. char *yyd = yydest;
  930. const char *yys = yysrc;
  931. while ((*yyd++ = *yys++) != '\0')
  932. continue;
  933. return yyd - 1;
  934. }
  935. # endif
  936. # endif
  937. # ifndef yytnamerr
  938. /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
  939. quotes and backslashes, so that it's suitable for yyerror. The
  940. heuristic is that double-quoting is unnecessary unless the string
  941. contains an apostrophe, a comma, or backslash (other than
  942. backslash-backslash). YYSTR is taken from yytname. If YYRES is
  943. null, do not copy; instead, return the length of what the result
  944. would have been. */
  945. static YYSIZE_T
  946. yytnamerr (char *yyres, const char *yystr)
  947. {
  948. if (*yystr == '"')
  949. {
  950. YYSIZE_T yyn = 0;
  951. char const *yyp = yystr;
  952. for (;;)
  953. switch (*++yyp)
  954. {
  955. case '\'':
  956. case ',':
  957. goto do_not_strip_quotes;
  958. case '\\':
  959. if (*++yyp != '\\')
  960. goto do_not_strip_quotes;
  961. /* Fall through. */
  962. default:
  963. if (yyres)
  964. yyres[yyn] = *yyp;
  965. yyn++;
  966. break;
  967. case '"':
  968. if (yyres)
  969. yyres[yyn] = '\0';
  970. return yyn;
  971. }
  972. do_not_strip_quotes: ;
  973. }
  974. if (! yyres)
  975. return yystrlen (yystr);
  976. return yystpcpy (yyres, yystr) - yyres;
  977. }
  978. # endif
  979. /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
  980. about the unexpected token YYTOKEN for the state stack whose top is
  981. YYSSP.
  982. Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
  983. not large enough to hold the message. In that case, also set
  984. *YYMSG_ALLOC to the required number of bytes. Return 2 if the
  985. required number of bytes is too large to store. */
  986. static int
  987. yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
  988. yytype_int16 *yyssp, int yytoken)
  989. {
  990. YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
  991. YYSIZE_T yysize = yysize0;
  992. YYSIZE_T yysize1;
  993. enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
  994. /* Internationalized format string. */
  995. const char *yyformat = YY_NULL;
  996. /* Arguments of yyformat. */
  997. char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
  998. /* Number of reported tokens (one for the "unexpected", one per
  999. "expected"). */
  1000. int yycount = 0;
  1001. /* There are many possibilities here to consider:
  1002. - Assume YYFAIL is not used. It's too flawed to consider. See
  1003. <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
  1004. for details. YYERROR is fine as it does not invoke this
  1005. function.
  1006. - If this state is a consistent state with a default action, then
  1007. the only way this function was invoked is if the default action
  1008. is an error action. In that case, don't check for expected
  1009. tokens because there are none.
  1010. - The only way there can be no lookahead present (in yychar) is if
  1011. this state is a consistent state with a default action. Thus,
  1012. detecting the absence of a lookahead is sufficient to determine
  1013. that there is no unexpected or expected token to report. In that
  1014. case, just report a simple "syntax error".
  1015. - Don't assume there isn't a lookahead just because this state is a
  1016. consistent state with a default action. There might have been a
  1017. previous inconsistent state, consistent state with a non-default
  1018. action, or user semantic action that manipulated yychar.
  1019. - Of course, the expected token list depends on states to have
  1020. correct lookahead information, and it depends on the parser not
  1021. to perform extra reductions after fetching a lookahead from the
  1022. scanner and before detecting a syntax error. Thus, state merging
  1023. (from LALR or IELR) and default reductions corrupt the expected
  1024. token list. However, the list is correct for canonical LR with
  1025. one exception: it will still contain any token that will not be
  1026. accepted due to an error action in a later state.
  1027. */
  1028. if (yytoken != YYEMPTY)
  1029. {
  1030. int yyn = yypact[*yyssp];
  1031. yyarg[yycount++] = yytname[yytoken];
  1032. if (!yypact_value_is_default (yyn))
  1033. {
  1034. /* Start YYX at -YYN if negative to avoid negative indexes in
  1035. YYCHECK. In other words, skip the first -YYN actions for
  1036. this state because they are default actions. */
  1037. int yyxbegin = yyn < 0 ? -yyn : 0;
  1038. /* Stay within bounds of both yycheck and yytname. */
  1039. int yychecklim = YYLAST - yyn + 1;
  1040. int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
  1041. int yyx;
  1042. for (yyx = yyxbegin; yyx < yyxend; ++yyx)
  1043. if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
  1044. && !yytable_value_is_error (yytable[yyx + yyn]))
  1045. {
  1046. if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
  1047. {
  1048. yycount = 1;
  1049. yysize = yysize0;
  1050. break;
  1051. }
  1052. yyarg[yycount++] = yytname[yyx];
  1053. yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
  1054. if (! (yysize <= yysize1
  1055. && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
  1056. return 2;
  1057. yysize = yysize1;
  1058. }
  1059. }
  1060. }
  1061. switch (yycount)
  1062. {
  1063. # define YYCASE_(N, S) \
  1064. case N: \
  1065. yyformat = S; \
  1066. break
  1067. YYCASE_(0, YY_("syntax error"));
  1068. YYCASE_(1, YY_("syntax error, unexpected %s"));
  1069. YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
  1070. YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
  1071. YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
  1072. YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
  1073. # undef YYCASE_
  1074. }
  1075. yysize1 = yysize + yystrlen (yyformat);
  1076. if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
  1077. return 2;
  1078. yysize = yysize1;
  1079. if (*yymsg_alloc < yysize)
  1080. {
  1081. *yymsg_alloc = 2 * yysize;
  1082. if (! (yysize <= *yymsg_alloc
  1083. && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
  1084. *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
  1085. return 1;
  1086. }
  1087. /* Avoid sprintf, as that infringes on the user's name space.
  1088. Don't have undefined behavior even if the translation
  1089. produced a string with the wrong number of "%s"s. */
  1090. {
  1091. char *yyp = *yymsg;
  1092. int yyi = 0;
  1093. while ((*yyp = *yyformat) != '\0')
  1094. if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
  1095. {
  1096. yyp += yytnamerr (yyp, yyarg[yyi++]);
  1097. yyformat += 2;
  1098. }
  1099. else
  1100. {
  1101. yyp++;
  1102. yyformat++;
  1103. }
  1104. }
  1105. return 0;
  1106. }
  1107. #endif /* YYERROR_VERBOSE */
  1108. /*-----------------------------------------------.
  1109. | Release the memory associated to this symbol. |
  1110. `-----------------------------------------------*/
  1111. /*ARGSUSED*/
  1112. #if (defined __STDC__ || defined __C99__FUNC__ \
  1113. || defined __cplusplus || defined _MSC_VER)
  1114. static void
  1115. yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, void *scanner, struct predicate_node **result)
  1116. #else
  1117. static void
  1118. yydestruct (yymsg, yytype, yyvaluep, yylocationp, scanner, result)
  1119. const char *yymsg;
  1120. int yytype;
  1121. YYSTYPE *yyvaluep;
  1122. YYLTYPE *yylocationp;
  1123. void *scanner;
  1124. struct predicate_node **result;
  1125. #endif
  1126. {
  1127. YYUSE (yyvaluep);
  1128. YYUSE (yylocationp);
  1129. YYUSE (scanner);
  1130. YYUSE (result);
  1131. if (!yymsg)
  1132. yymsg = "Deleting";
  1133. YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
  1134. switch (yytype)
  1135. {
  1136. case 3: /* "STRING" */
  1137. /* Line 1395 of yacc.c */
  1138. #line 240 "predicate/BPredicate.y"
  1139. {
  1140. free((yyvaluep->text));
  1141. };
  1142. /* Line 1395 of yacc.c */
  1143. #line 1340 "generated//bison_BPredicate.c"
  1144. break;
  1145. case 4: /* "NAME" */
  1146. /* Line 1395 of yacc.c */
  1147. #line 240 "predicate/BPredicate.y"
  1148. {
  1149. free((yyvaluep->text));
  1150. };
  1151. /* Line 1395 of yacc.c */
  1152. #line 1351 "generated//bison_BPredicate.c"
  1153. break;
  1154. case 17: /* "predicate" */
  1155. /* Line 1395 of yacc.c */
  1156. #line 250 "predicate/BPredicate.y"
  1157. {
  1158. if ((yyvaluep->node)) {
  1159. free_predicate_node((yyvaluep->node));
  1160. }
  1161. };
  1162. /* Line 1395 of yacc.c */
  1163. #line 1364 "generated//bison_BPredicate.c"
  1164. break;
  1165. case 18: /* "constant" */
  1166. /* Line 1395 of yacc.c */
  1167. #line 250 "predicate/BPredicate.y"
  1168. {
  1169. if ((yyvaluep->node)) {
  1170. free_predicate_node((yyvaluep->node));
  1171. }
  1172. };
  1173. /* Line 1395 of yacc.c */
  1174. #line 1377 "generated//bison_BPredicate.c"
  1175. break;
  1176. case 19: /* "parentheses" */
  1177. /* Line 1395 of yacc.c */
  1178. #line 250 "predicate/BPredicate.y"
  1179. {
  1180. if ((yyvaluep->node)) {
  1181. free_predicate_node((yyvaluep->node));
  1182. }
  1183. };
  1184. /* Line 1395 of yacc.c */
  1185. #line 1390 "generated//bison_BPredicate.c"
  1186. break;
  1187. case 20: /* "neg" */
  1188. /* Line 1395 of yacc.c */
  1189. #line 250 "predicate/BPredicate.y"
  1190. {
  1191. if ((yyvaluep->node)) {
  1192. free_predicate_node((yyvaluep->node));
  1193. }
  1194. };
  1195. /* Line 1395 of yacc.c */
  1196. #line 1403 "generated//bison_BPredicate.c"
  1197. break;
  1198. case 21: /* "conjunct" */
  1199. /* Line 1395 of yacc.c */
  1200. #line 250 "predicate/BPredicate.y"
  1201. {
  1202. if ((yyvaluep->node)) {
  1203. free_predicate_node((yyvaluep->node));
  1204. }
  1205. };
  1206. /* Line 1395 of yacc.c */
  1207. #line 1416 "generated//bison_BPredicate.c"
  1208. break;
  1209. case 22: /* "disjunct" */
  1210. /* Line 1395 of yacc.c */
  1211. #line 250 "predicate/BPredicate.y"
  1212. {
  1213. if ((yyvaluep->node)) {
  1214. free_predicate_node((yyvaluep->node));
  1215. }
  1216. };
  1217. /* Line 1395 of yacc.c */
  1218. #line 1429 "generated//bison_BPredicate.c"
  1219. break;
  1220. case 23: /* "function" */
  1221. /* Line 1395 of yacc.c */
  1222. #line 250 "predicate/BPredicate.y"
  1223. {
  1224. if ((yyvaluep->node)) {
  1225. free_predicate_node((yyvaluep->node));
  1226. }
  1227. };
  1228. /* Line 1395 of yacc.c */
  1229. #line 1442 "generated//bison_BPredicate.c"
  1230. break;
  1231. case 24: /* "arguments" */
  1232. /* Line 1395 of yacc.c */
  1233. #line 257 "predicate/BPredicate.y"
  1234. {
  1235. if ((yyvaluep->arg_node)) {
  1236. free_arguments_node((yyvaluep->arg_node));
  1237. }
  1238. };
  1239. /* Line 1395 of yacc.c */
  1240. #line 1455 "generated//bison_BPredicate.c"
  1241. break;
  1242. case 25: /* "argument" */
  1243. /* Line 1395 of yacc.c */
  1244. #line 264 "predicate/BPredicate.y"
  1245. {
  1246. free_argument((yyvaluep->arg_arg));
  1247. };
  1248. /* Line 1395 of yacc.c */
  1249. #line 1466 "generated//bison_BPredicate.c"
  1250. break;
  1251. default:
  1252. break;
  1253. }
  1254. }
  1255. /* Prevent warnings from -Wmissing-prototypes. */
  1256. #ifdef YYPARSE_PARAM
  1257. #if defined __STDC__ || defined __cplusplus
  1258. int yyparse (void *YYPARSE_PARAM);
  1259. #else
  1260. int yyparse ();
  1261. #endif
  1262. #else /* ! YYPARSE_PARAM */
  1263. #if defined __STDC__ || defined __cplusplus
  1264. int yyparse (void *scanner, struct predicate_node **result);
  1265. #else
  1266. int yyparse ();
  1267. #endif
  1268. #endif /* ! YYPARSE_PARAM */
  1269. /*----------.
  1270. | yyparse. |
  1271. `----------*/
  1272. #ifdef YYPARSE_PARAM
  1273. #if (defined __STDC__ || defined __C99__FUNC__ \
  1274. || defined __cplusplus || defined _MSC_VER)
  1275. int
  1276. yyparse (void *YYPARSE_PARAM)
  1277. #else
  1278. int
  1279. yyparse (YYPARSE_PARAM)
  1280. void *YYPARSE_PARAM;
  1281. #endif
  1282. #else /* ! YYPARSE_PARAM */
  1283. #if (defined __STDC__ || defined __C99__FUNC__ \
  1284. || defined __cplusplus || defined _MSC_VER)
  1285. int
  1286. yyparse (void *scanner, struct predicate_node **result)
  1287. #else
  1288. int
  1289. yyparse (scanner, result)
  1290. void *scanner;
  1291. struct predicate_node **result;
  1292. #endif
  1293. #endif
  1294. {
  1295. /* The lookahead symbol. */
  1296. int yychar;
  1297. /* The semantic value of the lookahead symbol. */
  1298. YYSTYPE yylval;
  1299. /* Location data for the lookahead symbol. */
  1300. YYLTYPE yylloc;
  1301. /* Number of syntax errors so far. */
  1302. int yynerrs;
  1303. int yystate;
  1304. /* Number of tokens to shift before error messages enabled. */
  1305. int yyerrstatus;
  1306. /* The stacks and their tools:
  1307. `yyss': related to states.
  1308. `yyvs': related to semantic values.
  1309. `yyls': related to locations.
  1310. Refer to the stacks through separate pointers, to allow yyoverflow
  1311. to reallocate them elsewhere. */
  1312. /* The state stack. */
  1313. yytype_int16 yyssa[YYINITDEPTH];
  1314. yytype_int16 *yyss;
  1315. yytype_int16 *yyssp;
  1316. /* The semantic value stack. */
  1317. YYSTYPE yyvsa[YYINITDEPTH];
  1318. YYSTYPE *yyvs;
  1319. YYSTYPE *yyvsp;
  1320. /* The location stack. */
  1321. YYLTYPE yylsa[YYINITDEPTH];
  1322. YYLTYPE *yyls;
  1323. YYLTYPE *yylsp;
  1324. /* The locations where the error started and ended. */
  1325. YYLTYPE yyerror_range[3];
  1326. YYSIZE_T yystacksize;
  1327. int yyn;
  1328. int yyresult;
  1329. /* Lookahead token as an internal (translated) token number. */
  1330. int yytoken;
  1331. /* The variables used to return semantic value and location from the
  1332. action routines. */
  1333. YYSTYPE yyval;
  1334. YYLTYPE yyloc;
  1335. #if YYERROR_VERBOSE
  1336. /* Buffer for error messages, and its allocated size. */
  1337. char yymsgbuf[128];
  1338. char *yymsg = yymsgbuf;
  1339. YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
  1340. #endif
  1341. #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
  1342. /* The number of symbols on the RHS of the reduced rule.
  1343. Keep to zero when no symbol should be popped. */
  1344. int yylen = 0;
  1345. yytoken = 0;
  1346. yyss = yyssa;
  1347. yyvs = yyvsa;
  1348. yyls = yylsa;
  1349. yystacksize = YYINITDEPTH;
  1350. YYDPRINTF ((stderr, "Starting parse\n"));
  1351. yystate = 0;
  1352. yyerrstatus = 0;
  1353. yynerrs = 0;
  1354. yychar = YYEMPTY; /* Cause a token to be read. */
  1355. /* Initialize stack pointers.
  1356. Waste one element of value and location stack
  1357. so that they stay on the same level as the state stack.
  1358. The wasted elements are never initialized. */
  1359. yyssp = yyss;
  1360. yyvsp = yyvs;
  1361. yylsp = yyls;
  1362. #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
  1363. /* Initialize the default location before parsing starts. */
  1364. yylloc.first_line = yylloc.last_line = 1;
  1365. yylloc.first_column = yylloc.last_column = 1;
  1366. #endif
  1367. goto yysetstate;
  1368. /*------------------------------------------------------------.
  1369. | yynewstate -- Push a new state, which is found in yystate. |
  1370. `------------------------------------------------------------*/
  1371. yynewstate:
  1372. /* In all cases, when you get here, the value and location stacks
  1373. have just been pushed. So pushing a state here evens the stacks. */
  1374. yyssp++;
  1375. yysetstate:
  1376. *yyssp = yystate;
  1377. if (yyss + yystacksize - 1 <= yyssp)
  1378. {
  1379. /* Get the current used size of the three stacks, in elements. */
  1380. YYSIZE_T yysize = yyssp - yyss + 1;
  1381. #ifdef yyoverflow
  1382. {
  1383. /* Give user a chance to reallocate the stack. Use copies of
  1384. these so that the &'s don't force the real ones into
  1385. memory. */
  1386. YYSTYPE *yyvs1 = yyvs;
  1387. yytype_int16 *yyss1 = yyss;
  1388. YYLTYPE *yyls1 = yyls;
  1389. /* Each stack pointer address is followed by the size of the
  1390. data in use in that stack, in bytes. This used to be a
  1391. conditional around just the two extra args, but that might
  1392. be undefined if yyoverflow is a macro. */
  1393. yyoverflow (YY_("memory exhausted"),
  1394. &yyss1, yysize * sizeof (*yyssp),
  1395. &yyvs1, yysize * sizeof (*yyvsp),
  1396. &yyls1, yysize * sizeof (*yylsp),
  1397. &yystacksize);
  1398. yyls = yyls1;
  1399. yyss = yyss1;
  1400. yyvs = yyvs1;
  1401. }
  1402. #else /* no yyoverflow */
  1403. # ifndef YYSTACK_RELOCATE
  1404. goto yyexhaustedlab;
  1405. # else
  1406. /* Extend the stack our own way. */
  1407. if (YYMAXDEPTH <= yystacksize)
  1408. goto yyexhaustedlab;
  1409. yystacksize *= 2;
  1410. if (YYMAXDEPTH < yystacksize)
  1411. yystacksize = YYMAXDEPTH;
  1412. {
  1413. yytype_int16 *yyss1 = yyss;
  1414. union yyalloc *yyptr =
  1415. (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
  1416. if (! yyptr)
  1417. goto yyexhaustedlab;
  1418. YYSTACK_RELOCATE (yyss_alloc, yyss);
  1419. YYSTACK_RELOCATE (yyvs_alloc, yyvs);
  1420. YYSTACK_RELOCATE (yyls_alloc, yyls);
  1421. # undef YYSTACK_RELOCATE
  1422. if (yyss1 != yyssa)
  1423. YYSTACK_FREE (yyss1);
  1424. }
  1425. # endif
  1426. #endif /* no yyoverflow */
  1427. yyssp = yyss + yysize - 1;
  1428. yyvsp = yyvs + yysize - 1;
  1429. yylsp = yyls + yysize - 1;
  1430. YYDPRINTF ((stderr, "Stack size increased to %lu\n",
  1431. (unsigned long int) yystacksize));
  1432. if (yyss + yystacksize - 1 <= yyssp)
  1433. YYABORT;
  1434. }
  1435. YYDPRINTF ((stderr, "Entering state %d\n", yystate));
  1436. if (yystate == YYFINAL)
  1437. YYACCEPT;
  1438. goto yybackup;
  1439. /*-----------.
  1440. | yybackup. |
  1441. `-----------*/
  1442. yybackup:
  1443. /* Do appropriate processing given the current state. Read a
  1444. lookahead token if we need one and don't already have one. */
  1445. /* First try to decide what to do without reference to lookahead token. */
  1446. yyn = yypact[yystate];
  1447. if (yypact_value_is_default (yyn))
  1448. goto yydefault;
  1449. /* Not known => get a lookahead token if don't already have one. */
  1450. /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
  1451. if (yychar == YYEMPTY)
  1452. {
  1453. YYDPRINTF ((stderr, "Reading a token: "));
  1454. yychar = YYLEX;
  1455. }
  1456. if (yychar <= YYEOF)
  1457. {
  1458. yychar = yytoken = YYEOF;
  1459. YYDPRINTF ((stderr, "Now at end of input.\n"));
  1460. }
  1461. else
  1462. {
  1463. yytoken = YYTRANSLATE (yychar);
  1464. YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
  1465. }
  1466. /* If the proper action on seeing token YYTOKEN is to reduce or to
  1467. detect an error, take that action. */
  1468. yyn += yytoken;
  1469. if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
  1470. goto yydefault;
  1471. yyn = yytable[yyn];
  1472. if (yyn <= 0)
  1473. {
  1474. if (yytable_value_is_error (yyn))
  1475. goto yyerrlab;
  1476. yyn = -yyn;
  1477. goto yyreduce;
  1478. }
  1479. /* Count tokens shifted since error; after three, turn off error
  1480. status. */
  1481. if (yyerrstatus)
  1482. yyerrstatus--;
  1483. /* Shift the lookahead token. */
  1484. YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
  1485. /* Discard the shifted token. */
  1486. yychar = YYEMPTY;
  1487. yystate = yyn;
  1488. *++yyvsp = yylval;
  1489. *++yylsp = yylloc;
  1490. goto yynewstate;
  1491. /*-----------------------------------------------------------.
  1492. | yydefault -- do the default action for the current state. |
  1493. `-----------------------------------------------------------*/
  1494. yydefault:
  1495. yyn = yydefact[yystate];
  1496. if (yyn == 0)
  1497. goto yyerrlab;
  1498. goto yyreduce;
  1499. /*-----------------------------.
  1500. | yyreduce -- Do a reduction. |
  1501. `-----------------------------*/
  1502. yyreduce:
  1503. /* yyn is the number of a rule to reduce with. */
  1504. yylen = yyr2[yyn];
  1505. /* If YYLEN is nonzero, implement the default value of the action:
  1506. `$$ = $1'.
  1507. Otherwise, the following line sets YYVAL to garbage.
  1508. This behavior is undocumented and Bison
  1509. users should not rely upon it. Assigning to YYVAL
  1510. unconditionally makes the parser a bit smaller, and it avoids a
  1511. GCC warning that YYVAL may be used uninitialized. */
  1512. yyval = yyvsp[1-yylen];
  1513. /* Default location. */
  1514. YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
  1515. YY_REDUCE_PRINT (yyn);
  1516. switch (yyn)
  1517. {
  1518. case 2:
  1519. /* Line 1810 of yacc.c */
  1520. #line 276 "predicate/BPredicate.y"
  1521. {
  1522. *result = (yyvsp[(1) - (1)].node);
  1523. }
  1524. break;
  1525. case 9:
  1526. /* Line 1810 of yacc.c */
  1527. #line 284 "predicate/BPredicate.y"
  1528. {
  1529. (yyval.node) = make_constant(1);
  1530. }
  1531. break;
  1532. case 10:
  1533. /* Line 1810 of yacc.c */
  1534. #line 288 "predicate/BPredicate.y"
  1535. {
  1536. (yyval.node) = make_constant(0);
  1537. }
  1538. break;
  1539. case 11:
  1540. /* Line 1810 of yacc.c */
  1541. #line 294 "predicate/BPredicate.y"
  1542. {
  1543. (yyval.node) = (yyvsp[(2) - (3)].node);
  1544. }
  1545. break;
  1546. case 12:
  1547. /* Line 1810 of yacc.c */
  1548. #line 300 "predicate/BPredicate.y"
  1549. {
  1550. (yyval.node) = make_negation((yyvsp[(2) - (2)].node));
  1551. }
  1552. break;
  1553. case 13:
  1554. /* Line 1810 of yacc.c */
  1555. #line 306 "predicate/BPredicate.y"
  1556. {
  1557. (yyval.node) = make_conjunction((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
  1558. }
  1559. break;
  1560. case 14:
  1561. /* Line 1810 of yacc.c */
  1562. #line 312 "predicate/BPredicate.y"
  1563. {
  1564. (yyval.node) = make_disjunction((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
  1565. }
  1566. break;
  1567. case 15:
  1568. /* Line 1810 of yacc.c */
  1569. #line 318 "predicate/BPredicate.y"
  1570. {
  1571. (yyval.node) = make_function((yyvsp[(1) - (3)].text), NULL, 0);
  1572. }
  1573. break;
  1574. case 16:
  1575. /* Line 1810 of yacc.c */
  1576. #line 322 "predicate/BPredicate.y"
  1577. {
  1578. (yyval.node) = make_function((yyvsp[(1) - (4)].text), (yyvsp[(3) - (4)].arg_node), 1);
  1579. }
  1580. break;
  1581. case 17:
  1582. /* Line 1810 of yacc.c */
  1583. #line 328 "predicate/BPredicate.y"
  1584. {
  1585. (yyval.arg_node) = make_arguments((yyvsp[(1) - (1)].arg_arg), NULL, 0);
  1586. }
  1587. break;
  1588. case 18:
  1589. /* Line 1810 of yacc.c */
  1590. #line 332 "predicate/BPredicate.y"
  1591. {
  1592. (yyval.arg_node) = make_arguments((yyvsp[(1) - (3)].arg_arg), (yyvsp[(3) - (3)].arg_node), 1);
  1593. }
  1594. break;
  1595. case 19:
  1596. /* Line 1810 of yacc.c */
  1597. #line 338 "predicate/BPredicate.y"
  1598. {
  1599. (yyval.arg_arg) = make_argument_predicate((yyvsp[(1) - (1)].node));
  1600. }
  1601. break;
  1602. case 20:
  1603. /* Line 1810 of yacc.c */
  1604. #line 342 "predicate/BPredicate.y"
  1605. {
  1606. (yyval.arg_arg) = make_argument_string((yyvsp[(1) - (1)].text));
  1607. }
  1608. break;
  1609. /* Line 1810 of yacc.c */
  1610. #line 1913 "generated//bison_BPredicate.c"
  1611. default: break;
  1612. }
  1613. /* User semantic actions sometimes alter yychar, and that requires
  1614. that yytoken be updated with the new translation. We take the
  1615. approach of translating immediately before every use of yytoken.
  1616. One alternative is translating here after every semantic action,
  1617. but that translation would be missed if the semantic action invokes
  1618. YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
  1619. if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
  1620. incorrect destructor might then be invoked immediately. In the
  1621. case of YYERROR or YYBACKUP, subsequent parser actions might lead
  1622. to an incorrect destructor call or verbose syntax error message
  1623. before the lookahead is translated. */
  1624. YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
  1625. YYPOPSTACK (yylen);
  1626. yylen = 0;
  1627. YY_STACK_PRINT (yyss, yyssp);
  1628. *++yyvsp = yyval;
  1629. *++yylsp = yyloc;
  1630. /* Now `shift' the result of the reduction. Determine what state
  1631. that goes to, based on the state we popped back to and the rule
  1632. number reduced by. */
  1633. yyn = yyr1[yyn];
  1634. yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
  1635. if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  1636. yystate = yytable[yystate];
  1637. else
  1638. yystate = yydefgoto[yyn - YYNTOKENS];
  1639. goto yynewstate;
  1640. /*------------------------------------.
  1641. | yyerrlab -- here on detecting error |
  1642. `------------------------------------*/
  1643. yyerrlab:
  1644. /* Make sure we have latest lookahead translation. See comments at
  1645. user semantic actions for why this is necessary. */
  1646. yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
  1647. /* If not already recovering from an error, report this error. */
  1648. if (!yyerrstatus)
  1649. {
  1650. ++yynerrs;
  1651. #if ! YYERROR_VERBOSE
  1652. yyerror (&yylloc, scanner, result, YY_("syntax error"));
  1653. #else
  1654. # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
  1655. yyssp, yytoken)
  1656. {
  1657. char const *yymsgp = YY_("syntax error");
  1658. int yysyntax_error_status;
  1659. yysyntax_error_status = YYSYNTAX_ERROR;
  1660. if (yysyntax_error_status == 0)
  1661. yymsgp = yymsg;
  1662. else if (yysyntax_error_status == 1)
  1663. {
  1664. if (yymsg != yymsgbuf)
  1665. YYSTACK_FREE (yymsg);
  1666. yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
  1667. if (!yymsg)
  1668. {
  1669. yymsg = yymsgbuf;
  1670. yymsg_alloc = sizeof yymsgbuf;
  1671. yysyntax_error_status = 2;
  1672. }
  1673. else
  1674. {
  1675. yysyntax_error_status = YYSYNTAX_ERROR;
  1676. yymsgp = yymsg;
  1677. }
  1678. }
  1679. yyerror (&yylloc, scanner, result, yymsgp);
  1680. if (yysyntax_error_status == 2)
  1681. goto yyexhaustedlab;
  1682. }
  1683. # undef YYSYNTAX_ERROR
  1684. #endif
  1685. }
  1686. yyerror_range[1] = yylloc;
  1687. if (yyerrstatus == 3)
  1688. {
  1689. /* If just tried and failed to reuse lookahead token after an
  1690. error, discard it. */
  1691. if (yychar <= YYEOF)
  1692. {
  1693. /* Return failure if at end of input. */
  1694. if (yychar == YYEOF)
  1695. YYABORT;
  1696. }
  1697. else
  1698. {
  1699. yydestruct ("Error: discarding",
  1700. yytoken, &yylval, &yylloc, scanner, result);
  1701. yychar = YYEMPTY;
  1702. }
  1703. }
  1704. /* Else will try to reuse lookahead token after shifting the error
  1705. token. */
  1706. goto yyerrlab1;
  1707. /*---------------------------------------------------.
  1708. | yyerrorlab -- error raised explicitly by YYERROR. |
  1709. `---------------------------------------------------*/
  1710. yyerrorlab:
  1711. /* Pacify compilers like GCC when the user code never invokes
  1712. YYERROR and the label yyerrorlab therefore never appears in user
  1713. code. */
  1714. if (/*CONSTCOND*/ 0)
  1715. goto yyerrorlab;
  1716. yyerror_range[1] = yylsp[1-yylen];
  1717. /* Do not reclaim the symbols of the rule which action triggered
  1718. this YYERROR. */
  1719. YYPOPSTACK (yylen);
  1720. yylen = 0;
  1721. YY_STACK_PRINT (yyss, yyssp);
  1722. yystate = *yyssp;
  1723. goto yyerrlab1;
  1724. /*-------------------------------------------------------------.
  1725. | yyerrlab1 -- common code for both syntax error and YYERROR. |
  1726. `-------------------------------------------------------------*/
  1727. yyerrlab1:
  1728. yyerrstatus = 3; /* Each real token shifted decrements this. */
  1729. for (;;)
  1730. {
  1731. yyn = yypact[yystate];
  1732. if (!yypact_value_is_default (yyn))
  1733. {
  1734. yyn += YYTERROR;
  1735. if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
  1736. {
  1737. yyn = yytable[yyn];
  1738. if (0 < yyn)
  1739. break;
  1740. }
  1741. }
  1742. /* Pop the current state because it cannot handle the error token. */
  1743. if (yyssp == yyss)
  1744. YYABORT;
  1745. yyerror_range[1] = *yylsp;
  1746. yydestruct ("Error: popping",
  1747. yystos[yystate], yyvsp, yylsp, scanner, result);
  1748. YYPOPSTACK (1);
  1749. yystate = *yyssp;
  1750. YY_STACK_PRINT (yyss, yyssp);
  1751. }
  1752. *++yyvsp = yylval;
  1753. yyerror_range[2] = yylloc;
  1754. /* Using YYLLOC is tempting, but would change the location of
  1755. the lookahead. YYLOC is available though. */
  1756. YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
  1757. *++yylsp = yyloc;
  1758. /* Shift the error token. */
  1759. YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
  1760. yystate = yyn;
  1761. goto yynewstate;
  1762. /*-------------------------------------.
  1763. | yyacceptlab -- YYACCEPT comes here. |
  1764. `-------------------------------------*/
  1765. yyacceptlab:
  1766. yyresult = 0;
  1767. goto yyreturn;
  1768. /*-----------------------------------.
  1769. | yyabortlab -- YYABORT comes here. |
  1770. `-----------------------------------*/
  1771. yyabortlab:
  1772. yyresult = 1;
  1773. goto yyreturn;
  1774. #if !defined yyoverflow || YYERROR_VERBOSE
  1775. /*-------------------------------------------------.
  1776. | yyexhaustedlab -- memory exhaustion comes here. |
  1777. `-------------------------------------------------*/
  1778. yyexhaustedlab:
  1779. yyerror (&yylloc, scanner, result, YY_("memory exhausted"));
  1780. yyresult = 2;
  1781. /* Fall through. */
  1782. #endif
  1783. yyreturn:
  1784. if (yychar != YYEMPTY)
  1785. {
  1786. /* Make sure we have latest lookahead translation. See comments at
  1787. user semantic actions for why this is necessary. */
  1788. yytoken = YYTRANSLATE (yychar);
  1789. yydestruct ("Cleanup: discarding lookahead",
  1790. yytoken, &yylval, &yylloc, scanner, result);
  1791. }
  1792. /* Do not reclaim the symbols of the rule which action triggered
  1793. this YYABORT or YYACCEPT. */
  1794. YYPOPSTACK (yylen);
  1795. YY_STACK_PRINT (yyss, yyssp);
  1796. while (yyssp != yyss)
  1797. {
  1798. yydestruct ("Cleanup: popping",
  1799. yystos[*yyssp], yyvsp, yylsp, scanner, result);
  1800. YYPOPSTACK (1);
  1801. }
  1802. #ifndef yyoverflow
  1803. if (yyss != yyssa)
  1804. YYSTACK_FREE (yyss);
  1805. #endif
  1806. #if YYERROR_VERBOSE
  1807. if (yymsg != yymsgbuf)
  1808. YYSTACK_FREE (yymsg);
  1809. #endif
  1810. /* Make sure YYID is used. */
  1811. return YYID (yyresult);
  1812. }