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 57KB

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