lexer.cpp 72 KB

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