bison_BPredicate.c 58 KB

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