bison_BPredicate.c 60 KB

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