bison_BPredicate.c 53 KB

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