parser.hpp 82 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894
  1. // A Bison parser, made by GNU Bison 3.7.2.
  2. // Skeleton interface for Bison LALR(1) parsers in C++
  3. // Copyright (C) 2002-2015, 2018-2020 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. /**
  26. ** \file pico_sdk/tools/pioasm/gen/parser.hpp
  27. ** Define the yy::parser class.
  28. */
  29. // C++ LALR(1) parser skeleton written by Akim Demaille.
  30. // DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
  31. // especially those whose name start with YY_ or yy_. They are
  32. // private implementation details that can be changed or removed.
  33. #ifndef YY_YY_HOME_GRAHAM_DEV_MU_PICO_SDK_TOOLS_PIOASM_GEN_PARSER_HPP_INCLUDED
  34. # define YY_YY_HOME_GRAHAM_DEV_MU_PICO_SDK_TOOLS_PIOASM_GEN_PARSER_HPP_INCLUDED
  35. // "%code requires" blocks.
  36. #include <string>
  37. #include <fstream>
  38. #include <sstream>
  39. #include "pio_types.h"
  40. struct pio_assembler;
  41. #ifdef _MSC_VER
  42. #pragma warning(disable : 4065) // default only switch statement
  43. #endif
  44. # include <cstdlib> // std::abort
  45. # include <iostream>
  46. # include <stdexcept>
  47. # include <string>
  48. # include <vector>
  49. #if defined __cplusplus
  50. # define YY_CPLUSPLUS __cplusplus
  51. #else
  52. # define YY_CPLUSPLUS 199711L
  53. #endif
  54. // Support move semantics when possible.
  55. #if 201103L <= YY_CPLUSPLUS
  56. # define YY_MOVE std::move
  57. # define YY_MOVE_OR_COPY move
  58. # define YY_MOVE_REF(Type) Type&&
  59. # define YY_RVREF(Type) Type&&
  60. # define YY_COPY(Type) Type
  61. #else
  62. # define YY_MOVE
  63. # define YY_MOVE_OR_COPY copy
  64. # define YY_MOVE_REF(Type) Type&
  65. # define YY_RVREF(Type) const Type&
  66. # define YY_COPY(Type) const Type&
  67. #endif
  68. // Support noexcept when possible.
  69. #if 201103L <= YY_CPLUSPLUS
  70. # define YY_NOEXCEPT noexcept
  71. # define YY_NOTHROW
  72. #else
  73. # define YY_NOEXCEPT
  74. # define YY_NOTHROW throw ()
  75. #endif
  76. // Support constexpr when possible.
  77. #if 201703 <= YY_CPLUSPLUS
  78. # define YY_CONSTEXPR constexpr
  79. #else
  80. # define YY_CONSTEXPR
  81. #endif
  82. # include "location.h"
  83. #ifndef YY_ASSERT
  84. # include <cassert>
  85. # define YY_ASSERT assert
  86. #endif
  87. #ifndef YY_ATTRIBUTE_PURE
  88. # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
  89. # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
  90. # else
  91. # define YY_ATTRIBUTE_PURE
  92. # endif
  93. #endif
  94. #ifndef YY_ATTRIBUTE_UNUSED
  95. # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
  96. # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
  97. # else
  98. # define YY_ATTRIBUTE_UNUSED
  99. # endif
  100. #endif
  101. /* Suppress unused-variable warnings by "using" E. */
  102. #if ! defined lint || defined __GNUC__
  103. # define YYUSE(E) ((void) (E))
  104. #else
  105. # define YYUSE(E) /* empty */
  106. #endif
  107. #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
  108. /* Suppress an incorrect diagnostic about yylval being uninitialized. */
  109. # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
  110. _Pragma ("GCC diagnostic push") \
  111. _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
  112. _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
  113. # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
  114. _Pragma ("GCC diagnostic pop")
  115. #else
  116. # define YY_INITIAL_VALUE(Value) Value
  117. #endif
  118. #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  119. # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  120. # define YY_IGNORE_MAYBE_UNINITIALIZED_END
  121. #endif
  122. #ifndef YY_INITIAL_VALUE
  123. # define YY_INITIAL_VALUE(Value) /* Nothing. */
  124. #endif
  125. #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
  126. # define YY_IGNORE_USELESS_CAST_BEGIN \
  127. _Pragma ("GCC diagnostic push") \
  128. _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
  129. # define YY_IGNORE_USELESS_CAST_END \
  130. _Pragma ("GCC diagnostic pop")
  131. #endif
  132. #ifndef YY_IGNORE_USELESS_CAST_BEGIN
  133. # define YY_IGNORE_USELESS_CAST_BEGIN
  134. # define YY_IGNORE_USELESS_CAST_END
  135. #endif
  136. # ifndef YY_CAST
  137. # ifdef __cplusplus
  138. # define YY_CAST(Type, Val) static_cast<Type> (Val)
  139. # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
  140. # else
  141. # define YY_CAST(Type, Val) ((Type) (Val))
  142. # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
  143. # endif
  144. # endif
  145. # ifndef YY_NULLPTR
  146. # if defined __cplusplus
  147. # if 201103L <= __cplusplus
  148. # define YY_NULLPTR nullptr
  149. # else
  150. # define YY_NULLPTR 0
  151. # endif
  152. # else
  153. # define YY_NULLPTR ((void*)0)
  154. # endif
  155. # endif
  156. /* Debug traces. */
  157. #ifndef YYDEBUG
  158. # define YYDEBUG 0
  159. #endif
  160. namespace yy {
  161. /// A Bison parser.
  162. class parser
  163. {
  164. public:
  165. #ifndef YYSTYPE
  166. /// A buffer to store and retrieve objects.
  167. ///
  168. /// Sort of a variant, but does not keep track of the nature
  169. /// of the stored data, since that knowledge is available
  170. /// via the current parser state.
  171. class semantic_type
  172. {
  173. public:
  174. /// Type of *this.
  175. typedef semantic_type self_type;
  176. /// Empty construction.
  177. semantic_type () YY_NOEXCEPT
  178. : yybuffer_ ()
  179. {}
  180. /// Construct and fill.
  181. template <typename T>
  182. semantic_type (YY_RVREF (T) t)
  183. {
  184. YY_ASSERT (sizeof (T) <= size);
  185. new (yyas_<T> ()) T (YY_MOVE (t));
  186. }
  187. #if 201103L <= YY_CPLUSPLUS
  188. /// Non copyable.
  189. semantic_type (const self_type&) = delete;
  190. /// Non copyable.
  191. self_type& operator= (const self_type&) = delete;
  192. #endif
  193. /// Destruction, allowed only if empty.
  194. ~semantic_type () YY_NOEXCEPT
  195. {}
  196. # if 201103L <= YY_CPLUSPLUS
  197. /// Instantiate a \a T in here from \a t.
  198. template <typename T, typename... U>
  199. T&
  200. emplace (U&&... u)
  201. {
  202. return *new (yyas_<T> ()) T (std::forward <U>(u)...);
  203. }
  204. # else
  205. /// Instantiate an empty \a T in here.
  206. template <typename T>
  207. T&
  208. emplace ()
  209. {
  210. return *new (yyas_<T> ()) T ();
  211. }
  212. /// Instantiate a \a T in here from \a t.
  213. template <typename T>
  214. T&
  215. emplace (const T& t)
  216. {
  217. return *new (yyas_<T> ()) T (t);
  218. }
  219. # endif
  220. /// Instantiate an empty \a T in here.
  221. /// Obsolete, use emplace.
  222. template <typename T>
  223. T&
  224. build ()
  225. {
  226. return emplace<T> ();
  227. }
  228. /// Instantiate a \a T in here from \a t.
  229. /// Obsolete, use emplace.
  230. template <typename T>
  231. T&
  232. build (const T& t)
  233. {
  234. return emplace<T> (t);
  235. }
  236. /// Accessor to a built \a T.
  237. template <typename T>
  238. T&
  239. as () YY_NOEXCEPT
  240. {
  241. return *yyas_<T> ();
  242. }
  243. /// Const accessor to a built \a T (for %printer).
  244. template <typename T>
  245. const T&
  246. as () const YY_NOEXCEPT
  247. {
  248. return *yyas_<T> ();
  249. }
  250. /// Swap the content with \a that, of same type.
  251. ///
  252. /// Both variants must be built beforehand, because swapping the actual
  253. /// data requires reading it (with as()), and this is not possible on
  254. /// unconstructed variants: it would require some dynamic testing, which
  255. /// should not be the variant's responsibility.
  256. /// Swapping between built and (possibly) non-built is done with
  257. /// self_type::move ().
  258. template <typename T>
  259. void
  260. swap (self_type& that) YY_NOEXCEPT
  261. {
  262. std::swap (as<T> (), that.as<T> ());
  263. }
  264. /// Move the content of \a that to this.
  265. ///
  266. /// Destroys \a that.
  267. template <typename T>
  268. void
  269. move (self_type& that)
  270. {
  271. # if 201103L <= YY_CPLUSPLUS
  272. emplace<T> (std::move (that.as<T> ()));
  273. # else
  274. emplace<T> ();
  275. swap<T> (that);
  276. # endif
  277. that.destroy<T> ();
  278. }
  279. # if 201103L <= YY_CPLUSPLUS
  280. /// Move the content of \a that to this.
  281. template <typename T>
  282. void
  283. move (self_type&& that)
  284. {
  285. emplace<T> (std::move (that.as<T> ()));
  286. that.destroy<T> ();
  287. }
  288. #endif
  289. /// Copy the content of \a that to this.
  290. template <typename T>
  291. void
  292. copy (const self_type& that)
  293. {
  294. emplace<T> (that.as<T> ());
  295. }
  296. /// Destroy the stored \a T.
  297. template <typename T>
  298. void
  299. destroy ()
  300. {
  301. as<T> ().~T ();
  302. }
  303. private:
  304. #if YY_CPLUSPLUS < 201103L
  305. /// Non copyable.
  306. semantic_type (const self_type&);
  307. /// Non copyable.
  308. self_type& operator= (const self_type&);
  309. #endif
  310. /// Accessor to raw memory as \a T.
  311. template <typename T>
  312. T*
  313. yyas_ () YY_NOEXCEPT
  314. {
  315. void *yyp = yybuffer_.yyraw;
  316. return static_cast<T*> (yyp);
  317. }
  318. /// Const accessor to raw memory as \a T.
  319. template <typename T>
  320. const T*
  321. yyas_ () const YY_NOEXCEPT
  322. {
  323. const void *yyp = yybuffer_.yyraw;
  324. return static_cast<const T*> (yyp);
  325. }
  326. /// An auxiliary type to compute the largest semantic type.
  327. union union_type
  328. {
  329. // if_full
  330. // if_empty
  331. // blocking
  332. char dummy1[sizeof (bool)];
  333. // condition
  334. char dummy2[sizeof (enum condition)];
  335. // in_source
  336. // out_target
  337. // set_target
  338. char dummy3[sizeof (enum in_out_set)];
  339. // irq_modifiers
  340. char dummy4[sizeof (enum irq)];
  341. // mov_target
  342. // mov_source
  343. char dummy5[sizeof (enum mov)];
  344. // mov_op
  345. char dummy6[sizeof (enum mov_op)];
  346. // "integer"
  347. char dummy7[sizeof (int)];
  348. // instruction
  349. // base_instruction
  350. char dummy8[sizeof (std::shared_ptr<instruction>)];
  351. // value
  352. // expression
  353. // delay
  354. // sideset
  355. char dummy9[sizeof (std::shared_ptr<resolvable>)];
  356. // label_decl
  357. // symbol_def
  358. char dummy10[sizeof (std::shared_ptr<symbol>)];
  359. // wait_source
  360. char dummy11[sizeof (std::shared_ptr<wait_source>)];
  361. // "identifier"
  362. // "string"
  363. // "text"
  364. // "code block"
  365. // "%}"
  366. // UNKNOWN_DIRECTIVE
  367. char dummy12[sizeof (std::string)];
  368. };
  369. /// The size of the largest semantic type.
  370. enum { size = sizeof (union_type) };
  371. /// A buffer to store semantic values.
  372. union
  373. {
  374. /// Strongest alignment constraints.
  375. long double yyalign_me;
  376. /// A buffer large enough to store any of the semantic values.
  377. char yyraw[size];
  378. } yybuffer_;
  379. };
  380. #else
  381. typedef YYSTYPE semantic_type;
  382. #endif
  383. /// Symbol locations.
  384. typedef location location_type;
  385. /// Syntax errors thrown from user actions.
  386. struct syntax_error : std::runtime_error
  387. {
  388. syntax_error (const location_type& l, const std::string& m)
  389. : std::runtime_error (m)
  390. , location (l)
  391. {}
  392. syntax_error (const syntax_error& s)
  393. : std::runtime_error (s.what ())
  394. , location (s.location)
  395. {}
  396. ~syntax_error () YY_NOEXCEPT YY_NOTHROW;
  397. location_type location;
  398. };
  399. /// Token kinds.
  400. struct token
  401. {
  402. enum token_kind_type
  403. {
  404. TOK_YYEMPTY = -2,
  405. TOK_END = 0, // "end of file"
  406. TOK_YYerror = 256, // error
  407. TOK_YYUNDEF = 257, // "invalid token"
  408. TOK_NEWLINE = 258, // "end of line"
  409. TOK_COMMA = 259, // ","
  410. TOK_COLON = 260, // ":"
  411. TOK_LPAREN = 261, // "("
  412. TOK_RPAREN = 262, // ")"
  413. TOK_LBRACKET = 263, // "["
  414. TOK_RBRACKET = 264, // "]"
  415. TOK_PLUS = 265, // "+"
  416. TOK_MINUS = 266, // "-"
  417. TOK_MULTIPLY = 267, // "*"
  418. TOK_DIVIDE = 268, // "/"
  419. TOK_OR = 269, // "|"
  420. TOK_AND = 270, // "&"
  421. TOK_XOR = 271, // "^"
  422. TOK_POST_DECREMENT = 272, // "--"
  423. TOK_NOT_EQUAL = 273, // "!="
  424. TOK_NOT = 274, // "!"
  425. TOK_REVERSE = 275, // "::"
  426. TOK_EQUAL = 276, // "="
  427. TOK_PROGRAM = 277, // ".program"
  428. TOK_WRAP_TARGET = 278, // ".wrap_target"
  429. TOK_WRAP = 279, // ".wrap"
  430. TOK_DEFINE = 280, // ".define"
  431. TOK_SIDE_SET = 281, // ".side_set"
  432. TOK_WORD = 282, // ".word"
  433. TOK_ORIGIN = 283, // ".origin"
  434. TOK_LANG_OPT = 284, // ".lang_opt"
  435. TOK_JMP = 285, // "jmp"
  436. TOK_WAIT = 286, // "wait"
  437. TOK_IN = 287, // "in"
  438. TOK_OUT = 288, // "out"
  439. TOK_PUSH = 289, // "push"
  440. TOK_PULL = 290, // "pull"
  441. TOK_MOV = 291, // "mov"
  442. TOK_IRQ = 292, // "irq"
  443. TOK_SET = 293, // "set"
  444. TOK_NOP = 294, // "nop"
  445. TOK_PIN = 295, // "pin"
  446. TOK_GPIO = 296, // "gpio"
  447. TOK_OSRE = 297, // "osre"
  448. TOK_PINS = 298, // "pins"
  449. TOK_NULL = 299, // "null"
  450. TOK_PINDIRS = 300, // "pindirs"
  451. TOK_BLOCK = 301, // "block"
  452. TOK_NOBLOCK = 302, // "noblock"
  453. TOK_IFEMPTY = 303, // "ifempty"
  454. TOK_IFFULL = 304, // "iffull"
  455. TOK_NOWAIT = 305, // "nowait"
  456. TOK_CLEAR = 306, // "clear"
  457. TOK_REL = 307, // "rel"
  458. TOK_X = 308, // "x"
  459. TOK_Y = 309, // "y"
  460. TOK_EXEC = 310, // "exec"
  461. TOK_PC = 311, // "pc"
  462. TOK_ISR = 312, // "isr"
  463. TOK_OSR = 313, // "osr"
  464. TOK_OPTIONAL = 314, // "opt"
  465. TOK_SIDE = 315, // "side"
  466. TOK_STATUS = 316, // "status"
  467. TOK_PUBLIC = 317, // "public"
  468. TOK_ID = 318, // "identifier"
  469. TOK_STRING = 319, // "string"
  470. TOK_NON_WS = 320, // "text"
  471. TOK_CODE_BLOCK_START = 321, // "code block"
  472. TOK_CODE_BLOCK_CONTENTS = 322, // "%}"
  473. TOK_UNKNOWN_DIRECTIVE = 323, // UNKNOWN_DIRECTIVE
  474. TOK_INT = 324 // "integer"
  475. };
  476. /// Backward compatibility alias (Bison 3.6).
  477. typedef token_kind_type yytokentype;
  478. };
  479. /// Token kind, as returned by yylex.
  480. typedef token::yytokentype token_kind_type;
  481. /// Backward compatibility alias (Bison 3.6).
  482. typedef token_kind_type token_type;
  483. /// Symbol kinds.
  484. struct symbol_kind
  485. {
  486. enum symbol_kind_type
  487. {
  488. YYNTOKENS = 70, ///< Number of tokens.
  489. S_YYEMPTY = -2,
  490. S_YYEOF = 0, // "end of file"
  491. S_YYerror = 1, // error
  492. S_YYUNDEF = 2, // "invalid token"
  493. S_NEWLINE = 3, // "end of line"
  494. S_COMMA = 4, // ","
  495. S_COLON = 5, // ":"
  496. S_LPAREN = 6, // "("
  497. S_RPAREN = 7, // ")"
  498. S_LBRACKET = 8, // "["
  499. S_RBRACKET = 9, // "]"
  500. S_PLUS = 10, // "+"
  501. S_MINUS = 11, // "-"
  502. S_MULTIPLY = 12, // "*"
  503. S_DIVIDE = 13, // "/"
  504. S_OR = 14, // "|"
  505. S_AND = 15, // "&"
  506. S_XOR = 16, // "^"
  507. S_POST_DECREMENT = 17, // "--"
  508. S_NOT_EQUAL = 18, // "!="
  509. S_NOT = 19, // "!"
  510. S_REVERSE = 20, // "::"
  511. S_EQUAL = 21, // "="
  512. S_PROGRAM = 22, // ".program"
  513. S_WRAP_TARGET = 23, // ".wrap_target"
  514. S_WRAP = 24, // ".wrap"
  515. S_DEFINE = 25, // ".define"
  516. S_SIDE_SET = 26, // ".side_set"
  517. S_WORD = 27, // ".word"
  518. S_ORIGIN = 28, // ".origin"
  519. S_LANG_OPT = 29, // ".lang_opt"
  520. S_JMP = 30, // "jmp"
  521. S_WAIT = 31, // "wait"
  522. S_IN = 32, // "in"
  523. S_OUT = 33, // "out"
  524. S_PUSH = 34, // "push"
  525. S_PULL = 35, // "pull"
  526. S_MOV = 36, // "mov"
  527. S_IRQ = 37, // "irq"
  528. S_SET = 38, // "set"
  529. S_NOP = 39, // "nop"
  530. S_PIN = 40, // "pin"
  531. S_GPIO = 41, // "gpio"
  532. S_OSRE = 42, // "osre"
  533. S_PINS = 43, // "pins"
  534. S_NULL = 44, // "null"
  535. S_PINDIRS = 45, // "pindirs"
  536. S_BLOCK = 46, // "block"
  537. S_NOBLOCK = 47, // "noblock"
  538. S_IFEMPTY = 48, // "ifempty"
  539. S_IFFULL = 49, // "iffull"
  540. S_NOWAIT = 50, // "nowait"
  541. S_CLEAR = 51, // "clear"
  542. S_REL = 52, // "rel"
  543. S_X = 53, // "x"
  544. S_Y = 54, // "y"
  545. S_EXEC = 55, // "exec"
  546. S_PC = 56, // "pc"
  547. S_ISR = 57, // "isr"
  548. S_OSR = 58, // "osr"
  549. S_OPTIONAL = 59, // "opt"
  550. S_SIDE = 60, // "side"
  551. S_STATUS = 61, // "status"
  552. S_PUBLIC = 62, // "public"
  553. S_ID = 63, // "identifier"
  554. S_STRING = 64, // "string"
  555. S_NON_WS = 65, // "text"
  556. S_CODE_BLOCK_START = 66, // "code block"
  557. S_CODE_BLOCK_CONTENTS = 67, // "%}"
  558. S_UNKNOWN_DIRECTIVE = 68, // UNKNOWN_DIRECTIVE
  559. S_INT = 69, // "integer"
  560. S_YYACCEPT = 70, // $accept
  561. S_file = 71, // file
  562. S_lines = 72, // lines
  563. S_line = 73, // line
  564. S_code_block = 74, // code_block
  565. S_label_decl = 75, // label_decl
  566. S_directive = 76, // directive
  567. S_value = 77, // value
  568. S_expression = 78, // expression
  569. S_instruction = 79, // instruction
  570. S_base_instruction = 80, // base_instruction
  571. S_delay = 81, // delay
  572. S_sideset = 82, // sideset
  573. S_condition = 83, // condition
  574. S_wait_source = 84, // wait_source
  575. S_comma = 85, // comma
  576. S_in_source = 86, // in_source
  577. S_out_target = 87, // out_target
  578. S_mov_target = 88, // mov_target
  579. S_mov_source = 89, // mov_source
  580. S_mov_op = 90, // mov_op
  581. S_set_target = 91, // set_target
  582. S_if_full = 92, // if_full
  583. S_if_empty = 93, // if_empty
  584. S_blocking = 94, // blocking
  585. S_irq_modifiers = 95, // irq_modifiers
  586. S_symbol_def = 96 // symbol_def
  587. };
  588. };
  589. /// (Internal) symbol kind.
  590. typedef symbol_kind::symbol_kind_type symbol_kind_type;
  591. /// The number of tokens.
  592. static const symbol_kind_type YYNTOKENS = symbol_kind::YYNTOKENS;
  593. /// A complete symbol.
  594. ///
  595. /// Expects its Base type to provide access to the symbol kind
  596. /// via kind ().
  597. ///
  598. /// Provide access to semantic value and location.
  599. template <typename Base>
  600. struct basic_symbol : Base
  601. {
  602. /// Alias to Base.
  603. typedef Base super_type;
  604. /// Default constructor.
  605. basic_symbol ()
  606. : value ()
  607. , location ()
  608. {}
  609. #if 201103L <= YY_CPLUSPLUS
  610. /// Move constructor.
  611. basic_symbol (basic_symbol&& that)
  612. : Base (std::move (that))
  613. , value ()
  614. , location (std::move (that.location))
  615. {
  616. switch (this->kind ())
  617. {
  618. case symbol_kind::S_if_full: // if_full
  619. case symbol_kind::S_if_empty: // if_empty
  620. case symbol_kind::S_blocking: // blocking
  621. value.move< bool > (std::move (that.value));
  622. break;
  623. case symbol_kind::S_condition: // condition
  624. value.move< enum condition > (std::move (that.value));
  625. break;
  626. case symbol_kind::S_in_source: // in_source
  627. case symbol_kind::S_out_target: // out_target
  628. case symbol_kind::S_set_target: // set_target
  629. value.move< enum in_out_set > (std::move (that.value));
  630. break;
  631. case symbol_kind::S_irq_modifiers: // irq_modifiers
  632. value.move< enum irq > (std::move (that.value));
  633. break;
  634. case symbol_kind::S_mov_target: // mov_target
  635. case symbol_kind::S_mov_source: // mov_source
  636. value.move< enum mov > (std::move (that.value));
  637. break;
  638. case symbol_kind::S_mov_op: // mov_op
  639. value.move< enum mov_op > (std::move (that.value));
  640. break;
  641. case symbol_kind::S_INT: // "integer"
  642. value.move< int > (std::move (that.value));
  643. break;
  644. case symbol_kind::S_instruction: // instruction
  645. case symbol_kind::S_base_instruction: // base_instruction
  646. value.move< std::shared_ptr<instruction> > (std::move (that.value));
  647. break;
  648. case symbol_kind::S_value: // value
  649. case symbol_kind::S_expression: // expression
  650. case symbol_kind::S_delay: // delay
  651. case symbol_kind::S_sideset: // sideset
  652. value.move< std::shared_ptr<resolvable> > (std::move (that.value));
  653. break;
  654. case symbol_kind::S_label_decl: // label_decl
  655. case symbol_kind::S_symbol_def: // symbol_def
  656. value.move< std::shared_ptr<symbol> > (std::move (that.value));
  657. break;
  658. case symbol_kind::S_wait_source: // wait_source
  659. value.move< std::shared_ptr<wait_source> > (std::move (that.value));
  660. break;
  661. case symbol_kind::S_ID: // "identifier"
  662. case symbol_kind::S_STRING: // "string"
  663. case symbol_kind::S_NON_WS: // "text"
  664. case symbol_kind::S_CODE_BLOCK_START: // "code block"
  665. case symbol_kind::S_CODE_BLOCK_CONTENTS: // "%}"
  666. case symbol_kind::S_UNKNOWN_DIRECTIVE: // UNKNOWN_DIRECTIVE
  667. value.move< std::string > (std::move (that.value));
  668. break;
  669. default:
  670. break;
  671. }
  672. }
  673. #endif
  674. /// Copy constructor.
  675. basic_symbol (const basic_symbol& that);
  676. /// Constructor for valueless symbols, and symbols from each type.
  677. #if 201103L <= YY_CPLUSPLUS
  678. basic_symbol (typename Base::kind_type t, location_type&& l)
  679. : Base (t)
  680. , location (std::move (l))
  681. {}
  682. #else
  683. basic_symbol (typename Base::kind_type t, const location_type& l)
  684. : Base (t)
  685. , location (l)
  686. {}
  687. #endif
  688. #if 201103L <= YY_CPLUSPLUS
  689. basic_symbol (typename Base::kind_type t, bool&& v, location_type&& l)
  690. : Base (t)
  691. , value (std::move (v))
  692. , location (std::move (l))
  693. {}
  694. #else
  695. basic_symbol (typename Base::kind_type t, const bool& v, const location_type& l)
  696. : Base (t)
  697. , value (v)
  698. , location (l)
  699. {}
  700. #endif
  701. #if 201103L <= YY_CPLUSPLUS
  702. basic_symbol (typename Base::kind_type t, enum condition&& v, location_type&& l)
  703. : Base (t)
  704. , value (std::move (v))
  705. , location (std::move (l))
  706. {}
  707. #else
  708. basic_symbol (typename Base::kind_type t, const enum condition& v, const location_type& l)
  709. : Base (t)
  710. , value (v)
  711. , location (l)
  712. {}
  713. #endif
  714. #if 201103L <= YY_CPLUSPLUS
  715. basic_symbol (typename Base::kind_type t, enum in_out_set&& v, location_type&& l)
  716. : Base (t)
  717. , value (std::move (v))
  718. , location (std::move (l))
  719. {}
  720. #else
  721. basic_symbol (typename Base::kind_type t, const enum in_out_set& v, const location_type& l)
  722. : Base (t)
  723. , value (v)
  724. , location (l)
  725. {}
  726. #endif
  727. #if 201103L <= YY_CPLUSPLUS
  728. basic_symbol (typename Base::kind_type t, enum irq&& v, location_type&& l)
  729. : Base (t)
  730. , value (std::move (v))
  731. , location (std::move (l))
  732. {}
  733. #else
  734. basic_symbol (typename Base::kind_type t, const enum irq& v, const location_type& l)
  735. : Base (t)
  736. , value (v)
  737. , location (l)
  738. {}
  739. #endif
  740. #if 201103L <= YY_CPLUSPLUS
  741. basic_symbol (typename Base::kind_type t, enum mov&& v, location_type&& l)
  742. : Base (t)
  743. , value (std::move (v))
  744. , location (std::move (l))
  745. {}
  746. #else
  747. basic_symbol (typename Base::kind_type t, const enum mov& v, const location_type& l)
  748. : Base (t)
  749. , value (v)
  750. , location (l)
  751. {}
  752. #endif
  753. #if 201103L <= YY_CPLUSPLUS
  754. basic_symbol (typename Base::kind_type t, enum mov_op&& v, location_type&& l)
  755. : Base (t)
  756. , value (std::move (v))
  757. , location (std::move (l))
  758. {}
  759. #else
  760. basic_symbol (typename Base::kind_type t, const enum mov_op& v, const location_type& l)
  761. : Base (t)
  762. , value (v)
  763. , location (l)
  764. {}
  765. #endif
  766. #if 201103L <= YY_CPLUSPLUS
  767. basic_symbol (typename Base::kind_type t, int&& v, location_type&& l)
  768. : Base (t)
  769. , value (std::move (v))
  770. , location (std::move (l))
  771. {}
  772. #else
  773. basic_symbol (typename Base::kind_type t, const int& v, const location_type& l)
  774. : Base (t)
  775. , value (v)
  776. , location (l)
  777. {}
  778. #endif
  779. #if 201103L <= YY_CPLUSPLUS
  780. basic_symbol (typename Base::kind_type t, std::shared_ptr<instruction>&& v, location_type&& l)
  781. : Base (t)
  782. , value (std::move (v))
  783. , location (std::move (l))
  784. {}
  785. #else
  786. basic_symbol (typename Base::kind_type t, const std::shared_ptr<instruction>& v, const location_type& l)
  787. : Base (t)
  788. , value (v)
  789. , location (l)
  790. {}
  791. #endif
  792. #if 201103L <= YY_CPLUSPLUS
  793. basic_symbol (typename Base::kind_type t, std::shared_ptr<resolvable>&& v, location_type&& l)
  794. : Base (t)
  795. , value (std::move (v))
  796. , location (std::move (l))
  797. {}
  798. #else
  799. basic_symbol (typename Base::kind_type t, const std::shared_ptr<resolvable>& v, const location_type& l)
  800. : Base (t)
  801. , value (v)
  802. , location (l)
  803. {}
  804. #endif
  805. #if 201103L <= YY_CPLUSPLUS
  806. basic_symbol (typename Base::kind_type t, std::shared_ptr<symbol>&& v, location_type&& l)
  807. : Base (t)
  808. , value (std::move (v))
  809. , location (std::move (l))
  810. {}
  811. #else
  812. basic_symbol (typename Base::kind_type t, const std::shared_ptr<symbol>& v, const location_type& l)
  813. : Base (t)
  814. , value (v)
  815. , location (l)
  816. {}
  817. #endif
  818. #if 201103L <= YY_CPLUSPLUS
  819. basic_symbol (typename Base::kind_type t, std::shared_ptr<wait_source>&& v, location_type&& l)
  820. : Base (t)
  821. , value (std::move (v))
  822. , location (std::move (l))
  823. {}
  824. #else
  825. basic_symbol (typename Base::kind_type t, const std::shared_ptr<wait_source>& v, const location_type& l)
  826. : Base (t)
  827. , value (v)
  828. , location (l)
  829. {}
  830. #endif
  831. #if 201103L <= YY_CPLUSPLUS
  832. basic_symbol (typename Base::kind_type t, std::string&& v, location_type&& l)
  833. : Base (t)
  834. , value (std::move (v))
  835. , location (std::move (l))
  836. {}
  837. #else
  838. basic_symbol (typename Base::kind_type t, const std::string& v, const location_type& l)
  839. : Base (t)
  840. , value (v)
  841. , location (l)
  842. {}
  843. #endif
  844. /// Destroy the symbol.
  845. ~basic_symbol ()
  846. {
  847. clear ();
  848. }
  849. /// Destroy contents, and record that is empty.
  850. void clear ()
  851. {
  852. // User destructor.
  853. symbol_kind_type yykind = this->kind ();
  854. basic_symbol<Base>& yysym = *this;
  855. (void) yysym;
  856. switch (yykind)
  857. {
  858. default:
  859. break;
  860. }
  861. // Value type destructor.
  862. switch (yykind)
  863. {
  864. case symbol_kind::S_if_full: // if_full
  865. case symbol_kind::S_if_empty: // if_empty
  866. case symbol_kind::S_blocking: // blocking
  867. value.template destroy< bool > ();
  868. break;
  869. case symbol_kind::S_condition: // condition
  870. value.template destroy< enum condition > ();
  871. break;
  872. case symbol_kind::S_in_source: // in_source
  873. case symbol_kind::S_out_target: // out_target
  874. case symbol_kind::S_set_target: // set_target
  875. value.template destroy< enum in_out_set > ();
  876. break;
  877. case symbol_kind::S_irq_modifiers: // irq_modifiers
  878. value.template destroy< enum irq > ();
  879. break;
  880. case symbol_kind::S_mov_target: // mov_target
  881. case symbol_kind::S_mov_source: // mov_source
  882. value.template destroy< enum mov > ();
  883. break;
  884. case symbol_kind::S_mov_op: // mov_op
  885. value.template destroy< enum mov_op > ();
  886. break;
  887. case symbol_kind::S_INT: // "integer"
  888. value.template destroy< int > ();
  889. break;
  890. case symbol_kind::S_instruction: // instruction
  891. case symbol_kind::S_base_instruction: // base_instruction
  892. value.template destroy< std::shared_ptr<instruction> > ();
  893. break;
  894. case symbol_kind::S_value: // value
  895. case symbol_kind::S_expression: // expression
  896. case symbol_kind::S_delay: // delay
  897. case symbol_kind::S_sideset: // sideset
  898. value.template destroy< std::shared_ptr<resolvable> > ();
  899. break;
  900. case symbol_kind::S_label_decl: // label_decl
  901. case symbol_kind::S_symbol_def: // symbol_def
  902. value.template destroy< std::shared_ptr<symbol> > ();
  903. break;
  904. case symbol_kind::S_wait_source: // wait_source
  905. value.template destroy< std::shared_ptr<wait_source> > ();
  906. break;
  907. case symbol_kind::S_ID: // "identifier"
  908. case symbol_kind::S_STRING: // "string"
  909. case symbol_kind::S_NON_WS: // "text"
  910. case symbol_kind::S_CODE_BLOCK_START: // "code block"
  911. case symbol_kind::S_CODE_BLOCK_CONTENTS: // "%}"
  912. case symbol_kind::S_UNKNOWN_DIRECTIVE: // UNKNOWN_DIRECTIVE
  913. value.template destroy< std::string > ();
  914. break;
  915. default:
  916. break;
  917. }
  918. Base::clear ();
  919. }
  920. /// The user-facing name of this symbol.
  921. std::string name () const YY_NOEXCEPT
  922. {
  923. return parser::symbol_name (this->kind ());
  924. }
  925. /// Backward compatibility (Bison 3.6).
  926. symbol_kind_type type_get () const YY_NOEXCEPT;
  927. /// Whether empty.
  928. bool empty () const YY_NOEXCEPT;
  929. /// Destructive move, \a s is emptied into this.
  930. void move (basic_symbol& s);
  931. /// The semantic value.
  932. semantic_type value;
  933. /// The location.
  934. location_type location;
  935. private:
  936. #if YY_CPLUSPLUS < 201103L
  937. /// Assignment operator.
  938. basic_symbol& operator= (const basic_symbol& that);
  939. #endif
  940. };
  941. /// Type access provider for token (enum) based symbols.
  942. struct by_kind
  943. {
  944. /// Default constructor.
  945. by_kind ();
  946. #if 201103L <= YY_CPLUSPLUS
  947. /// Move constructor.
  948. by_kind (by_kind&& that);
  949. #endif
  950. /// Copy constructor.
  951. by_kind (const by_kind& that);
  952. /// The symbol kind as needed by the constructor.
  953. typedef token_kind_type kind_type;
  954. /// Constructor from (external) token numbers.
  955. by_kind (kind_type t);
  956. /// Record that this symbol is empty.
  957. void clear ();
  958. /// Steal the symbol kind from \a that.
  959. void move (by_kind& that);
  960. /// The (internal) type number (corresponding to \a type).
  961. /// \a empty when empty.
  962. symbol_kind_type kind () const YY_NOEXCEPT;
  963. /// Backward compatibility (Bison 3.6).
  964. symbol_kind_type type_get () const YY_NOEXCEPT;
  965. /// The symbol kind.
  966. /// \a S_YYEMPTY when empty.
  967. symbol_kind_type kind_;
  968. };
  969. /// Backward compatibility for a private implementation detail (Bison 3.6).
  970. typedef by_kind by_type;
  971. /// "External" symbols: returned by the scanner.
  972. struct symbol_type : basic_symbol<by_kind>
  973. {
  974. /// Superclass.
  975. typedef basic_symbol<by_kind> super_type;
  976. /// Empty symbol.
  977. symbol_type () {}
  978. /// Constructor for valueless symbols, and symbols from each type.
  979. #if 201103L <= YY_CPLUSPLUS
  980. symbol_type (int tok, location_type l)
  981. : super_type(token_type (tok), std::move (l))
  982. {
  983. YY_ASSERT (tok == token::TOK_END || tok == token::TOK_YYerror || tok == token::TOK_YYUNDEF || tok == token::TOK_NEWLINE || tok == token::TOK_COMMA || tok == token::TOK_COLON || tok == token::TOK_LPAREN || tok == token::TOK_RPAREN || tok == token::TOK_LBRACKET || tok == token::TOK_RBRACKET || tok == token::TOK_PLUS || tok == token::TOK_MINUS || tok == token::TOK_MULTIPLY || tok == token::TOK_DIVIDE || tok == token::TOK_OR || tok == token::TOK_AND || tok == token::TOK_XOR || tok == token::TOK_POST_DECREMENT || tok == token::TOK_NOT_EQUAL || tok == token::TOK_NOT || tok == token::TOK_REVERSE || tok == token::TOK_EQUAL || tok == token::TOK_PROGRAM || tok == token::TOK_WRAP_TARGET || tok == token::TOK_WRAP || tok == token::TOK_DEFINE || tok == token::TOK_SIDE_SET || tok == token::TOK_WORD || tok == token::TOK_ORIGIN || tok == token::TOK_LANG_OPT || tok == token::TOK_JMP || tok == token::TOK_WAIT || tok == token::TOK_IN || tok == token::TOK_OUT || tok == token::TOK_PUSH || tok == token::TOK_PULL || tok == token::TOK_MOV || tok == token::TOK_IRQ || tok == token::TOK_SET || tok == token::TOK_NOP || tok == token::TOK_PIN || tok == token::TOK_GPIO || tok == token::TOK_OSRE || tok == token::TOK_PINS || tok == token::TOK_NULL || tok == token::TOK_PINDIRS || tok == token::TOK_BLOCK || tok == token::TOK_NOBLOCK || tok == token::TOK_IFEMPTY || tok == token::TOK_IFFULL || tok == token::TOK_NOWAIT || tok == token::TOK_CLEAR || tok == token::TOK_REL || tok == token::TOK_X || tok == token::TOK_Y || tok == token::TOK_EXEC || tok == token::TOK_PC || tok == token::TOK_ISR || tok == token::TOK_OSR || tok == token::TOK_OPTIONAL || tok == token::TOK_SIDE || tok == token::TOK_STATUS || tok == token::TOK_PUBLIC);
  984. }
  985. #else
  986. symbol_type (int tok, const location_type& l)
  987. : super_type(token_type (tok), l)
  988. {
  989. YY_ASSERT (tok == token::TOK_END || tok == token::TOK_YYerror || tok == token::TOK_YYUNDEF || tok == token::TOK_NEWLINE || tok == token::TOK_COMMA || tok == token::TOK_COLON || tok == token::TOK_LPAREN || tok == token::TOK_RPAREN || tok == token::TOK_LBRACKET || tok == token::TOK_RBRACKET || tok == token::TOK_PLUS || tok == token::TOK_MINUS || tok == token::TOK_MULTIPLY || tok == token::TOK_DIVIDE || tok == token::TOK_OR || tok == token::TOK_AND || tok == token::TOK_XOR || tok == token::TOK_POST_DECREMENT || tok == token::TOK_NOT_EQUAL || tok == token::TOK_NOT || tok == token::TOK_REVERSE || tok == token::TOK_EQUAL || tok == token::TOK_PROGRAM || tok == token::TOK_WRAP_TARGET || tok == token::TOK_WRAP || tok == token::TOK_DEFINE || tok == token::TOK_SIDE_SET || tok == token::TOK_WORD || tok == token::TOK_ORIGIN || tok == token::TOK_LANG_OPT || tok == token::TOK_JMP || tok == token::TOK_WAIT || tok == token::TOK_IN || tok == token::TOK_OUT || tok == token::TOK_PUSH || tok == token::TOK_PULL || tok == token::TOK_MOV || tok == token::TOK_IRQ || tok == token::TOK_SET || tok == token::TOK_NOP || tok == token::TOK_PIN || tok == token::TOK_GPIO || tok == token::TOK_OSRE || tok == token::TOK_PINS || tok == token::TOK_NULL || tok == token::TOK_PINDIRS || tok == token::TOK_BLOCK || tok == token::TOK_NOBLOCK || tok == token::TOK_IFEMPTY || tok == token::TOK_IFFULL || tok == token::TOK_NOWAIT || tok == token::TOK_CLEAR || tok == token::TOK_REL || tok == token::TOK_X || tok == token::TOK_Y || tok == token::TOK_EXEC || tok == token::TOK_PC || tok == token::TOK_ISR || tok == token::TOK_OSR || tok == token::TOK_OPTIONAL || tok == token::TOK_SIDE || tok == token::TOK_STATUS || tok == token::TOK_PUBLIC);
  990. }
  991. #endif
  992. #if 201103L <= YY_CPLUSPLUS
  993. symbol_type (int tok, int v, location_type l)
  994. : super_type(token_type (tok), std::move (v), std::move (l))
  995. {
  996. YY_ASSERT (tok == token::TOK_INT);
  997. }
  998. #else
  999. symbol_type (int tok, const int& v, const location_type& l)
  1000. : super_type(token_type (tok), v, l)
  1001. {
  1002. YY_ASSERT (tok == token::TOK_INT);
  1003. }
  1004. #endif
  1005. #if 201103L <= YY_CPLUSPLUS
  1006. symbol_type (int tok, std::string v, location_type l)
  1007. : super_type(token_type (tok), std::move (v), std::move (l))
  1008. {
  1009. YY_ASSERT (tok == token::TOK_ID || tok == token::TOK_STRING || tok == token::TOK_NON_WS || tok == token::TOK_CODE_BLOCK_START || tok == token::TOK_CODE_BLOCK_CONTENTS || tok == token::TOK_UNKNOWN_DIRECTIVE);
  1010. }
  1011. #else
  1012. symbol_type (int tok, const std::string& v, const location_type& l)
  1013. : super_type(token_type (tok), v, l)
  1014. {
  1015. YY_ASSERT (tok == token::TOK_ID || tok == token::TOK_STRING || tok == token::TOK_NON_WS || tok == token::TOK_CODE_BLOCK_START || tok == token::TOK_CODE_BLOCK_CONTENTS || tok == token::TOK_UNKNOWN_DIRECTIVE);
  1016. }
  1017. #endif
  1018. };
  1019. /// Build a parser object.
  1020. parser (pio_assembler& pioasm_yyarg);
  1021. virtual ~parser ();
  1022. #if 201103L <= YY_CPLUSPLUS
  1023. /// Non copyable.
  1024. parser (const parser&) = delete;
  1025. /// Non copyable.
  1026. parser& operator= (const parser&) = delete;
  1027. #endif
  1028. /// Parse. An alias for parse ().
  1029. /// \returns 0 iff parsing succeeded.
  1030. int operator() ();
  1031. /// Parse.
  1032. /// \returns 0 iff parsing succeeded.
  1033. virtual int parse ();
  1034. #if YYDEBUG
  1035. /// The current debugging stream.
  1036. std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
  1037. /// Set the current debugging stream.
  1038. void set_debug_stream (std::ostream &);
  1039. /// Type for debugging levels.
  1040. typedef int debug_level_type;
  1041. /// The current debugging level.
  1042. debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
  1043. /// Set the current debugging level.
  1044. void set_debug_level (debug_level_type l);
  1045. #endif
  1046. /// Report a syntax error.
  1047. /// \param loc where the syntax error is found.
  1048. /// \param msg a description of the syntax error.
  1049. virtual void error (const location_type& loc, const std::string& msg);
  1050. /// Report a syntax error.
  1051. void error (const syntax_error& err);
  1052. /// The user-facing name of the symbol whose (internal) number is
  1053. /// YYSYMBOL. No bounds checking.
  1054. static std::string symbol_name (symbol_kind_type yysymbol);
  1055. // Implementation of make_symbol for each symbol type.
  1056. #if 201103L <= YY_CPLUSPLUS
  1057. static
  1058. symbol_type
  1059. make_END (location_type l)
  1060. {
  1061. return symbol_type (token::TOK_END, std::move (l));
  1062. }
  1063. #else
  1064. static
  1065. symbol_type
  1066. make_END (const location_type& l)
  1067. {
  1068. return symbol_type (token::TOK_END, l);
  1069. }
  1070. #endif
  1071. #if 201103L <= YY_CPLUSPLUS
  1072. static
  1073. symbol_type
  1074. make_YYerror (location_type l)
  1075. {
  1076. return symbol_type (token::TOK_YYerror, std::move (l));
  1077. }
  1078. #else
  1079. static
  1080. symbol_type
  1081. make_YYerror (const location_type& l)
  1082. {
  1083. return symbol_type (token::TOK_YYerror, l);
  1084. }
  1085. #endif
  1086. #if 201103L <= YY_CPLUSPLUS
  1087. static
  1088. symbol_type
  1089. make_YYUNDEF (location_type l)
  1090. {
  1091. return symbol_type (token::TOK_YYUNDEF, std::move (l));
  1092. }
  1093. #else
  1094. static
  1095. symbol_type
  1096. make_YYUNDEF (const location_type& l)
  1097. {
  1098. return symbol_type (token::TOK_YYUNDEF, l);
  1099. }
  1100. #endif
  1101. #if 201103L <= YY_CPLUSPLUS
  1102. static
  1103. symbol_type
  1104. make_NEWLINE (location_type l)
  1105. {
  1106. return symbol_type (token::TOK_NEWLINE, std::move (l));
  1107. }
  1108. #else
  1109. static
  1110. symbol_type
  1111. make_NEWLINE (const location_type& l)
  1112. {
  1113. return symbol_type (token::TOK_NEWLINE, l);
  1114. }
  1115. #endif
  1116. #if 201103L <= YY_CPLUSPLUS
  1117. static
  1118. symbol_type
  1119. make_COMMA (location_type l)
  1120. {
  1121. return symbol_type (token::TOK_COMMA, std::move (l));
  1122. }
  1123. #else
  1124. static
  1125. symbol_type
  1126. make_COMMA (const location_type& l)
  1127. {
  1128. return symbol_type (token::TOK_COMMA, l);
  1129. }
  1130. #endif
  1131. #if 201103L <= YY_CPLUSPLUS
  1132. static
  1133. symbol_type
  1134. make_COLON (location_type l)
  1135. {
  1136. return symbol_type (token::TOK_COLON, std::move (l));
  1137. }
  1138. #else
  1139. static
  1140. symbol_type
  1141. make_COLON (const location_type& l)
  1142. {
  1143. return symbol_type (token::TOK_COLON, l);
  1144. }
  1145. #endif
  1146. #if 201103L <= YY_CPLUSPLUS
  1147. static
  1148. symbol_type
  1149. make_LPAREN (location_type l)
  1150. {
  1151. return symbol_type (token::TOK_LPAREN, std::move (l));
  1152. }
  1153. #else
  1154. static
  1155. symbol_type
  1156. make_LPAREN (const location_type& l)
  1157. {
  1158. return symbol_type (token::TOK_LPAREN, l);
  1159. }
  1160. #endif
  1161. #if 201103L <= YY_CPLUSPLUS
  1162. static
  1163. symbol_type
  1164. make_RPAREN (location_type l)
  1165. {
  1166. return symbol_type (token::TOK_RPAREN, std::move (l));
  1167. }
  1168. #else
  1169. static
  1170. symbol_type
  1171. make_RPAREN (const location_type& l)
  1172. {
  1173. return symbol_type (token::TOK_RPAREN, l);
  1174. }
  1175. #endif
  1176. #if 201103L <= YY_CPLUSPLUS
  1177. static
  1178. symbol_type
  1179. make_LBRACKET (location_type l)
  1180. {
  1181. return symbol_type (token::TOK_LBRACKET, std::move (l));
  1182. }
  1183. #else
  1184. static
  1185. symbol_type
  1186. make_LBRACKET (const location_type& l)
  1187. {
  1188. return symbol_type (token::TOK_LBRACKET, l);
  1189. }
  1190. #endif
  1191. #if 201103L <= YY_CPLUSPLUS
  1192. static
  1193. symbol_type
  1194. make_RBRACKET (location_type l)
  1195. {
  1196. return symbol_type (token::TOK_RBRACKET, std::move (l));
  1197. }
  1198. #else
  1199. static
  1200. symbol_type
  1201. make_RBRACKET (const location_type& l)
  1202. {
  1203. return symbol_type (token::TOK_RBRACKET, l);
  1204. }
  1205. #endif
  1206. #if 201103L <= YY_CPLUSPLUS
  1207. static
  1208. symbol_type
  1209. make_PLUS (location_type l)
  1210. {
  1211. return symbol_type (token::TOK_PLUS, std::move (l));
  1212. }
  1213. #else
  1214. static
  1215. symbol_type
  1216. make_PLUS (const location_type& l)
  1217. {
  1218. return symbol_type (token::TOK_PLUS, l);
  1219. }
  1220. #endif
  1221. #if 201103L <= YY_CPLUSPLUS
  1222. static
  1223. symbol_type
  1224. make_MINUS (location_type l)
  1225. {
  1226. return symbol_type (token::TOK_MINUS, std::move (l));
  1227. }
  1228. #else
  1229. static
  1230. symbol_type
  1231. make_MINUS (const location_type& l)
  1232. {
  1233. return symbol_type (token::TOK_MINUS, l);
  1234. }
  1235. #endif
  1236. #if 201103L <= YY_CPLUSPLUS
  1237. static
  1238. symbol_type
  1239. make_MULTIPLY (location_type l)
  1240. {
  1241. return symbol_type (token::TOK_MULTIPLY, std::move (l));
  1242. }
  1243. #else
  1244. static
  1245. symbol_type
  1246. make_MULTIPLY (const location_type& l)
  1247. {
  1248. return symbol_type (token::TOK_MULTIPLY, l);
  1249. }
  1250. #endif
  1251. #if 201103L <= YY_CPLUSPLUS
  1252. static
  1253. symbol_type
  1254. make_DIVIDE (location_type l)
  1255. {
  1256. return symbol_type (token::TOK_DIVIDE, std::move (l));
  1257. }
  1258. #else
  1259. static
  1260. symbol_type
  1261. make_DIVIDE (const location_type& l)
  1262. {
  1263. return symbol_type (token::TOK_DIVIDE, l);
  1264. }
  1265. #endif
  1266. #if 201103L <= YY_CPLUSPLUS
  1267. static
  1268. symbol_type
  1269. make_OR (location_type l)
  1270. {
  1271. return symbol_type (token::TOK_OR, std::move (l));
  1272. }
  1273. #else
  1274. static
  1275. symbol_type
  1276. make_OR (const location_type& l)
  1277. {
  1278. return symbol_type (token::TOK_OR, l);
  1279. }
  1280. #endif
  1281. #if 201103L <= YY_CPLUSPLUS
  1282. static
  1283. symbol_type
  1284. make_AND (location_type l)
  1285. {
  1286. return symbol_type (token::TOK_AND, std::move (l));
  1287. }
  1288. #else
  1289. static
  1290. symbol_type
  1291. make_AND (const location_type& l)
  1292. {
  1293. return symbol_type (token::TOK_AND, l);
  1294. }
  1295. #endif
  1296. #if 201103L <= YY_CPLUSPLUS
  1297. static
  1298. symbol_type
  1299. make_XOR (location_type l)
  1300. {
  1301. return symbol_type (token::TOK_XOR, std::move (l));
  1302. }
  1303. #else
  1304. static
  1305. symbol_type
  1306. make_XOR (const location_type& l)
  1307. {
  1308. return symbol_type (token::TOK_XOR, l);
  1309. }
  1310. #endif
  1311. #if 201103L <= YY_CPLUSPLUS
  1312. static
  1313. symbol_type
  1314. make_POST_DECREMENT (location_type l)
  1315. {
  1316. return symbol_type (token::TOK_POST_DECREMENT, std::move (l));
  1317. }
  1318. #else
  1319. static
  1320. symbol_type
  1321. make_POST_DECREMENT (const location_type& l)
  1322. {
  1323. return symbol_type (token::TOK_POST_DECREMENT, l);
  1324. }
  1325. #endif
  1326. #if 201103L <= YY_CPLUSPLUS
  1327. static
  1328. symbol_type
  1329. make_NOT_EQUAL (location_type l)
  1330. {
  1331. return symbol_type (token::TOK_NOT_EQUAL, std::move (l));
  1332. }
  1333. #else
  1334. static
  1335. symbol_type
  1336. make_NOT_EQUAL (const location_type& l)
  1337. {
  1338. return symbol_type (token::TOK_NOT_EQUAL, l);
  1339. }
  1340. #endif
  1341. #if 201103L <= YY_CPLUSPLUS
  1342. static
  1343. symbol_type
  1344. make_NOT (location_type l)
  1345. {
  1346. return symbol_type (token::TOK_NOT, std::move (l));
  1347. }
  1348. #else
  1349. static
  1350. symbol_type
  1351. make_NOT (const location_type& l)
  1352. {
  1353. return symbol_type (token::TOK_NOT, l);
  1354. }
  1355. #endif
  1356. #if 201103L <= YY_CPLUSPLUS
  1357. static
  1358. symbol_type
  1359. make_REVERSE (location_type l)
  1360. {
  1361. return symbol_type (token::TOK_REVERSE, std::move (l));
  1362. }
  1363. #else
  1364. static
  1365. symbol_type
  1366. make_REVERSE (const location_type& l)
  1367. {
  1368. return symbol_type (token::TOK_REVERSE, l);
  1369. }
  1370. #endif
  1371. #if 201103L <= YY_CPLUSPLUS
  1372. static
  1373. symbol_type
  1374. make_EQUAL (location_type l)
  1375. {
  1376. return symbol_type (token::TOK_EQUAL, std::move (l));
  1377. }
  1378. #else
  1379. static
  1380. symbol_type
  1381. make_EQUAL (const location_type& l)
  1382. {
  1383. return symbol_type (token::TOK_EQUAL, l);
  1384. }
  1385. #endif
  1386. #if 201103L <= YY_CPLUSPLUS
  1387. static
  1388. symbol_type
  1389. make_PROGRAM (location_type l)
  1390. {
  1391. return symbol_type (token::TOK_PROGRAM, std::move (l));
  1392. }
  1393. #else
  1394. static
  1395. symbol_type
  1396. make_PROGRAM (const location_type& l)
  1397. {
  1398. return symbol_type (token::TOK_PROGRAM, l);
  1399. }
  1400. #endif
  1401. #if 201103L <= YY_CPLUSPLUS
  1402. static
  1403. symbol_type
  1404. make_WRAP_TARGET (location_type l)
  1405. {
  1406. return symbol_type (token::TOK_WRAP_TARGET, std::move (l));
  1407. }
  1408. #else
  1409. static
  1410. symbol_type
  1411. make_WRAP_TARGET (const location_type& l)
  1412. {
  1413. return symbol_type (token::TOK_WRAP_TARGET, l);
  1414. }
  1415. #endif
  1416. #if 201103L <= YY_CPLUSPLUS
  1417. static
  1418. symbol_type
  1419. make_WRAP (location_type l)
  1420. {
  1421. return symbol_type (token::TOK_WRAP, std::move (l));
  1422. }
  1423. #else
  1424. static
  1425. symbol_type
  1426. make_WRAP (const location_type& l)
  1427. {
  1428. return symbol_type (token::TOK_WRAP, l);
  1429. }
  1430. #endif
  1431. #if 201103L <= YY_CPLUSPLUS
  1432. static
  1433. symbol_type
  1434. make_DEFINE (location_type l)
  1435. {
  1436. return symbol_type (token::TOK_DEFINE, std::move (l));
  1437. }
  1438. #else
  1439. static
  1440. symbol_type
  1441. make_DEFINE (const location_type& l)
  1442. {
  1443. return symbol_type (token::TOK_DEFINE, l);
  1444. }
  1445. #endif
  1446. #if 201103L <= YY_CPLUSPLUS
  1447. static
  1448. symbol_type
  1449. make_SIDE_SET (location_type l)
  1450. {
  1451. return symbol_type (token::TOK_SIDE_SET, std::move (l));
  1452. }
  1453. #else
  1454. static
  1455. symbol_type
  1456. make_SIDE_SET (const location_type& l)
  1457. {
  1458. return symbol_type (token::TOK_SIDE_SET, l);
  1459. }
  1460. #endif
  1461. #if 201103L <= YY_CPLUSPLUS
  1462. static
  1463. symbol_type
  1464. make_WORD (location_type l)
  1465. {
  1466. return symbol_type (token::TOK_WORD, std::move (l));
  1467. }
  1468. #else
  1469. static
  1470. symbol_type
  1471. make_WORD (const location_type& l)
  1472. {
  1473. return symbol_type (token::TOK_WORD, l);
  1474. }
  1475. #endif
  1476. #if 201103L <= YY_CPLUSPLUS
  1477. static
  1478. symbol_type
  1479. make_ORIGIN (location_type l)
  1480. {
  1481. return symbol_type (token::TOK_ORIGIN, std::move (l));
  1482. }
  1483. #else
  1484. static
  1485. symbol_type
  1486. make_ORIGIN (const location_type& l)
  1487. {
  1488. return symbol_type (token::TOK_ORIGIN, l);
  1489. }
  1490. #endif
  1491. #if 201103L <= YY_CPLUSPLUS
  1492. static
  1493. symbol_type
  1494. make_LANG_OPT (location_type l)
  1495. {
  1496. return symbol_type (token::TOK_LANG_OPT, std::move (l));
  1497. }
  1498. #else
  1499. static
  1500. symbol_type
  1501. make_LANG_OPT (const location_type& l)
  1502. {
  1503. return symbol_type (token::TOK_LANG_OPT, l);
  1504. }
  1505. #endif
  1506. #if 201103L <= YY_CPLUSPLUS
  1507. static
  1508. symbol_type
  1509. make_JMP (location_type l)
  1510. {
  1511. return symbol_type (token::TOK_JMP, std::move (l));
  1512. }
  1513. #else
  1514. static
  1515. symbol_type
  1516. make_JMP (const location_type& l)
  1517. {
  1518. return symbol_type (token::TOK_JMP, l);
  1519. }
  1520. #endif
  1521. #if 201103L <= YY_CPLUSPLUS
  1522. static
  1523. symbol_type
  1524. make_WAIT (location_type l)
  1525. {
  1526. return symbol_type (token::TOK_WAIT, std::move (l));
  1527. }
  1528. #else
  1529. static
  1530. symbol_type
  1531. make_WAIT (const location_type& l)
  1532. {
  1533. return symbol_type (token::TOK_WAIT, l);
  1534. }
  1535. #endif
  1536. #if 201103L <= YY_CPLUSPLUS
  1537. static
  1538. symbol_type
  1539. make_IN (location_type l)
  1540. {
  1541. return symbol_type (token::TOK_IN, std::move (l));
  1542. }
  1543. #else
  1544. static
  1545. symbol_type
  1546. make_IN (const location_type& l)
  1547. {
  1548. return symbol_type (token::TOK_IN, l);
  1549. }
  1550. #endif
  1551. #if 201103L <= YY_CPLUSPLUS
  1552. static
  1553. symbol_type
  1554. make_OUT (location_type l)
  1555. {
  1556. return symbol_type (token::TOK_OUT, std::move (l));
  1557. }
  1558. #else
  1559. static
  1560. symbol_type
  1561. make_OUT (const location_type& l)
  1562. {
  1563. return symbol_type (token::TOK_OUT, l);
  1564. }
  1565. #endif
  1566. #if 201103L <= YY_CPLUSPLUS
  1567. static
  1568. symbol_type
  1569. make_PUSH (location_type l)
  1570. {
  1571. return symbol_type (token::TOK_PUSH, std::move (l));
  1572. }
  1573. #else
  1574. static
  1575. symbol_type
  1576. make_PUSH (const location_type& l)
  1577. {
  1578. return symbol_type (token::TOK_PUSH, l);
  1579. }
  1580. #endif
  1581. #if 201103L <= YY_CPLUSPLUS
  1582. static
  1583. symbol_type
  1584. make_PULL (location_type l)
  1585. {
  1586. return symbol_type (token::TOK_PULL, std::move (l));
  1587. }
  1588. #else
  1589. static
  1590. symbol_type
  1591. make_PULL (const location_type& l)
  1592. {
  1593. return symbol_type (token::TOK_PULL, l);
  1594. }
  1595. #endif
  1596. #if 201103L <= YY_CPLUSPLUS
  1597. static
  1598. symbol_type
  1599. make_MOV (location_type l)
  1600. {
  1601. return symbol_type (token::TOK_MOV, std::move (l));
  1602. }
  1603. #else
  1604. static
  1605. symbol_type
  1606. make_MOV (const location_type& l)
  1607. {
  1608. return symbol_type (token::TOK_MOV, l);
  1609. }
  1610. #endif
  1611. #if 201103L <= YY_CPLUSPLUS
  1612. static
  1613. symbol_type
  1614. make_IRQ (location_type l)
  1615. {
  1616. return symbol_type (token::TOK_IRQ, std::move (l));
  1617. }
  1618. #else
  1619. static
  1620. symbol_type
  1621. make_IRQ (const location_type& l)
  1622. {
  1623. return symbol_type (token::TOK_IRQ, l);
  1624. }
  1625. #endif
  1626. #if 201103L <= YY_CPLUSPLUS
  1627. static
  1628. symbol_type
  1629. make_SET (location_type l)
  1630. {
  1631. return symbol_type (token::TOK_SET, std::move (l));
  1632. }
  1633. #else
  1634. static
  1635. symbol_type
  1636. make_SET (const location_type& l)
  1637. {
  1638. return symbol_type (token::TOK_SET, l);
  1639. }
  1640. #endif
  1641. #if 201103L <= YY_CPLUSPLUS
  1642. static
  1643. symbol_type
  1644. make_NOP (location_type l)
  1645. {
  1646. return symbol_type (token::TOK_NOP, std::move (l));
  1647. }
  1648. #else
  1649. static
  1650. symbol_type
  1651. make_NOP (const location_type& l)
  1652. {
  1653. return symbol_type (token::TOK_NOP, l);
  1654. }
  1655. #endif
  1656. #if 201103L <= YY_CPLUSPLUS
  1657. static
  1658. symbol_type
  1659. make_PIN (location_type l)
  1660. {
  1661. return symbol_type (token::TOK_PIN, std::move (l));
  1662. }
  1663. #else
  1664. static
  1665. symbol_type
  1666. make_PIN (const location_type& l)
  1667. {
  1668. return symbol_type (token::TOK_PIN, l);
  1669. }
  1670. #endif
  1671. #if 201103L <= YY_CPLUSPLUS
  1672. static
  1673. symbol_type
  1674. make_GPIO (location_type l)
  1675. {
  1676. return symbol_type (token::TOK_GPIO, std::move (l));
  1677. }
  1678. #else
  1679. static
  1680. symbol_type
  1681. make_GPIO (const location_type& l)
  1682. {
  1683. return symbol_type (token::TOK_GPIO, l);
  1684. }
  1685. #endif
  1686. #if 201103L <= YY_CPLUSPLUS
  1687. static
  1688. symbol_type
  1689. make_OSRE (location_type l)
  1690. {
  1691. return symbol_type (token::TOK_OSRE, std::move (l));
  1692. }
  1693. #else
  1694. static
  1695. symbol_type
  1696. make_OSRE (const location_type& l)
  1697. {
  1698. return symbol_type (token::TOK_OSRE, l);
  1699. }
  1700. #endif
  1701. #if 201103L <= YY_CPLUSPLUS
  1702. static
  1703. symbol_type
  1704. make_PINS (location_type l)
  1705. {
  1706. return symbol_type (token::TOK_PINS, std::move (l));
  1707. }
  1708. #else
  1709. static
  1710. symbol_type
  1711. make_PINS (const location_type& l)
  1712. {
  1713. return symbol_type (token::TOK_PINS, l);
  1714. }
  1715. #endif
  1716. #if 201103L <= YY_CPLUSPLUS
  1717. static
  1718. symbol_type
  1719. make_NULL (location_type l)
  1720. {
  1721. return symbol_type (token::TOK_NULL, std::move (l));
  1722. }
  1723. #else
  1724. static
  1725. symbol_type
  1726. make_NULL (const location_type& l)
  1727. {
  1728. return symbol_type (token::TOK_NULL, l);
  1729. }
  1730. #endif
  1731. #if 201103L <= YY_CPLUSPLUS
  1732. static
  1733. symbol_type
  1734. make_PINDIRS (location_type l)
  1735. {
  1736. return symbol_type (token::TOK_PINDIRS, std::move (l));
  1737. }
  1738. #else
  1739. static
  1740. symbol_type
  1741. make_PINDIRS (const location_type& l)
  1742. {
  1743. return symbol_type (token::TOK_PINDIRS, l);
  1744. }
  1745. #endif
  1746. #if 201103L <= YY_CPLUSPLUS
  1747. static
  1748. symbol_type
  1749. make_BLOCK (location_type l)
  1750. {
  1751. return symbol_type (token::TOK_BLOCK, std::move (l));
  1752. }
  1753. #else
  1754. static
  1755. symbol_type
  1756. make_BLOCK (const location_type& l)
  1757. {
  1758. return symbol_type (token::TOK_BLOCK, l);
  1759. }
  1760. #endif
  1761. #if 201103L <= YY_CPLUSPLUS
  1762. static
  1763. symbol_type
  1764. make_NOBLOCK (location_type l)
  1765. {
  1766. return symbol_type (token::TOK_NOBLOCK, std::move (l));
  1767. }
  1768. #else
  1769. static
  1770. symbol_type
  1771. make_NOBLOCK (const location_type& l)
  1772. {
  1773. return symbol_type (token::TOK_NOBLOCK, l);
  1774. }
  1775. #endif
  1776. #if 201103L <= YY_CPLUSPLUS
  1777. static
  1778. symbol_type
  1779. make_IFEMPTY (location_type l)
  1780. {
  1781. return symbol_type (token::TOK_IFEMPTY, std::move (l));
  1782. }
  1783. #else
  1784. static
  1785. symbol_type
  1786. make_IFEMPTY (const location_type& l)
  1787. {
  1788. return symbol_type (token::TOK_IFEMPTY, l);
  1789. }
  1790. #endif
  1791. #if 201103L <= YY_CPLUSPLUS
  1792. static
  1793. symbol_type
  1794. make_IFFULL (location_type l)
  1795. {
  1796. return symbol_type (token::TOK_IFFULL, std::move (l));
  1797. }
  1798. #else
  1799. static
  1800. symbol_type
  1801. make_IFFULL (const location_type& l)
  1802. {
  1803. return symbol_type (token::TOK_IFFULL, l);
  1804. }
  1805. #endif
  1806. #if 201103L <= YY_CPLUSPLUS
  1807. static
  1808. symbol_type
  1809. make_NOWAIT (location_type l)
  1810. {
  1811. return symbol_type (token::TOK_NOWAIT, std::move (l));
  1812. }
  1813. #else
  1814. static
  1815. symbol_type
  1816. make_NOWAIT (const location_type& l)
  1817. {
  1818. return symbol_type (token::TOK_NOWAIT, l);
  1819. }
  1820. #endif
  1821. #if 201103L <= YY_CPLUSPLUS
  1822. static
  1823. symbol_type
  1824. make_CLEAR (location_type l)
  1825. {
  1826. return symbol_type (token::TOK_CLEAR, std::move (l));
  1827. }
  1828. #else
  1829. static
  1830. symbol_type
  1831. make_CLEAR (const location_type& l)
  1832. {
  1833. return symbol_type (token::TOK_CLEAR, l);
  1834. }
  1835. #endif
  1836. #if 201103L <= YY_CPLUSPLUS
  1837. static
  1838. symbol_type
  1839. make_REL (location_type l)
  1840. {
  1841. return symbol_type (token::TOK_REL, std::move (l));
  1842. }
  1843. #else
  1844. static
  1845. symbol_type
  1846. make_REL (const location_type& l)
  1847. {
  1848. return symbol_type (token::TOK_REL, l);
  1849. }
  1850. #endif
  1851. #if 201103L <= YY_CPLUSPLUS
  1852. static
  1853. symbol_type
  1854. make_X (location_type l)
  1855. {
  1856. return symbol_type (token::TOK_X, std::move (l));
  1857. }
  1858. #else
  1859. static
  1860. symbol_type
  1861. make_X (const location_type& l)
  1862. {
  1863. return symbol_type (token::TOK_X, l);
  1864. }
  1865. #endif
  1866. #if 201103L <= YY_CPLUSPLUS
  1867. static
  1868. symbol_type
  1869. make_Y (location_type l)
  1870. {
  1871. return symbol_type (token::TOK_Y, std::move (l));
  1872. }
  1873. #else
  1874. static
  1875. symbol_type
  1876. make_Y (const location_type& l)
  1877. {
  1878. return symbol_type (token::TOK_Y, l);
  1879. }
  1880. #endif
  1881. #if 201103L <= YY_CPLUSPLUS
  1882. static
  1883. symbol_type
  1884. make_EXEC (location_type l)
  1885. {
  1886. return symbol_type (token::TOK_EXEC, std::move (l));
  1887. }
  1888. #else
  1889. static
  1890. symbol_type
  1891. make_EXEC (const location_type& l)
  1892. {
  1893. return symbol_type (token::TOK_EXEC, l);
  1894. }
  1895. #endif
  1896. #if 201103L <= YY_CPLUSPLUS
  1897. static
  1898. symbol_type
  1899. make_PC (location_type l)
  1900. {
  1901. return symbol_type (token::TOK_PC, std::move (l));
  1902. }
  1903. #else
  1904. static
  1905. symbol_type
  1906. make_PC (const location_type& l)
  1907. {
  1908. return symbol_type (token::TOK_PC, l);
  1909. }
  1910. #endif
  1911. #if 201103L <= YY_CPLUSPLUS
  1912. static
  1913. symbol_type
  1914. make_ISR (location_type l)
  1915. {
  1916. return symbol_type (token::TOK_ISR, std::move (l));
  1917. }
  1918. #else
  1919. static
  1920. symbol_type
  1921. make_ISR (const location_type& l)
  1922. {
  1923. return symbol_type (token::TOK_ISR, l);
  1924. }
  1925. #endif
  1926. #if 201103L <= YY_CPLUSPLUS
  1927. static
  1928. symbol_type
  1929. make_OSR (location_type l)
  1930. {
  1931. return symbol_type (token::TOK_OSR, std::move (l));
  1932. }
  1933. #else
  1934. static
  1935. symbol_type
  1936. make_OSR (const location_type& l)
  1937. {
  1938. return symbol_type (token::TOK_OSR, l);
  1939. }
  1940. #endif
  1941. #if 201103L <= YY_CPLUSPLUS
  1942. static
  1943. symbol_type
  1944. make_OPTIONAL (location_type l)
  1945. {
  1946. return symbol_type (token::TOK_OPTIONAL, std::move (l));
  1947. }
  1948. #else
  1949. static
  1950. symbol_type
  1951. make_OPTIONAL (const location_type& l)
  1952. {
  1953. return symbol_type (token::TOK_OPTIONAL, l);
  1954. }
  1955. #endif
  1956. #if 201103L <= YY_CPLUSPLUS
  1957. static
  1958. symbol_type
  1959. make_SIDE (location_type l)
  1960. {
  1961. return symbol_type (token::TOK_SIDE, std::move (l));
  1962. }
  1963. #else
  1964. static
  1965. symbol_type
  1966. make_SIDE (const location_type& l)
  1967. {
  1968. return symbol_type (token::TOK_SIDE, l);
  1969. }
  1970. #endif
  1971. #if 201103L <= YY_CPLUSPLUS
  1972. static
  1973. symbol_type
  1974. make_STATUS (location_type l)
  1975. {
  1976. return symbol_type (token::TOK_STATUS, std::move (l));
  1977. }
  1978. #else
  1979. static
  1980. symbol_type
  1981. make_STATUS (const location_type& l)
  1982. {
  1983. return symbol_type (token::TOK_STATUS, l);
  1984. }
  1985. #endif
  1986. #if 201103L <= YY_CPLUSPLUS
  1987. static
  1988. symbol_type
  1989. make_PUBLIC (location_type l)
  1990. {
  1991. return symbol_type (token::TOK_PUBLIC, std::move (l));
  1992. }
  1993. #else
  1994. static
  1995. symbol_type
  1996. make_PUBLIC (const location_type& l)
  1997. {
  1998. return symbol_type (token::TOK_PUBLIC, l);
  1999. }
  2000. #endif
  2001. #if 201103L <= YY_CPLUSPLUS
  2002. static
  2003. symbol_type
  2004. make_ID (std::string v, location_type l)
  2005. {
  2006. return symbol_type (token::TOK_ID, std::move (v), std::move (l));
  2007. }
  2008. #else
  2009. static
  2010. symbol_type
  2011. make_ID (const std::string& v, const location_type& l)
  2012. {
  2013. return symbol_type (token::TOK_ID, v, l);
  2014. }
  2015. #endif
  2016. #if 201103L <= YY_CPLUSPLUS
  2017. static
  2018. symbol_type
  2019. make_STRING (std::string v, location_type l)
  2020. {
  2021. return symbol_type (token::TOK_STRING, std::move (v), std::move (l));
  2022. }
  2023. #else
  2024. static
  2025. symbol_type
  2026. make_STRING (const std::string& v, const location_type& l)
  2027. {
  2028. return symbol_type (token::TOK_STRING, v, l);
  2029. }
  2030. #endif
  2031. #if 201103L <= YY_CPLUSPLUS
  2032. static
  2033. symbol_type
  2034. make_NON_WS (std::string v, location_type l)
  2035. {
  2036. return symbol_type (token::TOK_NON_WS, std::move (v), std::move (l));
  2037. }
  2038. #else
  2039. static
  2040. symbol_type
  2041. make_NON_WS (const std::string& v, const location_type& l)
  2042. {
  2043. return symbol_type (token::TOK_NON_WS, v, l);
  2044. }
  2045. #endif
  2046. #if 201103L <= YY_CPLUSPLUS
  2047. static
  2048. symbol_type
  2049. make_CODE_BLOCK_START (std::string v, location_type l)
  2050. {
  2051. return symbol_type (token::TOK_CODE_BLOCK_START, std::move (v), std::move (l));
  2052. }
  2053. #else
  2054. static
  2055. symbol_type
  2056. make_CODE_BLOCK_START (const std::string& v, const location_type& l)
  2057. {
  2058. return symbol_type (token::TOK_CODE_BLOCK_START, v, l);
  2059. }
  2060. #endif
  2061. #if 201103L <= YY_CPLUSPLUS
  2062. static
  2063. symbol_type
  2064. make_CODE_BLOCK_CONTENTS (std::string v, location_type l)
  2065. {
  2066. return symbol_type (token::TOK_CODE_BLOCK_CONTENTS, std::move (v), std::move (l));
  2067. }
  2068. #else
  2069. static
  2070. symbol_type
  2071. make_CODE_BLOCK_CONTENTS (const std::string& v, const location_type& l)
  2072. {
  2073. return symbol_type (token::TOK_CODE_BLOCK_CONTENTS, v, l);
  2074. }
  2075. #endif
  2076. #if 201103L <= YY_CPLUSPLUS
  2077. static
  2078. symbol_type
  2079. make_UNKNOWN_DIRECTIVE (std::string v, location_type l)
  2080. {
  2081. return symbol_type (token::TOK_UNKNOWN_DIRECTIVE, std::move (v), std::move (l));
  2082. }
  2083. #else
  2084. static
  2085. symbol_type
  2086. make_UNKNOWN_DIRECTIVE (const std::string& v, const location_type& l)
  2087. {
  2088. return symbol_type (token::TOK_UNKNOWN_DIRECTIVE, v, l);
  2089. }
  2090. #endif
  2091. #if 201103L <= YY_CPLUSPLUS
  2092. static
  2093. symbol_type
  2094. make_INT (int v, location_type l)
  2095. {
  2096. return symbol_type (token::TOK_INT, std::move (v), std::move (l));
  2097. }
  2098. #else
  2099. static
  2100. symbol_type
  2101. make_INT (const int& v, const location_type& l)
  2102. {
  2103. return symbol_type (token::TOK_INT, v, l);
  2104. }
  2105. #endif
  2106. class context
  2107. {
  2108. public:
  2109. context (const parser& yyparser, const symbol_type& yyla);
  2110. const symbol_type& lookahead () const { return yyla_; }
  2111. symbol_kind_type token () const { return yyla_.kind (); }
  2112. const location_type& location () const { return yyla_.location; }
  2113. /// Put in YYARG at most YYARGN of the expected tokens, and return the
  2114. /// number of tokens stored in YYARG. If YYARG is null, return the
  2115. /// number of expected tokens (guaranteed to be less than YYNTOKENS).
  2116. int expected_tokens (symbol_kind_type yyarg[], int yyargn) const;
  2117. private:
  2118. const parser& yyparser_;
  2119. const symbol_type& yyla_;
  2120. };
  2121. private:
  2122. #if YY_CPLUSPLUS < 201103L
  2123. /// Non copyable.
  2124. parser (const parser&);
  2125. /// Non copyable.
  2126. parser& operator= (const parser&);
  2127. #endif
  2128. /// Check the lookahead yytoken.
  2129. /// \returns true iff the token will be eventually shifted.
  2130. bool yy_lac_check_ (symbol_kind_type yytoken) const;
  2131. /// Establish the initial context if no initial context currently exists.
  2132. /// \returns true iff the token will be eventually shifted.
  2133. bool yy_lac_establish_ (symbol_kind_type yytoken);
  2134. /// Discard any previous initial lookahead context because of event.
  2135. /// \param event the event which caused the lookahead to be discarded.
  2136. /// Only used for debbuging output.
  2137. void yy_lac_discard_ (const char* event);
  2138. /// Stored state numbers (used for stacks).
  2139. typedef unsigned char state_type;
  2140. /// The arguments of the error message.
  2141. int yy_syntax_error_arguments_ (const context& yyctx,
  2142. symbol_kind_type yyarg[], int yyargn) const;
  2143. /// Generate an error message.
  2144. /// \param yyctx the context in which the error occurred.
  2145. virtual std::string yysyntax_error_ (const context& yyctx) const;
  2146. /// Compute post-reduction state.
  2147. /// \param yystate the current state
  2148. /// \param yysym the nonterminal to push on the stack
  2149. static state_type yy_lr_goto_state_ (state_type yystate, int yysym);
  2150. /// Whether the given \c yypact_ value indicates a defaulted state.
  2151. /// \param yyvalue the value to check
  2152. static bool yy_pact_value_is_default_ (int yyvalue);
  2153. /// Whether the given \c yytable_ value indicates a syntax error.
  2154. /// \param yyvalue the value to check
  2155. static bool yy_table_value_is_error_ (int yyvalue);
  2156. static const signed char yypact_ninf_;
  2157. static const signed char yytable_ninf_;
  2158. /// Convert a scanner token kind \a t to a symbol kind.
  2159. /// In theory \a t should be a token_kind_type, but character literals
  2160. /// are valid, yet not members of the token_type enum.
  2161. static symbol_kind_type yytranslate_ (int t);
  2162. /// Convert the symbol name \a n to a form suitable for a diagnostic.
  2163. static std::string yytnamerr_ (const char *yystr);
  2164. /// For a symbol, its name in clear.
  2165. static const char* const yytname_[];
  2166. // Tables.
  2167. // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
  2168. // STATE-NUM.
  2169. static const short yypact_[];
  2170. // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
  2171. // Performed when YYTABLE does not specify something else to do. Zero
  2172. // means the default is an error.
  2173. static const signed char yydefact_[];
  2174. // YYPGOTO[NTERM-NUM].
  2175. static const short yypgoto_[];
  2176. // YYDEFGOTO[NTERM-NUM].
  2177. static const short yydefgoto_[];
  2178. // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
  2179. // positive, shift that token. If negative, reduce the rule whose
  2180. // number is the opposite. If YYTABLE_NINF, syntax error.
  2181. static const short yytable_[];
  2182. static const unsigned char yycheck_[];
  2183. // YYSTOS[STATE-NUM] -- The (internal number of the) accessing
  2184. // symbol of state STATE-NUM.
  2185. static const signed char yystos_[];
  2186. // YYR1[YYN] -- Symbol number of symbol that rule YYN derives.
  2187. static const signed char yyr1_[];
  2188. // YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.
  2189. static const signed char yyr2_[];
  2190. #if YYDEBUG
  2191. // YYRLINE[YYN] -- Source line where rule number YYN was defined.
  2192. static const short yyrline_[];
  2193. /// Report on the debug stream that the rule \a r is going to be reduced.
  2194. virtual void yy_reduce_print_ (int r) const;
  2195. /// Print the state stack on the debug stream.
  2196. virtual void yy_stack_print_ () const;
  2197. /// Debugging level.
  2198. int yydebug_;
  2199. /// Debug stream.
  2200. std::ostream* yycdebug_;
  2201. /// \brief Display a symbol kind, value and location.
  2202. /// \param yyo The output stream.
  2203. /// \param yysym The symbol.
  2204. template <typename Base>
  2205. void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
  2206. #endif
  2207. /// \brief Reclaim the memory associated to a symbol.
  2208. /// \param yymsg Why this token is reclaimed.
  2209. /// If null, print nothing.
  2210. /// \param yysym The symbol.
  2211. template <typename Base>
  2212. void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
  2213. private:
  2214. /// Type access provider for state based symbols.
  2215. struct by_state
  2216. {
  2217. /// Default constructor.
  2218. by_state () YY_NOEXCEPT;
  2219. /// The symbol kind as needed by the constructor.
  2220. typedef state_type kind_type;
  2221. /// Constructor.
  2222. by_state (kind_type s) YY_NOEXCEPT;
  2223. /// Copy constructor.
  2224. by_state (const by_state& that) YY_NOEXCEPT;
  2225. /// Record that this symbol is empty.
  2226. void clear () YY_NOEXCEPT;
  2227. /// Steal the symbol kind from \a that.
  2228. void move (by_state& that);
  2229. /// The symbol kind (corresponding to \a state).
  2230. /// \a symbol_kind::S_YYEMPTY when empty.
  2231. symbol_kind_type kind () const YY_NOEXCEPT;
  2232. /// The state number used to denote an empty symbol.
  2233. /// We use the initial state, as it does not have a value.
  2234. enum { empty_state = 0 };
  2235. /// The state.
  2236. /// \a empty when empty.
  2237. state_type state;
  2238. };
  2239. /// "Internal" symbol: element of the stack.
  2240. struct stack_symbol_type : basic_symbol<by_state>
  2241. {
  2242. /// Superclass.
  2243. typedef basic_symbol<by_state> super_type;
  2244. /// Construct an empty symbol.
  2245. stack_symbol_type ();
  2246. /// Move or copy construction.
  2247. stack_symbol_type (YY_RVREF (stack_symbol_type) that);
  2248. /// Steal the contents from \a sym to build this.
  2249. stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) sym);
  2250. #if YY_CPLUSPLUS < 201103L
  2251. /// Assignment, needed by push_back by some old implementations.
  2252. /// Moves the contents of that.
  2253. stack_symbol_type& operator= (stack_symbol_type& that);
  2254. /// Assignment, needed by push_back by other implementations.
  2255. /// Needed by some other old implementations.
  2256. stack_symbol_type& operator= (const stack_symbol_type& that);
  2257. #endif
  2258. };
  2259. /// A stack with random access from its top.
  2260. template <typename T, typename S = std::vector<T> >
  2261. class stack
  2262. {
  2263. public:
  2264. // Hide our reversed order.
  2265. typedef typename S::iterator iterator;
  2266. typedef typename S::const_iterator const_iterator;
  2267. typedef typename S::size_type size_type;
  2268. typedef typename std::ptrdiff_t index_type;
  2269. stack (size_type n = 200)
  2270. : seq_ (n)
  2271. {}
  2272. #if 201103L <= YY_CPLUSPLUS
  2273. /// Non copyable.
  2274. stack (const stack&) = delete;
  2275. /// Non copyable.
  2276. stack& operator= (const stack&) = delete;
  2277. #endif
  2278. /// Random access.
  2279. ///
  2280. /// Index 0 returns the topmost element.
  2281. const T&
  2282. operator[] (index_type i) const
  2283. {
  2284. return seq_[size_type (size () - 1 - i)];
  2285. }
  2286. /// Random access.
  2287. ///
  2288. /// Index 0 returns the topmost element.
  2289. T&
  2290. operator[] (index_type i)
  2291. {
  2292. return seq_[size_type (size () - 1 - i)];
  2293. }
  2294. /// Steal the contents of \a t.
  2295. ///
  2296. /// Close to move-semantics.
  2297. void
  2298. push (YY_MOVE_REF (T) t)
  2299. {
  2300. seq_.push_back (T ());
  2301. operator[] (0).move (t);
  2302. }
  2303. /// Pop elements from the stack.
  2304. void
  2305. pop (std::ptrdiff_t n = 1) YY_NOEXCEPT
  2306. {
  2307. for (; 0 < n; --n)
  2308. seq_.pop_back ();
  2309. }
  2310. /// Pop all elements from the stack.
  2311. void
  2312. clear () YY_NOEXCEPT
  2313. {
  2314. seq_.clear ();
  2315. }
  2316. /// Number of elements on the stack.
  2317. index_type
  2318. size () const YY_NOEXCEPT
  2319. {
  2320. return index_type (seq_.size ());
  2321. }
  2322. /// Iterator on top of the stack (going downwards).
  2323. const_iterator
  2324. begin () const YY_NOEXCEPT
  2325. {
  2326. return seq_.begin ();
  2327. }
  2328. /// Bottom of the stack.
  2329. const_iterator
  2330. end () const YY_NOEXCEPT
  2331. {
  2332. return seq_.end ();
  2333. }
  2334. /// Present a slice of the top of a stack.
  2335. class slice
  2336. {
  2337. public:
  2338. slice (const stack& stack, index_type range)
  2339. : stack_ (stack)
  2340. , range_ (range)
  2341. {}
  2342. const T&
  2343. operator[] (index_type i) const
  2344. {
  2345. return stack_[range_ - i];
  2346. }
  2347. private:
  2348. const stack& stack_;
  2349. index_type range_;
  2350. };
  2351. private:
  2352. #if YY_CPLUSPLUS < 201103L
  2353. /// Non copyable.
  2354. stack (const stack&);
  2355. /// Non copyable.
  2356. stack& operator= (const stack&);
  2357. #endif
  2358. /// The wrapped container.
  2359. S seq_;
  2360. };
  2361. /// Stack type.
  2362. typedef stack<stack_symbol_type> stack_type;
  2363. /// The stack.
  2364. stack_type yystack_;
  2365. /// The stack for LAC.
  2366. /// Logically, the yy_lac_stack's lifetime is confined to the function
  2367. /// yy_lac_check_. We just store it as a member of this class to hold
  2368. /// on to the memory and to avoid frequent reallocations.
  2369. /// Since yy_lac_check_ is const, this member must be mutable.
  2370. mutable std::vector<state_type> yylac_stack_;
  2371. /// Whether an initial LAC context was established.
  2372. bool yy_lac_established_;
  2373. /// Push a new state on the stack.
  2374. /// \param m a debug message to display
  2375. /// if null, no trace is output.
  2376. /// \param sym the symbol
  2377. /// \warning the contents of \a s.value is stolen.
  2378. void yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym);
  2379. /// Push a new look ahead token on the state on the stack.
  2380. /// \param m a debug message to display
  2381. /// if null, no trace is output.
  2382. /// \param s the state
  2383. /// \param sym the symbol (for its value and location).
  2384. /// \warning the contents of \a sym.value is stolen.
  2385. void yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym);
  2386. /// Pop \a n symbols from the stack.
  2387. void yypop_ (int n = 1);
  2388. /// Constants.
  2389. enum
  2390. {
  2391. yylast_ = 205, ///< Last index in yytable_.
  2392. yynnts_ = 27, ///< Number of nonterminal symbols.
  2393. yyfinal_ = 96 ///< Termination state number.
  2394. };
  2395. // User arguments.
  2396. pio_assembler& pioasm;
  2397. };
  2398. inline
  2399. parser::symbol_kind_type
  2400. parser::yytranslate_ (int t)
  2401. {
  2402. // YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to
  2403. // TOKEN-NUM as returned by yylex.
  2404. static
  2405. const signed char
  2406. translate_table[] =
  2407. {
  2408. 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2409. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2410. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2411. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2412. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2413. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2414. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2415. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2416. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2417. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2418. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2419. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2420. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2421. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2422. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2423. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2424. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2425. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2426. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2427. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2428. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2429. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2430. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2431. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2432. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  2433. 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
  2434. 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
  2435. 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
  2436. 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
  2437. 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
  2438. 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
  2439. 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
  2440. 65, 66, 67, 68, 69
  2441. };
  2442. // Last valid token kind.
  2443. const int code_max = 324;
  2444. if (t <= 0)
  2445. return symbol_kind::S_YYEOF;
  2446. else if (t <= code_max)
  2447. return YY_CAST (symbol_kind_type, translate_table[t]);
  2448. else
  2449. return symbol_kind::S_YYUNDEF;
  2450. }
  2451. // basic_symbol.
  2452. template <typename Base>
  2453. parser::basic_symbol<Base>::basic_symbol (const basic_symbol& that)
  2454. : Base (that)
  2455. , value ()
  2456. , location (that.location)
  2457. {
  2458. switch (this->kind ())
  2459. {
  2460. case symbol_kind::S_if_full: // if_full
  2461. case symbol_kind::S_if_empty: // if_empty
  2462. case symbol_kind::S_blocking: // blocking
  2463. value.copy< bool > (YY_MOVE (that.value));
  2464. break;
  2465. case symbol_kind::S_condition: // condition
  2466. value.copy< enum condition > (YY_MOVE (that.value));
  2467. break;
  2468. case symbol_kind::S_in_source: // in_source
  2469. case symbol_kind::S_out_target: // out_target
  2470. case symbol_kind::S_set_target: // set_target
  2471. value.copy< enum in_out_set > (YY_MOVE (that.value));
  2472. break;
  2473. case symbol_kind::S_irq_modifiers: // irq_modifiers
  2474. value.copy< enum irq > (YY_MOVE (that.value));
  2475. break;
  2476. case symbol_kind::S_mov_target: // mov_target
  2477. case symbol_kind::S_mov_source: // mov_source
  2478. value.copy< enum mov > (YY_MOVE (that.value));
  2479. break;
  2480. case symbol_kind::S_mov_op: // mov_op
  2481. value.copy< enum mov_op > (YY_MOVE (that.value));
  2482. break;
  2483. case symbol_kind::S_INT: // "integer"
  2484. value.copy< int > (YY_MOVE (that.value));
  2485. break;
  2486. case symbol_kind::S_instruction: // instruction
  2487. case symbol_kind::S_base_instruction: // base_instruction
  2488. value.copy< std::shared_ptr<instruction> > (YY_MOVE (that.value));
  2489. break;
  2490. case symbol_kind::S_value: // value
  2491. case symbol_kind::S_expression: // expression
  2492. case symbol_kind::S_delay: // delay
  2493. case symbol_kind::S_sideset: // sideset
  2494. value.copy< std::shared_ptr<resolvable> > (YY_MOVE (that.value));
  2495. break;
  2496. case symbol_kind::S_label_decl: // label_decl
  2497. case symbol_kind::S_symbol_def: // symbol_def
  2498. value.copy< std::shared_ptr<symbol> > (YY_MOVE (that.value));
  2499. break;
  2500. case symbol_kind::S_wait_source: // wait_source
  2501. value.copy< std::shared_ptr<wait_source> > (YY_MOVE (that.value));
  2502. break;
  2503. case symbol_kind::S_ID: // "identifier"
  2504. case symbol_kind::S_STRING: // "string"
  2505. case symbol_kind::S_NON_WS: // "text"
  2506. case symbol_kind::S_CODE_BLOCK_START: // "code block"
  2507. case symbol_kind::S_CODE_BLOCK_CONTENTS: // "%}"
  2508. case symbol_kind::S_UNKNOWN_DIRECTIVE: // UNKNOWN_DIRECTIVE
  2509. value.copy< std::string > (YY_MOVE (that.value));
  2510. break;
  2511. default:
  2512. break;
  2513. }
  2514. }
  2515. template <typename Base>
  2516. parser::symbol_kind_type
  2517. parser::basic_symbol<Base>::type_get () const YY_NOEXCEPT
  2518. {
  2519. return this->kind ();
  2520. }
  2521. template <typename Base>
  2522. bool
  2523. parser::basic_symbol<Base>::empty () const YY_NOEXCEPT
  2524. {
  2525. return this->kind () == symbol_kind::S_YYEMPTY;
  2526. }
  2527. template <typename Base>
  2528. void
  2529. parser::basic_symbol<Base>::move (basic_symbol& s)
  2530. {
  2531. super_type::move (s);
  2532. switch (this->kind ())
  2533. {
  2534. case symbol_kind::S_if_full: // if_full
  2535. case symbol_kind::S_if_empty: // if_empty
  2536. case symbol_kind::S_blocking: // blocking
  2537. value.move< bool > (YY_MOVE (s.value));
  2538. break;
  2539. case symbol_kind::S_condition: // condition
  2540. value.move< enum condition > (YY_MOVE (s.value));
  2541. break;
  2542. case symbol_kind::S_in_source: // in_source
  2543. case symbol_kind::S_out_target: // out_target
  2544. case symbol_kind::S_set_target: // set_target
  2545. value.move< enum in_out_set > (YY_MOVE (s.value));
  2546. break;
  2547. case symbol_kind::S_irq_modifiers: // irq_modifiers
  2548. value.move< enum irq > (YY_MOVE (s.value));
  2549. break;
  2550. case symbol_kind::S_mov_target: // mov_target
  2551. case symbol_kind::S_mov_source: // mov_source
  2552. value.move< enum mov > (YY_MOVE (s.value));
  2553. break;
  2554. case symbol_kind::S_mov_op: // mov_op
  2555. value.move< enum mov_op > (YY_MOVE (s.value));
  2556. break;
  2557. case symbol_kind::S_INT: // "integer"
  2558. value.move< int > (YY_MOVE (s.value));
  2559. break;
  2560. case symbol_kind::S_instruction: // instruction
  2561. case symbol_kind::S_base_instruction: // base_instruction
  2562. value.move< std::shared_ptr<instruction> > (YY_MOVE (s.value));
  2563. break;
  2564. case symbol_kind::S_value: // value
  2565. case symbol_kind::S_expression: // expression
  2566. case symbol_kind::S_delay: // delay
  2567. case symbol_kind::S_sideset: // sideset
  2568. value.move< std::shared_ptr<resolvable> > (YY_MOVE (s.value));
  2569. break;
  2570. case symbol_kind::S_label_decl: // label_decl
  2571. case symbol_kind::S_symbol_def: // symbol_def
  2572. value.move< std::shared_ptr<symbol> > (YY_MOVE (s.value));
  2573. break;
  2574. case symbol_kind::S_wait_source: // wait_source
  2575. value.move< std::shared_ptr<wait_source> > (YY_MOVE (s.value));
  2576. break;
  2577. case symbol_kind::S_ID: // "identifier"
  2578. case symbol_kind::S_STRING: // "string"
  2579. case symbol_kind::S_NON_WS: // "text"
  2580. case symbol_kind::S_CODE_BLOCK_START: // "code block"
  2581. case symbol_kind::S_CODE_BLOCK_CONTENTS: // "%}"
  2582. case symbol_kind::S_UNKNOWN_DIRECTIVE: // UNKNOWN_DIRECTIVE
  2583. value.move< std::string > (YY_MOVE (s.value));
  2584. break;
  2585. default:
  2586. break;
  2587. }
  2588. location = YY_MOVE (s.location);
  2589. }
  2590. // by_kind.
  2591. inline
  2592. parser::by_kind::by_kind ()
  2593. : kind_ (symbol_kind::S_YYEMPTY)
  2594. {}
  2595. #if 201103L <= YY_CPLUSPLUS
  2596. inline
  2597. parser::by_kind::by_kind (by_kind&& that)
  2598. : kind_ (that.kind_)
  2599. {
  2600. that.clear ();
  2601. }
  2602. #endif
  2603. inline
  2604. parser::by_kind::by_kind (const by_kind& that)
  2605. : kind_ (that.kind_)
  2606. {}
  2607. inline
  2608. parser::by_kind::by_kind (token_kind_type t)
  2609. : kind_ (yytranslate_ (t))
  2610. {}
  2611. inline
  2612. void
  2613. parser::by_kind::clear ()
  2614. {
  2615. kind_ = symbol_kind::S_YYEMPTY;
  2616. }
  2617. inline
  2618. void
  2619. parser::by_kind::move (by_kind& that)
  2620. {
  2621. kind_ = that.kind_;
  2622. that.clear ();
  2623. }
  2624. inline
  2625. parser::symbol_kind_type
  2626. parser::by_kind::kind () const YY_NOEXCEPT
  2627. {
  2628. return kind_;
  2629. }
  2630. inline
  2631. parser::symbol_kind_type
  2632. parser::by_kind::type_get () const YY_NOEXCEPT
  2633. {
  2634. return this->kind ();
  2635. }
  2636. } // yy
  2637. #endif // !YY_YY_HOME_GRAHAM_DEV_MU_PICO_SDK_TOOLS_PIOASM_GEN_PARSER_HPP_INCLUDED