lexer.cpp 73 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707
  1. #define YY_INT_ALIGNED short int
  2. /* A lexical scanner generated by flex */
  3. /* %not-for-header */
  4. /* %if-c-only */
  5. /* %if-not-reentrant */
  6. /* %endif */
  7. /* %endif */
  8. /* %ok-for-header */
  9. #define FLEX_SCANNER
  10. #define YY_FLEX_MAJOR_VERSION 2
  11. #define YY_FLEX_MINOR_VERSION 6
  12. #define YY_FLEX_SUBMINOR_VERSION 4
  13. #if YY_FLEX_SUBMINOR_VERSION > 0
  14. #define FLEX_BETA
  15. #endif
  16. /* %if-c++-only */
  17. /* %endif */
  18. /* %if-c-only */
  19. /* %endif */
  20. /* %if-c-only */
  21. /* %endif */
  22. /* First, we deal with platform-specific or compiler-specific issues. */
  23. /* begin standard C headers. */
  24. /* %if-c-only */
  25. #include <stdio.h>
  26. #include <string.h>
  27. #include <errno.h>
  28. #include <stdlib.h>
  29. /* %endif */
  30. /* %if-tables-serialization */
  31. /* %endif */
  32. /* end standard C headers. */
  33. /* begin standard C++ headers. */
  34. /* %if-c++-only */
  35. /* %endif */
  36. /* %if-c-or-c++ */
  37. /* flex integer type definitions */
  38. #ifndef YYFLEX_INTTYPES_DEFINED
  39. #define YYFLEX_INTTYPES_DEFINED
  40. /* Prefer C99 integer types if available. */
  41. # if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  42. /* Include <inttypes.h> and not <stdint.h> because Solaris 2.6 has the former
  43. * and not the latter.
  44. */
  45. #include <inttypes.h>
  46. # define YYFLEX_USE_STDINT
  47. # else
  48. # if defined(_MSC_VER) && _MSC_VER >= 1600
  49. /* Visual C++ 2010 does not define __STDC_VERSION__ and has <stdint.h> but not
  50. * <inttypes.h>.
  51. */
  52. #include <stdint.h>
  53. # define YYFLEX_USE_STDINT
  54. # endif
  55. # endif
  56. # ifdef YYFLEX_USE_STDINT
  57. typedef int8_t flex_int8_t;
  58. typedef uint8_t flex_uint8_t;
  59. typedef int16_t flex_int16_t;
  60. typedef uint16_t flex_uint16_t;
  61. typedef int32_t flex_int32_t;
  62. typedef uint32_t flex_uint32_t;
  63. # else
  64. typedef unsigned char flex_uint8_t;
  65. typedef short int flex_int16_t;
  66. typedef unsigned short int flex_uint16_t;
  67. # ifdef __STDC__
  68. typedef signed char flex_int8_t;
  69. /* ISO C only requires at least 16 bits for int. */
  70. #include <limits.h>
  71. # if UINT_MAX >= 4294967295
  72. # define YYFLEX_INT32_DEFINED
  73. typedef int flex_int32_t;
  74. typedef unsigned int flex_uint32_t;
  75. # endif
  76. # else
  77. typedef char flex_int8_t;
  78. # endif
  79. # ifndef YYFLEX_INT32_DEFINED
  80. typedef long int flex_int32_t;
  81. typedef unsigned long int flex_uint32_t;
  82. # endif
  83. # endif
  84. #endif /* YYFLEX_INTTYPES_DEFINED */
  85. /* %endif */
  86. /* TODO: this is always defined, so inline it */
  87. #define yyconst const
  88. #if defined(__GNUC__) && __GNUC__ >= 3
  89. #define yynoreturn __attribute__((__noreturn__))
  90. #else
  91. #define yynoreturn
  92. #endif
  93. /* %not-for-header */
  94. /* Returned upon end-of-file. */
  95. #define YY_NULL 0
  96. /* %ok-for-header */
  97. /* %not-for-header */
  98. /* Promotes a possibly negative, possibly signed char to an
  99. * integer in range [0..255] for use as an array index.
  100. */
  101. #define YY_SC_TO_UI(c) ((YY_CHAR) (c))
  102. /* %ok-for-header */
  103. /* %if-reentrant */
  104. /* %endif */
  105. /* %if-not-reentrant */
  106. /* %endif */
  107. /* Enter a start condition. This macro really ought to take a parameter,
  108. * but we do it the disgusting crufty way forced on us by the ()-less
  109. * definition of BEGIN.
  110. */
  111. #define BEGIN (yy_start) = 1 + 2 *
  112. /* Translate the current start state into a value that can be later handed
  113. * to BEGIN to return to the state. The YYSTATE alias is for lex
  114. * compatibility.
  115. */
  116. #define YY_START (((yy_start) - 1) / 2)
  117. #define YYSTATE YY_START
  118. /* Action number for EOF rule of a given start state. */
  119. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  120. /* Special action meaning "start processing a new file". */
  121. #define YY_NEW_FILE yyrestart( yyin )
  122. #define YY_END_OF_BUFFER_CHAR 0
  123. /* Size of default input buffer. */
  124. #ifndef YY_BUF_SIZE
  125. #ifdef __ia64__
  126. /* On IA-64, the buffer size is 16k, not 8k.
  127. * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
  128. * Ditto for the __ia64__ case accordingly.
  129. */
  130. #define YY_BUF_SIZE 32768
  131. #else
  132. #define YY_BUF_SIZE 16384
  133. #endif /* __ia64__ */
  134. #endif
  135. /* The state buf must be large enough to hold one state per character in the main buffer.
  136. */
  137. #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
  138. #ifndef YY_TYPEDEF_YY_BUFFER_STATE
  139. #define YY_TYPEDEF_YY_BUFFER_STATE
  140. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  141. #endif
  142. #ifndef YY_TYPEDEF_YY_SIZE_T
  143. #define YY_TYPEDEF_YY_SIZE_T
  144. typedef size_t yy_size_t;
  145. #endif
  146. /* %if-not-reentrant */
  147. extern int yyleng;
  148. /* %endif */
  149. /* %if-c-only */
  150. /* %if-not-reentrant */
  151. extern FILE *yyin, *yyout;
  152. /* %endif */
  153. /* %endif */
  154. #define EOB_ACT_CONTINUE_SCAN 0
  155. #define EOB_ACT_END_OF_FILE 1
  156. #define EOB_ACT_LAST_MATCH 2
  157. #define YY_LESS_LINENO(n)
  158. #define YY_LINENO_REWIND_TO(ptr)
  159. /* Return all but the first "n" matched characters back to the input stream. */
  160. #define yyless(n) \
  161. do \
  162. { \
  163. /* Undo effects of setting up yytext. */ \
  164. int yyless_macro_arg = (n); \
  165. YY_LESS_LINENO(yyless_macro_arg);\
  166. *yy_cp = (yy_hold_char); \
  167. YY_RESTORE_YY_MORE_OFFSET \
  168. (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
  169. YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  170. } \
  171. while ( 0 )
  172. #define unput(c) yyunput( c, (yytext_ptr) )
  173. #ifndef YY_STRUCT_YY_BUFFER_STATE
  174. #define YY_STRUCT_YY_BUFFER_STATE
  175. struct yy_buffer_state
  176. {
  177. /* %if-c-only */
  178. FILE *yy_input_file;
  179. /* %endif */
  180. /* %if-c++-only */
  181. /* %endif */
  182. char *yy_ch_buf; /* input buffer */
  183. char *yy_buf_pos; /* current position in input buffer */
  184. /* Size of input buffer in bytes, not including room for EOB
  185. * characters.
  186. */
  187. int yy_buf_size;
  188. /* Number of characters read into yy_ch_buf, not including EOB
  189. * characters.
  190. */
  191. int yy_n_chars;
  192. /* Whether we "own" the buffer - i.e., we know we created it,
  193. * and can realloc() it to grow it, and should free() it to
  194. * delete it.
  195. */
  196. int yy_is_our_buffer;
  197. /* Whether this is an "interactive" input source; if so, and
  198. * if we're using stdio for input, then we want to use getc()
  199. * instead of fread(), to make sure we stop fetching input after
  200. * each newline.
  201. */
  202. int yy_is_interactive;
  203. /* Whether we're considered to be at the beginning of a line.
  204. * If so, '^' rules will be active on the next match, otherwise
  205. * not.
  206. */
  207. int yy_at_bol;
  208. int yy_bs_lineno; /**< The line count. */
  209. int yy_bs_column; /**< The column count. */
  210. /* Whether to try to fill the input buffer when we reach the
  211. * end of it.
  212. */
  213. int yy_fill_buffer;
  214. int yy_buffer_status;
  215. #define YY_BUFFER_NEW 0
  216. #define YY_BUFFER_NORMAL 1
  217. /* When an EOF's been seen but there's still some text to process
  218. * then we mark the buffer as YY_EOF_PENDING, to indicate that we
  219. * shouldn't try reading from the input source any more. We might
  220. * still have a bunch of tokens to match, though, because of
  221. * possible backing-up.
  222. *
  223. * When we actually see the EOF, we change the status to "new"
  224. * (via yyrestart()), so that the user can continue scanning by
  225. * just pointing yyin at a new input file.
  226. */
  227. #define YY_BUFFER_EOF_PENDING 2
  228. };
  229. #endif /* !YY_STRUCT_YY_BUFFER_STATE */
  230. /* %if-c-only Standard (non-C++) definition */
  231. /* %not-for-header */
  232. /* %if-not-reentrant */
  233. /* Stack of input buffers. */
  234. static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
  235. static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
  236. static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
  237. /* %endif */
  238. /* %ok-for-header */
  239. /* %endif */
  240. /* We provide macros for accessing buffer states in case in the
  241. * future we want to put the buffer states in a more general
  242. * "scanner state".
  243. *
  244. * Returns the top of the stack, or NULL.
  245. */
  246. #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
  247. ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
  248. : NULL)
  249. /* Same as previous macro, but useful when we know that the buffer stack is not
  250. * NULL or when we need an lvalue. For internal use only.
  251. */
  252. #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
  253. /* %if-c-only Standard (non-C++) definition */
  254. /* %if-not-reentrant */
  255. /* %not-for-header */
  256. /* yy_hold_char holds the character lost when yytext is formed. */
  257. static char yy_hold_char;
  258. static int yy_n_chars; /* number of characters read into yy_ch_buf */
  259. int yyleng;
  260. /* Points to current character in buffer. */
  261. static char *yy_c_buf_p = NULL;
  262. static int yy_init = 0; /* whether we need to initialize */
  263. static int yy_start = 0; /* start state number */
  264. /* Flag which is used to allow yywrap()'s to do buffer switches
  265. * instead of setting up a fresh yyin. A bit of a hack ...
  266. */
  267. static int yy_did_buffer_switch_on_eof;
  268. /* %ok-for-header */
  269. /* %endif */
  270. void yyrestart ( FILE *input_file );
  271. void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer );
  272. YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size );
  273. void yy_delete_buffer ( YY_BUFFER_STATE b );
  274. void yy_flush_buffer ( YY_BUFFER_STATE b );
  275. void yypush_buffer_state ( YY_BUFFER_STATE new_buffer );
  276. void yypop_buffer_state ( void );
  277. static void yyensure_buffer_stack ( void );
  278. static void yy_load_buffer_state ( void );
  279. static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file );
  280. #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER )
  281. YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size );
  282. YY_BUFFER_STATE yy_scan_string ( const char *yy_str );
  283. YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len );
  284. /* %endif */
  285. void *yyalloc ( yy_size_t );
  286. void *yyrealloc ( void *, yy_size_t );
  287. void yyfree ( void * );
  288. #define yy_new_buffer yy_create_buffer
  289. #define yy_set_interactive(is_interactive) \
  290. { \
  291. if ( ! YY_CURRENT_BUFFER ){ \
  292. yyensure_buffer_stack (); \
  293. YY_CURRENT_BUFFER_LVALUE = \
  294. yy_create_buffer( yyin, YY_BUF_SIZE ); \
  295. } \
  296. YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
  297. }
  298. #define yy_set_bol(at_bol) \
  299. { \
  300. if ( ! YY_CURRENT_BUFFER ){\
  301. yyensure_buffer_stack (); \
  302. YY_CURRENT_BUFFER_LVALUE = \
  303. yy_create_buffer( yyin, YY_BUF_SIZE ); \
  304. } \
  305. YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
  306. }
  307. #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
  308. /* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */
  309. /* Begin user sect3 */
  310. #define yywrap() (/*CONSTCOND*/1)
  311. #define YY_SKIP_YYWRAP
  312. #define FLEX_DEBUG
  313. typedef flex_uint8_t YY_CHAR;
  314. FILE *yyin = NULL, *yyout = NULL;
  315. typedef int yy_state_type;
  316. extern int yylineno;
  317. int yylineno = 1;
  318. extern char *yytext;
  319. #ifdef yytext_ptr
  320. #undef yytext_ptr
  321. #endif
  322. #define yytext_ptr yytext
  323. /* %% [1.5] DFA */
  324. /* %if-c-only Standard (non-C++) definition */
  325. static yy_state_type yy_get_previous_state ( void );
  326. static yy_state_type yy_try_NUL_trans ( yy_state_type current_state );
  327. static int yy_get_next_buffer ( void );
  328. static void yynoreturn yy_fatal_error ( const char* msg );
  329. /* %endif */
  330. /* Done after the current pattern has been matched and before the
  331. * corresponding action - sets up yytext.
  332. */
  333. #define YY_DO_BEFORE_ACTION \
  334. (yytext_ptr) = yy_bp; \
  335. /* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\
  336. yyleng = (int) (yy_cp - yy_bp); \
  337. (yy_hold_char) = *yy_cp; \
  338. *yy_cp = '\0'; \
  339. /* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\
  340. (yy_c_buf_p) = yy_cp;
  341. /* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */
  342. #define YY_NUM_RULES 95
  343. #define YY_END_OF_BUFFER 96
  344. /* This struct is not used in this scanner,
  345. but its presence is necessary. */
  346. struct yy_trans_info
  347. {
  348. flex_int32_t yy_verify;
  349. flex_int32_t yy_nxt;
  350. };
  351. static const flex_int16_t yy_accept[266] =
  352. { 0,
  353. 0, 0, 7, 7, 11, 11, 0, 0, 96, 94,
  354. 1, 2, 40, 94, 37, 28, 29, 34, 30, 23,
  355. 33, 94, 35, 89, 89, 25, 93, 92, 92, 92,
  356. 92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
  357. 92, 73, 74, 92, 26, 27, 38, 36, 41, 94,
  358. 7, 4, 5, 7, 11, 8, 12, 10, 19, 14,
  359. 20, 14, 21, 16, 16, 15, 1, 2, 39, 0,
  360. 0, 31, 50, 50, 50, 50, 50, 50, 50, 22,
  361. 93, 89, 0, 0, 24, 93, 92, 92, 92, 92,
  362. 92, 92, 53, 92, 92, 92, 92, 92, 92, 92,
  363. 92, 92, 92, 75, 92, 92, 92, 92, 92, 92,
  364. 92, 92, 0, 7, 4, 5, 6, 11, 8, 12,
  365. 9, 19, 14, 20, 14, 0, 13, 16, 19, 19,
  366. 0, 3, 0, 50, 50, 50, 50, 50, 50, 50,
  367. 50, 91, 90, 92, 92, 92, 92, 92, 92, 58,
  368. 77, 51, 57, 92, 60, 92, 92, 87, 63, 78,
  369. 54, 67, 92, 92, 92, 84, 59, 92, 92, 92,
  370. 92, 0, 6, 18, 17, 50, 50, 50, 50, 50,
  371. 50, 50, 92, 92, 76, 68, 92, 92, 92, 92,
  372. 71, 92, 69, 92, 70, 92, 56, 55, 64, 92,
  373. 52, 88, 0, 50, 50, 50, 50, 50, 45, 44,
  374. 80, 85, 92, 92, 92, 92, 92, 92, 92, 92,
  375. 92, 92, 0, 50, 50, 50, 50, 50, 50, 92,
  376. 82, 92, 86, 92, 92, 61, 92, 92, 79, 32,
  377. 46, 50, 48, 50, 50, 50, 83, 81, 92, 72,
  378. 65, 92, 50, 42, 50, 50, 62, 66, 49, 47,
  379. 50, 50, 50, 43, 0
  380. } ;
  381. static const YY_CHAR yy_ec[256] =
  382. { 0,
  383. 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
  384. 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
  385. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  386. 1, 2, 5, 6, 1, 1, 7, 8, 1, 9,
  387. 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
  388. 19, 19, 19, 19, 19, 19, 19, 20, 21, 1,
  389. 22, 1, 1, 1, 23, 24, 25, 26, 27, 28,
  390. 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
  391. 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
  392. 49, 1, 50, 51, 52, 1, 53, 54, 55, 56,
  393. 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
  394. 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
  395. 77, 78, 79, 80, 81, 82, 1, 1, 1, 1,
  396. 1, 1, 1, 1, 1, 83, 1, 1, 1, 1,
  397. 1, 1, 1, 1, 1, 84, 1, 1, 1, 1,
  398. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  399. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  400. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  401. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  402. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  403. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  404. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  405. 1, 1, 1, 1, 1, 85, 1, 1, 1, 1,
  406. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  407. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  408. 1, 1, 1, 1, 1
  409. } ;
  410. static const YY_CHAR yy_meta[86] =
  411. { 0,
  412. 1, 2, 3, 1, 1, 2, 4, 1, 1, 1,
  413. 5, 1, 1, 1, 1, 1, 6, 6, 6, 1,
  414. 1, 2, 7, 7, 7, 7, 7, 7, 8, 8,
  415. 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
  416. 8, 8, 8, 8, 8, 8, 8, 8, 1, 1,
  417. 1, 8, 7, 7, 7, 7, 7, 7, 8, 8,
  418. 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
  419. 8, 8, 8, 8, 8, 8, 8, 8, 1, 1,
  420. 1, 1, 1, 1, 1
  421. } ;
  422. static const flex_int16_t yy_base[279] =
  423. { 0,
  424. 0, 0, 84, 90, 96, 99, 102, 109, 540, 644,
  425. 112, 536, 516, 121, 644, 644, 644, 644, 644, 644,
  426. 523, 96, 79, 126, 121, 516, 0, 0, 83, 84,
  427. 83, 94, 125, 111, 112, 114, 132, 161, 127, 151,
  428. 132, 0, 0, 131, 644, 644, 644, 644, 644, 452,
  429. 0, 195, 531, 452, 0, 205, 529, 391, 0, 209,
  430. 401, 213, 393, 201, 209, 644, 227, 310, 644, 228,
  431. 231, 644, 0, 167, 183, 170, 174, 190, 201, 644,
  432. 0, 231, 118, 0, 644, 0, 0, 200, 212, 215,
  433. 212, 218, 0, 213, 213, 216, 212, 236, 223, 231,
  434. 217, 221, 220, 0, 227, 261, 230, 224, 244, 255,
  435. 248, 257, 214, 0, 297, 277, 301, 0, 310, 262,
  436. 644, 0, 314, 198, 315, 171, 168, 303, 172, 316,
  437. 322, 326, 327, 0, 278, 287, 306, 301, 319, 306,
  438. 324, 331, 0, 325, 328, 327, 317, 320, 313, 0,
  439. 0, 0, 0, 323, 0, 335, 325, 0, 329, 334,
  440. 0, 337, 328, 330, 335, 0, 0, 339, 337, 341,
  441. 360, 84, 396, 385, 411, 379, 382, 383, 385, 388,
  442. 390, 379, 385, 379, 0, 0, 382, 387, 385, 392,
  443. 0, 387, 0, 394, 0, 395, 0, 0, 391, 388,
  444. 0, 0, 73, 397, 90, 426, 418, 57, 0, 44,
  445. 0, 0, 417, 426, 445, 429, 436, 433, 449, 448,
  446. 435, 436, 5, 451, 442, 444, 458, 441, 441, 437,
  447. 0, 452, 0, 463, 450, 0, 450, 466, 0, 644,
  448. 0, 456, 0, 460, 469, 474, 0, 0, 464, 0,
  449. 0, 457, 475, 0, 476, 479, 0, 0, 0, 0,
  450. 491, 503, 489, 0, 644, 561, 569, 577, 585, 587,
  451. 595, 598, 606, 614, 622, 630, 633, 636
  452. } ;
  453. static const flex_int16_t yy_def[279] =
  454. { 0,
  455. 265, 1, 266, 266, 267, 267, 268, 268, 265, 265,
  456. 265, 265, 265, 269, 265, 265, 265, 265, 265, 265,
  457. 265, 270, 265, 265, 265, 265, 271, 272, 272, 272,
  458. 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
  459. 272, 272, 272, 272, 265, 265, 265, 265, 265, 265,
  460. 273, 273, 265, 273, 274, 274, 265, 265, 275, 265,
  461. 265, 275, 276, 275, 275, 265, 265, 265, 265, 269,
  462. 269, 265, 277, 277, 277, 277, 277, 277, 277, 265,
  463. 271, 265, 265, 278, 265, 271, 272, 272, 272, 272,
  464. 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
  465. 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
  466. 272, 272, 265, 273, 273, 265, 273, 274, 274, 265,
  467. 265, 275, 265, 265, 275, 276, 276, 275, 275, 275,
  468. 269, 269, 269, 277, 277, 277, 277, 277, 277, 277,
  469. 277, 265, 278, 272, 272, 272, 272, 272, 272, 272,
  470. 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
  471. 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
  472. 272, 265, 273, 275, 275, 277, 277, 277, 277, 277,
  473. 277, 277, 272, 272, 272, 272, 272, 272, 272, 272,
  474. 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
  475. 272, 272, 265, 277, 277, 277, 277, 277, 277, 277,
  476. 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
  477. 272, 272, 265, 277, 277, 277, 277, 277, 277, 272,
  478. 272, 272, 272, 272, 272, 272, 272, 272, 272, 265,
  479. 277, 277, 277, 277, 277, 277, 272, 272, 272, 272,
  480. 272, 272, 277, 277, 277, 277, 272, 272, 277, 277,
  481. 277, 277, 277, 277, 0, 265, 265, 265, 265, 265,
  482. 265, 265, 265, 265, 265, 265, 265, 265
  483. } ;
  484. static const flex_int16_t yy_nxt[730] =
  485. { 0,
  486. 10, 11, 12, 11, 13, 10, 14, 15, 16, 17,
  487. 18, 19, 20, 21, 22, 23, 24, 25, 25, 26,
  488. 27, 10, 28, 29, 30, 28, 31, 28, 32, 28,
  489. 33, 34, 28, 28, 35, 36, 37, 38, 28, 39,
  490. 40, 28, 28, 28, 41, 42, 43, 44, 45, 46,
  491. 47, 28, 28, 29, 30, 28, 31, 28, 32, 28,
  492. 33, 34, 28, 28, 35, 36, 37, 38, 28, 39,
  493. 40, 28, 28, 28, 41, 42, 43, 44, 10, 48,
  494. 10, 49, 10, 10, 50, 52, 53, 52, 240, 80,
  495. 54, 52, 53, 52, 81, 229, 54, 56, 57, 56,
  496. 56, 57, 56, 60, 61, 62, 58, 63, 228, 58,
  497. 60, 61, 62, 67, 63, 67, 88, 89, 64, 65,
  498. 65, 74, 71, 66, 71, 64, 65, 65, 90, 75,
  499. 66, 91, 76, 77, 142, 142, 78, 82, 82, 82,
  500. 79, 225, 82, 82, 82, 96, 88, 89, 97, 83,
  501. 98, 74, 92, 107, 111, 223, 99, 112, 90, 75,
  502. 93, 91, 76, 77, 94, 95, 78, 100, 203, 101,
  503. 79, 84, 102, 127, 103, 96, 127, 108, 97, 83,
  504. 98, 109, 92, 107, 111, 104, 99, 112, 174, 174,
  505. 93, 105, 110, 135, 94, 95, 115, 100, 115, 101,
  506. 124, 84, 102, 106, 103, 136, 119, 108, 119, 137,
  507. 123, 109, 123, 138, 123, 104, 125, 128, 128, 128,
  508. 139, 105, 110, 135, 129, 128, 128, 128, 67, 131,
  509. 67, 131, 133, 106, 133, 136, 144, 140, 145, 137,
  510. 141, 146, 147, 138, 148, 149, 130, 82, 82, 82,
  511. 139, 150, 151, 152, 129, 153, 157, 158, 159, 154,
  512. 160, 161, 162, 166, 120, 167, 144, 140, 145, 168,
  513. 141, 146, 147, 155, 148, 149, 130, 169, 170, 116,
  514. 156, 150, 151, 152, 163, 153, 157, 158, 159, 154,
  515. 160, 161, 162, 166, 164, 167, 171, 172, 115, 168,
  516. 115, 165, 173, 155, 173, 176, 132, 169, 170, 132,
  517. 156, 119, 68, 119, 163, 123, 123, 123, 125, 128,
  518. 128, 128, 177, 131, 164, 131, 171, 131, 133, 131,
  519. 133, 165, 175, 175, 175, 176, 178, 179, 175, 175,
  520. 175, 175, 175, 175, 180, 181, 182, 142, 142, 183,
  521. 184, 185, 177, 186, 187, 188, 189, 190, 191, 192,
  522. 193, 196, 194, 197, 198, 199, 178, 179, 175, 175,
  523. 175, 175, 175, 175, 180, 181, 182, 195, 200, 183,
  524. 184, 185, 201, 186, 187, 188, 189, 190, 191, 192,
  525. 193, 196, 194, 197, 198, 199, 202, 173, 127, 173,
  526. 132, 174, 174, 124, 132, 132, 121, 195, 200, 204,
  527. 205, 206, 201, 207, 208, 209, 210, 211, 212, 213,
  528. 214, 215, 216, 217, 218, 219, 202, 175, 175, 175,
  529. 222, 220, 224, 175, 175, 175, 175, 175, 175, 204,
  530. 205, 206, 221, 207, 208, 209, 210, 211, 212, 213,
  531. 214, 215, 216, 217, 218, 219, 226, 227, 230, 231,
  532. 222, 220, 224, 175, 175, 175, 175, 175, 175, 232,
  533. 233, 234, 235, 236, 237, 238, 239, 241, 242, 243,
  534. 244, 245, 246, 247, 248, 249, 226, 227, 230, 231,
  535. 250, 251, 252, 253, 254, 255, 256, 257, 258, 232,
  536. 233, 234, 235, 236, 237, 238, 239, 241, 242, 243,
  537. 244, 245, 246, 247, 248, 249, 259, 260, 261, 262,
  538. 250, 251, 252, 253, 254, 255, 256, 257, 258, 263,
  539. 264, 120, 117, 116, 113, 85, 72, 69, 68, 265,
  540. 265, 265, 265, 265, 265, 265, 259, 260, 261, 262,
  541. 265, 265, 265, 265, 265, 265, 265, 265, 265, 263,
  542. 264, 51, 51, 51, 51, 51, 51, 51, 51, 55,
  543. 55, 55, 55, 55, 55, 55, 55, 59, 59, 59,
  544. 59, 59, 59, 59, 59, 70, 70, 265, 265, 70,
  545. 70, 70, 70, 73, 73, 86, 86, 265, 86, 86,
  546. 86, 86, 86, 87, 87, 87, 114, 114, 265, 114,
  547. 114, 114, 114, 114, 118, 118, 265, 118, 265, 118,
  548. 118, 118, 122, 265, 265, 122, 122, 122, 122, 122,
  549. 126, 126, 265, 126, 126, 126, 126, 126, 134, 134,
  550. 134, 143, 143, 9, 265, 265, 265, 265, 265, 265,
  551. 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
  552. 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
  553. 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
  554. 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
  555. 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
  556. 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
  557. 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
  558. 265, 265, 265, 265, 265, 265, 265, 265, 265
  559. } ;
  560. static const flex_int16_t yy_chk[730] =
  561. { 0,
  562. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  563. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  564. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  565. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  566. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  567. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  568. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  569. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  570. 1, 1, 1, 1, 1, 3, 3, 3, 223, 23,
  571. 3, 4, 4, 4, 23, 210, 4, 5, 5, 5,
  572. 6, 6, 6, 7, 7, 7, 5, 7, 208, 6,
  573. 8, 8, 8, 11, 8, 11, 29, 30, 7, 7,
  574. 7, 22, 14, 7, 14, 8, 8, 8, 31, 22,
  575. 8, 32, 22, 22, 83, 83, 22, 25, 25, 25,
  576. 22, 205, 24, 24, 24, 34, 29, 30, 35, 24,
  577. 36, 22, 33, 39, 41, 203, 36, 44, 31, 22,
  578. 33, 32, 22, 22, 33, 33, 22, 37, 172, 37,
  579. 22, 24, 37, 127, 37, 34, 126, 40, 35, 24,
  580. 36, 40, 33, 39, 41, 38, 36, 44, 129, 129,
  581. 33, 38, 40, 74, 33, 33, 52, 37, 52, 37,
  582. 124, 24, 37, 38, 37, 75, 56, 40, 56, 76,
  583. 60, 40, 60, 77, 62, 38, 62, 64, 64, 64,
  584. 78, 38, 40, 74, 64, 65, 65, 65, 67, 70,
  585. 67, 70, 71, 38, 71, 75, 88, 79, 89, 76,
  586. 79, 90, 91, 77, 92, 92, 64, 82, 82, 82,
  587. 78, 94, 95, 96, 64, 97, 99, 100, 101, 98,
  588. 102, 103, 105, 107, 120, 108, 88, 79, 89, 109,
  589. 79, 90, 91, 98, 92, 92, 64, 110, 111, 116,
  590. 98, 94, 95, 96, 106, 97, 99, 100, 101, 98,
  591. 102, 103, 105, 107, 106, 108, 112, 113, 115, 109,
  592. 115, 106, 117, 98, 117, 135, 70, 110, 111, 71,
  593. 98, 119, 68, 119, 106, 123, 125, 123, 125, 128,
  594. 128, 128, 136, 131, 106, 131, 112, 132, 133, 132,
  595. 133, 106, 130, 130, 130, 135, 137, 138, 130, 130,
  596. 130, 130, 130, 130, 139, 140, 141, 142, 142, 144,
  597. 145, 146, 136, 147, 148, 149, 154, 156, 157, 159,
  598. 160, 163, 162, 164, 165, 168, 137, 138, 130, 130,
  599. 130, 130, 130, 130, 139, 140, 141, 162, 169, 144,
  600. 145, 146, 170, 147, 148, 149, 154, 156, 157, 159,
  601. 160, 163, 162, 164, 165, 168, 171, 173, 63, 173,
  602. 131, 174, 174, 61, 132, 133, 58, 162, 169, 176,
  603. 177, 178, 170, 179, 180, 181, 182, 183, 184, 187,
  604. 188, 189, 190, 192, 194, 196, 171, 175, 175, 175,
  605. 200, 199, 204, 175, 175, 175, 175, 175, 175, 176,
  606. 177, 178, 199, 179, 180, 181, 182, 183, 184, 187,
  607. 188, 189, 190, 192, 194, 196, 206, 207, 213, 214,
  608. 200, 199, 204, 175, 175, 175, 175, 175, 175, 215,
  609. 216, 217, 218, 219, 220, 221, 222, 224, 225, 226,
  610. 227, 228, 229, 230, 232, 234, 206, 207, 213, 214,
  611. 235, 237, 238, 242, 244, 245, 246, 249, 252, 215,
  612. 216, 217, 218, 219, 220, 221, 222, 224, 225, 226,
  613. 227, 228, 229, 230, 232, 234, 253, 255, 256, 261,
  614. 235, 237, 238, 242, 244, 245, 246, 249, 252, 262,
  615. 263, 57, 54, 53, 50, 26, 21, 13, 12, 9,
  616. 0, 0, 0, 0, 0, 0, 253, 255, 256, 261,
  617. 0, 0, 0, 0, 0, 0, 0, 0, 0, 262,
  618. 263, 266, 266, 266, 266, 266, 266, 266, 266, 267,
  619. 267, 267, 267, 267, 267, 267, 267, 268, 268, 268,
  620. 268, 268, 268, 268, 268, 269, 269, 0, 0, 269,
  621. 269, 269, 269, 270, 270, 271, 271, 0, 271, 271,
  622. 271, 271, 271, 272, 272, 272, 273, 273, 0, 273,
  623. 273, 273, 273, 273, 274, 274, 0, 274, 0, 274,
  624. 274, 274, 275, 0, 0, 275, 275, 275, 275, 275,
  625. 276, 276, 0, 276, 276, 276, 276, 276, 277, 277,
  626. 277, 278, 278, 265, 265, 265, 265, 265, 265, 265,
  627. 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
  628. 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
  629. 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
  630. 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
  631. 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
  632. 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
  633. 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
  634. 265, 265, 265, 265, 265, 265, 265, 265, 265
  635. } ;
  636. static yy_state_type yy_last_accepting_state;
  637. static char *yy_last_accepting_cpos;
  638. extern int yy_flex_debug;
  639. int yy_flex_debug = 1;
  640. static const flex_int16_t yy_rule_linenum[95] =
  641. { 0,
  642. 65, 66, 68, 79, 80, 81, 82, 86, 87, 88,
  643. 89, 90, 94, 95, 96, 97, 98, 99, 100, 101,
  644. 102, 105, 106, 107, 108, 109, 110, 111, 112, 113,
  645. 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
  646. 124, 126, 127, 128, 129, 130, 131, 132, 133, 134,
  647. 136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
  648. 147, 149, 150, 151, 152, 153, 154, 155, 156, 158,
  649. 159, 160, 161, 162, 163, 164, 165, 166, 167, 169,
  650. 170, 171, 172, 173, 175, 176, 178, 179, 183, 184,
  651. 185, 187, 189, 191
  652. } ;
  653. /* The intent behind this definition is that it'll catch
  654. * any uses of REJECT which flex missed.
  655. */
  656. #define REJECT reject_used_but_not_detected
  657. #define yymore() yymore_used_but_not_detected
  658. #define YY_MORE_ADJ 0
  659. #define YY_RESTORE_YY_MORE_OFFSET
  660. char *yytext;
  661. #line 1 "lexer.ll"
  662. /*
  663. * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
  664. *
  665. * SPDX-License-Identifier: BSD-3-Clause
  666. */
  667. #line 8 "lexer.ll"
  668. # include <cerrno>
  669. # include <climits>
  670. # include <cstdlib>
  671. # include <cstring>
  672. # include <string>
  673. # include "pio_assembler.h"
  674. # include "parser.hpp"
  675. #ifdef _MSC_VER
  676. #pragma warning(disable : 4996) // fopen
  677. #endif
  678. #define YY_NO_INPUT 1
  679. yy::parser::symbol_type make_INT(const std::string &s, const yy::parser::location_type& loc);
  680. yy::parser::symbol_type make_HEX(const std::string &s, const yy::parser::location_type& loc);
  681. yy::parser::symbol_type make_BINARY(const std::string &s, const yy::parser::location_type& loc);
  682. // Code run each time a pattern is matched.
  683. # define YY_USER_ACTION loc.columns (yyleng);
  684. #define INITIAL 0
  685. #define code_block 1
  686. #define c_comment 2
  687. #define lang_opt 3
  688. #ifndef YY_NO_UNISTD_H
  689. /* Special case for "unistd.h", since it is non-ANSI. We include it way
  690. * down here because we want the user's section 1 to have been scanned first.
  691. * The user has a chance to override it with an option.
  692. */
  693. /* %if-c-only */
  694. #include <unistd.h>
  695. /* %endif */
  696. /* %if-c++-only */
  697. /* %endif */
  698. #endif
  699. #ifndef YY_EXTRA_TYPE
  700. #define YY_EXTRA_TYPE void *
  701. #endif
  702. /* %if-c-only Reentrant structure and macros (non-C++). */
  703. /* %if-reentrant */
  704. /* %if-c-only */
  705. static int yy_init_globals ( void );
  706. /* %endif */
  707. /* %if-reentrant */
  708. /* %endif */
  709. /* %endif End reentrant structures and macros. */
  710. /* Accessor methods to globals.
  711. These are made visible to non-reentrant scanners for convenience. */
  712. int yylex_destroy ( void );
  713. int yyget_debug ( void );
  714. void yyset_debug ( int debug_flag );
  715. YY_EXTRA_TYPE yyget_extra ( void );
  716. void yyset_extra ( YY_EXTRA_TYPE user_defined );
  717. FILE *yyget_in ( void );
  718. void yyset_in ( FILE * _in_str );
  719. FILE *yyget_out ( void );
  720. void yyset_out ( FILE * _out_str );
  721. int yyget_leng ( void );
  722. char *yyget_text ( void );
  723. int yyget_lineno ( void );
  724. void yyset_lineno ( int _line_number );
  725. /* %if-bison-bridge */
  726. /* %endif */
  727. /* Macros after this point can all be overridden by user definitions in
  728. * section 1.
  729. */
  730. #ifndef YY_SKIP_YYWRAP
  731. #ifdef __cplusplus
  732. extern "C" int yywrap ( void );
  733. #else
  734. extern int yywrap ( void );
  735. #endif
  736. #endif
  737. /* %not-for-header */
  738. #ifndef YY_NO_UNPUT
  739. #endif
  740. /* %ok-for-header */
  741. /* %endif */
  742. #ifndef yytext_ptr
  743. static void yy_flex_strncpy ( char *, const char *, int );
  744. #endif
  745. #ifdef YY_NEED_STRLEN
  746. static int yy_flex_strlen ( const char * );
  747. #endif
  748. #ifndef YY_NO_INPUT
  749. /* %if-c-only Standard (non-C++) definition */
  750. /* %not-for-header */
  751. #ifdef __cplusplus
  752. static int yyinput ( void );
  753. #else
  754. static int input ( void );
  755. #endif
  756. /* %ok-for-header */
  757. /* %endif */
  758. #endif
  759. /* %if-c-only */
  760. /* %endif */
  761. /* Amount of stuff to slurp up with each read. */
  762. #ifndef YY_READ_BUF_SIZE
  763. #ifdef __ia64__
  764. /* On IA-64, the buffer size is 16k, not 8k */
  765. #define YY_READ_BUF_SIZE 16384
  766. #else
  767. #define YY_READ_BUF_SIZE 8192
  768. #endif /* __ia64__ */
  769. #endif
  770. /* Copy whatever the last rule matched to the standard output. */
  771. #ifndef ECHO
  772. /* %if-c-only Standard (non-C++) definition */
  773. /* This used to be an fputs(), but since the string might contain NUL's,
  774. * we now use fwrite().
  775. */
  776. #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
  777. /* %endif */
  778. /* %if-c++-only C++ definition */
  779. /* %endif */
  780. #endif
  781. /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
  782. * is returned in "result".
  783. */
  784. #ifndef YY_INPUT
  785. #define YY_INPUT(buf,result,max_size) \
  786. /* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\
  787. if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
  788. { \
  789. int c = '*'; \
  790. int n; \
  791. for ( n = 0; n < max_size && \
  792. (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
  793. buf[n] = (char) c; \
  794. if ( c == '\n' ) \
  795. buf[n++] = (char) c; \
  796. if ( c == EOF && ferror( yyin ) ) \
  797. YY_FATAL_ERROR( "input in flex scanner failed" ); \
  798. result = n; \
  799. } \
  800. else \
  801. { \
  802. errno=0; \
  803. while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
  804. { \
  805. if( errno != EINTR) \
  806. { \
  807. YY_FATAL_ERROR( "input in flex scanner failed" ); \
  808. break; \
  809. } \
  810. errno=0; \
  811. clearerr(yyin); \
  812. } \
  813. }\
  814. \
  815. /* %if-c++-only C++ definition \ */\
  816. /* %endif */
  817. #endif
  818. /* No semi-colon after return; correct usage is to write "yyterminate();" -
  819. * we don't want an extra ';' after the "return" because that will cause
  820. * some compilers to complain about unreachable statements.
  821. */
  822. #ifndef yyterminate
  823. #define yyterminate() return YY_NULL
  824. #endif
  825. /* Number of entries by which start-condition stack grows. */
  826. #ifndef YY_START_STACK_INCR
  827. #define YY_START_STACK_INCR 25
  828. #endif
  829. /* Report a fatal error. */
  830. #ifndef YY_FATAL_ERROR
  831. /* %if-c-only */
  832. #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
  833. /* %endif */
  834. /* %if-c++-only */
  835. /* %endif */
  836. #endif
  837. /* %if-tables-serialization structures and prototypes */
  838. /* %not-for-header */
  839. /* %ok-for-header */
  840. /* %not-for-header */
  841. /* %tables-yydmap generated elements */
  842. /* %endif */
  843. /* end tables serialization structures and prototypes */
  844. /* %ok-for-header */
  845. /* Default declaration of generated scanner - a define so the user can
  846. * easily add parameters.
  847. */
  848. #ifndef YY_DECL
  849. #define YY_DECL_IS_OURS 1
  850. /* %if-c-only Standard (non-C++) definition */
  851. extern int yylex (void);
  852. #define YY_DECL int yylex (void)
  853. /* %endif */
  854. /* %if-c++-only C++ definition */
  855. /* %endif */
  856. #endif /* !YY_DECL */
  857. /* Code executed at the beginning of each rule, after yytext and yyleng
  858. * have been set up.
  859. */
  860. #ifndef YY_USER_ACTION
  861. #define YY_USER_ACTION
  862. #endif
  863. /* Code executed at the end of each rule. */
  864. #ifndef YY_BREAK
  865. #define YY_BREAK /*LINTED*/break;
  866. #endif
  867. /* %% [6.0] YY_RULE_SETUP definition goes here */
  868. #define YY_RULE_SETUP \
  869. YY_USER_ACTION
  870. /* %not-for-header */
  871. /** The main scanner function which does all the work.
  872. */
  873. YY_DECL
  874. {
  875. yy_state_type yy_current_state;
  876. char *yy_cp, *yy_bp;
  877. int yy_act;
  878. if ( !(yy_init) )
  879. {
  880. (yy_init) = 1;
  881. #ifdef YY_USER_INIT
  882. YY_USER_INIT;
  883. #endif
  884. if ( ! (yy_start) )
  885. (yy_start) = 1; /* first start state */
  886. if ( ! yyin )
  887. /* %if-c-only */
  888. yyin = stdin;
  889. /* %endif */
  890. /* %if-c++-only */
  891. /* %endif */
  892. if ( ! yyout )
  893. /* %if-c-only */
  894. yyout = stdout;
  895. /* %endif */
  896. /* %if-c++-only */
  897. /* %endif */
  898. if ( ! YY_CURRENT_BUFFER ) {
  899. yyensure_buffer_stack ();
  900. YY_CURRENT_BUFFER_LVALUE =
  901. yy_create_buffer( yyin, YY_BUF_SIZE );
  902. }
  903. yy_load_buffer_state( );
  904. }
  905. {
  906. /* %% [7.0] user's declarations go here */
  907. std::string code_block_contents;
  908. yy::location code_block_start;
  909. // A handy shortcut to the location held by the pio_assembler.
  910. yy::location& loc = pioasm.location;
  911. // Code run each time yylex is called.
  912. loc.step();
  913. while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
  914. {
  915. /* %% [8.0] yymore()-related code goes here */
  916. yy_cp = (yy_c_buf_p);
  917. /* Support of yytext. */
  918. *yy_cp = (yy_hold_char);
  919. /* yy_bp points to the position in yy_ch_buf of the start of
  920. * the current run.
  921. */
  922. yy_bp = yy_cp;
  923. /* %% [9.0] code to set up and find next match goes here */
  924. yy_current_state = (yy_start);
  925. yy_match:
  926. do
  927. {
  928. YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
  929. if ( yy_accept[yy_current_state] )
  930. {
  931. (yy_last_accepting_state) = yy_current_state;
  932. (yy_last_accepting_cpos) = yy_cp;
  933. }
  934. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  935. {
  936. yy_current_state = (int) yy_def[yy_current_state];
  937. if ( yy_current_state >= 266 )
  938. yy_c = yy_meta[yy_c];
  939. }
  940. yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  941. ++yy_cp;
  942. }
  943. while ( yy_current_state != 265 );
  944. yy_cp = (yy_last_accepting_cpos);
  945. yy_current_state = (yy_last_accepting_state);
  946. yy_find_action:
  947. /* %% [10.0] code to find the action number goes here */
  948. yy_act = yy_accept[yy_current_state];
  949. YY_DO_BEFORE_ACTION;
  950. /* %% [11.0] code for yylineno update goes here */
  951. do_action: /* This label is used only to access EOF actions. */
  952. /* %% [12.0] debug code goes here */
  953. if ( yy_flex_debug )
  954. {
  955. if ( yy_act == 0 )
  956. fprintf( stderr, "--scanner backing up\n" );
  957. else if ( yy_act < 95 )
  958. fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n",
  959. (long)yy_rule_linenum[yy_act], yytext );
  960. else if ( yy_act == 95 )
  961. fprintf( stderr, "--accepting default rule (\"%s\")\n",
  962. yytext );
  963. else if ( yy_act == 96 )
  964. fprintf( stderr, "--(end of buffer or a NUL)\n" );
  965. else
  966. fprintf( stderr, "--EOF (start condition %d)\n", YY_START );
  967. }
  968. switch ( yy_act )
  969. { /* beginning of action switch */
  970. /* %% [13.0] actions go here */
  971. case 0: /* must back up */
  972. /* undo the effects of YY_DO_BEFORE_ACTION */
  973. *yy_cp = (yy_hold_char);
  974. yy_cp = (yy_last_accepting_cpos);
  975. yy_current_state = (yy_last_accepting_state);
  976. goto yy_find_action;
  977. case 1:
  978. YY_RULE_SETUP
  979. loc.step();
  980. YY_BREAK
  981. case 2:
  982. /* rule 2 can match eol */
  983. YY_RULE_SETUP
  984. { auto loc_newline = loc; loc_newline.end = loc_newline.begin; loc.lines(yyleng); loc.step(); return yy::parser::make_NEWLINE(loc_newline); }
  985. YY_BREAK
  986. case 3:
  987. YY_RULE_SETUP
  988. {
  989. BEGIN(code_block);
  990. code_block_contents = "";
  991. code_block_start = loc;
  992. std::string tmp(yytext);
  993. tmp = tmp.substr(1, tmp.length() - 2);
  994. tmp = tmp.erase(0, tmp.find_first_not_of(" \t"));
  995. tmp = tmp.erase(tmp.find_last_not_of(" \t") + 1);
  996. return yy::parser::make_CODE_BLOCK_START( tmp, loc);
  997. }
  998. YY_BREAK
  999. case 4:
  1000. YY_RULE_SETUP
  1001. loc.step();
  1002. YY_BREAK
  1003. case 5:
  1004. /* rule 5 can match eol */
  1005. YY_RULE_SETUP
  1006. { auto loc_newline = loc; loc_newline.end = loc_newline.begin; loc.lines(yyleng); loc.step(); }
  1007. YY_BREAK
  1008. case 6:
  1009. YY_RULE_SETUP
  1010. { BEGIN(INITIAL); auto loc2 = loc; loc2.begin = code_block_start.begin; return yy::parser::make_CODE_BLOCK_CONTENTS(code_block_contents, loc2); }
  1011. YY_BREAK
  1012. case 7:
  1013. YY_RULE_SETUP
  1014. { code_block_contents += std::string(yytext) + "\n"; }
  1015. YY_BREAK
  1016. case 8:
  1017. YY_RULE_SETUP
  1018. loc.step();
  1019. YY_BREAK
  1020. case 9:
  1021. YY_RULE_SETUP
  1022. { BEGIN(INITIAL); }
  1023. YY_BREAK
  1024. case 10:
  1025. YY_RULE_SETUP
  1026. { }
  1027. YY_BREAK
  1028. case 11:
  1029. YY_RULE_SETUP
  1030. { }
  1031. YY_BREAK
  1032. case 12:
  1033. /* rule 12 can match eol */
  1034. YY_RULE_SETUP
  1035. { auto loc_newline = loc; loc_newline.end = loc_newline.begin; loc.lines(yyleng); loc.step(); }
  1036. YY_BREAK
  1037. case 13:
  1038. YY_RULE_SETUP
  1039. return yy::parser::make_STRING(yytext, loc);
  1040. YY_BREAK
  1041. case 14:
  1042. YY_RULE_SETUP
  1043. loc.step();
  1044. YY_BREAK
  1045. case 15:
  1046. YY_RULE_SETUP
  1047. return yy::parser::make_EQUAL(loc);
  1048. YY_BREAK
  1049. case 16:
  1050. YY_RULE_SETUP
  1051. return make_INT(yytext, loc);
  1052. YY_BREAK
  1053. case 17:
  1054. YY_RULE_SETUP
  1055. return make_HEX(yytext, loc);
  1056. YY_BREAK
  1057. case 18:
  1058. YY_RULE_SETUP
  1059. return make_BINARY(yytext, loc);
  1060. YY_BREAK
  1061. case 19:
  1062. YY_RULE_SETUP
  1063. return yy::parser::make_NON_WS(yytext, loc);
  1064. YY_BREAK
  1065. case 20:
  1066. /* rule 20 can match eol */
  1067. YY_RULE_SETUP
  1068. { BEGIN(INITIAL); auto loc_newline = loc; loc_newline.end = loc_newline.begin; loc.lines(yyleng); loc.step(); return yy::parser::make_NEWLINE(loc_newline); }
  1069. YY_BREAK
  1070. case 21:
  1071. YY_RULE_SETUP
  1072. { throw yy::parser::syntax_error(loc, "invalid character: " + std::string(yytext)); }
  1073. YY_BREAK
  1074. case 22:
  1075. YY_RULE_SETUP
  1076. { BEGIN(c_comment); }
  1077. YY_BREAK
  1078. case 23:
  1079. YY_RULE_SETUP
  1080. return yy::parser::make_COMMA(loc);
  1081. YY_BREAK
  1082. case 24:
  1083. YY_RULE_SETUP
  1084. return yy::parser::make_REVERSE(loc);
  1085. YY_BREAK
  1086. case 25:
  1087. YY_RULE_SETUP
  1088. return yy::parser::make_COLON(loc);
  1089. YY_BREAK
  1090. case 26:
  1091. YY_RULE_SETUP
  1092. return yy::parser::make_LBRACKET(loc);
  1093. YY_BREAK
  1094. case 27:
  1095. YY_RULE_SETUP
  1096. return yy::parser::make_RBRACKET(loc);
  1097. YY_BREAK
  1098. case 28:
  1099. YY_RULE_SETUP
  1100. return yy::parser::make_LPAREN(loc);
  1101. YY_BREAK
  1102. case 29:
  1103. YY_RULE_SETUP
  1104. return yy::parser::make_RPAREN(loc);
  1105. YY_BREAK
  1106. case 30:
  1107. YY_RULE_SETUP
  1108. return yy::parser::make_PLUS(loc);
  1109. YY_BREAK
  1110. case 31:
  1111. YY_RULE_SETUP
  1112. return yy::parser::make_POST_DECREMENT(loc);
  1113. YY_BREAK
  1114. case 32:
  1115. YY_RULE_SETUP
  1116. return yy::parser::make_POST_DECREMENT(loc);
  1117. YY_BREAK
  1118. case 33:
  1119. YY_RULE_SETUP
  1120. return yy::parser::make_MINUS(loc);
  1121. YY_BREAK
  1122. case 34:
  1123. YY_RULE_SETUP
  1124. return yy::parser::make_MULTIPLY(loc);
  1125. YY_BREAK
  1126. case 35:
  1127. YY_RULE_SETUP
  1128. return yy::parser::make_DIVIDE(loc);
  1129. YY_BREAK
  1130. case 36:
  1131. YY_RULE_SETUP
  1132. return yy::parser::make_OR(loc);
  1133. YY_BREAK
  1134. case 37:
  1135. YY_RULE_SETUP
  1136. return yy::parser::make_AND(loc);
  1137. YY_BREAK
  1138. case 38:
  1139. YY_RULE_SETUP
  1140. return yy::parser::make_XOR(loc);
  1141. YY_BREAK
  1142. case 39:
  1143. YY_RULE_SETUP
  1144. return yy::parser::make_NOT_EQUAL(loc);
  1145. YY_BREAK
  1146. case 40:
  1147. YY_RULE_SETUP
  1148. return yy::parser::make_NOT(loc);
  1149. YY_BREAK
  1150. case 41:
  1151. YY_RULE_SETUP
  1152. return yy::parser::make_NOT(loc);
  1153. YY_BREAK
  1154. case 42:
  1155. YY_RULE_SETUP
  1156. return yy::parser::make_PROGRAM(loc);
  1157. YY_BREAK
  1158. case 43:
  1159. YY_RULE_SETUP
  1160. return yy::parser::make_WRAP_TARGET(loc);
  1161. YY_BREAK
  1162. case 44:
  1163. YY_RULE_SETUP
  1164. return yy::parser::make_WRAP(loc);
  1165. YY_BREAK
  1166. case 45:
  1167. YY_RULE_SETUP
  1168. return yy::parser::make_WORD(loc);
  1169. YY_BREAK
  1170. case 46:
  1171. YY_RULE_SETUP
  1172. return yy::parser::make_DEFINE(loc);
  1173. YY_BREAK
  1174. case 47:
  1175. YY_RULE_SETUP
  1176. return yy::parser::make_SIDE_SET(loc);
  1177. YY_BREAK
  1178. case 48:
  1179. YY_RULE_SETUP
  1180. return yy::parser::make_ORIGIN(loc);
  1181. YY_BREAK
  1182. case 49:
  1183. YY_RULE_SETUP
  1184. { BEGIN(lang_opt); return yy::parser::make_LANG_OPT(loc); }
  1185. YY_BREAK
  1186. case 50:
  1187. YY_RULE_SETUP
  1188. return yy::parser::make_UNKNOWN_DIRECTIVE(yytext, loc);
  1189. YY_BREAK
  1190. case 51:
  1191. YY_RULE_SETUP
  1192. return yy::parser::make_JMP(loc);
  1193. YY_BREAK
  1194. case 52:
  1195. YY_RULE_SETUP
  1196. return yy::parser::make_WAIT(loc);
  1197. YY_BREAK
  1198. case 53:
  1199. YY_RULE_SETUP
  1200. return yy::parser::make_IN(loc);
  1201. YY_BREAK
  1202. case 54:
  1203. YY_RULE_SETUP
  1204. return yy::parser::make_OUT(loc);
  1205. YY_BREAK
  1206. case 55:
  1207. YY_RULE_SETUP
  1208. return yy::parser::make_PUSH(loc);
  1209. YY_BREAK
  1210. case 56:
  1211. YY_RULE_SETUP
  1212. return yy::parser::make_PULL(loc);
  1213. YY_BREAK
  1214. case 57:
  1215. YY_RULE_SETUP
  1216. return yy::parser::make_MOV(loc);
  1217. YY_BREAK
  1218. case 58:
  1219. YY_RULE_SETUP
  1220. return yy::parser::make_IRQ(loc);
  1221. YY_BREAK
  1222. case 59:
  1223. YY_RULE_SETUP
  1224. return yy::parser::make_SET(loc);
  1225. YY_BREAK
  1226. case 60:
  1227. YY_RULE_SETUP
  1228. return yy::parser::make_NOP(loc);
  1229. YY_BREAK
  1230. case 61:
  1231. YY_RULE_SETUP
  1232. return yy::parser::make_PUBLIC(loc);
  1233. YY_BREAK
  1234. case 62:
  1235. YY_RULE_SETUP
  1236. return yy::parser::make_OPTIONAL(loc);
  1237. YY_BREAK
  1238. case 63:
  1239. YY_RULE_SETUP
  1240. return yy::parser::make_OPTIONAL(loc);
  1241. YY_BREAK
  1242. case 64:
  1243. YY_RULE_SETUP
  1244. return yy::parser::make_SIDE(loc);
  1245. YY_BREAK
  1246. case 65:
  1247. YY_RULE_SETUP
  1248. return yy::parser::make_SIDE(loc);
  1249. YY_BREAK
  1250. case 66:
  1251. YY_RULE_SETUP
  1252. return yy::parser::make_SIDE(loc);
  1253. YY_BREAK
  1254. case 67:
  1255. YY_RULE_SETUP
  1256. return yy::parser::make_PIN(loc);
  1257. YY_BREAK
  1258. case 68:
  1259. YY_RULE_SETUP
  1260. return yy::parser::make_GPIO(loc);
  1261. YY_BREAK
  1262. case 69:
  1263. YY_RULE_SETUP
  1264. return yy::parser::make_OSRE(loc);
  1265. YY_BREAK
  1266. case 70:
  1267. YY_RULE_SETUP
  1268. return yy::parser::make_PINS(loc);
  1269. YY_BREAK
  1270. case 71:
  1271. YY_RULE_SETUP
  1272. return yy::parser::make_NULL(loc);
  1273. YY_BREAK
  1274. case 72:
  1275. YY_RULE_SETUP
  1276. return yy::parser::make_PINDIRS(loc);
  1277. YY_BREAK
  1278. case 73:
  1279. YY_RULE_SETUP
  1280. return yy::parser::make_X(loc);
  1281. YY_BREAK
  1282. case 74:
  1283. YY_RULE_SETUP
  1284. return yy::parser::make_Y(loc);
  1285. YY_BREAK
  1286. case 75:
  1287. YY_RULE_SETUP
  1288. return yy::parser::make_PC(loc);
  1289. YY_BREAK
  1290. case 76:
  1291. YY_RULE_SETUP
  1292. return yy::parser::make_EXEC(loc);
  1293. YY_BREAK
  1294. case 77:
  1295. YY_RULE_SETUP
  1296. return yy::parser::make_ISR(loc);
  1297. YY_BREAK
  1298. case 78:
  1299. YY_RULE_SETUP
  1300. return yy::parser::make_OSR(loc);
  1301. YY_BREAK
  1302. case 79:
  1303. YY_RULE_SETUP
  1304. return yy::parser::make_STATUS(loc);
  1305. YY_BREAK
  1306. case 80:
  1307. YY_RULE_SETUP
  1308. return yy::parser::make_BLOCK(loc);
  1309. YY_BREAK
  1310. case 81:
  1311. YY_RULE_SETUP
  1312. return yy::parser::make_NOBLOCK(loc);
  1313. YY_BREAK
  1314. case 82:
  1315. YY_RULE_SETUP
  1316. return yy::parser::make_IFFULL(loc);
  1317. YY_BREAK
  1318. case 83:
  1319. YY_RULE_SETUP
  1320. return yy::parser::make_IFEMPTY(loc);
  1321. YY_BREAK
  1322. case 84:
  1323. YY_RULE_SETUP
  1324. return yy::parser::make_REL(loc);
  1325. YY_BREAK
  1326. case 85:
  1327. YY_RULE_SETUP
  1328. return yy::parser::make_CLEAR(loc);
  1329. YY_BREAK
  1330. case 86:
  1331. YY_RULE_SETUP
  1332. return yy::parser::make_NOWAIT(loc);
  1333. YY_BREAK
  1334. case 87:
  1335. YY_RULE_SETUP
  1336. return yy::parser::make_INT(1, loc);
  1337. YY_BREAK
  1338. case 88:
  1339. YY_RULE_SETUP
  1340. return yy::parser::make_INT(0, loc);
  1341. YY_BREAK
  1342. case YY_STATE_EOF(INITIAL):
  1343. case YY_STATE_EOF(code_block):
  1344. case YY_STATE_EOF(c_comment):
  1345. case YY_STATE_EOF(lang_opt):
  1346. return yy::parser::make_END(loc);
  1347. YY_BREAK
  1348. case 89:
  1349. YY_RULE_SETUP
  1350. return make_INT(yytext, loc);
  1351. YY_BREAK
  1352. case 90:
  1353. YY_RULE_SETUP
  1354. return make_HEX(yytext, loc);
  1355. YY_BREAK
  1356. case 91:
  1357. YY_RULE_SETUP
  1358. return make_BINARY(yytext, loc);
  1359. YY_BREAK
  1360. case 92:
  1361. YY_RULE_SETUP
  1362. return yy::parser::make_ID(yytext, loc);
  1363. YY_BREAK
  1364. case 93:
  1365. YY_RULE_SETUP
  1366. { }
  1367. YY_BREAK
  1368. case 94:
  1369. YY_RULE_SETUP
  1370. { throw yy::parser::syntax_error(loc, "invalid character: " + std::string(yytext)); }
  1371. YY_BREAK
  1372. case 95:
  1373. YY_RULE_SETUP
  1374. ECHO;
  1375. YY_BREAK
  1376. case YY_END_OF_BUFFER:
  1377. {
  1378. /* Amount of text matched not including the EOB char. */
  1379. int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
  1380. /* Undo the effects of YY_DO_BEFORE_ACTION. */
  1381. *yy_cp = (yy_hold_char);
  1382. YY_RESTORE_YY_MORE_OFFSET
  1383. if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
  1384. {
  1385. /* We're scanning a new file or input source. It's
  1386. * possible that this happened because the user
  1387. * just pointed yyin at a new source and called
  1388. * yylex(). If so, then we have to assure
  1389. * consistency between YY_CURRENT_BUFFER and our
  1390. * globals. Here is the right place to do so, because
  1391. * this is the first action (other than possibly a
  1392. * back-up) that will match for the new input source.
  1393. */
  1394. (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  1395. /* %if-c-only */
  1396. YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
  1397. /* %endif */
  1398. /* %if-c++-only */
  1399. /* %endif */
  1400. YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
  1401. }
  1402. /* Note that here we test for yy_c_buf_p "<=" to the position
  1403. * of the first EOB in the buffer, since yy_c_buf_p will
  1404. * already have been incremented past the NUL character
  1405. * (since all states make transitions on EOB to the
  1406. * end-of-buffer state). Contrast this with the test
  1407. * in input().
  1408. */
  1409. if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
  1410. { /* This was really a NUL. */
  1411. yy_state_type yy_next_state;
  1412. (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
  1413. yy_current_state = yy_get_previous_state( );
  1414. /* Okay, we're now positioned to make the NUL
  1415. * transition. We couldn't have
  1416. * yy_get_previous_state() go ahead and do it
  1417. * for us because it doesn't know how to deal
  1418. * with the possibility of jamming (and we don't
  1419. * want to build jamming into it because then it
  1420. * will run more slowly).
  1421. */
  1422. yy_next_state = yy_try_NUL_trans( yy_current_state );
  1423. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  1424. if ( yy_next_state )
  1425. {
  1426. /* Consume the NUL. */
  1427. yy_cp = ++(yy_c_buf_p);
  1428. yy_current_state = yy_next_state;
  1429. goto yy_match;
  1430. }
  1431. else
  1432. {
  1433. /* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */
  1434. yy_cp = (yy_last_accepting_cpos);
  1435. yy_current_state = (yy_last_accepting_state);
  1436. goto yy_find_action;
  1437. }
  1438. }
  1439. else switch ( yy_get_next_buffer( ) )
  1440. {
  1441. case EOB_ACT_END_OF_FILE:
  1442. {
  1443. (yy_did_buffer_switch_on_eof) = 0;
  1444. if ( yywrap( ) )
  1445. {
  1446. /* Note: because we've taken care in
  1447. * yy_get_next_buffer() to have set up
  1448. * yytext, we can now set up
  1449. * yy_c_buf_p so that if some total
  1450. * hoser (like flex itself) wants to
  1451. * call the scanner after we return the
  1452. * YY_NULL, it'll still work - another
  1453. * YY_NULL will get returned.
  1454. */
  1455. (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
  1456. yy_act = YY_STATE_EOF(YY_START);
  1457. goto do_action;
  1458. }
  1459. else
  1460. {
  1461. if ( ! (yy_did_buffer_switch_on_eof) )
  1462. YY_NEW_FILE;
  1463. }
  1464. break;
  1465. }
  1466. case EOB_ACT_CONTINUE_SCAN:
  1467. (yy_c_buf_p) =
  1468. (yytext_ptr) + yy_amount_of_matched_text;
  1469. yy_current_state = yy_get_previous_state( );
  1470. yy_cp = (yy_c_buf_p);
  1471. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  1472. goto yy_match;
  1473. case EOB_ACT_LAST_MATCH:
  1474. (yy_c_buf_p) =
  1475. &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
  1476. yy_current_state = yy_get_previous_state( );
  1477. yy_cp = (yy_c_buf_p);
  1478. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  1479. goto yy_find_action;
  1480. }
  1481. break;
  1482. }
  1483. default:
  1484. YY_FATAL_ERROR(
  1485. "fatal flex scanner internal error--no action found" );
  1486. } /* end of action switch */
  1487. } /* end of scanning one token */
  1488. } /* end of user's declarations */
  1489. } /* end of yylex */
  1490. /* %ok-for-header */
  1491. /* %if-c++-only */
  1492. /* %not-for-header */
  1493. /* %ok-for-header */
  1494. /* %endif */
  1495. /* yy_get_next_buffer - try to read in a new buffer
  1496. *
  1497. * Returns a code representing an action:
  1498. * EOB_ACT_LAST_MATCH -
  1499. * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  1500. * EOB_ACT_END_OF_FILE - end of file
  1501. */
  1502. /* %if-c-only */
  1503. static int yy_get_next_buffer (void)
  1504. /* %endif */
  1505. /* %if-c++-only */
  1506. /* %endif */
  1507. {
  1508. char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
  1509. char *source = (yytext_ptr);
  1510. int number_to_move, i;
  1511. int ret_val;
  1512. if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
  1513. YY_FATAL_ERROR(
  1514. "fatal flex scanner internal error--end of buffer missed" );
  1515. if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
  1516. { /* Don't try to fill the buffer, so this is an EOF. */
  1517. if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
  1518. {
  1519. /* We matched a single character, the EOB, so
  1520. * treat this as a final EOF.
  1521. */
  1522. return EOB_ACT_END_OF_FILE;
  1523. }
  1524. else
  1525. {
  1526. /* We matched some text prior to the EOB, first
  1527. * process it.
  1528. */
  1529. return EOB_ACT_LAST_MATCH;
  1530. }
  1531. }
  1532. /* Try to read more data. */
  1533. /* First move last chars to start of buffer. */
  1534. number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1);
  1535. for ( i = 0; i < number_to_move; ++i )
  1536. *(dest++) = *(source++);
  1537. if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
  1538. /* don't do the read, it's not guaranteed to return an EOF,
  1539. * just force an EOF
  1540. */
  1541. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
  1542. else
  1543. {
  1544. int num_to_read =
  1545. YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
  1546. while ( num_to_read <= 0 )
  1547. { /* Not enough room in the buffer - grow it. */
  1548. /* just a shorter name for the current buffer */
  1549. YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
  1550. int yy_c_buf_p_offset =
  1551. (int) ((yy_c_buf_p) - b->yy_ch_buf);
  1552. if ( b->yy_is_our_buffer )
  1553. {
  1554. int new_size = b->yy_buf_size * 2;
  1555. if ( new_size <= 0 )
  1556. b->yy_buf_size += b->yy_buf_size / 8;
  1557. else
  1558. b->yy_buf_size *= 2;
  1559. b->yy_ch_buf = (char *)
  1560. /* Include room in for 2 EOB chars. */
  1561. yyrealloc( (void *) b->yy_ch_buf,
  1562. (yy_size_t) (b->yy_buf_size + 2) );
  1563. }
  1564. else
  1565. /* Can't grow it, we don't own it. */
  1566. b->yy_ch_buf = NULL;
  1567. if ( ! b->yy_ch_buf )
  1568. YY_FATAL_ERROR(
  1569. "fatal error - scanner input buffer overflow" );
  1570. (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
  1571. num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
  1572. number_to_move - 1;
  1573. }
  1574. if ( num_to_read > YY_READ_BUF_SIZE )
  1575. num_to_read = YY_READ_BUF_SIZE;
  1576. /* Read in more data. */
  1577. YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
  1578. (yy_n_chars), num_to_read );
  1579. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1580. }
  1581. if ( (yy_n_chars) == 0 )
  1582. {
  1583. if ( number_to_move == YY_MORE_ADJ )
  1584. {
  1585. ret_val = EOB_ACT_END_OF_FILE;
  1586. yyrestart( yyin );
  1587. }
  1588. else
  1589. {
  1590. ret_val = EOB_ACT_LAST_MATCH;
  1591. YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
  1592. YY_BUFFER_EOF_PENDING;
  1593. }
  1594. }
  1595. else
  1596. ret_val = EOB_ACT_CONTINUE_SCAN;
  1597. if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
  1598. /* Extend the array by 50%, plus the number we really need. */
  1599. int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
  1600. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
  1601. (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size );
  1602. if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
  1603. YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
  1604. /* "- 2" to take care of EOB's */
  1605. YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
  1606. }
  1607. (yy_n_chars) += number_to_move;
  1608. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
  1609. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
  1610. (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
  1611. return ret_val;
  1612. }
  1613. /* yy_get_previous_state - get the state just before the EOB char was reached */
  1614. /* %if-c-only */
  1615. /* %not-for-header */
  1616. static yy_state_type yy_get_previous_state (void)
  1617. /* %endif */
  1618. /* %if-c++-only */
  1619. /* %endif */
  1620. {
  1621. yy_state_type yy_current_state;
  1622. char *yy_cp;
  1623. /* %% [15.0] code to get the start state into yy_current_state goes here */
  1624. yy_current_state = (yy_start);
  1625. for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
  1626. {
  1627. /* %% [16.0] code to find the next state goes here */
  1628. YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
  1629. if ( yy_accept[yy_current_state] )
  1630. {
  1631. (yy_last_accepting_state) = yy_current_state;
  1632. (yy_last_accepting_cpos) = yy_cp;
  1633. }
  1634. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1635. {
  1636. yy_current_state = (int) yy_def[yy_current_state];
  1637. if ( yy_current_state >= 266 )
  1638. yy_c = yy_meta[yy_c];
  1639. }
  1640. yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  1641. }
  1642. return yy_current_state;
  1643. }
  1644. /* yy_try_NUL_trans - try to make a transition on the NUL character
  1645. *
  1646. * synopsis
  1647. * next_state = yy_try_NUL_trans( current_state );
  1648. */
  1649. /* %if-c-only */
  1650. static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
  1651. /* %endif */
  1652. /* %if-c++-only */
  1653. /* %endif */
  1654. {
  1655. int yy_is_jam;
  1656. /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */
  1657. char *yy_cp = (yy_c_buf_p);
  1658. YY_CHAR yy_c = 1;
  1659. if ( yy_accept[yy_current_state] )
  1660. {
  1661. (yy_last_accepting_state) = yy_current_state;
  1662. (yy_last_accepting_cpos) = yy_cp;
  1663. }
  1664. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1665. {
  1666. yy_current_state = (int) yy_def[yy_current_state];
  1667. if ( yy_current_state >= 266 )
  1668. yy_c = yy_meta[yy_c];
  1669. }
  1670. yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  1671. yy_is_jam = (yy_current_state == 265);
  1672. return yy_is_jam ? 0 : yy_current_state;
  1673. }
  1674. #ifndef YY_NO_UNPUT
  1675. /* %if-c-only */
  1676. /* %endif */
  1677. #endif
  1678. /* %if-c-only */
  1679. #ifndef YY_NO_INPUT
  1680. #ifdef __cplusplus
  1681. static int yyinput (void)
  1682. #else
  1683. static int input (void)
  1684. #endif
  1685. /* %endif */
  1686. /* %if-c++-only */
  1687. /* %endif */
  1688. {
  1689. int c;
  1690. *(yy_c_buf_p) = (yy_hold_char);
  1691. if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
  1692. {
  1693. /* yy_c_buf_p now points to the character we want to return.
  1694. * If this occurs *before* the EOB characters, then it's a
  1695. * valid NUL; if not, then we've hit the end of the buffer.
  1696. */
  1697. if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
  1698. /* This was really a NUL. */
  1699. *(yy_c_buf_p) = '\0';
  1700. else
  1701. { /* need more input */
  1702. int offset = (int) ((yy_c_buf_p) - (yytext_ptr));
  1703. ++(yy_c_buf_p);
  1704. switch ( yy_get_next_buffer( ) )
  1705. {
  1706. case EOB_ACT_LAST_MATCH:
  1707. /* This happens because yy_g_n_b()
  1708. * sees that we've accumulated a
  1709. * token and flags that we need to
  1710. * try matching the token before
  1711. * proceeding. But for input(),
  1712. * there's no matching to consider.
  1713. * So convert the EOB_ACT_LAST_MATCH
  1714. * to EOB_ACT_END_OF_FILE.
  1715. */
  1716. /* Reset buffer status. */
  1717. yyrestart( yyin );
  1718. /*FALLTHROUGH*/
  1719. case EOB_ACT_END_OF_FILE:
  1720. {
  1721. if ( yywrap( ) )
  1722. return 0;
  1723. if ( ! (yy_did_buffer_switch_on_eof) )
  1724. YY_NEW_FILE;
  1725. #ifdef __cplusplus
  1726. return yyinput();
  1727. #else
  1728. return input();
  1729. #endif
  1730. }
  1731. case EOB_ACT_CONTINUE_SCAN:
  1732. (yy_c_buf_p) = (yytext_ptr) + offset;
  1733. break;
  1734. }
  1735. }
  1736. }
  1737. c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
  1738. *(yy_c_buf_p) = '\0'; /* preserve yytext */
  1739. (yy_hold_char) = *++(yy_c_buf_p);
  1740. /* %% [19.0] update BOL and yylineno */
  1741. return c;
  1742. }
  1743. /* %if-c-only */
  1744. #endif /* ifndef YY_NO_INPUT */
  1745. /* %endif */
  1746. /** Immediately switch to a different input stream.
  1747. * @param input_file A readable stream.
  1748. *
  1749. * @note This function does not reset the start condition to @c INITIAL .
  1750. */
  1751. /* %if-c-only */
  1752. void yyrestart (FILE * input_file )
  1753. /* %endif */
  1754. /* %if-c++-only */
  1755. /* %endif */
  1756. {
  1757. if ( ! YY_CURRENT_BUFFER ){
  1758. yyensure_buffer_stack ();
  1759. YY_CURRENT_BUFFER_LVALUE =
  1760. yy_create_buffer( yyin, YY_BUF_SIZE );
  1761. }
  1762. yy_init_buffer( YY_CURRENT_BUFFER, input_file );
  1763. yy_load_buffer_state( );
  1764. }
  1765. /* %if-c++-only */
  1766. /* %endif */
  1767. /** Switch to a different input buffer.
  1768. * @param new_buffer The new input buffer.
  1769. *
  1770. */
  1771. /* %if-c-only */
  1772. void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
  1773. /* %endif */
  1774. /* %if-c++-only */
  1775. /* %endif */
  1776. {
  1777. /* TODO. We should be able to replace this entire function body
  1778. * with
  1779. * yypop_buffer_state();
  1780. * yypush_buffer_state(new_buffer);
  1781. */
  1782. yyensure_buffer_stack ();
  1783. if ( YY_CURRENT_BUFFER == new_buffer )
  1784. return;
  1785. if ( YY_CURRENT_BUFFER )
  1786. {
  1787. /* Flush out information for old buffer. */
  1788. *(yy_c_buf_p) = (yy_hold_char);
  1789. YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
  1790. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1791. }
  1792. YY_CURRENT_BUFFER_LVALUE = new_buffer;
  1793. yy_load_buffer_state( );
  1794. /* We don't actually know whether we did this switch during
  1795. * EOF (yywrap()) processing, but the only time this flag
  1796. * is looked at is after yywrap() is called, so it's safe
  1797. * to go ahead and always set it.
  1798. */
  1799. (yy_did_buffer_switch_on_eof) = 1;
  1800. }
  1801. /* %if-c-only */
  1802. static void yy_load_buffer_state (void)
  1803. /* %endif */
  1804. /* %if-c++-only */
  1805. /* %endif */
  1806. {
  1807. (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  1808. (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
  1809. /* %if-c-only */
  1810. yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
  1811. /* %endif */
  1812. /* %if-c++-only */
  1813. /* %endif */
  1814. (yy_hold_char) = *(yy_c_buf_p);
  1815. }
  1816. /** Allocate and initialize an input buffer state.
  1817. * @param file A readable stream.
  1818. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
  1819. *
  1820. * @return the allocated buffer state.
  1821. */
  1822. /* %if-c-only */
  1823. YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
  1824. /* %endif */
  1825. /* %if-c++-only */
  1826. /* %endif */
  1827. {
  1828. YY_BUFFER_STATE b;
  1829. b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
  1830. if ( ! b )
  1831. YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1832. b->yy_buf_size = size;
  1833. /* yy_ch_buf has to be 2 characters longer than the size given because
  1834. * we need to put in 2 end-of-buffer characters.
  1835. */
  1836. b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) );
  1837. if ( ! b->yy_ch_buf )
  1838. YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1839. b->yy_is_our_buffer = 1;
  1840. yy_init_buffer( b, file );
  1841. return b;
  1842. }
  1843. /* %if-c++-only */
  1844. /* %endif */
  1845. /** Destroy the buffer.
  1846. * @param b a buffer created with yy_create_buffer()
  1847. *
  1848. */
  1849. /* %if-c-only */
  1850. void yy_delete_buffer (YY_BUFFER_STATE b )
  1851. /* %endif */
  1852. /* %if-c++-only */
  1853. /* %endif */
  1854. {
  1855. if ( ! b )
  1856. return;
  1857. if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
  1858. YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
  1859. if ( b->yy_is_our_buffer )
  1860. yyfree( (void *) b->yy_ch_buf );
  1861. yyfree( (void *) b );
  1862. }
  1863. /* Initializes or reinitializes a buffer.
  1864. * This function is sometimes called more than once on the same buffer,
  1865. * such as during a yyrestart() or at EOF.
  1866. */
  1867. /* %if-c-only */
  1868. static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
  1869. /* %endif */
  1870. /* %if-c++-only */
  1871. /* %endif */
  1872. {
  1873. int oerrno = errno;
  1874. yy_flush_buffer( b );
  1875. /* %if-c-only */
  1876. b->yy_input_file = file;
  1877. /* %endif */
  1878. /* %if-c++-only */
  1879. /* %endif */
  1880. b->yy_fill_buffer = 1;
  1881. /* If b is the current buffer, then yy_init_buffer was _probably_
  1882. * called from yyrestart() or through yy_get_next_buffer.
  1883. * In that case, we don't want to reset the lineno or column.
  1884. */
  1885. if (b != YY_CURRENT_BUFFER){
  1886. b->yy_bs_lineno = 1;
  1887. b->yy_bs_column = 0;
  1888. }
  1889. /* %if-c-only */
  1890. b->yy_is_interactive = 0;
  1891. /* %endif */
  1892. /* %if-c++-only */
  1893. /* %endif */
  1894. errno = oerrno;
  1895. }
  1896. /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
  1897. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
  1898. *
  1899. */
  1900. /* %if-c-only */
  1901. void yy_flush_buffer (YY_BUFFER_STATE b )
  1902. /* %endif */
  1903. /* %if-c++-only */
  1904. /* %endif */
  1905. {
  1906. if ( ! b )
  1907. return;
  1908. b->yy_n_chars = 0;
  1909. /* We always need two end-of-buffer characters. The first causes
  1910. * a transition to the end-of-buffer state. The second causes
  1911. * a jam in that state.
  1912. */
  1913. b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
  1914. b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  1915. b->yy_buf_pos = &b->yy_ch_buf[0];
  1916. b->yy_at_bol = 1;
  1917. b->yy_buffer_status = YY_BUFFER_NEW;
  1918. if ( b == YY_CURRENT_BUFFER )
  1919. yy_load_buffer_state( );
  1920. }
  1921. /* %if-c-or-c++ */
  1922. /** Pushes the new state onto the stack. The new state becomes
  1923. * the current state. This function will allocate the stack
  1924. * if necessary.
  1925. * @param new_buffer The new state.
  1926. *
  1927. */
  1928. /* %if-c-only */
  1929. void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
  1930. /* %endif */
  1931. /* %if-c++-only */
  1932. /* %endif */
  1933. {
  1934. if (new_buffer == NULL)
  1935. return;
  1936. yyensure_buffer_stack();
  1937. /* This block is copied from yy_switch_to_buffer. */
  1938. if ( YY_CURRENT_BUFFER )
  1939. {
  1940. /* Flush out information for old buffer. */
  1941. *(yy_c_buf_p) = (yy_hold_char);
  1942. YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
  1943. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1944. }
  1945. /* Only push if top exists. Otherwise, replace top. */
  1946. if (YY_CURRENT_BUFFER)
  1947. (yy_buffer_stack_top)++;
  1948. YY_CURRENT_BUFFER_LVALUE = new_buffer;
  1949. /* copied from yy_switch_to_buffer. */
  1950. yy_load_buffer_state( );
  1951. (yy_did_buffer_switch_on_eof) = 1;
  1952. }
  1953. /* %endif */
  1954. /* %if-c-or-c++ */
  1955. /** Removes and deletes the top of the stack, if present.
  1956. * The next element becomes the new top.
  1957. *
  1958. */
  1959. /* %if-c-only */
  1960. void yypop_buffer_state (void)
  1961. /* %endif */
  1962. /* %if-c++-only */
  1963. /* %endif */
  1964. {
  1965. if (!YY_CURRENT_BUFFER)
  1966. return;
  1967. yy_delete_buffer(YY_CURRENT_BUFFER );
  1968. YY_CURRENT_BUFFER_LVALUE = NULL;
  1969. if ((yy_buffer_stack_top) > 0)
  1970. --(yy_buffer_stack_top);
  1971. if (YY_CURRENT_BUFFER) {
  1972. yy_load_buffer_state( );
  1973. (yy_did_buffer_switch_on_eof) = 1;
  1974. }
  1975. }
  1976. /* %endif */
  1977. /* %if-c-or-c++ */
  1978. /* Allocates the stack if it does not exist.
  1979. * Guarantees space for at least one push.
  1980. */
  1981. /* %if-c-only */
  1982. static void yyensure_buffer_stack (void)
  1983. /* %endif */
  1984. /* %if-c++-only */
  1985. /* %endif */
  1986. {
  1987. yy_size_t num_to_alloc;
  1988. if (!(yy_buffer_stack)) {
  1989. /* First allocation is just for 2 elements, since we don't know if this
  1990. * scanner will even need a stack. We use 2 instead of 1 to avoid an
  1991. * immediate realloc on the next call.
  1992. */
  1993. num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
  1994. (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
  1995. (num_to_alloc * sizeof(struct yy_buffer_state*)
  1996. );
  1997. if ( ! (yy_buffer_stack) )
  1998. YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
  1999. memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
  2000. (yy_buffer_stack_max) = num_to_alloc;
  2001. (yy_buffer_stack_top) = 0;
  2002. return;
  2003. }
  2004. if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
  2005. /* Increase the buffer to prepare for a possible push. */
  2006. yy_size_t grow_size = 8 /* arbitrary grow size */;
  2007. num_to_alloc = (yy_buffer_stack_max) + grow_size;
  2008. (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
  2009. ((yy_buffer_stack),
  2010. num_to_alloc * sizeof(struct yy_buffer_state*)
  2011. );
  2012. if ( ! (yy_buffer_stack) )
  2013. YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
  2014. /* zero only the new slots.*/
  2015. memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
  2016. (yy_buffer_stack_max) = num_to_alloc;
  2017. }
  2018. }
  2019. /* %endif */
  2020. /* %if-c-only */
  2021. /** Setup the input buffer state to scan directly from a user-specified character buffer.
  2022. * @param base the character buffer
  2023. * @param size the size in bytes of the character buffer
  2024. *
  2025. * @return the newly allocated buffer state object.
  2026. */
  2027. YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
  2028. {
  2029. YY_BUFFER_STATE b;
  2030. if ( size < 2 ||
  2031. base[size-2] != YY_END_OF_BUFFER_CHAR ||
  2032. base[size-1] != YY_END_OF_BUFFER_CHAR )
  2033. /* They forgot to leave room for the EOB's. */
  2034. return NULL;
  2035. b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
  2036. if ( ! b )
  2037. YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
  2038. b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
  2039. b->yy_buf_pos = b->yy_ch_buf = base;
  2040. b->yy_is_our_buffer = 0;
  2041. b->yy_input_file = NULL;
  2042. b->yy_n_chars = b->yy_buf_size;
  2043. b->yy_is_interactive = 0;
  2044. b->yy_at_bol = 1;
  2045. b->yy_fill_buffer = 0;
  2046. b->yy_buffer_status = YY_BUFFER_NEW;
  2047. yy_switch_to_buffer( b );
  2048. return b;
  2049. }
  2050. /* %endif */
  2051. /* %if-c-only */
  2052. /** Setup the input buffer state to scan a string. The next call to yylex() will
  2053. * scan from a @e copy of @a str.
  2054. * @param yystr a NUL-terminated string to scan
  2055. *
  2056. * @return the newly allocated buffer state object.
  2057. * @note If you want to scan bytes that may contain NUL values, then use
  2058. * yy_scan_bytes() instead.
  2059. */
  2060. YY_BUFFER_STATE yy_scan_string (const char * yystr )
  2061. {
  2062. return yy_scan_bytes( yystr, (int) strlen(yystr) );
  2063. }
  2064. /* %endif */
  2065. /* %if-c-only */
  2066. /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
  2067. * scan from a @e copy of @a bytes.
  2068. * @param yybytes the byte buffer to scan
  2069. * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
  2070. *
  2071. * @return the newly allocated buffer state object.
  2072. */
  2073. YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len )
  2074. {
  2075. YY_BUFFER_STATE b;
  2076. char *buf;
  2077. yy_size_t n;
  2078. int i;
  2079. /* Get memory for full buffer, including space for trailing EOB's. */
  2080. n = (yy_size_t) (_yybytes_len + 2);
  2081. buf = (char *) yyalloc( n );
  2082. if ( ! buf )
  2083. YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
  2084. for ( i = 0; i < _yybytes_len; ++i )
  2085. buf[i] = yybytes[i];
  2086. buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
  2087. b = yy_scan_buffer( buf, n );
  2088. if ( ! b )
  2089. YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
  2090. /* It's okay to grow etc. this buffer, and we should throw it
  2091. * away when we're done.
  2092. */
  2093. b->yy_is_our_buffer = 1;
  2094. return b;
  2095. }
  2096. /* %endif */
  2097. #ifndef YY_EXIT_FAILURE
  2098. #define YY_EXIT_FAILURE 2
  2099. #endif
  2100. /* %if-c-only */
  2101. static void yynoreturn yy_fatal_error (const char* msg )
  2102. {
  2103. fprintf( stderr, "%s\n", msg );
  2104. exit( YY_EXIT_FAILURE );
  2105. }
  2106. /* %endif */
  2107. /* %if-c++-only */
  2108. /* %endif */
  2109. /* Redefine yyless() so it works in section 3 code. */
  2110. #undef yyless
  2111. #define yyless(n) \
  2112. do \
  2113. { \
  2114. /* Undo effects of setting up yytext. */ \
  2115. int yyless_macro_arg = (n); \
  2116. YY_LESS_LINENO(yyless_macro_arg);\
  2117. yytext[yyleng] = (yy_hold_char); \
  2118. (yy_c_buf_p) = yytext + yyless_macro_arg; \
  2119. (yy_hold_char) = *(yy_c_buf_p); \
  2120. *(yy_c_buf_p) = '\0'; \
  2121. yyleng = yyless_macro_arg; \
  2122. } \
  2123. while ( 0 )
  2124. /* Accessor methods (get/set functions) to struct members. */
  2125. /* %if-c-only */
  2126. /* %if-reentrant */
  2127. /* %endif */
  2128. /** Get the current line number.
  2129. *
  2130. */
  2131. int yyget_lineno (void)
  2132. {
  2133. return yylineno;
  2134. }
  2135. /** Get the input stream.
  2136. *
  2137. */
  2138. FILE *yyget_in (void)
  2139. {
  2140. return yyin;
  2141. }
  2142. /** Get the output stream.
  2143. *
  2144. */
  2145. FILE *yyget_out (void)
  2146. {
  2147. return yyout;
  2148. }
  2149. /** Get the length of the current token.
  2150. *
  2151. */
  2152. int yyget_leng (void)
  2153. {
  2154. return yyleng;
  2155. }
  2156. /** Get the current token.
  2157. *
  2158. */
  2159. char *yyget_text (void)
  2160. {
  2161. return yytext;
  2162. }
  2163. /* %if-reentrant */
  2164. /* %endif */
  2165. /** Set the current line number.
  2166. * @param _line_number line number
  2167. *
  2168. */
  2169. void yyset_lineno (int _line_number )
  2170. {
  2171. yylineno = _line_number;
  2172. }
  2173. /** Set the input stream. This does not discard the current
  2174. * input buffer.
  2175. * @param _in_str A readable stream.
  2176. *
  2177. * @see yy_switch_to_buffer
  2178. */
  2179. void yyset_in (FILE * _in_str )
  2180. {
  2181. yyin = _in_str ;
  2182. }
  2183. void yyset_out (FILE * _out_str )
  2184. {
  2185. yyout = _out_str ;
  2186. }
  2187. int yyget_debug (void)
  2188. {
  2189. return yy_flex_debug;
  2190. }
  2191. void yyset_debug (int _bdebug )
  2192. {
  2193. yy_flex_debug = _bdebug ;
  2194. }
  2195. /* %endif */
  2196. /* %if-reentrant */
  2197. /* %if-bison-bridge */
  2198. /* %endif */
  2199. /* %endif if-c-only */
  2200. /* %if-c-only */
  2201. static int yy_init_globals (void)
  2202. {
  2203. /* Initialization is the same as for the non-reentrant scanner.
  2204. * This function is called from yylex_destroy(), so don't allocate here.
  2205. */
  2206. (yy_buffer_stack) = NULL;
  2207. (yy_buffer_stack_top) = 0;
  2208. (yy_buffer_stack_max) = 0;
  2209. (yy_c_buf_p) = NULL;
  2210. (yy_init) = 0;
  2211. (yy_start) = 0;
  2212. /* Defined in main.c */
  2213. #ifdef YY_STDINIT
  2214. yyin = stdin;
  2215. yyout = stdout;
  2216. #else
  2217. yyin = NULL;
  2218. yyout = NULL;
  2219. #endif
  2220. /* For future reference: Set errno on error, since we are called by
  2221. * yylex_init()
  2222. */
  2223. return 0;
  2224. }
  2225. /* %endif */
  2226. /* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */
  2227. /* yylex_destroy is for both reentrant and non-reentrant scanners. */
  2228. int yylex_destroy (void)
  2229. {
  2230. /* Pop the buffer stack, destroying each element. */
  2231. while(YY_CURRENT_BUFFER){
  2232. yy_delete_buffer( YY_CURRENT_BUFFER );
  2233. YY_CURRENT_BUFFER_LVALUE = NULL;
  2234. yypop_buffer_state();
  2235. }
  2236. /* Destroy the stack itself. */
  2237. yyfree((yy_buffer_stack) );
  2238. (yy_buffer_stack) = NULL;
  2239. /* Reset the globals. This is important in a non-reentrant scanner so the next time
  2240. * yylex() is called, initialization will occur. */
  2241. yy_init_globals( );
  2242. /* %if-reentrant */
  2243. /* %endif */
  2244. return 0;
  2245. }
  2246. /* %endif */
  2247. /*
  2248. * Internal utility routines.
  2249. */
  2250. #ifndef yytext_ptr
  2251. static void yy_flex_strncpy (char* s1, const char * s2, int n )
  2252. {
  2253. int i;
  2254. for ( i = 0; i < n; ++i )
  2255. s1[i] = s2[i];
  2256. }
  2257. #endif
  2258. #ifdef YY_NEED_STRLEN
  2259. static int yy_flex_strlen (const char * s )
  2260. {
  2261. int n;
  2262. for ( n = 0; s[n]; ++n )
  2263. ;
  2264. return n;
  2265. }
  2266. #endif
  2267. void *yyalloc (yy_size_t size )
  2268. {
  2269. return malloc(size);
  2270. }
  2271. void *yyrealloc (void * ptr, yy_size_t size )
  2272. {
  2273. /* The cast to (char *) in the following accommodates both
  2274. * implementations that use char* generic pointers, and those
  2275. * that use void* generic pointers. It works with the latter
  2276. * because both ANSI C and C++ allow castless assignment from
  2277. * any pointer type to void*, and deal with argument conversions
  2278. * as though doing an assignment.
  2279. */
  2280. return realloc(ptr, size);
  2281. }
  2282. void yyfree (void * ptr )
  2283. {
  2284. free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
  2285. }
  2286. /* %if-tables-serialization definitions */
  2287. /* %define-yytables The name for this specific scanner's tables. */
  2288. /* %endif */
  2289. /* %ok-for-header */
  2290. yy::parser::symbol_type make_INT(const std::string &s, const yy::parser::location_type& loc)
  2291. {
  2292. errno = 0;
  2293. long n = strtol (s.c_str(), NULL, 10);
  2294. if (! (INT_MIN <= n && n <= INT_MAX && errno != ERANGE))
  2295. throw yy::parser::syntax_error (loc, "integer is out of range: " + s);
  2296. return yy::parser::make_INT((int) n, loc);
  2297. }
  2298. yy::parser::symbol_type make_HEX(const std::string &s, const yy::parser::location_type& loc)
  2299. {
  2300. errno = 0;
  2301. long n = strtol (s.c_str() + 2, NULL, 16);
  2302. if (! (INT_MIN <= n && n <= INT_MAX && errno != ERANGE))
  2303. throw yy::parser::syntax_error (loc, "hex is out of range: " + s);
  2304. return yy::parser::make_INT((int) n, loc);
  2305. }
  2306. yy::parser::symbol_type make_BINARY(const std::string &s, const yy::parser::location_type& loc)
  2307. {
  2308. errno = 0;
  2309. long n = strtol (s.c_str()+2, NULL, 2);
  2310. if (! (INT_MIN <= n && n <= INT_MAX && errno != ERANGE))
  2311. throw yy::parser::syntax_error (loc, "binary is out of range: " + s);
  2312. return yy::parser::make_INT((int) n, loc);
  2313. }
  2314. void pio_assembler::scan_begin ()
  2315. {
  2316. yy_flex_debug = false;
  2317. if (source.empty () || source == "-")
  2318. yyin = stdin;
  2319. else if (!(yyin = fopen (source.c_str (), "r")))
  2320. {
  2321. std::cerr << "cannot open " << source << ": " << strerror(errno) << '\n';
  2322. exit (EXIT_FAILURE);
  2323. }
  2324. }
  2325. void pio_assembler::scan_end ()
  2326. {
  2327. fclose (yyin);
  2328. }