dot.tab.c 87 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816
  1. /* A Bison parser, made by GNU Bison 3.7.5. */
  2. /* Skeleton implementation for Bison GLR parsers in C
  3. Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  14. /* As a special exception, you may create a larger work that contains
  15. part or all of the Bison parser skeleton and distribute that work
  16. under terms of your choice, so long as that work isn't itself a
  17. parser generator using the skeleton or a modified version thereof
  18. as a parser skeleton. Alternatively, if you modify or redistribute
  19. the parser skeleton itself, you may (at your option) remove this
  20. special exception, which will cause the skeleton and the resulting
  21. Bison output files to be licensed under the GNU General Public
  22. License without this special exception.
  23. This special exception was added by the Free Software Foundation in
  24. version 2.2 of Bison. */
  25. /* C GLR parser skeleton written by Paul Hilfinger. */
  26. /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
  27. especially those whose name start with YY_ or yy_. They are
  28. private implementation details that can be changed or removed. */
  29. /* Identify Bison output, and Bison version. */
  30. #define YYBISON 30705
  31. /* Bison version string. */
  32. #define YYBISON_VERSION "3.7.5"
  33. /* Skeleton name. */
  34. #define YYSKELETON_NAME "glr.c"
  35. /* Pure parsers. */
  36. #define YYPURE 0
  37. /* First part of user prologue. */
  38. #line 23 "dot.y"
  39. #include "config.h"
  40. #include <stdio.h>
  41. #include <stdlib.h>
  42. #include <string.h>
  43. #include <zlib.h>
  44. #include "splay-tree.h"
  45. #include "main.h"
  46. #include "dp.h"
  47. #include "dpus.h"
  48. #include "lex.yy.h"
  49. #include "dpmem.h"
  50. #define YY_DEBUG 1
  51. #define YYERROR_VERBOSE 1
  52. /* GNU Bison 3.7.4 bug wrongly uses this attribute not supported in C99 mode */
  53. #undef _Noreturn
  54. #define _Noreturn /**/
  55. /* memory usage wrapping feature */
  56. #ifndef YYFREE
  57. #define YYFREE free
  58. #endif
  59. #ifndef YYMALLOC
  60. #define YYMALLOC malloc
  61. #endif
  62. #ifndef YYREALLOC
  63. #define YYREALLOC realloc
  64. #endif
  65. /* utf8 code at start if 1 */
  66. static int utfseen = 0;
  67. /* graph is strict if 1 */
  68. static int isstrict = 0;
  69. extern int yylex(void);
  70. static void yyerror(const char *msg)
  71. {
  72. if (strlen(dp_errmsg) == 0) {
  73. snprintf(dp_errmsg, 256 - 1, "dot %s(): %s at line %d yytext is %s'\n", __func__, msg, yylineno, yytext);
  74. }
  75. printf("dot %s(): %s at line %d yytext is `%s'\n", __func__, msg, yylineno, yytext);
  76. fflush(stdout);
  77. fflush(stderr);
  78. return;
  79. }
  80. #line 114 "dot.tab.c"
  81. #ifndef YY_CAST
  82. #ifdef __cplusplus
  83. #define YY_CAST(Type, Val) static_cast<Type> (Val)
  84. #define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
  85. #else
  86. #define YY_CAST(Type, Val) ((Type) (Val))
  87. #define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
  88. #endif
  89. #endif
  90. #ifndef YY_NULLPTR
  91. #if defined __cplusplus
  92. #if 201103L <= __cplusplus
  93. #define YY_NULLPTR nullptr
  94. #else
  95. #define YY_NULLPTR 0
  96. #endif
  97. #else
  98. #define YY_NULLPTR ((void*)0)
  99. #endif
  100. #endif
  101. #include "dot.tab.h"
  102. /* Symbol kind. */
  103. enum yysymbol_kind_t {
  104. YYSYMBOL_YYEMPTY = -2,
  105. YYSYMBOL_YYEOF = 0, /* "end of file" */
  106. YYSYMBOL_YYerror = 1, /* error */
  107. YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
  108. YYSYMBOL_TOKEN_BRACEOPEN = 3, /* "{" */
  109. YYSYMBOL_TOKEN_BRACECLOSE = 4, /* "}" */
  110. YYSYMBOL_TOKEN_PLUS = 5, /* "+" */
  111. YYSYMBOL_TOKEN_COMMA = 6, /* "," */
  112. YYSYMBOL_TOKEN_COLON = 7, /* ":" */
  113. YYSYMBOL_TOKEN_IS = 8, /* "=" */
  114. YYSYMBOL_TOKEN_SC = 9, /* ";" */
  115. YYSYMBOL_TOKEN_BRACKETOPEN = 10, /* "[" */
  116. YYSYMBOL_TOKEN_BRACKETCLOSE = 11, /* "]" */
  117. YYSYMBOL_TOKEN_UTF8BOM = 12, /* "utf8code" */
  118. YYSYMBOL_TOKEN_STRICT = 13, /* "strict" */
  119. YYSYMBOL_TOKEN_GRAPH = 14, /* "graph" */
  120. YYSYMBOL_TOKEN_SUBGRAPH = 15, /* "subgraph" */
  121. YYSYMBOL_TOKEN_DIGRAPH = 16, /* "digraph" */
  122. YYSYMBOL_TOKEN_NODE = 17, /* "node" */
  123. YYSYMBOL_TOKEN_EDGE = 18, /* "edge" */
  124. YYSYMBOL_TOKEN_TEXT = 19, /* "text" */
  125. YYSYMBOL_TOKEN_NUM = 20, /* "number" */
  126. YYSYMBOL_TOKEN_QTEXT = 21, /* "string" */
  127. YYSYMBOL_TOKEN_HTEXT = 22, /* "<html-string>" */
  128. YYSYMBOL_TOKEN_EOP = 23, /* "-> or --" */
  129. YYSYMBOL_YYACCEPT = 24, /* $accept */
  130. YYSYMBOL_startdot = 25, /* startdot */
  131. YYSYMBOL_26_1 = 26, /* $@1 */
  132. YYSYMBOL_utf = 27, /* utf */
  133. YYSYMBOL_thetype = 28, /* thetype */
  134. YYSYMBOL_thename = 29, /* thename */
  135. YYSYMBOL_ctext = 30, /* ctext */
  136. YYSYMBOL_text = 31, /* text */
  137. YYSYMBOL_htext = 32, /* htext */
  138. YYSYMBOL_statements = 33, /* statements */
  139. YYSYMBOL_statement = 34, /* statement */
  140. YYSYMBOL_statement2 = 35, /* statement2 */
  141. YYSYMBOL_36_2 = 36, /* $@2 */
  142. YYSYMBOL_nstatement = 37, /* nstatement */
  143. YYSYMBOL_38_3 = 38, /* $@3 */
  144. YYSYMBOL_nidid = 39, /* nidid */
  145. YYSYMBOL_nid = 40, /* nid */
  146. YYSYMBOL_sattr = 41, /* sattr */
  147. YYSYMBOL_sattr2 = 42, /* sattr2 */
  148. YYSYMBOL_iattr = 43, /* iattr */
  149. YYSYMBOL_tattr = 44, /* tattr */
  150. YYSYMBOL_oattrib = 45, /* oattrib */
  151. YYSYMBOL_estatement = 46, /* estatement */
  152. YYSYMBOL_47_4 = 47, /* $@4 */
  153. YYSYMBOL_48_5 = 48, /* $@5 */
  154. YYSYMBOL_49_6 = 49, /* $@6 */
  155. YYSYMBOL_50_7 = 50, /* $@7 */
  156. YYSYMBOL_erhs = 51, /* erhs */
  157. YYSYMBOL_52_8 = 52, /* $@8 */
  158. YYSYMBOL_53_9 = 53, /* $@9 */
  159. YYSYMBOL_astatement = 54, /* astatement */
  160. YYSYMBOL_atype = 55, /* atype */
  161. YYSYMBOL_aset = 56, /* aset */
  162. YYSYMBOL_sstatement = 57, /* sstatement */
  163. YYSYMBOL_58_10 = 58, /* $@10 */
  164. YYSYMBOL_shead = 59 /* shead */
  165. };
  166. typedef enum yysymbol_kind_t yysymbol_kind_t;
  167. /* Default (constant) value used for initialization for null
  168. right-hand sides. Unlike the standard yacc.c template, here we set
  169. the default value of $$ to a zeroed-out value. Since the default
  170. value is undefined, this behavior is technically correct. */
  171. static YYSTYPE yyval_default;
  172. #include <stddef.h>
  173. #include <stdint.h>
  174. #include <stdio.h>
  175. #include <stdlib.h>
  176. #include <string.h>
  177. #ifdef short
  178. #undef short
  179. #endif
  180. /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
  181. <limits.h> and (if available) <stdint.h> are included
  182. so that the code can choose integer types of a good width. */
  183. #ifndef __PTRDIFF_MAX__
  184. #include <limits.h> /* INFRINGES ON USER NAME SPACE */
  185. #if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
  186. #include <stdint.h> /* INFRINGES ON USER NAME SPACE */
  187. #define YY_STDINT_H
  188. #endif
  189. #endif
  190. /* Narrow types that promote to a signed type and that can represent a
  191. signed or unsigned integer of at least N bits. In tables they can
  192. save space and decrease cache pressure. Promoting to a signed type
  193. helps avoid bugs in integer arithmetic. */
  194. #ifdef __INT_LEAST8_MAX__
  195. typedef __INT_LEAST8_TYPE__ yytype_int8;
  196. #elif defined YY_STDINT_H
  197. typedef int_least8_t yytype_int8;
  198. #else
  199. typedef signed char yytype_int8;
  200. #endif
  201. #ifdef __INT_LEAST16_MAX__
  202. typedef __INT_LEAST16_TYPE__ yytype_int16;
  203. #elif defined YY_STDINT_H
  204. typedef int_least16_t yytype_int16;
  205. #else
  206. typedef short yytype_int16;
  207. #endif
  208. /* Work around bug in HP-UX 11.23, which defines these macros
  209. incorrectly for preprocessor constants. This workaround can likely
  210. be removed in 2023, as HPE has promised support for HP-UX 11.23
  211. (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
  212. <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
  213. #ifdef __hpux
  214. #undef UINT_LEAST8_MAX
  215. #undef UINT_LEAST16_MAX
  216. #define UINT_LEAST8_MAX 255
  217. #define UINT_LEAST16_MAX 65535
  218. #endif
  219. #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
  220. typedef __UINT_LEAST8_TYPE__ yytype_uint8;
  221. #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
  222. && UINT_LEAST8_MAX <= INT_MAX)
  223. typedef uint_least8_t yytype_uint8;
  224. #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
  225. typedef unsigned char yytype_uint8;
  226. #else
  227. typedef short yytype_uint8;
  228. #endif
  229. #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
  230. typedef __UINT_LEAST16_TYPE__ yytype_uint16;
  231. #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
  232. && UINT_LEAST16_MAX <= INT_MAX)
  233. typedef uint_least16_t yytype_uint16;
  234. #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
  235. typedef unsigned short yytype_uint16;
  236. #else
  237. typedef int yytype_uint16;
  238. #endif
  239. #ifndef YYPTRDIFF_T
  240. #if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
  241. #define YYPTRDIFF_T __PTRDIFF_TYPE__
  242. #define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
  243. #elif defined PTRDIFF_MAX
  244. #ifndef ptrdiff_t
  245. #include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  246. #endif
  247. #define YYPTRDIFF_T ptrdiff_t
  248. #define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
  249. #else
  250. #define YYPTRDIFF_T long
  251. #define YYPTRDIFF_MAXIMUM LONG_MAX
  252. #endif
  253. #endif
  254. #ifndef YYSIZE_T
  255. #ifdef __SIZE_TYPE__
  256. #define YYSIZE_T __SIZE_TYPE__
  257. #elif defined size_t
  258. #define YYSIZE_T size_t
  259. #elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
  260. #include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  261. #define YYSIZE_T size_t
  262. #else
  263. #define YYSIZE_T unsigned
  264. #endif
  265. #endif
  266. #define YYSIZE_MAXIMUM \
  267. YY_CAST (YYPTRDIFF_T, \
  268. (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
  269. ? YYPTRDIFF_MAXIMUM \
  270. : YY_CAST (YYSIZE_T, -1)))
  271. #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
  272. #ifndef YY_
  273. #if defined YYENABLE_NLS && YYENABLE_NLS
  274. #if ENABLE_NLS
  275. #include <libintl.h> /* INFRINGES ON USER NAME SPACE */
  276. #define YY_(Msgid) dgettext ("bison-runtime", Msgid)
  277. #endif
  278. #endif
  279. #ifndef YY_
  280. #define YY_(Msgid) Msgid
  281. #endif
  282. #endif
  283. #ifndef YYFREE
  284. #define YYFREE free
  285. #endif
  286. #ifndef YYMALLOC
  287. #define YYMALLOC malloc
  288. #endif
  289. #ifndef YYREALLOC
  290. #define YYREALLOC realloc
  291. #endif
  292. #ifdef __cplusplus
  293. typedef bool yybool;
  294. #define yytrue true
  295. #define yyfalse false
  296. #else
  297. /* When we move to stdbool, get rid of the various casts to yybool. */
  298. typedef signed char yybool;
  299. #define yytrue 1
  300. #define yyfalse 0
  301. #endif
  302. #ifndef YYSETJMP
  303. #include <setjmp.h>
  304. #define YYJMP_BUF jmp_buf
  305. #define YYSETJMP(Env) setjmp (Env)
  306. /* Pacify Clang and ICC. */
  307. #define YYLONGJMP(Env, Val) \
  308. do { \
  309. longjmp (Env, Val); \
  310. YY_ASSERT (0); \
  311. } while (yyfalse)
  312. #endif
  313. #ifndef YY_ATTRIBUTE_PURE
  314. #if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
  315. #define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
  316. #else
  317. #define YY_ATTRIBUTE_PURE
  318. #endif
  319. #endif
  320. #ifndef YY_ATTRIBUTE_UNUSED
  321. #if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
  322. #define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
  323. #else
  324. #define YY_ATTRIBUTE_UNUSED
  325. #endif
  326. #endif
  327. /* The _Noreturn keyword of C11. */
  328. #ifndef _Noreturn
  329. #if (defined __cplusplus \
  330. && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \
  331. || (defined _MSC_VER && 1900 <= _MSC_VER)))
  332. #define _Noreturn [[noreturn]]
  333. #elif ((!defined __cplusplus || defined __clang__) \
  334. && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
  335. || (!defined __STRICT_ANSI__ \
  336. && (__4 < __GNUC__ + (7 <= __GNUC_MINOR__) \
  337. || (defined __apple_build_version__ \
  338. ? 6000000 <= __apple_build_version__ \
  339. : 3 < __clang_major__ + (5 <= __clang_minor__))))))
  340. /* _Noreturn works as-is. */
  341. #elif (2 < __GNUC__ + (8 <= __GNUC_MINOR__) || defined __clang__ \
  342. || 0x5110 <= __SUNPRO_C)
  343. #define _Noreturn __attribute__ ((__noreturn__))
  344. #elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
  345. #define _Noreturn __declspec (noreturn)
  346. #else
  347. #define _Noreturn
  348. #endif
  349. #endif
  350. /* Suppress unused-variable warnings by "using" E. */
  351. #if ! defined lint || defined __GNUC__
  352. #define YY_USE(E) ((void) (E))
  353. #else
  354. #define YY_USE(E) /* empty */
  355. #endif
  356. #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
  357. /* Suppress an incorrect diagnostic about yylval being uninitialized. */
  358. #define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
  359. _Pragma ("GCC diagnostic push") \
  360. _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
  361. _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
  362. #define YY_IGNORE_MAYBE_UNINITIALIZED_END \
  363. _Pragma ("GCC diagnostic pop")
  364. #else
  365. #define YY_INITIAL_VALUE(Value) Value
  366. #endif
  367. #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  368. #define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  369. #define YY_IGNORE_MAYBE_UNINITIALIZED_END
  370. #endif
  371. #ifndef YY_INITIAL_VALUE
  372. #define YY_INITIAL_VALUE(Value) /* Nothing. */
  373. #endif
  374. #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
  375. #define YY_IGNORE_USELESS_CAST_BEGIN \
  376. _Pragma ("GCC diagnostic push") \
  377. _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
  378. #define YY_IGNORE_USELESS_CAST_END \
  379. _Pragma ("GCC diagnostic pop")
  380. #endif
  381. #ifndef YY_IGNORE_USELESS_CAST_BEGIN
  382. #define YY_IGNORE_USELESS_CAST_BEGIN
  383. #define YY_IGNORE_USELESS_CAST_END
  384. #endif
  385. #define YY_ASSERT(E) ((void) (0 && (E)))
  386. /* YYFINAL -- State number of the termination state. */
  387. #define YYFINAL 5
  388. /* YYLAST -- Last index in YYTABLE. */
  389. #define YYLAST 111
  390. /* YYNTOKENS -- Number of terminals. */
  391. #define YYNTOKENS 24
  392. /* YYNNTS -- Number of nonterminals. */
  393. #define YYNNTS 36
  394. /* YYNRULES -- Number of rules. */
  395. #define YYNRULES 72
  396. /* YYNSTATES -- Number of states. */
  397. #define YYNSTATES 100
  398. /* YYMAXRHS -- Maximum number of symbols on right-hand side of rule. */
  399. #define YYMAXRHS 7
  400. /* YYMAXLEFT -- Maximum number of symbols to the left of a handle
  401. accessed by $0, $-1, etc., in any rule. */
  402. #define YYMAXLEFT 0
  403. /* YYMAXUTOK -- Last valid token kind. */
  404. #define YYMAXUTOK 278
  405. /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
  406. as returned by yylex, with out-of-bounds checking. */
  407. #define YYTRANSLATE(YYX) \
  408. (0 <= (YYX) && (YYX) <= YYMAXUTOK \
  409. ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
  410. : YYSYMBOL_YYUNDEF)
  411. /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
  412. as returned by yylex. */
  413. static const yytype_int8 yytranslate[] = {
  414. 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  415. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  416. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  417. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  418. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  419. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  420. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  421. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  422. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  423. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  424. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  425. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  426. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  427. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  428. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  429. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  430. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  431. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  432. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  433. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  434. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  435. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  436. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  437. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  438. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  439. 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
  440. 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
  441. 15, 16, 17, 18, 19, 20, 21, 22, 23
  442. };
  443. #if YYDEBUG
  444. /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
  445. static const yytype_int16 yyrline[] = {
  446. 0, 131, 131, 131, 132, 133, 137, 138, 142, 143,
  447. 144, 145, 150, 151, 156, 157, 162, 163, 164, 169,
  448. 173, 174, 180, 181, 182, 192, 193, 194, 195, 195,
  449. 199, 199, 210, 211, 212, 222, 223, 224, 232, 233,
  450. 237, 238, 242, 243, 244, 245, 249, 253, 254, 258,
  451. 258, 258, 259, 259, 259, 264, 265, 265, 266, 267,
  452. 267, 272, 273, 277, 278, 279, 284, 285, 289, 290,
  453. 290, 295, 296
  454. };
  455. #endif
  456. #define YYPACT_NINF (-52)
  457. #define YYTABLE_NINF (-60)
  458. /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
  459. STATE-NUM. */
  460. static const yytype_int8 yypact[] = {
  461. 59, -52, -52, 7, 85, -52, 60, -52, -52, 71,
  462. -52, -52, -52, -52, -52, -52, -2, -52, 10, 6,
  463. 67, -52, -52, -52, 71, -52, -52, 1, 2, -52,
  464. 5, -52, -52, -52, -52, -52, 39, -52, 31, 52,
  465. 67, -52, 71, 75, -52, -52, -52, -52, 39, 55,
  466. 81, -52, 39, 55, 67, 27, 3, -52, -52, -52,
  467. 39, -52, 37, -52, 94, -52, 74, 68, -52, -52,
  468. 47, -52, 71, -52, 96, 82, 83, 39, 75, 81,
  469. 81, -52, -52, 39, -52, 84, 71, 55, 55, -52,
  470. -52, -52, -52, -52, -52, 97, -52, -52, 71, -52
  471. };
  472. /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
  473. Performed when YYTABLE does not specify something else to do. Zero
  474. means the default is an error. */
  475. static const yytype_int8 yydefact[] = {
  476. 0, 4, 6, 0, 0, 1, 0, 9, 11, 13,
  477. 8, 10, 16, 17, 14, 2, 18, 12, 0, 0,
  478. 0, 15, 69, 63, 72, 64, 65, 32, 0, 21,
  479. 22, 25, 30, 49, 26, 27, 0, 62, 28, 0,
  480. 0, 71, 0, 0, 3, 20, 24, 23, 48, 0,
  481. 45, 61, 48, 0, 0, 0, 33, 19, 66, 67,
  482. 48, 31, 0, 50, 41, 40, 45, 0, 29, 53,
  483. 0, 70, 0, 47, 35, 55, 58, 48, 0, 45,
  484. 45, 42, 46, 48, 68, 34, 0, 0, 0, 51,
  485. 38, 39, 43, 44, 54, 36, 57, 60, 0, 37
  486. };
  487. /* YYPGOTO[NTERM-NUM]. */
  488. static const yytype_int8 yypgoto[] = {
  489. -52, -52, -52, -52, -52, -52, -52, -9, 30, -22,
  490. -27, -52, -52, -52, -52, -52, 48, -52, -52, -41,
  491. 73, -48, -52, -52, -52, -52, -52, -51, -52, -52,
  492. -52, -52, -52, 49, -52, -52
  493. };
  494. /* YYDEFGOTO[NTERM-NUM]. */
  495. static const yytype_int8 yydefgoto[] = {
  496. 0, 3, 18, 4, 9, 15, 16, 27, 59, 28,
  497. 29, 30, 52, 31, 48, 32, 33, 65, 66, 67,
  498. 60, 61, 34, 49, 77, 53, 83, 63, 87, 88,
  499. 35, 36, 37, 38, 40, 39
  500. };
  501. /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
  502. positive, shift that token. If negative, reduce the rule whose
  503. number is the opposite. If YYTABLE_NINF, syntax error. */
  504. static const yytype_int8 yytable[] = {
  505. 17, 45, 69, 19, 68, 22, 44, 5, 42, 43,
  506. 72, 46, 73, 20, 47, 41, 23, 24, 55, 25,
  507. 26, 12, 13, 14, -35, 81, -36, 21, 45, 89,
  508. 22, 71, 70, 56, 58, 94, 96, 97, 92, 93,
  509. 22, 23, 24, 45, 25, 26, 12, 13, 14, 50,
  510. 22, 84, 24, 74, -52, 54, 12, 13, 14, -5,
  511. 1, 23, 24, 85, 25, 26, 12, 13, 14, 90,
  512. 22, 2, -7, -7, 10, -7, 11, 95, 62, 82,
  513. 79, 23, 24, 80, 25, 26, 12, 13, 14, 99,
  514. 12, 13, 14, 64, 12, 13, 14, 57, 6, 7,
  515. 64, 8, 78, 86, 98, -56, -59, -37, 91, 51,
  516. 75, 76
  517. };
  518. static const yytype_int8 yycheck[] = {
  519. 9, 28, 53, 5, 52, 3, 4, 0, 7, 8,
  520. 7, 6, 60, 3, 9, 24, 14, 15, 40, 17,
  521. 18, 19, 20, 21, 23, 66, 23, 21, 55, 77,
  522. 3, 4, 54, 42, 43, 83, 87, 88, 79, 80,
  523. 3, 14, 15, 70, 17, 18, 19, 20, 21, 10,
  524. 3, 4, 15, 62, 23, 3, 19, 20, 21, 0,
  525. 1, 14, 15, 72, 17, 18, 19, 20, 21, 78,
  526. 3, 12, 13, 14, 14, 16, 16, 86, 23, 11,
  527. 6, 14, 15, 9, 17, 18, 19, 20, 21, 98,
  528. 19, 20, 21, 19, 19, 20, 21, 22, 13, 14,
  529. 19, 16, 8, 7, 7, 23, 23, 23, 78, 36,
  530. 62, 62
  531. };
  532. /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
  533. symbol of state STATE-NUM. */
  534. static const yytype_int8 yystos[] = {
  535. 0, 1, 12, 25, 27, 0, 13, 14, 16, 28,
  536. 14, 16, 19, 20, 21, 29, 30, 31, 26, 5,
  537. 3, 21, 3, 14, 15, 17, 18, 31, 33, 34,
  538. 35, 37, 39, 40, 46, 54, 55, 56, 57, 59,
  539. 58, 31, 7, 8, 4, 34, 6, 9, 38, 47,
  540. 10, 44, 36, 49, 3, 33, 31, 22, 31, 32,
  541. 44, 45, 23, 51, 19, 41, 42, 43, 45, 51,
  542. 33, 4, 7, 45, 31, 40, 57, 48, 8, 6,
  543. 9, 43, 11, 50, 4, 31, 7, 52, 53, 45,
  544. 31, 32, 43, 43, 45, 31, 51, 51, 7, 31
  545. };
  546. /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
  547. static const yytype_int8 yyr1[] = {
  548. 0, 24, 26, 25, 25, 25, 27, 27, 28, 28,
  549. 28, 28, 29, 29, 30, 30, 31, 31, 31, 32,
  550. 33, 33, 34, 34, 34, 35, 35, 35, 36, 35,
  551. 38, 37, 39, 39, 39, 40, 40, 40, 41, 41,
  552. 42, 42, 43, 43, 43, 43, 44, 45, 45, 47,
  553. 48, 46, 49, 50, 46, 51, 52, 51, 51, 53,
  554. 51, 54, 54, 55, 55, 55, 56, 56, 57, 58,
  555. 57, 59, 59
  556. };
  557. /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
  558. static const yytype_int8 yyr2[] = {
  559. 0, 2, 0, 7, 1, 0, 1, 0, 2, 1,
  560. 2, 1, 1, 0, 1, 3, 1, 1, 1, 1,
  561. 2, 1, 1, 2, 2, 1, 1, 1, 0, 3,
  562. 0, 3, 1, 3, 5, 1, 3, 5, 3, 3,
  563. 1, 1, 2, 3, 3, 0, 3, 2, 0, 0,
  564. 0, 5, 0, 0, 5, 2, 0, 4, 2, 0,
  565. 4, 2, 1, 1, 1, 1, 3, 3, 4, 0,
  566. 4, 2, 1
  567. };
  568. /* YYDPREC[RULE-NUM] -- Dynamic precedence of rule #RULE-NUM (0 if none). */
  569. static const yytype_int8 yydprec[] = {
  570. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  571. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  572. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  573. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  574. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  575. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  576. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  577. 0, 0, 0
  578. };
  579. /* YYMERGER[RULE-NUM] -- Index of merging function for rule #RULE-NUM. */
  580. static const yytype_int8 yymerger[] = {
  581. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  582. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  583. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  584. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  585. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  586. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  587. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  588. 0, 0, 0
  589. };
  590. /* YYIMMEDIATE[RULE-NUM] -- True iff rule #RULE-NUM is not to be deferred, as
  591. in the case of predicates. */
  592. static const yybool yyimmediate[] = {
  593. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  594. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  595. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  596. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  597. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  598. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  599. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  600. 0, 0, 0
  601. };
  602. /* YYCONFLP[YYPACT[STATE-NUM]] -- Pointer into YYCONFL of start of
  603. list of conflicting reductions corresponding to action entry for
  604. state STATE-NUM in yytable. 0 means no conflicts. The list in
  605. yyconfl is terminated by a rule number of 0. */
  606. static const yytype_int8 yyconflp[] = {
  607. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  608. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  609. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  610. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  611. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  612. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  613. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  614. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  615. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  616. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  617. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  618. 0, 0
  619. };
  620. /* YYCONFL[I] -- lists of conflicting rule numbers, each terminated by
  621. 0, pointed into by YYCONFLP. */
  622. static const short yyconfl[] = {
  623. 0
  624. };
  625. YYSTYPE yylval;
  626. int yynerrs;
  627. int yychar;
  628. enum { YYENOMEM = -2 };
  629. typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG;
  630. #define YYCHK(YYE) \
  631. do { \
  632. YYRESULTTAG yychk_flag = YYE; \
  633. if (yychk_flag != yyok) \
  634. return yychk_flag; \
  635. } while (0)
  636. /* YYINITDEPTH -- initial size of the parser's stacks. */
  637. #ifndef YYINITDEPTH
  638. #define YYINITDEPTH 200
  639. #endif
  640. /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
  641. if the built-in stack extension method is used).
  642. Do not make this value too large; the results are undefined if
  643. SIZE_MAX < YYMAXDEPTH * sizeof (GLRStackItem)
  644. evaluated with infinite-precision integer arithmetic. */
  645. #ifndef YYMAXDEPTH
  646. #define YYMAXDEPTH 10000
  647. #endif
  648. /* Minimum number of free items on the stack allowed after an
  649. allocation. This is to allow allocation and initialization
  650. to be completed by functions that call yyexpandGLRStack before the
  651. stack is expanded, thus insuring that all necessary pointers get
  652. properly redirected to new data. */
  653. #define YYHEADROOM 2
  654. #ifndef YYSTACKEXPANDABLE
  655. #define YYSTACKEXPANDABLE 1
  656. #endif
  657. #if YYSTACKEXPANDABLE
  658. #define YY_RESERVE_GLRSTACK(Yystack) \
  659. do { \
  660. if (Yystack->yyspaceLeft < YYHEADROOM) \
  661. yyexpandGLRStack (Yystack); \
  662. } while (0)
  663. #else
  664. #define YY_RESERVE_GLRSTACK(Yystack) \
  665. do { \
  666. if (Yystack->yyspaceLeft < YYHEADROOM) \
  667. yyMemoryExhausted (Yystack); \
  668. } while (0)
  669. #endif
  670. /** State numbers. */
  671. typedef int yy_state_t;
  672. /** Rule numbers. */
  673. typedef int yyRuleNum;
  674. /** Item references. */
  675. typedef short yyItemNum;
  676. typedef struct yyGLRState yyGLRState;
  677. typedef struct yyGLRStateSet yyGLRStateSet;
  678. typedef struct yySemanticOption yySemanticOption;
  679. typedef union yyGLRStackItem yyGLRStackItem;
  680. typedef struct yyGLRStack yyGLRStack;
  681. struct yyGLRState {
  682. /** Type tag: always true. */
  683. yybool yyisState;
  684. /** Type tag for yysemantics. If true, yysval applies, otherwise
  685. * yyfirstVal applies. */
  686. yybool yyresolved;
  687. /** Number of corresponding LALR(1) machine state. */
  688. yy_state_t yylrState;
  689. /** Preceding state in this stack */
  690. yyGLRState *yypred;
  691. /** Source position of the last token produced by my symbol */
  692. YYPTRDIFF_T yyposn;
  693. union {
  694. /** First in a chain of alternative reductions producing the
  695. * nonterminal corresponding to this state, threaded through
  696. * yynext. */
  697. yySemanticOption *yyfirstVal;
  698. /** Semantic value for this state. */
  699. YYSTYPE yysval;
  700. } yysemantics;
  701. };
  702. struct yyGLRStateSet {
  703. yyGLRState **yystates;
  704. /** During nondeterministic operation, yylookaheadNeeds tracks which
  705. * stacks have actually needed the current lookahead. During deterministic
  706. * operation, yylookaheadNeeds[0] is not maintained since it would merely
  707. * duplicate yychar != YYEMPTY. */
  708. yybool *yylookaheadNeeds;
  709. YYPTRDIFF_T yysize;
  710. YYPTRDIFF_T yycapacity;
  711. };
  712. struct yySemanticOption {
  713. /** Type tag: always false. */
  714. yybool yyisState;
  715. /** Rule number for this reduction */
  716. yyRuleNum yyrule;
  717. /** The last RHS state in the list of states to be reduced. */
  718. yyGLRState *yystate;
  719. /** The lookahead for this reduction. */
  720. int yyrawchar;
  721. YYSTYPE yyval;
  722. /** Next sibling in chain of options. To facilitate merging,
  723. * options are chained in decreasing order by address. */
  724. yySemanticOption *yynext;
  725. };
  726. /** Type of the items in the GLR stack. The yyisState field
  727. * indicates which item of the union is valid. */
  728. union yyGLRStackItem {
  729. yyGLRState yystate;
  730. yySemanticOption yyoption;
  731. };
  732. struct yyGLRStack {
  733. int yyerrState;
  734. YYJMP_BUF yyexception_buffer;
  735. yyGLRStackItem *yyitems;
  736. yyGLRStackItem *yynextFree;
  737. YYPTRDIFF_T yyspaceLeft;
  738. yyGLRState *yysplitPoint;
  739. yyGLRState *yylastDeleted;
  740. yyGLRStateSet yytops;
  741. };
  742. #if YYSTACKEXPANDABLE
  743. static void yyexpandGLRStack(yyGLRStack * yystackp);
  744. #endif
  745. _Noreturn static void yyFail(yyGLRStack * yystackp, const char *yymsg)
  746. {
  747. if (yymsg != YY_NULLPTR)
  748. yyerror(yymsg);
  749. YYLONGJMP(yystackp->yyexception_buffer, 1);
  750. }
  751. _Noreturn static void yyMemoryExhausted(yyGLRStack * yystackp)
  752. {
  753. YYLONGJMP(yystackp->yyexception_buffer, 2);
  754. }
  755. /** Accessing symbol of state YYSTATE. */
  756. static inline yysymbol_kind_t yy_accessing_symbol(yy_state_t yystate)
  757. {
  758. return YY_CAST(yysymbol_kind_t, yystos[yystate]);
  759. }
  760. #if YYDEBUG || 0
  761. /* The user-facing name of the symbol whose (internal) number is
  762. YYSYMBOL. No bounds checking. */
  763. static const char *yysymbol_name(yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
  764. /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
  765. First, the terminals, then, starting at YYNTOKENS, nonterminals. */
  766. static const char *const yytname[] = {
  767. "\"end of file\"", "error", "\"invalid token\"", "\"{\"", "\"}\"",
  768. "\"+\"", "\",\"", "\":\"", "\"=\"", "\";\"", "\"[\"", "\"]\"",
  769. "\"utf8code\"", "\"strict\"", "\"graph\"", "\"subgraph\"", "\"digraph\"",
  770. "\"node\"", "\"edge\"", "\"text\"", "\"number\"", "\"string\"",
  771. "\"<html-string>\"", "\"-> or --\"", "$accept", "startdot", "$@1", "utf",
  772. "thetype", "thename", "ctext", "text", "htext", "statements",
  773. "statement", "statement2", "$@2", "nstatement", "$@3", "nidid", "nid",
  774. "sattr", "sattr2", "iattr", "tattr", "oattrib", "estatement", "$@4",
  775. "$@5", "$@6", "$@7", "erhs", "$@8", "$@9", "astatement", "atype", "aset",
  776. "sstatement", "$@10", "shead", YY_NULLPTR
  777. };
  778. static const char *yysymbol_name(yysymbol_kind_t yysymbol)
  779. {
  780. return yytname[yysymbol];
  781. }
  782. #endif
  783. #if YYDEBUG
  784. #ifndef YYFPRINTF
  785. #define YYFPRINTF fprintf
  786. #endif
  787. #define YY_FPRINTF \
  788. YY_IGNORE_USELESS_CAST_BEGIN YY_FPRINTF_
  789. #define YY_FPRINTF_(Args) \
  790. do { \
  791. YYFPRINTF Args; \
  792. YY_IGNORE_USELESS_CAST_END \
  793. } while (0)
  794. #define YY_DPRINTF \
  795. YY_IGNORE_USELESS_CAST_BEGIN YY_DPRINTF_
  796. #define YY_DPRINTF_(Args) \
  797. do { \
  798. if (yydebug) \
  799. YYFPRINTF Args; \
  800. YY_IGNORE_USELESS_CAST_END \
  801. } while (0)
  802. /* This macro is provided for backward compatibility. */
  803. #ifndef YY_LOCATION_PRINT
  804. #define YY_LOCATION_PRINT(File, Loc) ((void) 0)
  805. #endif
  806. /*-----------------------------------.
  807. | Print this symbol's value on YYO. |
  808. `-----------------------------------*/
  809. static void yy_symbol_value_print(FILE * yyo, yysymbol_kind_t yykind, YYSTYPE const *const yyvaluep)
  810. {
  811. FILE *yyoutput = yyo;
  812. YY_USE(yyoutput);
  813. if (!yyvaluep)
  814. return;
  815. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YY_USE(yykind);
  816. YY_IGNORE_MAYBE_UNINITIALIZED_END}
  817. /*---------------------------.
  818. | Print this symbol on YYO. |
  819. `---------------------------*/
  820. static void yy_symbol_print(FILE * yyo, yysymbol_kind_t yykind, YYSTYPE const *const yyvaluep)
  821. {
  822. YYFPRINTF(yyo, "%s %s (", yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name(yykind));
  823. yy_symbol_value_print(yyo, yykind, yyvaluep);
  824. YYFPRINTF(yyo, ")");
  825. }
  826. #define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
  827. do { \
  828. if (yydebug) \
  829. { \
  830. YY_FPRINTF ((stderr, "%s ", Title)); \
  831. yy_symbol_print (stderr, Kind, Value); \
  832. YY_FPRINTF ((stderr, "\n")); \
  833. } \
  834. } while (0)
  835. /* Nonzero means print parse trace. It is left uninitialized so that
  836. multiple parsers can coexist. */
  837. int yydebug;
  838. static void yypstack(yyGLRStack * yystackp, YYPTRDIFF_T yyk) YY_ATTRIBUTE_UNUSED;
  839. static void yypdumpstack(yyGLRStack * yystackp) YY_ATTRIBUTE_UNUSED;
  840. #else /* !YYDEBUG */
  841. #define YY_DPRINTF(Args) do {} while (yyfalse)
  842. #define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
  843. #endif /* !YYDEBUG */
  844. /** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting
  845. * at YYVSP[YYLOW0].yystate.yypred. Leaves YYVSP[YYLOW1].yystate.yypred
  846. * containing the pointer to the next state in the chain. */
  847. static void yyfillin(yyGLRStackItem *, int, int) YY_ATTRIBUTE_UNUSED;
  848. static void yyfillin(yyGLRStackItem * yyvsp, int yylow0, int yylow1)
  849. {
  850. int i;
  851. yyGLRState *s = yyvsp[yylow0].yystate.yypred;
  852. for (i = yylow0 - 1; i >= yylow1; i -= 1) {
  853. #if YYDEBUG
  854. yyvsp[i].yystate.yylrState = s->yylrState;
  855. #endif
  856. yyvsp[i].yystate.yyresolved = s->yyresolved;
  857. if (s->yyresolved)
  858. yyvsp[i].yystate.yysemantics.yysval = s->yysemantics.yysval;
  859. else
  860. /* The effect of using yysval or yyloc (in an immediate rule) is
  861. * undefined. */
  862. yyvsp[i].yystate.yysemantics.yyfirstVal = YY_NULLPTR;
  863. s = yyvsp[i].yystate.yypred = s->yypred;
  864. }
  865. }
  866. /** If yychar is empty, fetch the next token. */
  867. static inline yysymbol_kind_t yygetToken(int *yycharp)
  868. {
  869. yysymbol_kind_t yytoken;
  870. if (*yycharp == YYEMPTY) {
  871. YY_DPRINTF((stderr, "Reading a token\n"));
  872. *yycharp = yylex();
  873. }
  874. if (*yycharp <= YYEOF) {
  875. *yycharp = YYEOF;
  876. yytoken = YYSYMBOL_YYEOF;
  877. YY_DPRINTF((stderr, "Now at end of input.\n"));
  878. } else {
  879. yytoken = YYTRANSLATE(*yycharp);
  880. YY_SYMBOL_PRINT("Next token is", yytoken, &yylval, &yylloc);
  881. }
  882. return yytoken;
  883. }
  884. /* Do nothing if YYNORMAL or if *YYLOW <= YYLOW1. Otherwise, fill in
  885. * YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1.
  886. * For convenience, always return YYLOW1. */
  887. static inline int yyfill(yyGLRStackItem *, int *, int, yybool) YY_ATTRIBUTE_UNUSED;
  888. static inline int yyfill(yyGLRStackItem * yyvsp, int *yylow, int yylow1, yybool yynormal)
  889. {
  890. if (!yynormal && yylow1 < *yylow) {
  891. yyfillin(yyvsp, *yylow, yylow1);
  892. *yylow = yylow1;
  893. }
  894. return yylow1;
  895. }
  896. /** Perform user action for rule number YYN, with RHS length YYRHSLEN,
  897. * and top stack item YYVSP. YYLVALP points to place to put semantic
  898. * value ($$), and yylocp points to place for location information
  899. * (@$). Returns yyok for normal return, yyaccept for YYACCEPT,
  900. * yyerr for YYERROR, yyabort for YYABORT. */
  901. static YYRESULTTAG yyuserAction(yyRuleNum yyn, int yyrhslen, yyGLRStackItem * yyvsp, yyGLRStack * yystackp, YYSTYPE * yyvalp)
  902. {
  903. yybool yynormal YY_ATTRIBUTE_UNUSED = yystackp->yysplitPoint == YY_NULLPTR;
  904. int yylow;
  905. YY_USE(yyvalp);
  906. YY_USE(yyrhslen);
  907. #undef yyerrok
  908. #define yyerrok (yystackp->yyerrState = 0)
  909. #undef YYACCEPT
  910. #define YYACCEPT return yyaccept
  911. #undef YYABORT
  912. #define YYABORT return yyabort
  913. #undef YYERROR
  914. #define YYERROR return yyerrok, yyerr
  915. #undef YYRECOVERING
  916. #define YYRECOVERING() (yystackp->yyerrState != 0)
  917. #undef yyclearin
  918. #define yyclearin (yychar = YYEMPTY)
  919. #undef YYFILL
  920. #define YYFILL(N) yyfill (yyvsp, &yylow, (N), yynormal)
  921. #undef YYBACKUP
  922. #define YYBACKUP(Token, Value) \
  923. return yyerror (YY_("syntax error: cannot back up")), \
  924. yyerrok, yyerr
  925. yylow = 1;
  926. if (yyrhslen == 0)
  927. *yyvalp = yyval_default;
  928. else
  929. *yyvalp = yyvsp[YYFILL(1 - yyrhslen)].yystate.yysemantics.yysval;
  930. switch (yyn) {
  931. case 2: /* $@1: %empty */
  932. #line 131 "dot.y"
  933. {
  934. dp_sg((YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(-1)].yystate.yysemantics.yysval.string),
  935. (YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(0)].yystate.yysemantics.yysval.string));
  936. }
  937. #line 1130 "dot.tab.c"
  938. break;
  939. case 3: /* startdot: utf thetype thename $@1 "{" statements "}" */
  940. #line 131 "dot.y"
  941. {
  942. dp_eg();
  943. }
  944. #line 1136 "dot.tab.c"
  945. break;
  946. case 4: /* startdot: error */
  947. #line 132 "dot.y"
  948. {
  949. dp_eg();
  950. }
  951. #line 1142 "dot.tab.c"
  952. break;
  953. case 5: /* startdot: %empty */
  954. #line 133 "dot.y"
  955. {
  956. dp_eg();
  957. }
  958. #line 1148 "dot.tab.c"
  959. break;
  960. case 6: /* utf: "utf8code" */
  961. #line 137 "dot.y"
  962. {
  963. utfseen = 1;
  964. }
  965. #line 1154 "dot.tab.c"
  966. break;
  967. case 7: /* utf: %empty */
  968. #line 138 "dot.y"
  969. {
  970. utfseen = 0;
  971. }
  972. #line 1160 "dot.tab.c"
  973. break;
  974. case 8: /* thetype: "strict" "graph" */
  975. #line 142 "dot.y"
  976. {
  977. isstrict = 1;
  978. ((*yyvalp).string) = (char *)dp_uniqstr((char *)"--");
  979. }
  980. #line 1166 "dot.tab.c"
  981. break;
  982. case 9: /* thetype: "graph" */
  983. #line 143 "dot.y"
  984. {
  985. isstrict = 0;
  986. ((*yyvalp).string) = (char *)dp_uniqstr((char *)"--");
  987. }
  988. #line 1172 "dot.tab.c"
  989. break;
  990. case 10: /* thetype: "strict" "digraph" */
  991. #line 144 "dot.y"
  992. {
  993. isstrict = 1;
  994. ((*yyvalp).string) = (char *)dp_uniqstr((char *)"->");
  995. }
  996. #line 1178 "dot.tab.c"
  997. break;
  998. case 11: /* thetype: "digraph" */
  999. #line 145 "dot.y"
  1000. {
  1001. isstrict = 0;
  1002. ((*yyvalp).string) = (char *)dp_uniqstr((char *)"->");
  1003. }
  1004. #line 1184 "dot.tab.c"
  1005. break;
  1006. case 12: /* thename: text */
  1007. #line 150 "dot.y"
  1008. {
  1009. ((*yyvalp).string) = (YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(0)].yystate.yysemantics.yysval.string);
  1010. }
  1011. #line 1190 "dot.tab.c"
  1012. break;
  1013. case 13: /* thename: %empty */
  1014. #line 151 "dot.y"
  1015. {
  1016. ((*yyvalp).string) = NULL;
  1017. }
  1018. #line 1196 "dot.tab.c"
  1019. break;
  1020. case 14: /* ctext: "string" */
  1021. #line 156 "dot.y"
  1022. {
  1023. ((*yyvalp).string) = (YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(0)].yystate.yysemantics.yysval.string);
  1024. }
  1025. #line 1202 "dot.tab.c"
  1026. break;
  1027. case 15: /* ctext: ctext "+" "string" */
  1028. #line 157 "dot.y"
  1029. {
  1030. ((*yyvalp).string) =
  1031. dp_ccat((YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(-2)].yystate.yysemantics.yysval.string),
  1032. (YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(0)].yystate.yysemantics.yysval.string));
  1033. }
  1034. #line 1208 "dot.tab.c"
  1035. break;
  1036. case 16: /* text: "text" */
  1037. #line 162 "dot.y"
  1038. {
  1039. ((*yyvalp).string) = (YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(0)].yystate.yysemantics.yysval.string);
  1040. }
  1041. #line 1214 "dot.tab.c"
  1042. break;
  1043. case 17: /* text: "number" */
  1044. #line 163 "dot.y"
  1045. {
  1046. ((*yyvalp).string) = (YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(0)].yystate.yysemantics.yysval.string);
  1047. }
  1048. #line 1220 "dot.tab.c"
  1049. break;
  1050. case 18: /* text: ctext */
  1051. #line 164 "dot.y"
  1052. {
  1053. ((*yyvalp).string) = (YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(0)].yystate.yysemantics.yysval.string);
  1054. }
  1055. #line 1226 "dot.tab.c"
  1056. break;
  1057. case 19: /* htext: "<html-string>" */
  1058. #line 169 "dot.y"
  1059. {
  1060. ((*yyvalp).string) = (YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(0)].yystate.yysemantics.yysval.string);
  1061. }
  1062. #line 1232 "dot.tab.c"
  1063. break;
  1064. case 22: /* statement: statement2 */
  1065. #line 180 "dot.y"
  1066. {
  1067. if (dp_chkerr()) {
  1068. YYERROR; /* YYABORT; does not work as expected */
  1069. }
  1070. }
  1071. #line 1238 "dot.tab.c"
  1072. break;
  1073. case 23: /* statement: statement2 ";" */
  1074. #line 181 "dot.y"
  1075. {
  1076. if (dp_chkerr()) {
  1077. YYERROR; /* YYABORT; does not work as expected */
  1078. }
  1079. }
  1080. #line 1244 "dot.tab.c"
  1081. break;
  1082. case 24: /* statement: statement2 "," */
  1083. #line 182 "dot.y"
  1084. {
  1085. if (dp_chkerr()) {
  1086. YYERROR; /* YYABORT; does not work as expected */
  1087. }
  1088. }
  1089. #line 1250 "dot.tab.c"
  1090. break;
  1091. case 28: /* $@2: %empty */
  1092. #line 195 "dot.y"
  1093. { /* $1 is not used here *//* $1 is read-only object */
  1094. (void)dp_free((void *)(YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(0)].yystate.yysemantics.yysval.dp));
  1095. dp_atype_sgraph();
  1096. }
  1097. #line 1256 "dot.tab.c"
  1098. break;
  1099. case 29: /* statement2: sstatement $@2 oattrib */
  1100. #line 195 "dot.y"
  1101. {
  1102. dp_atype_graph();
  1103. }
  1104. #line 1262 "dot.tab.c"
  1105. break;
  1106. case 30: /* $@3: %empty */
  1107. #line 199 "dot.y"
  1108. {
  1109. dp_mknode0((YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(0)].yystate.yysemantics.yysval.string));
  1110. dp_atype_node();
  1111. }
  1112. #line 1268 "dot.tab.c"
  1113. break;
  1114. case 31: /* nstatement: nidid $@3 oattrib */
  1115. #line 199 "dot.y"
  1116. {
  1117. dp_atype_graph();
  1118. }
  1119. #line 1274 "dot.tab.c"
  1120. break;
  1121. case 32: /* nidid: text */
  1122. #line 210 "dot.y"
  1123. {
  1124. ((*yyvalp).string) = (YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(0)].yystate.yysemantics.yysval.string);
  1125. }
  1126. #line 1280 "dot.tab.c"
  1127. break;
  1128. case 33: /* nidid: text ":" text */
  1129. #line 211 "dot.y"
  1130. {
  1131. ((*yyvalp).string) = (YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(-2)].yystate.yysemantics.yysval.string); /* ignore $3 */
  1132. }
  1133. #line 1286 "dot.tab.c"
  1134. break;
  1135. case 34: /* nidid: text ":" text ":" text */
  1136. #line 212 "dot.y"
  1137. {
  1138. ((*yyvalp).string) = (YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(-4)].yystate.yysemantics.yysval.string); /* ignore $3 $5 */
  1139. }
  1140. #line 1292 "dot.tab.c"
  1141. break;
  1142. case 35: /* nid: text */
  1143. #line 222 "dot.y"
  1144. {
  1145. ((*yyvalp).dp) =
  1146. dp_mknid((YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(0)].yystate.yysemantics.yysval.string), NULL, NULL);
  1147. }
  1148. #line 1298 "dot.tab.c"
  1149. break;
  1150. case 36: /* nid: text ":" text */
  1151. #line 223 "dot.y"
  1152. {
  1153. ((*yyvalp).dp) =
  1154. dp_mknid((YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(-2)].yystate.yysemantics.yysval.string),
  1155. (YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(0)].yystate.yysemantics.yysval.string), NULL);
  1156. }
  1157. #line 1304 "dot.tab.c"
  1158. break;
  1159. case 37: /* nid: text ":" text ":" text */
  1160. #line 224 "dot.y"
  1161. {
  1162. ((*yyvalp).dp) =
  1163. dp_mknid((YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(-4)].yystate.yysemantics.yysval.string),
  1164. (YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(-2)].yystate.yysemantics.yysval.string),
  1165. (YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(0)].yystate.yysemantics.yysval.string));
  1166. }
  1167. #line 1310 "dot.tab.c"
  1168. break;
  1169. case 38: /* sattr: "text" "=" text */
  1170. #line 232 "dot.y"
  1171. { /* string as in "string" */
  1172. dp_aset((YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(-2)].yystate.yysemantics.yysval.string),
  1173. (YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(0)].yystate.yysemantics.yysval.string), 0);
  1174. }
  1175. #line 1316 "dot.tab.c"
  1176. break;
  1177. case 39: /* sattr: "text" "=" htext */
  1178. #line 233 "dot.y"
  1179. { /* html string as in <html-label> */
  1180. dp_aset((YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(-2)].yystate.yysemantics.yysval.string),
  1181. (YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(0)].yystate.yysemantics.yysval.string), 1);
  1182. }
  1183. #line 1322 "dot.tab.c"
  1184. break;
  1185. case 41: /* sattr2: "text" */
  1186. #line 238 "dot.y"
  1187. {
  1188. dp_aset((char *)(YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(0)].yystate.yysemantics.yysval.string),
  1189. (char *)"true", 0);
  1190. }
  1191. #line 1328 "dot.tab.c"
  1192. break;
  1193. case 49: /* $@4: %empty */
  1194. #line 258 "dot.y"
  1195. {
  1196. dp_starte1((YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(0)].yystate.yysemantics.yysval.dp));
  1197. }
  1198. #line 1334 "dot.tab.c"
  1199. break;
  1200. case 50: /* $@5: %empty */
  1201. #line 258 "dot.y"
  1202. {
  1203. dp_newe();
  1204. }
  1205. #line 1340 "dot.tab.c"
  1206. break;
  1207. case 51: /* estatement: nid $@4 erhs $@5 oattrib */
  1208. #line 258 "dot.y"
  1209. {
  1210. dp_ende();
  1211. dp_clrep();
  1212. }
  1213. #line 1346 "dot.tab.c"
  1214. break;
  1215. case 52: /* $@6: %empty */
  1216. #line 259 "dot.y"
  1217. {
  1218. dp_starte2((YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(0)].yystate.yysemantics.yysval.dp));
  1219. }
  1220. #line 1352 "dot.tab.c"
  1221. break;
  1222. case 53: /* $@7: %empty */
  1223. #line 259 "dot.y"
  1224. {
  1225. dp_newe();
  1226. }
  1227. #line 1358 "dot.tab.c"
  1228. break;
  1229. case 54: /* estatement: sstatement $@6 erhs $@7 oattrib */
  1230. #line 259 "dot.y"
  1231. {
  1232. dp_ende();
  1233. dp_clrep();
  1234. }
  1235. #line 1364 "dot.tab.c"
  1236. break;
  1237. case 55: /* erhs: "-> or --" nid */
  1238. #line 264 "dot.y"
  1239. {
  1240. dp_cke((YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(-1)].yystate.yysemantics.yysval.string));
  1241. dp_ine((YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(0)].yystate.yysemantics.yysval.dp));
  1242. }
  1243. #line 1370 "dot.tab.c"
  1244. break;
  1245. case 56: /* $@8: %empty */
  1246. #line 265 "dot.y"
  1247. {
  1248. dp_cke((YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(-1)].yystate.yysemantics.yysval.string));
  1249. dp_ine((YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(0)].yystate.yysemantics.yysval.dp));
  1250. }
  1251. #line 1376 "dot.tab.c"
  1252. break;
  1253. case 58: /* erhs: "-> or --" sstatement */
  1254. #line 266 "dot.y"
  1255. {
  1256. dp_cke((YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(-1)].yystate.yysemantics.yysval.string));
  1257. dp_ine((YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(0)].yystate.yysemantics.yysval.dp));
  1258. }
  1259. #line 1382 "dot.tab.c"
  1260. break;
  1261. case 59: /* $@9: %empty */
  1262. #line 267 "dot.y"
  1263. {
  1264. dp_cke((YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(-1)].yystate.yysemantics.yysval.string));
  1265. dp_ine((YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(0)].yystate.yysemantics.yysval.dp));
  1266. }
  1267. #line 1388 "dot.tab.c"
  1268. break;
  1269. case 61: /* astatement: atype tattr */
  1270. #line 272 "dot.y"
  1271. {
  1272. dp_atype_graph();
  1273. }
  1274. #line 1394 "dot.tab.c"
  1275. break;
  1276. case 62: /* astatement: aset */
  1277. #line 273 "dot.y"
  1278. {
  1279. dp_atype_graph();
  1280. }
  1281. #line 1400 "dot.tab.c"
  1282. break;
  1283. case 63: /* atype: "graph" */
  1284. #line 277 "dot.y"
  1285. {
  1286. dp_atype_graphdef();
  1287. }
  1288. #line 1406 "dot.tab.c"
  1289. break;
  1290. case 64: /* atype: "node" */
  1291. #line 278 "dot.y"
  1292. {
  1293. dp_atype_nodedef();
  1294. }
  1295. #line 1412 "dot.tab.c"
  1296. break;
  1297. case 65: /* atype: "edge" */
  1298. #line 279 "dot.y"
  1299. {
  1300. dp_atype_edgedef();
  1301. }
  1302. #line 1418 "dot.tab.c"
  1303. break;
  1304. case 66: /* aset: text "=" text */
  1305. #line 284 "dot.y"
  1306. {
  1307. dp_aset((YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(-2)].yystate.yysemantics.yysval.string),
  1308. (YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(0)].yystate.yysemantics.yysval.string), 0);
  1309. }
  1310. #line 1424 "dot.tab.c"
  1311. break;
  1312. case 67: /* aset: text "=" htext */
  1313. #line 285 "dot.y"
  1314. {
  1315. dp_aset((YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(-2)].yystate.yysemantics.yysval.string),
  1316. (YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(0)].yystate.yysemantics.yysval.string), 1);
  1317. }
  1318. #line 1430 "dot.tab.c"
  1319. break;
  1320. case 68: /* sstatement: shead "{" statements "}" */
  1321. #line 289 "dot.y"
  1322. {
  1323. ((*yyvalp).dp) = dp_endss();
  1324. }
  1325. #line 1436 "dot.tab.c"
  1326. break;
  1327. case 69: /* $@10: %empty */
  1328. #line 290 "dot.y"
  1329. {
  1330. dp_namedsubg(NULL, DP_SG_CO);
  1331. }
  1332. #line 1442 "dot.tab.c"
  1333. break;
  1334. case 70: /* sstatement: "{" $@10 statements "}" */
  1335. #line 290 "dot.y"
  1336. {
  1337. ((*yyvalp).dp) = dp_endss();
  1338. }
  1339. #line 1448 "dot.tab.c"
  1340. break;
  1341. case 71: /* shead: "subgraph" text */
  1342. #line 295 "dot.y"
  1343. {
  1344. dp_namedsubg((YY_CAST(yyGLRStackItem const *, yyvsp)[YYFILL(0)].yystate.yysemantics.yysval.string), DP_SG_NM);
  1345. }
  1346. #line 1454 "dot.tab.c"
  1347. break;
  1348. case 72: /* shead: "subgraph" */
  1349. #line 296 "dot.y"
  1350. {
  1351. dp_namedsubg(NULL, DP_SG_NN);
  1352. }
  1353. #line 1460 "dot.tab.c"
  1354. break;
  1355. #line 1464 "dot.tab.c"
  1356. default:
  1357. break;
  1358. }
  1359. return yyok;
  1360. #undef yyerrok
  1361. #undef YYABORT
  1362. #undef YYACCEPT
  1363. #undef YYERROR
  1364. #undef YYBACKUP
  1365. #undef yyclearin
  1366. #undef YYRECOVERING
  1367. }
  1368. static void yyuserMerge(int yyn, YYSTYPE * yy0, YYSTYPE * yy1)
  1369. {
  1370. YY_USE(yy0);
  1371. YY_USE(yy1);
  1372. switch (yyn) {
  1373. default:
  1374. break;
  1375. }
  1376. }
  1377. /* Bison grammar-table manipulation. */
  1378. /*-----------------------------------------------.
  1379. | Release the memory associated to this symbol. |
  1380. `-----------------------------------------------*/
  1381. static void yydestruct(const char *yymsg, yysymbol_kind_t yykind, YYSTYPE * yyvaluep)
  1382. {
  1383. YY_USE(yyvaluep);
  1384. if (!yymsg)
  1385. yymsg = "Deleting";
  1386. YY_SYMBOL_PRINT(yymsg, yykind, yyvaluep, yylocationp);
  1387. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YY_USE(yykind);
  1388. YY_IGNORE_MAYBE_UNINITIALIZED_END}
  1389. /** Number of symbols composing the right hand side of rule #RULE. */
  1390. static inline int yyrhsLength(yyRuleNum yyrule)
  1391. {
  1392. return yyr2[yyrule];
  1393. }
  1394. static void yydestroyGLRState(char const *yymsg, yyGLRState * yys)
  1395. {
  1396. if (yys->yyresolved)
  1397. yydestruct(yymsg, yy_accessing_symbol(yys->yylrState), &yys->yysemantics.yysval);
  1398. else {
  1399. #if YYDEBUG
  1400. if (yydebug) {
  1401. if (yys->yysemantics.yyfirstVal)
  1402. YY_FPRINTF((stderr, "%s unresolved", yymsg));
  1403. else
  1404. YY_FPRINTF((stderr, "%s incomplete", yymsg));
  1405. YY_SYMBOL_PRINT("", yy_accessing_symbol(yys->yylrState), YY_NULLPTR, &yys->yyloc);
  1406. }
  1407. #endif
  1408. if (yys->yysemantics.yyfirstVal) {
  1409. yySemanticOption *yyoption = yys->yysemantics.yyfirstVal;
  1410. yyGLRState *yyrh;
  1411. int yyn;
  1412. for (yyrh = yyoption->yystate, yyn = yyrhsLength(yyoption->yyrule); yyn > 0; yyrh = yyrh->yypred, yyn -= 1)
  1413. yydestroyGLRState(yymsg, yyrh);
  1414. }
  1415. }
  1416. }
  1417. /** Left-hand-side symbol for rule #YYRULE. */
  1418. static inline yysymbol_kind_t yylhsNonterm(yyRuleNum yyrule)
  1419. {
  1420. return YY_CAST(yysymbol_kind_t, yyr1[yyrule]);
  1421. }
  1422. #define yypact_value_is_default(Yyn) \
  1423. ((Yyn) == YYPACT_NINF)
  1424. /** True iff LR state YYSTATE has only a default reduction (regardless
  1425. * of token). */
  1426. static inline yybool yyisDefaultedState(yy_state_t yystate)
  1427. {
  1428. return yypact_value_is_default(yypact[yystate]);
  1429. }
  1430. /** The default reduction for YYSTATE, assuming it has one. */
  1431. static inline yyRuleNum yydefaultAction(yy_state_t yystate)
  1432. {
  1433. return yydefact[yystate];
  1434. }
  1435. #define yytable_value_is_error(Yyn) \
  1436. 0
  1437. /** The action to take in YYSTATE on seeing YYTOKEN.
  1438. * Result R means
  1439. * R < 0: Reduce on rule -R.
  1440. * R = 0: Error.
  1441. * R > 0: Shift to state R.
  1442. * Set *YYCONFLICTS to a pointer into yyconfl to a 0-terminated list
  1443. * of conflicting reductions.
  1444. */
  1445. static inline int yygetLRActions(yy_state_t yystate, yysymbol_kind_t yytoken, const short **yyconflicts)
  1446. {
  1447. int yyindex = yypact[yystate] + yytoken;
  1448. if (yytoken == YYSYMBOL_YYerror) {
  1449. // This is the error token.
  1450. *yyconflicts = yyconfl;
  1451. return 0;
  1452. } else if (yyisDefaultedState(yystate)
  1453. || yyindex < 0 || YYLAST < yyindex || yycheck[yyindex] != yytoken) {
  1454. *yyconflicts = yyconfl;
  1455. return -yydefact[yystate];
  1456. } else if (!yytable_value_is_error(yytable[yyindex])) {
  1457. *yyconflicts = yyconfl + yyconflp[yyindex];
  1458. return yytable[yyindex];
  1459. } else {
  1460. *yyconflicts = yyconfl + yyconflp[yyindex];
  1461. return 0;
  1462. }
  1463. }
  1464. /** Compute post-reduction state.
  1465. * \param yystate the current state
  1466. * \param yysym the nonterminal to push on the stack
  1467. */
  1468. static inline yy_state_t yyLRgotoState(yy_state_t yystate, yysymbol_kind_t yysym)
  1469. {
  1470. int yyr = yypgoto[yysym - YYNTOKENS] + yystate;
  1471. if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate)
  1472. return yytable[yyr];
  1473. else
  1474. return yydefgoto[yysym - YYNTOKENS];
  1475. }
  1476. static inline yybool yyisShiftAction(int yyaction)
  1477. {
  1478. return 0 < yyaction;
  1479. }
  1480. static inline yybool yyisErrorAction(int yyaction)
  1481. {
  1482. return yyaction == 0;
  1483. }
  1484. /* GLRStates */
  1485. /** Return a fresh GLRStackItem in YYSTACKP. The item is an LR state
  1486. * if YYISSTATE, and otherwise a semantic option. Callers should call
  1487. * YY_RESERVE_GLRSTACK afterwards to make sure there is sufficient
  1488. * headroom. */
  1489. static inline yyGLRStackItem *yynewGLRStackItem(yyGLRStack * yystackp, yybool yyisState)
  1490. {
  1491. yyGLRStackItem *yynewItem = yystackp->yynextFree;
  1492. yystackp->yyspaceLeft -= 1;
  1493. yystackp->yynextFree += 1;
  1494. yynewItem->yystate.yyisState = yyisState;
  1495. return yynewItem;
  1496. }
  1497. /** Add a new semantic action that will execute the action for rule
  1498. * YYRULE on the semantic values in YYRHS to the list of
  1499. * alternative actions for YYSTATE. Assumes that YYRHS comes from
  1500. * stack #YYK of *YYSTACKP. */
  1501. static void yyaddDeferredAction(yyGLRStack * yystackp, YYPTRDIFF_T yyk, yyGLRState * yystate, yyGLRState * yyrhs, yyRuleNum yyrule)
  1502. {
  1503. yySemanticOption *yynewOption = &yynewGLRStackItem(yystackp, yyfalse)->yyoption;
  1504. YY_ASSERT(!yynewOption->yyisState);
  1505. yynewOption->yystate = yyrhs;
  1506. yynewOption->yyrule = yyrule;
  1507. if (yystackp->yytops.yylookaheadNeeds[yyk]) {
  1508. yynewOption->yyrawchar = yychar;
  1509. yynewOption->yyval = yylval;
  1510. } else
  1511. yynewOption->yyrawchar = YYEMPTY;
  1512. yynewOption->yynext = yystate->yysemantics.yyfirstVal;
  1513. yystate->yysemantics.yyfirstVal = yynewOption;
  1514. YY_RESERVE_GLRSTACK(yystackp);
  1515. }
  1516. /* GLRStacks */
  1517. /** Initialize YYSET to a singleton set containing an empty stack. */
  1518. static yybool yyinitStateSet(yyGLRStateSet * yyset)
  1519. {
  1520. yyset->yysize = 1;
  1521. yyset->yycapacity = 16;
  1522. yyset->yystates = YY_CAST(yyGLRState **, YYMALLOC(YY_CAST(YYSIZE_T, yyset->yycapacity)
  1523. * sizeof yyset->yystates[0]));
  1524. if (!yyset->yystates)
  1525. return yyfalse;
  1526. yyset->yystates[0] = YY_NULLPTR;
  1527. yyset->yylookaheadNeeds = YY_CAST(yybool *, YYMALLOC(YY_CAST(YYSIZE_T, yyset->yycapacity)
  1528. * sizeof yyset->yylookaheadNeeds[0]));
  1529. if (!yyset->yylookaheadNeeds) {
  1530. YYFREE(yyset->yystates);
  1531. return yyfalse;
  1532. }
  1533. memset(yyset->yylookaheadNeeds, 0, YY_CAST(YYSIZE_T, yyset->yycapacity) * sizeof yyset->yylookaheadNeeds[0]);
  1534. return yytrue;
  1535. }
  1536. static void yyfreeStateSet(yyGLRStateSet * yyset)
  1537. {
  1538. YYFREE(yyset->yystates);
  1539. YYFREE(yyset->yylookaheadNeeds);
  1540. }
  1541. /** Initialize *YYSTACKP to a single empty stack, with total maximum
  1542. * capacity for all stacks of YYSIZE. */
  1543. static yybool yyinitGLRStack(yyGLRStack * yystackp, YYPTRDIFF_T yysize)
  1544. {
  1545. yystackp->yyerrState = 0;
  1546. yynerrs = 0;
  1547. yystackp->yyspaceLeft = yysize;
  1548. yystackp->yyitems = YY_CAST(yyGLRStackItem *, YYMALLOC(YY_CAST(YYSIZE_T, yysize)
  1549. * sizeof yystackp->yynextFree[0]));
  1550. if (!yystackp->yyitems)
  1551. return yyfalse;
  1552. yystackp->yynextFree = yystackp->yyitems;
  1553. yystackp->yysplitPoint = YY_NULLPTR;
  1554. yystackp->yylastDeleted = YY_NULLPTR;
  1555. return yyinitStateSet(&yystackp->yytops);
  1556. }
  1557. #if YYSTACKEXPANDABLE
  1558. #define YYRELOC(YYFROMITEMS, YYTOITEMS, YYX, YYTYPE) \
  1559. &((YYTOITEMS) \
  1560. - ((YYFROMITEMS) - YY_REINTERPRET_CAST (yyGLRStackItem*, (YYX))))->YYTYPE
  1561. /** If *YYSTACKP is expandable, extend it. WARNING: Pointers into the
  1562. stack from outside should be considered invalid after this call.
  1563. We always expand when there are 1 or fewer items left AFTER an
  1564. allocation, so that we can avoid having external pointers exist
  1565. across an allocation. */
  1566. static void yyexpandGLRStack(yyGLRStack * yystackp)
  1567. {
  1568. yyGLRStackItem *yynewItems;
  1569. yyGLRStackItem *yyp0, *yyp1;
  1570. YYPTRDIFF_T yynewSize;
  1571. YYPTRDIFF_T yyn;
  1572. YYPTRDIFF_T yysize = yystackp->yynextFree - yystackp->yyitems;
  1573. if (YYMAXDEPTH - YYHEADROOM < yysize)
  1574. yyMemoryExhausted(yystackp);
  1575. yynewSize = 2 * yysize;
  1576. if (YYMAXDEPTH < yynewSize)
  1577. yynewSize = YYMAXDEPTH;
  1578. yynewItems = YY_CAST(yyGLRStackItem *, YYMALLOC(YY_CAST(YYSIZE_T, yynewSize)
  1579. * sizeof yynewItems[0]));
  1580. if (!yynewItems)
  1581. yyMemoryExhausted(yystackp);
  1582. for (yyp0 = yystackp->yyitems, yyp1 = yynewItems, yyn = yysize; 0 < yyn; yyn -= 1, yyp0 += 1, yyp1 += 1) {
  1583. *yyp1 = *yyp0;
  1584. if (*YY_REINTERPRET_CAST(yybool *, yyp0)) {
  1585. yyGLRState *yys0 = &yyp0->yystate;
  1586. yyGLRState *yys1 = &yyp1->yystate;
  1587. if (yys0->yypred != YY_NULLPTR)
  1588. yys1->yypred = YYRELOC(yyp0, yyp1, yys0->yypred, yystate);
  1589. if (!yys0->yyresolved && yys0->yysemantics.yyfirstVal != YY_NULLPTR)
  1590. yys1->yysemantics.yyfirstVal = YYRELOC(yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption);
  1591. } else {
  1592. yySemanticOption *yyv0 = &yyp0->yyoption;
  1593. yySemanticOption *yyv1 = &yyp1->yyoption;
  1594. if (yyv0->yystate != YY_NULLPTR)
  1595. yyv1->yystate = YYRELOC(yyp0, yyp1, yyv0->yystate, yystate);
  1596. if (yyv0->yynext != YY_NULLPTR)
  1597. yyv1->yynext = YYRELOC(yyp0, yyp1, yyv0->yynext, yyoption);
  1598. }
  1599. }
  1600. if (yystackp->yysplitPoint != YY_NULLPTR)
  1601. yystackp->yysplitPoint = YYRELOC(yystackp->yyitems, yynewItems, yystackp->yysplitPoint, yystate);
  1602. for (yyn = 0; yyn < yystackp->yytops.yysize; yyn += 1)
  1603. if (yystackp->yytops.yystates[yyn] != YY_NULLPTR)
  1604. yystackp->yytops.yystates[yyn] = YYRELOC(yystackp->yyitems, yynewItems, yystackp->yytops.yystates[yyn], yystate);
  1605. YYFREE(yystackp->yyitems);
  1606. yystackp->yyitems = yynewItems;
  1607. yystackp->yynextFree = yynewItems + yysize;
  1608. yystackp->yyspaceLeft = yynewSize - yysize;
  1609. }
  1610. #endif
  1611. static void yyfreeGLRStack(yyGLRStack * yystackp)
  1612. {
  1613. YYFREE(yystackp->yyitems);
  1614. yyfreeStateSet(&yystackp->yytops);
  1615. }
  1616. /** Assuming that YYS is a GLRState somewhere on *YYSTACKP, update the
  1617. * splitpoint of *YYSTACKP, if needed, so that it is at least as deep as
  1618. * YYS. */
  1619. static inline void yyupdateSplit(yyGLRStack * yystackp, yyGLRState * yys)
  1620. {
  1621. if (yystackp->yysplitPoint != YY_NULLPTR && yystackp->yysplitPoint > yys)
  1622. yystackp->yysplitPoint = yys;
  1623. }
  1624. /** Invalidate stack #YYK in *YYSTACKP. */
  1625. static inline void yymarkStackDeleted(yyGLRStack * yystackp, YYPTRDIFF_T yyk)
  1626. {
  1627. if (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
  1628. yystackp->yylastDeleted = yystackp->yytops.yystates[yyk];
  1629. yystackp->yytops.yystates[yyk] = YY_NULLPTR;
  1630. }
  1631. /** Undelete the last stack in *YYSTACKP that was marked as deleted. Can
  1632. only be done once after a deletion, and only when all other stacks have
  1633. been deleted. */
  1634. static void yyundeleteLastStack(yyGLRStack * yystackp)
  1635. {
  1636. if (yystackp->yylastDeleted == YY_NULLPTR || yystackp->yytops.yysize != 0)
  1637. return;
  1638. yystackp->yytops.yystates[0] = yystackp->yylastDeleted;
  1639. yystackp->yytops.yysize = 1;
  1640. YY_DPRINTF((stderr, "Restoring last deleted stack as stack #0.\n"));
  1641. yystackp->yylastDeleted = YY_NULLPTR;
  1642. }
  1643. static inline void yyremoveDeletes(yyGLRStack * yystackp)
  1644. {
  1645. YYPTRDIFF_T yyi, yyj;
  1646. yyi = yyj = 0;
  1647. while (yyj < yystackp->yytops.yysize) {
  1648. if (yystackp->yytops.yystates[yyi] == YY_NULLPTR) {
  1649. if (yyi == yyj)
  1650. YY_DPRINTF((stderr, "Removing dead stacks.\n"));
  1651. yystackp->yytops.yysize -= 1;
  1652. } else {
  1653. yystackp->yytops.yystates[yyj] = yystackp->yytops.yystates[yyi];
  1654. /* In the current implementation, it's unnecessary to copy
  1655. yystackp->yytops.yylookaheadNeeds[yyi] since, after
  1656. yyremoveDeletes returns, the parser immediately either enters
  1657. deterministic operation or shifts a token. However, it doesn't
  1658. hurt, and the code might evolve to need it. */
  1659. yystackp->yytops.yylookaheadNeeds[yyj] = yystackp->yytops.yylookaheadNeeds[yyi];
  1660. if (yyj != yyi)
  1661. YY_DPRINTF((stderr, "Rename stack %ld -> %ld.\n", YY_CAST(long, yyi), YY_CAST(long, yyj)));
  1662. yyj += 1;
  1663. }
  1664. yyi += 1;
  1665. }
  1666. }
  1667. /** Shift to a new state on stack #YYK of *YYSTACKP, corresponding to LR
  1668. * state YYLRSTATE, at input position YYPOSN, with (resolved) semantic
  1669. * value *YYVALP and source location *YYLOCP. */
  1670. static inline void yyglrShift(yyGLRStack * yystackp, YYPTRDIFF_T yyk, yy_state_t yylrState, YYPTRDIFF_T yyposn, YYSTYPE * yyvalp)
  1671. {
  1672. yyGLRState *yynewState = &yynewGLRStackItem(yystackp, yytrue)->yystate;
  1673. yynewState->yylrState = yylrState;
  1674. yynewState->yyposn = yyposn;
  1675. yynewState->yyresolved = yytrue;
  1676. yynewState->yypred = yystackp->yytops.yystates[yyk];
  1677. yynewState->yysemantics.yysval = *yyvalp;
  1678. yystackp->yytops.yystates[yyk] = yynewState;
  1679. YY_RESERVE_GLRSTACK(yystackp);
  1680. }
  1681. /** Shift stack #YYK of *YYSTACKP, to a new state corresponding to LR
  1682. * state YYLRSTATE, at input position YYPOSN, with the (unresolved)
  1683. * semantic value of YYRHS under the action for YYRULE. */
  1684. static inline void
  1685. yyglrShiftDefer(yyGLRStack * yystackp, YYPTRDIFF_T yyk, yy_state_t yylrState,
  1686. YYPTRDIFF_T yyposn, yyGLRState * yyrhs, yyRuleNum yyrule)
  1687. {
  1688. yyGLRState *yynewState = &yynewGLRStackItem(yystackp, yytrue)->yystate;
  1689. YY_ASSERT(yynewState->yyisState);
  1690. yynewState->yylrState = yylrState;
  1691. yynewState->yyposn = yyposn;
  1692. yynewState->yyresolved = yyfalse;
  1693. yynewState->yypred = yystackp->yytops.yystates[yyk];
  1694. yynewState->yysemantics.yyfirstVal = YY_NULLPTR;
  1695. yystackp->yytops.yystates[yyk] = yynewState;
  1696. /* Invokes YY_RESERVE_GLRSTACK. */
  1697. yyaddDeferredAction(yystackp, yyk, yynewState, yyrhs, yyrule);
  1698. }
  1699. #if !YYDEBUG
  1700. #define YY_REDUCE_PRINT(Args)
  1701. #else
  1702. #define YY_REDUCE_PRINT(Args) \
  1703. do { \
  1704. if (yydebug) \
  1705. yy_reduce_print Args; \
  1706. } while (0)
  1707. /*----------------------------------------------------------------------.
  1708. | Report that stack #YYK of *YYSTACKP is going to be reduced by YYRULE. |
  1709. `----------------------------------------------------------------------*/
  1710. static inline void yy_reduce_print(yybool yynormal, yyGLRStackItem * yyvsp, YYPTRDIFF_T yyk, yyRuleNum yyrule)
  1711. {
  1712. int yynrhs = yyrhsLength(yyrule);
  1713. int yyi;
  1714. YY_FPRINTF((stderr, "Reducing stack %ld by rule %d (line %d):\n", YY_CAST(long, yyk), yyrule - 1, yyrline[yyrule]));
  1715. if (!yynormal)
  1716. yyfillin(yyvsp, 1, -yynrhs);
  1717. /* The symbols being reduced. */
  1718. for (yyi = 0; yyi < yynrhs; yyi++) {
  1719. YY_FPRINTF((stderr, " $%d = ", yyi + 1));
  1720. yy_symbol_print(stderr,
  1721. yy_accessing_symbol(yyvsp[yyi - yynrhs + 1].yystate.yylrState),
  1722. &yyvsp[yyi - yynrhs + 1].yystate.yysemantics.yysval);
  1723. if (!yyvsp[yyi - yynrhs + 1].yystate.yyresolved)
  1724. YY_FPRINTF((stderr, " (unresolved)"));
  1725. YY_FPRINTF((stderr, "\n"));
  1726. }
  1727. }
  1728. #endif
  1729. /** Pop the symbols consumed by reduction #YYRULE from the top of stack
  1730. * #YYK of *YYSTACKP, and perform the appropriate semantic action on their
  1731. * semantic values. Assumes that all ambiguities in semantic values
  1732. * have been previously resolved. Set *YYVALP to the resulting value,
  1733. * and *YYLOCP to the computed location (if any). Return value is as
  1734. * for userAction. */
  1735. static inline YYRESULTTAG yydoAction(yyGLRStack * yystackp, YYPTRDIFF_T yyk, yyRuleNum yyrule, YYSTYPE * yyvalp)
  1736. {
  1737. int yynrhs = yyrhsLength(yyrule);
  1738. if (yystackp->yysplitPoint == YY_NULLPTR) {
  1739. /* Standard special case: single stack. */
  1740. yyGLRStackItem *yyrhs = YY_REINTERPRET_CAST(yyGLRStackItem *, yystackp->yytops.yystates[yyk]);
  1741. YY_ASSERT(yyk == 0);
  1742. yystackp->yynextFree -= yynrhs;
  1743. yystackp->yyspaceLeft += yynrhs;
  1744. yystackp->yytops.yystates[0] = &yystackp->yynextFree[-1].yystate;
  1745. YY_REDUCE_PRINT((yytrue, yyrhs, yyk, yyrule));
  1746. return yyuserAction(yyrule, yynrhs, yyrhs, yystackp, yyvalp);
  1747. } else {
  1748. yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1];
  1749. yyGLRState *yys = yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred = yystackp->yytops.yystates[yyk];
  1750. int yyi;
  1751. for (yyi = 0; yyi < yynrhs; yyi += 1) {
  1752. yys = yys->yypred;
  1753. YY_ASSERT(yys);
  1754. }
  1755. yyupdateSplit(yystackp, yys);
  1756. yystackp->yytops.yystates[yyk] = yys;
  1757. YY_REDUCE_PRINT((yyfalse, yyrhsVals + YYMAXRHS + YYMAXLEFT - 1, yyk, yyrule));
  1758. return yyuserAction(yyrule, yynrhs, yyrhsVals + YYMAXRHS + YYMAXLEFT - 1, yystackp, yyvalp);
  1759. }
  1760. }
  1761. /** Pop items off stack #YYK of *YYSTACKP according to grammar rule YYRULE,
  1762. * and push back on the resulting nonterminal symbol. Perform the
  1763. * semantic action associated with YYRULE and store its value with the
  1764. * newly pushed state, if YYFORCEEVAL or if *YYSTACKP is currently
  1765. * unambiguous. Otherwise, store the deferred semantic action with
  1766. * the new state. If the new state would have an identical input
  1767. * position, LR state, and predecessor to an existing state on the stack,
  1768. * it is identified with that existing state, eliminating stack #YYK from
  1769. * *YYSTACKP. In this case, the semantic value is
  1770. * added to the options for the existing state's semantic value.
  1771. */
  1772. static inline YYRESULTTAG yyglrReduce(yyGLRStack * yystackp, YYPTRDIFF_T yyk, yyRuleNum yyrule, yybool yyforceEval)
  1773. {
  1774. YYPTRDIFF_T yyposn = yystackp->yytops.yystates[yyk]->yyposn;
  1775. if (yyforceEval || yystackp->yysplitPoint == YY_NULLPTR) {
  1776. YYSTYPE yysval;
  1777. YYRESULTTAG yyflag = yydoAction(yystackp, yyk, yyrule, &yysval);
  1778. if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULLPTR)
  1779. YY_DPRINTF((stderr,
  1780. "Parse on stack %ld rejected by rule %d (line %d).\n",
  1781. YY_CAST(long, yyk), yyrule - 1, yyrline[yyrule - 1]));
  1782. if (yyflag != yyok)
  1783. return yyflag;
  1784. YY_SYMBOL_PRINT("-> $$ =", yylhsNonterm(yyrule), &yysval, &yyloc);
  1785. yyglrShift(yystackp, yyk, yyLRgotoState(yystackp->yytops.yystates[yyk]->yylrState, yylhsNonterm(yyrule)), yyposn, &yysval);
  1786. } else {
  1787. YYPTRDIFF_T yyi;
  1788. int yyn;
  1789. yyGLRState *yys, *yys0 = yystackp->yytops.yystates[yyk];
  1790. yy_state_t yynewLRState;
  1791. for (yys = yystackp->yytops.yystates[yyk], yyn = yyrhsLength(yyrule); 0 < yyn; yyn -= 1) {
  1792. yys = yys->yypred;
  1793. YY_ASSERT(yys);
  1794. }
  1795. yyupdateSplit(yystackp, yys);
  1796. yynewLRState = yyLRgotoState(yys->yylrState, yylhsNonterm(yyrule));
  1797. YY_DPRINTF((stderr,
  1798. "Reduced stack %ld by rule %d (line %d); action deferred. "
  1799. "Now in state %d.\n", YY_CAST(long, yyk), yyrule - 1, yyrline[yyrule - 1], yynewLRState));
  1800. for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
  1801. if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULLPTR) {
  1802. yyGLRState *yysplit = yystackp->yysplitPoint;
  1803. yyGLRState *yyp = yystackp->yytops.yystates[yyi];
  1804. while (yyp != yys && yyp != yysplit && yyp->yyposn >= yyposn) {
  1805. if (yyp->yylrState == yynewLRState && yyp->yypred == yys) {
  1806. yyaddDeferredAction(yystackp, yyk, yyp, yys0, yyrule);
  1807. yymarkStackDeleted(yystackp, yyk);
  1808. YY_DPRINTF((stderr, "Merging stack %ld into stack %ld.\n", YY_CAST(long, yyk), YY_CAST(long, yyi)));
  1809. return yyok;
  1810. }
  1811. yyp = yyp->yypred;
  1812. }
  1813. }
  1814. yystackp->yytops.yystates[yyk] = yys;
  1815. yyglrShiftDefer(yystackp, yyk, yynewLRState, yyposn, yys0, yyrule);
  1816. }
  1817. return yyok;
  1818. }
  1819. static YYPTRDIFF_T yysplitStack(yyGLRStack * yystackp, YYPTRDIFF_T yyk)
  1820. {
  1821. if (yystackp->yysplitPoint == YY_NULLPTR) {
  1822. YY_ASSERT(yyk == 0);
  1823. yystackp->yysplitPoint = yystackp->yytops.yystates[yyk];
  1824. }
  1825. if (yystackp->yytops.yycapacity <= yystackp->yytops.yysize) {
  1826. YYPTRDIFF_T state_size = YYSIZEOF(yystackp->yytops.yystates[0]);
  1827. YYPTRDIFF_T half_max_capacity = YYSIZE_MAXIMUM / 2 / state_size;
  1828. if (half_max_capacity < yystackp->yytops.yycapacity)
  1829. yyMemoryExhausted(yystackp);
  1830. yystackp->yytops.yycapacity *= 2;
  1831. {
  1832. yyGLRState **yynewStates = YY_CAST(yyGLRState **,
  1833. YYREALLOC(yystackp->yytops.yystates,
  1834. (YY_CAST(YYSIZE_T, yystackp->yytops.yycapacity)
  1835. * sizeof yynewStates[0])));
  1836. if (yynewStates == YY_NULLPTR)
  1837. yyMemoryExhausted(yystackp);
  1838. yystackp->yytops.yystates = yynewStates;
  1839. }
  1840. {
  1841. yybool *yynewLookaheadNeeds = YY_CAST(yybool *,
  1842. YYREALLOC(yystackp->yytops.yylookaheadNeeds,
  1843. (YY_CAST(YYSIZE_T, yystackp->yytops.yycapacity)
  1844. * sizeof yynewLookaheadNeeds[0])));
  1845. if (yynewLookaheadNeeds == YY_NULLPTR)
  1846. yyMemoryExhausted(yystackp);
  1847. yystackp->yytops.yylookaheadNeeds = yynewLookaheadNeeds;
  1848. }
  1849. }
  1850. yystackp->yytops.yystates[yystackp->yytops.yysize]
  1851. = yystackp->yytops.yystates[yyk];
  1852. yystackp->yytops.yylookaheadNeeds[yystackp->yytops.yysize]
  1853. = yystackp->yytops.yylookaheadNeeds[yyk];
  1854. yystackp->yytops.yysize += 1;
  1855. return yystackp->yytops.yysize - 1;
  1856. }
  1857. /** True iff YYY0 and YYY1 represent identical options at the top level.
  1858. * That is, they represent the same rule applied to RHS symbols
  1859. * that produce the same terminal symbols. */
  1860. static yybool yyidenticalOptions(yySemanticOption * yyy0, yySemanticOption * yyy1)
  1861. {
  1862. if (yyy0->yyrule == yyy1->yyrule) {
  1863. yyGLRState *yys0, *yys1;
  1864. int yyn;
  1865. for (yys0 = yyy0->yystate, yys1 = yyy1->yystate,
  1866. yyn = yyrhsLength(yyy0->yyrule); yyn > 0; yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1)
  1867. if (yys0->yyposn != yys1->yyposn)
  1868. return yyfalse;
  1869. return yytrue;
  1870. } else
  1871. return yyfalse;
  1872. }
  1873. /** Assuming identicalOptions (YYY0,YYY1), destructively merge the
  1874. * alternative semantic values for the RHS-symbols of YYY1 and YYY0. */
  1875. static void yymergeOptionSets(yySemanticOption * yyy0, yySemanticOption * yyy1)
  1876. {
  1877. yyGLRState *yys0, *yys1;
  1878. int yyn;
  1879. for (yys0 = yyy0->yystate, yys1 = yyy1->yystate,
  1880. yyn = yyrhsLength(yyy0->yyrule); 0 < yyn; yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1) {
  1881. if (yys0 == yys1)
  1882. break;
  1883. else if (yys0->yyresolved) {
  1884. yys1->yyresolved = yytrue;
  1885. yys1->yysemantics.yysval = yys0->yysemantics.yysval;
  1886. } else if (yys1->yyresolved) {
  1887. yys0->yyresolved = yytrue;
  1888. yys0->yysemantics.yysval = yys1->yysemantics.yysval;
  1889. } else {
  1890. yySemanticOption **yyz0p = &yys0->yysemantics.yyfirstVal;
  1891. yySemanticOption *yyz1 = yys1->yysemantics.yyfirstVal;
  1892. while (yytrue) {
  1893. if (yyz1 == *yyz0p || yyz1 == YY_NULLPTR)
  1894. break;
  1895. else if (*yyz0p == YY_NULLPTR) {
  1896. *yyz0p = yyz1;
  1897. break;
  1898. } else if (*yyz0p < yyz1) {
  1899. yySemanticOption *yyz = *yyz0p;
  1900. *yyz0p = yyz1;
  1901. yyz1 = yyz1->yynext;
  1902. (*yyz0p)->yynext = yyz;
  1903. }
  1904. yyz0p = &(*yyz0p)->yynext;
  1905. }
  1906. yys1->yysemantics.yyfirstVal = yys0->yysemantics.yyfirstVal;
  1907. }
  1908. }
  1909. }
  1910. /** Y0 and Y1 represent two possible actions to take in a given
  1911. * parsing state; return 0 if no combination is possible,
  1912. * 1 if user-mergeable, 2 if Y0 is preferred, 3 if Y1 is preferred. */
  1913. static int yypreference(yySemanticOption * y0, yySemanticOption * y1)
  1914. {
  1915. yyRuleNum r0 = y0->yyrule, r1 = y1->yyrule;
  1916. int p0 = yydprec[r0], p1 = yydprec[r1];
  1917. if (p0 == p1) {
  1918. if (yymerger[r0] == 0 || yymerger[r0] != yymerger[r1])
  1919. return 0;
  1920. else
  1921. return 1;
  1922. }
  1923. if (p0 == 0 || p1 == 0)
  1924. return 0;
  1925. if (p0 < p1)
  1926. return 3;
  1927. if (p1 < p0)
  1928. return 2;
  1929. return 0;
  1930. }
  1931. static YYRESULTTAG yyresolveValue(yyGLRState * yys, yyGLRStack * yystackp);
  1932. /** Resolve the previous YYN states starting at and including state YYS
  1933. * on *YYSTACKP. If result != yyok, some states may have been left
  1934. * unresolved possibly with empty semantic option chains. Regardless
  1935. * of whether result = yyok, each state has been left with consistent
  1936. * data so that yydestroyGLRState can be invoked if necessary. */
  1937. static YYRESULTTAG yyresolveStates(yyGLRState * yys, int yyn, yyGLRStack * yystackp)
  1938. {
  1939. if (0 < yyn) {
  1940. YY_ASSERT(yys->yypred);
  1941. YYCHK(yyresolveStates(yys->yypred, yyn - 1, yystackp));
  1942. if (!yys->yyresolved)
  1943. YYCHK(yyresolveValue(yys, yystackp));
  1944. }
  1945. return yyok;
  1946. }
  1947. /** Resolve the states for the RHS of YYOPT on *YYSTACKP, perform its
  1948. * user action, and return the semantic value and location in *YYVALP
  1949. * and *YYLOCP. Regardless of whether result = yyok, all RHS states
  1950. * have been destroyed (assuming the user action destroys all RHS
  1951. * semantic values if invoked). */
  1952. static YYRESULTTAG yyresolveAction(yySemanticOption * yyopt, yyGLRStack * yystackp, YYSTYPE * yyvalp)
  1953. {
  1954. yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1];
  1955. int yynrhs = yyrhsLength(yyopt->yyrule);
  1956. YYRESULTTAG yyflag = yyresolveStates(yyopt->yystate, yynrhs, yystackp);
  1957. if (yyflag != yyok) {
  1958. yyGLRState *yys;
  1959. for (yys = yyopt->yystate; yynrhs > 0; yys = yys->yypred, yynrhs -= 1)
  1960. yydestroyGLRState("Cleanup: popping", yys);
  1961. return yyflag;
  1962. }
  1963. yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred = yyopt->yystate;
  1964. {
  1965. int yychar_current = yychar;
  1966. YYSTYPE yylval_current = yylval;
  1967. yychar = yyopt->yyrawchar;
  1968. yylval = yyopt->yyval;
  1969. yyflag = yyuserAction(yyopt->yyrule, yynrhs, yyrhsVals + YYMAXRHS + YYMAXLEFT - 1, yystackp, yyvalp);
  1970. yychar = yychar_current;
  1971. yylval = yylval_current;
  1972. }
  1973. return yyflag;
  1974. }
  1975. #if YYDEBUG
  1976. static void yyreportTree(yySemanticOption * yyx, int yyindent)
  1977. {
  1978. int yynrhs = yyrhsLength(yyx->yyrule);
  1979. int yyi;
  1980. yyGLRState *yys;
  1981. yyGLRState *yystates[1 + YYMAXRHS];
  1982. yyGLRState yyleftmost_state;
  1983. for (yyi = yynrhs, yys = yyx->yystate; 0 < yyi; yyi -= 1, yys = yys->yypred)
  1984. yystates[yyi] = yys;
  1985. if (yys == YY_NULLPTR) {
  1986. yyleftmost_state.yyposn = 0;
  1987. yystates[0] = &yyleftmost_state;
  1988. } else
  1989. yystates[0] = yys;
  1990. if (yyx->yystate->yyposn < yys->yyposn + 1)
  1991. YY_FPRINTF((stderr, "%*s%s -> <Rule %d, empty>\n",
  1992. yyindent, "", yysymbol_name(yylhsNonterm(yyx->yyrule)), yyx->yyrule - 1));
  1993. else
  1994. YY_FPRINTF((stderr, "%*s%s -> <Rule %d, tokens %ld .. %ld>\n",
  1995. yyindent, "", yysymbol_name(yylhsNonterm(yyx->yyrule)),
  1996. yyx->yyrule - 1, YY_CAST(long, yys->yyposn + 1), YY_CAST(long, yyx->yystate->yyposn)));
  1997. for (yyi = 1; yyi <= yynrhs; yyi += 1) {
  1998. if (yystates[yyi]->yyresolved) {
  1999. if (yystates[yyi - 1]->yyposn + 1 > yystates[yyi]->yyposn)
  2000. YY_FPRINTF((stderr, "%*s%s <empty>\n", yyindent + 2, "",
  2001. yysymbol_name(yy_accessing_symbol(yystates[yyi]->yylrState))));
  2002. else
  2003. YY_FPRINTF((stderr, "%*s%s <tokens %ld .. %ld>\n", yyindent + 2, "",
  2004. yysymbol_name(yy_accessing_symbol(yystates[yyi]->yylrState)),
  2005. YY_CAST(long, yystates[yyi - 1]->yyposn + 1), YY_CAST(long, yystates[yyi]->yyposn)));
  2006. } else
  2007. yyreportTree(yystates[yyi]->yysemantics.yyfirstVal, yyindent + 2);
  2008. }
  2009. }
  2010. #endif
  2011. static YYRESULTTAG yyreportAmbiguity(yySemanticOption * yyx0, yySemanticOption * yyx1)
  2012. {
  2013. YY_USE(yyx0);
  2014. YY_USE(yyx1);
  2015. #if YYDEBUG
  2016. YY_FPRINTF((stderr, "Ambiguity detected.\n"));
  2017. YY_FPRINTF((stderr, "Option 1,\n"));
  2018. yyreportTree(yyx0, 2);
  2019. YY_FPRINTF((stderr, "\nOption 2,\n"));
  2020. yyreportTree(yyx1, 2);
  2021. YY_FPRINTF((stderr, "\n"));
  2022. #endif
  2023. yyerror(YY_("syntax is ambiguous"));
  2024. return yyabort;
  2025. }
  2026. /** Resolve the ambiguity represented in state YYS in *YYSTACKP,
  2027. * perform the indicated actions, and set the semantic value of YYS.
  2028. * If result != yyok, the chain of semantic options in YYS has been
  2029. * cleared instead or it has been left unmodified except that
  2030. * redundant options may have been removed. Regardless of whether
  2031. * result = yyok, YYS has been left with consistent data so that
  2032. * yydestroyGLRState can be invoked if necessary. */
  2033. static YYRESULTTAG yyresolveValue(yyGLRState * yys, yyGLRStack * yystackp)
  2034. {
  2035. yySemanticOption *yyoptionList = yys->yysemantics.yyfirstVal;
  2036. yySemanticOption *yybest = yyoptionList;
  2037. yySemanticOption **yypp;
  2038. yybool yymerge = yyfalse;
  2039. YYSTYPE yysval;
  2040. YYRESULTTAG yyflag;
  2041. for (yypp = &yyoptionList->yynext; *yypp != YY_NULLPTR;) {
  2042. yySemanticOption *yyp = *yypp;
  2043. if (yyidenticalOptions(yybest, yyp)) {
  2044. yymergeOptionSets(yybest, yyp);
  2045. *yypp = yyp->yynext;
  2046. } else {
  2047. switch (yypreference(yybest, yyp)) {
  2048. case 0:
  2049. return yyreportAmbiguity(yybest, yyp);
  2050. break;
  2051. case 1:
  2052. yymerge = yytrue;
  2053. break;
  2054. case 2:
  2055. break;
  2056. case 3:
  2057. yybest = yyp;
  2058. yymerge = yyfalse;
  2059. break;
  2060. default:
  2061. /* This cannot happen so it is not worth a YY_ASSERT (yyfalse),
  2062. but some compilers complain if the default case is
  2063. omitted. */
  2064. break;
  2065. }
  2066. yypp = &yyp->yynext;
  2067. }
  2068. }
  2069. if (yymerge) {
  2070. yySemanticOption *yyp;
  2071. int yyprec = yydprec[yybest->yyrule];
  2072. yyflag = yyresolveAction(yybest, yystackp, &yysval);
  2073. if (yyflag == yyok)
  2074. for (yyp = yybest->yynext; yyp != YY_NULLPTR; yyp = yyp->yynext) {
  2075. if (yyprec == yydprec[yyp->yyrule]) {
  2076. YYSTYPE yysval_other;
  2077. yyflag = yyresolveAction(yyp, yystackp, &yysval_other);
  2078. if (yyflag != yyok) {
  2079. yydestruct("Cleanup: discarding incompletely merged value for",
  2080. yy_accessing_symbol(yys->yylrState), &yysval);
  2081. break;
  2082. }
  2083. yyuserMerge(yymerger[yyp->yyrule], &yysval, &yysval_other);
  2084. }
  2085. }
  2086. } else
  2087. yyflag = yyresolveAction(yybest, yystackp, &yysval);
  2088. if (yyflag == yyok) {
  2089. yys->yyresolved = yytrue;
  2090. yys->yysemantics.yysval = yysval;
  2091. } else
  2092. yys->yysemantics.yyfirstVal = YY_NULLPTR;
  2093. return yyflag;
  2094. }
  2095. static YYRESULTTAG yyresolveStack(yyGLRStack * yystackp)
  2096. {
  2097. if (yystackp->yysplitPoint != YY_NULLPTR) {
  2098. yyGLRState *yys;
  2099. int yyn;
  2100. for (yyn = 0, yys = yystackp->yytops.yystates[0]; yys != yystackp->yysplitPoint; yys = yys->yypred, yyn += 1)
  2101. continue;
  2102. YYCHK(yyresolveStates(yystackp->yytops.yystates[0], yyn, yystackp));
  2103. }
  2104. return yyok;
  2105. }
  2106. static void yycompressStack(yyGLRStack * yystackp)
  2107. {
  2108. yyGLRState *yyp, *yyq, *yyr;
  2109. if (yystackp->yytops.yysize != 1 || yystackp->yysplitPoint == YY_NULLPTR)
  2110. return;
  2111. for (yyp = yystackp->yytops.yystates[0], yyq = yyp->yypred, yyr = YY_NULLPTR;
  2112. yyp != yystackp->yysplitPoint; yyr = yyp, yyp = yyq, yyq = yyp->yypred)
  2113. yyp->yypred = yyr;
  2114. yystackp->yyspaceLeft += yystackp->yynextFree - yystackp->yyitems;
  2115. yystackp->yynextFree = YY_REINTERPRET_CAST(yyGLRStackItem *, yystackp->yysplitPoint) + 1;
  2116. yystackp->yyspaceLeft -= yystackp->yynextFree - yystackp->yyitems;
  2117. yystackp->yysplitPoint = YY_NULLPTR;
  2118. yystackp->yylastDeleted = YY_NULLPTR;
  2119. while (yyr != YY_NULLPTR) {
  2120. yystackp->yynextFree->yystate = *yyr;
  2121. yyr = yyr->yypred;
  2122. yystackp->yynextFree->yystate.yypred = &yystackp->yynextFree[-1].yystate;
  2123. yystackp->yytops.yystates[0] = &yystackp->yynextFree->yystate;
  2124. yystackp->yynextFree += 1;
  2125. yystackp->yyspaceLeft -= 1;
  2126. }
  2127. }
  2128. static YYRESULTTAG yyprocessOneStack(yyGLRStack * yystackp, YYPTRDIFF_T yyk, YYPTRDIFF_T yyposn)
  2129. {
  2130. while (yystackp->yytops.yystates[yyk] != YY_NULLPTR) {
  2131. yy_state_t yystate = yystackp->yytops.yystates[yyk]->yylrState;
  2132. YY_DPRINTF((stderr, "Stack %ld Entering state %d\n", YY_CAST(long, yyk), yystate));
  2133. YY_ASSERT(yystate != YYFINAL);
  2134. if (yyisDefaultedState(yystate)) {
  2135. YYRESULTTAG yyflag;
  2136. yyRuleNum yyrule = yydefaultAction(yystate);
  2137. if (yyrule == 0) {
  2138. YY_DPRINTF((stderr, "Stack %ld dies.\n", YY_CAST(long, yyk)));
  2139. yymarkStackDeleted(yystackp, yyk);
  2140. return yyok;
  2141. }
  2142. yyflag = yyglrReduce(yystackp, yyk, yyrule, yyimmediate[yyrule]);
  2143. if (yyflag == yyerr) {
  2144. YY_DPRINTF((stderr, "Stack %ld dies " "(predicate failure or explicit user error).\n", YY_CAST(long, yyk)));
  2145. yymarkStackDeleted(yystackp, yyk);
  2146. return yyok;
  2147. }
  2148. if (yyflag != yyok)
  2149. return yyflag;
  2150. } else {
  2151. yysymbol_kind_t yytoken = yygetToken(&yychar);
  2152. const short *yyconflicts;
  2153. const int yyaction = yygetLRActions(yystate, yytoken, &yyconflicts);
  2154. yystackp->yytops.yylookaheadNeeds[yyk] = yytrue;
  2155. for ( /* nothing */ ; *yyconflicts; yyconflicts += 1) {
  2156. YYRESULTTAG yyflag;
  2157. YYPTRDIFF_T yynewStack = yysplitStack(yystackp, yyk);
  2158. YY_DPRINTF((stderr, "Splitting off stack %ld from %ld.\n", YY_CAST(long, yynewStack), YY_CAST(long, yyk)));
  2159. yyflag = yyglrReduce(yystackp, yynewStack, *yyconflicts, yyimmediate[*yyconflicts]);
  2160. if (yyflag == yyok)
  2161. YYCHK(yyprocessOneStack(yystackp, yynewStack, yyposn));
  2162. else if (yyflag == yyerr) {
  2163. YY_DPRINTF((stderr, "Stack %ld dies.\n", YY_CAST(long, yynewStack)));
  2164. yymarkStackDeleted(yystackp, yynewStack);
  2165. } else
  2166. return yyflag;
  2167. }
  2168. if (yyisShiftAction(yyaction))
  2169. break;
  2170. else if (yyisErrorAction(yyaction)) {
  2171. YY_DPRINTF((stderr, "Stack %ld dies.\n", YY_CAST(long, yyk)));
  2172. yymarkStackDeleted(yystackp, yyk);
  2173. break;
  2174. } else {
  2175. YYRESULTTAG yyflag = yyglrReduce(yystackp, yyk, -yyaction,
  2176. yyimmediate[-yyaction]);
  2177. if (yyflag == yyerr) {
  2178. YY_DPRINTF((stderr, "Stack %ld dies " "(predicate failure or explicit user error).\n", YY_CAST(long, yyk)));
  2179. yymarkStackDeleted(yystackp, yyk);
  2180. break;
  2181. } else if (yyflag != yyok)
  2182. return yyflag;
  2183. }
  2184. }
  2185. }
  2186. return yyok;
  2187. }
  2188. static void yyreportSyntaxError(yyGLRStack * yystackp)
  2189. {
  2190. if (yystackp->yyerrState != 0)
  2191. return;
  2192. yyerror(YY_("syntax error"));
  2193. yynerrs += 1;
  2194. }
  2195. /* Recover from a syntax error on *YYSTACKP, assuming that *YYSTACKP->YYTOKENP,
  2196. yylval, and yylloc are the syntactic category, semantic value, and location
  2197. of the lookahead. */
  2198. static void yyrecoverSyntaxError(yyGLRStack * yystackp)
  2199. {
  2200. if (yystackp->yyerrState == 3)
  2201. /* We just shifted the error token and (perhaps) took some
  2202. reductions. Skip tokens until we can proceed. */
  2203. while (yytrue) {
  2204. yysymbol_kind_t yytoken;
  2205. int yyj;
  2206. if (yychar == YYEOF)
  2207. yyFail(yystackp, YY_NULLPTR);
  2208. if (yychar != YYEMPTY) {
  2209. yytoken = YYTRANSLATE(yychar);
  2210. yydestruct("Error: discarding", yytoken, &yylval);
  2211. yychar = YYEMPTY;
  2212. }
  2213. yytoken = yygetToken(&yychar);
  2214. yyj = yypact[yystackp->yytops.yystates[0]->yylrState];
  2215. if (yypact_value_is_default(yyj))
  2216. return;
  2217. yyj += yytoken;
  2218. if (yyj < 0 || YYLAST < yyj || yycheck[yyj] != yytoken) {
  2219. if (yydefact[yystackp->yytops.yystates[0]->yylrState] != 0)
  2220. return;
  2221. } else if (!yytable_value_is_error(yytable[yyj]))
  2222. return;
  2223. }
  2224. /* Reduce to one stack. */
  2225. {
  2226. YYPTRDIFF_T yyk;
  2227. for (yyk = 0; yyk < yystackp->yytops.yysize; yyk += 1)
  2228. if (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
  2229. break;
  2230. if (yyk >= yystackp->yytops.yysize)
  2231. yyFail(yystackp, YY_NULLPTR);
  2232. for (yyk += 1; yyk < yystackp->yytops.yysize; yyk += 1)
  2233. yymarkStackDeleted(yystackp, yyk);
  2234. yyremoveDeletes(yystackp);
  2235. yycompressStack(yystackp);
  2236. }
  2237. /* Pop stack until we find a state that shifts the error token. */
  2238. yystackp->yyerrState = 3;
  2239. while (yystackp->yytops.yystates[0] != YY_NULLPTR) {
  2240. yyGLRState *yys = yystackp->yytops.yystates[0];
  2241. int yyj = yypact[yys->yylrState];
  2242. if (!yypact_value_is_default(yyj)) {
  2243. yyj += YYSYMBOL_YYerror;
  2244. if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYSYMBOL_YYerror && yyisShiftAction(yytable[yyj])) {
  2245. /* Shift the error token. */
  2246. int yyaction = yytable[yyj];
  2247. YY_SYMBOL_PRINT("Shifting", yy_accessing_symbol(yyaction), &yylval, &yyerrloc);
  2248. yyglrShift(yystackp, 0, yyaction, yys->yyposn, &yylval);
  2249. yys = yystackp->yytops.yystates[0];
  2250. break;
  2251. }
  2252. }
  2253. if (yys->yypred != YY_NULLPTR)
  2254. yydestroyGLRState("Error: popping", yys);
  2255. yystackp->yytops.yystates[0] = yys->yypred;
  2256. yystackp->yynextFree -= 1;
  2257. yystackp->yyspaceLeft += 1;
  2258. }
  2259. if (yystackp->yytops.yystates[0] == YY_NULLPTR)
  2260. yyFail(yystackp, YY_NULLPTR);
  2261. }
  2262. #define YYCHK1(YYE) \
  2263. do { \
  2264. switch (YYE) { \
  2265. case yyok: \
  2266. break; \
  2267. case yyabort: \
  2268. goto yyabortlab; \
  2269. case yyaccept: \
  2270. goto yyacceptlab; \
  2271. case yyerr: \
  2272. goto yyuser_error; \
  2273. default: \
  2274. goto yybuglab; \
  2275. } \
  2276. } while (0)
  2277. /*----------.
  2278. | yyparse. |
  2279. `----------*/
  2280. int yyparse(void)
  2281. {
  2282. int yyresult;
  2283. yyGLRStack yystack;
  2284. yyGLRStack *const yystackp = &yystack;
  2285. YYPTRDIFF_T yyposn;
  2286. YY_DPRINTF((stderr, "Starting parse\n"));
  2287. yychar = YYEMPTY;
  2288. yylval = yyval_default;
  2289. if (!yyinitGLRStack(yystackp, YYINITDEPTH))
  2290. goto yyexhaustedlab;
  2291. switch (YYSETJMP(yystack.yyexception_buffer)) {
  2292. case 0:
  2293. break;
  2294. case 1:
  2295. goto yyabortlab;
  2296. case 2:
  2297. goto yyexhaustedlab;
  2298. default:
  2299. goto yybuglab;
  2300. }
  2301. yyglrShift(&yystack, 0, 0, 0, &yylval);
  2302. yyposn = 0;
  2303. while (yytrue) {
  2304. /* For efficiency, we have two loops, the first of which is
  2305. specialized to deterministic operation (single stack, no
  2306. potential ambiguity). */
  2307. /* Standard mode. */
  2308. while (yytrue) {
  2309. yy_state_t yystate = yystack.yytops.yystates[0]->yylrState;
  2310. YY_DPRINTF((stderr, "Entering state %d\n", yystate));
  2311. if (yystate == YYFINAL)
  2312. goto yyacceptlab;
  2313. if (yyisDefaultedState(yystate)) {
  2314. yyRuleNum yyrule = yydefaultAction(yystate);
  2315. if (yyrule == 0) {
  2316. yyreportSyntaxError(&yystack);
  2317. goto yyuser_error;
  2318. }
  2319. YYCHK1(yyglrReduce(&yystack, 0, yyrule, yytrue));
  2320. } else {
  2321. yysymbol_kind_t yytoken = yygetToken(&yychar);
  2322. const short *yyconflicts;
  2323. int yyaction = yygetLRActions(yystate, yytoken, &yyconflicts);
  2324. if (*yyconflicts)
  2325. /* Enter nondeterministic mode. */
  2326. break;
  2327. if (yyisShiftAction(yyaction)) {
  2328. YY_SYMBOL_PRINT("Shifting", yytoken, &yylval, &yylloc);
  2329. yychar = YYEMPTY;
  2330. yyposn += 1;
  2331. yyglrShift(&yystack, 0, yyaction, yyposn, &yylval);
  2332. if (0 < yystack.yyerrState)
  2333. yystack.yyerrState -= 1;
  2334. } else if (yyisErrorAction(yyaction)) {
  2335. /* Issue an error message unless the scanner already
  2336. did. */
  2337. if (yychar != YYerror)
  2338. yyreportSyntaxError(&yystack);
  2339. goto yyuser_error;
  2340. } else
  2341. YYCHK1(yyglrReduce(&yystack, 0, -yyaction, yytrue));
  2342. }
  2343. }
  2344. /* Nondeterministic mode. */
  2345. while (yytrue) {
  2346. yysymbol_kind_t yytoken_to_shift;
  2347. YYPTRDIFF_T yys;
  2348. for (yys = 0; yys < yystack.yytops.yysize; yys += 1)
  2349. yystackp->yytops.yylookaheadNeeds[yys] = yychar != YYEMPTY;
  2350. /* yyprocessOneStack returns one of three things:
  2351. - An error flag. If the caller is yyprocessOneStack, it
  2352. immediately returns as well. When the caller is finally
  2353. yyparse, it jumps to an error label via YYCHK1.
  2354. - yyok, but yyprocessOneStack has invoked yymarkStackDeleted
  2355. (&yystack, yys), which sets the top state of yys to NULL. Thus,
  2356. yyparse's following invocation of yyremoveDeletes will remove
  2357. the stack.
  2358. - yyok, when ready to shift a token.
  2359. Except in the first case, yyparse will invoke yyremoveDeletes and
  2360. then shift the next token onto all remaining stacks. This
  2361. synchronization of the shift (that is, after all preceding
  2362. reductions on all stacks) helps prevent double destructor calls
  2363. on yylval in the event of memory exhaustion. */
  2364. for (yys = 0; yys < yystack.yytops.yysize; yys += 1)
  2365. YYCHK1(yyprocessOneStack(&yystack, yys, yyposn));
  2366. yyremoveDeletes(&yystack);
  2367. if (yystack.yytops.yysize == 0) {
  2368. yyundeleteLastStack(&yystack);
  2369. if (yystack.yytops.yysize == 0)
  2370. yyFail(&yystack, YY_("syntax error"));
  2371. YYCHK1(yyresolveStack(&yystack));
  2372. YY_DPRINTF((stderr, "Returning to deterministic operation.\n"));
  2373. yyreportSyntaxError(&yystack);
  2374. goto yyuser_error;
  2375. }
  2376. /* If any yyglrShift call fails, it will fail after shifting. Thus,
  2377. a copy of yylval will already be on stack 0 in the event of a
  2378. failure in the following loop. Thus, yychar is set to YYEMPTY
  2379. before the loop to make sure the user destructor for yylval isn't
  2380. called twice. */
  2381. yytoken_to_shift = YYTRANSLATE(yychar);
  2382. yychar = YYEMPTY;
  2383. yyposn += 1;
  2384. for (yys = 0; yys < yystack.yytops.yysize; yys += 1) {
  2385. yy_state_t yystate = yystack.yytops.yystates[yys]->yylrState;
  2386. const short *yyconflicts;
  2387. int yyaction = yygetLRActions(yystate, yytoken_to_shift,
  2388. &yyconflicts);
  2389. /* Note that yyconflicts were handled by yyprocessOneStack. */
  2390. YY_DPRINTF((stderr, "On stack %ld, ", YY_CAST(long, yys)));
  2391. YY_SYMBOL_PRINT("shifting", yytoken_to_shift, &yylval, &yylloc);
  2392. yyglrShift(&yystack, yys, yyaction, yyposn, &yylval);
  2393. YY_DPRINTF((stderr, "Stack %ld now in state #%d\n", YY_CAST(long, yys), yystack.yytops.yystates[yys]->yylrState));
  2394. }
  2395. if (yystack.yytops.yysize == 1) {
  2396. YYCHK1(yyresolveStack(&yystack));
  2397. YY_DPRINTF((stderr, "Returning to deterministic operation.\n"));
  2398. yycompressStack(&yystack);
  2399. break;
  2400. }
  2401. }
  2402. continue;
  2403. yyuser_error:
  2404. yyrecoverSyntaxError(&yystack);
  2405. yyposn = yystack.yytops.yystates[0]->yyposn;
  2406. }
  2407. yyacceptlab:
  2408. yyresult = 0;
  2409. goto yyreturn;
  2410. yybuglab:
  2411. YY_ASSERT(yyfalse);
  2412. goto yyabortlab;
  2413. yyabortlab:
  2414. yyresult = 1;
  2415. goto yyreturn;
  2416. yyexhaustedlab:
  2417. yyerror(YY_("memory exhausted"));
  2418. yyresult = 2;
  2419. goto yyreturn;
  2420. yyreturn:
  2421. if (yychar != YYEMPTY)
  2422. yydestruct("Cleanup: discarding lookahead", YYTRANSLATE(yychar), &yylval);
  2423. /* If the stack is well-formed, pop the stack until it is empty,
  2424. destroying its entries as we go. But free the stack regardless
  2425. of whether it is well-formed. */
  2426. if (yystack.yyitems) {
  2427. yyGLRState **yystates = yystack.yytops.yystates;
  2428. if (yystates) {
  2429. YYPTRDIFF_T yysize = yystack.yytops.yysize;
  2430. YYPTRDIFF_T yyk;
  2431. for (yyk = 0; yyk < yysize; yyk += 1)
  2432. if (yystates[yyk]) {
  2433. while (yystates[yyk]) {
  2434. yyGLRState *yys = yystates[yyk];
  2435. if (yys->yypred != YY_NULLPTR)
  2436. yydestroyGLRState("Cleanup: popping", yys);
  2437. yystates[yyk] = yys->yypred;
  2438. yystack.yynextFree -= 1;
  2439. yystack.yyspaceLeft += 1;
  2440. }
  2441. break;
  2442. }
  2443. }
  2444. yyfreeGLRStack(&yystack);
  2445. }
  2446. return yyresult;
  2447. }
  2448. /* DEBUGGING ONLY */
  2449. #if YYDEBUG
  2450. static void yy_yypstack(yyGLRState * yys)
  2451. {
  2452. if (yys->yypred) {
  2453. yy_yypstack(yys->yypred);
  2454. YY_FPRINTF((stderr, " -> "));
  2455. }
  2456. YY_FPRINTF((stderr, "%d@%ld", yys->yylrState, YY_CAST(long, yys->yyposn)));
  2457. }
  2458. static void yypstates(yyGLRState * yyst)
  2459. {
  2460. if (yyst == YY_NULLPTR)
  2461. YY_FPRINTF((stderr, "<null>"));
  2462. else
  2463. yy_yypstack(yyst);
  2464. YY_FPRINTF((stderr, "\n"));
  2465. }
  2466. static void yypstack(yyGLRStack * yystackp, YYPTRDIFF_T yyk)
  2467. {
  2468. yypstates(yystackp->yytops.yystates[yyk]);
  2469. }
  2470. static void yypdumpstack(yyGLRStack * yystackp)
  2471. {
  2472. #define YYINDEX(YYX) \
  2473. YY_CAST (long, \
  2474. ((YYX) \
  2475. ? YY_REINTERPRET_CAST (yyGLRStackItem*, (YYX)) - yystackp->yyitems \
  2476. : -1))
  2477. yyGLRStackItem *yyp;
  2478. for (yyp = yystackp->yyitems; yyp < yystackp->yynextFree; yyp += 1) {
  2479. YY_FPRINTF((stderr, "%3ld. ", YY_CAST(long, yyp - yystackp->yyitems)));
  2480. if (*YY_REINTERPRET_CAST(yybool *, yyp)) {
  2481. YY_ASSERT(yyp->yystate.yyisState);
  2482. YY_ASSERT(yyp->yyoption.yyisState);
  2483. YY_FPRINTF((stderr, "Res: %d, LR State: %d, posn: %ld, pred: %ld",
  2484. yyp->yystate.yyresolved, yyp->yystate.yylrState,
  2485. YY_CAST(long, yyp->yystate.yyposn), YYINDEX(yyp->yystate.yypred)));
  2486. if (!yyp->yystate.yyresolved)
  2487. YY_FPRINTF((stderr, ", firstVal: %ld", YYINDEX(yyp->yystate.yysemantics.yyfirstVal)));
  2488. } else {
  2489. YY_ASSERT(!yyp->yystate.yyisState);
  2490. YY_ASSERT(!yyp->yyoption.yyisState);
  2491. YY_FPRINTF((stderr, "Option. rule: %d, state: %ld, next: %ld",
  2492. yyp->yyoption.yyrule - 1, YYINDEX(yyp->yyoption.yystate), YYINDEX(yyp->yyoption.yynext)));
  2493. }
  2494. YY_FPRINTF((stderr, "\n"));
  2495. }
  2496. YY_FPRINTF((stderr, "Tops:"));
  2497. {
  2498. YYPTRDIFF_T yyi;
  2499. for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
  2500. YY_FPRINTF((stderr, "%ld: %ld; ", YY_CAST(long, yyi), YYINDEX(yystackp->yytops.yystates[yyi])));
  2501. YY_FPRINTF((stderr, "\n"));
  2502. }
  2503. #undef YYINDEX
  2504. }
  2505. #endif
  2506. #undef yylval
  2507. #undef yychar
  2508. #undef yynerrs
  2509. #line 299 "dot.y"
  2510. /* end. */