The Sol Programming Language!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

lex.yy.c 59KB

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