grammar.c 53 KB

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