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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451
  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. int writing_html = 0;
  497. void str_init(void) {
  498. str = malloc(SZMUL);
  499. curptr = str;
  500. cursz = SZMUL;
  501. chars = 0;
  502. }
  503. void str_putc(char c) {
  504. *curptr++ = c;
  505. chars++;
  506. if(chars >= cursz) {
  507. str = realloc(str, cursz + SZMUL);
  508. curptr = str + chars;
  509. cursz += SZMUL;
  510. }
  511. }
  512. /* http://stackoverflow.com/questions/656703/how-does-flex-support-bison-location-exactly */
  513. /* Many thanks to hugomg and David Elson! */
  514. static void update_loc(YYLTYPE *yylloc, char *yytext){
  515. int curr_line;
  516. int curr_col;
  517. curr_line = yylloc->first_line = yylloc->last_line;
  518. curr_col = yylloc->first_column = yylloc->last_column;
  519. {char * s; for(s = yytext; *s != '\0'; s++){
  520. if(*s == '\n'){
  521. curr_line++;
  522. curr_col = 1;
  523. }else{
  524. curr_col++;
  525. }
  526. }}
  527. yylloc->last_line = curr_line;
  528. yylloc->last_column = curr_col-1;
  529. }
  530. char *FONTS[] = {
  531. "Adobe Courier",
  532. "Adobe Helvetica",
  533. "Adobe New Century Schoolbook",
  534. "Adobe Times",
  535. "Andale Mono",
  536. "Arial",
  537. "Arial Black",
  538. "C059",
  539. "Cantarell",
  540. "Century Schoolbook L",
  541. "Comic Sans MS",
  542. "Courier New",
  543. "cursor.pcf",
  544. "D050000L",
  545. "DejaVu Math TeX Gyre",
  546. "DejaVu Sans",
  547. "DejaVu Sans,DejaVu Sans Condensed",
  548. "DejaVu Sans,DejaVu Sans Light",
  549. "DejaVu Sans Mono",
  550. "DejaVu Serif",
  551. "DejaVu Serif,DejaVu Serif Condensed",
  552. "Denemo",
  553. "Dingbats",
  554. "Emmentaler",
  555. "feta26",
  556. "Georgia",
  557. "GNU Unifont",
  558. "GNU Unifont CSUR",
  559. "GNU Unifont Sample",
  560. "Impact",
  561. "Misc Fixed",
  562. "Misc Fixed Wide",
  563. "Nimbus Mono L",
  564. "Nimbus Mono PS",
  565. "Nimbus Roman",
  566. "Nimbus Roman No9 L",
  567. "NimbusSans",
  568. "Nimbus Sans",
  569. "Nimbus Sans L",
  570. "Nimbus Sans Narrow",
  571. "P052",
  572. "Standard Symbols L",
  573. "Standard Symbols PS",
  574. "Times New Roman",
  575. "Trebuchet MS",
  576. "Unifont",
  577. "Unifont CSUR",
  578. "Unifont Sample",
  579. "Unifont Upper",
  580. "URW Bookman",
  581. "URW Bookman L",
  582. "URW Chancery L",
  583. "URW Gothic",
  584. "URW Gothic L",
  585. "URW Palladio L",
  586. "Verdana",
  587. "Webdings",
  588. "Z003",
  589. };
  590. static void write_html(char *yytext) {
  591. if(writing_html) {
  592. printf("<span style=\"font-family: %s;%s%s%s%s\">%s</span>",
  593. FONTS[rand() % (sizeof(FONTS) / sizeof(*FONTS))],
  594. rand() & 1 ? "font-weight: bold;" : "",
  595. rand() & 1 ? "font-style: italic;" : "",
  596. rand() & 1 ? "text-decoration: underline;" : "",
  597. rand() & 1 ? "font-variant: small-caps;" : "",
  598. yytext
  599. );
  600. }
  601. }
  602. #define YY_USER_ACTION update_loc(yylloc, yytext); write_html(yytext);
  603. #line 701 "lex.yy.c"
  604. /* This is the right way to do it, but it keeps generating token $undefined.
  605. %x STRING
  606. \" { str_init(); BEGIN STRING; }
  607. <STRING>\\n { str_putc('\n'); }
  608. <STRING>\\t { str_putc('\t'); }
  609. <STRING>\\b { str_putc('\b'); }
  610. <STRING>\\r { str_putc('\r'); }
  611. <STRING>\\x{HEXDIGIT}{HEXDIGIT} { str_putc(strtol(yytext+2, NULL, 16)); }
  612. <STRING>\\\" { str_putc('"'); }
  613. <STRING>\" { str_putc('\0'); yylval = str; BEGIN 0; return STRING; }
  614. <STRING>. { str_putc(*yytext); }
  615. */
  616. #line 717 "lex.yy.c"
  617. #define INITIAL 0
  618. #ifndef YY_NO_UNISTD_H
  619. /* Special case for "unistd.h", since it is non-ANSI. We include it way
  620. * down here because we want the user's section 1 to have been scanned first.
  621. * The user has a chance to override it with an option.
  622. */
  623. #include <unistd.h>
  624. #endif
  625. #ifndef YY_EXTRA_TYPE
  626. #define YY_EXTRA_TYPE void *
  627. #endif
  628. static int yy_init_globals ( void );
  629. /* Accessor methods to globals.
  630. These are made visible to non-reentrant scanners for convenience. */
  631. int yylex_destroy ( void );
  632. int yyget_debug ( void );
  633. void yyset_debug ( int debug_flag );
  634. YY_EXTRA_TYPE yyget_extra ( void );
  635. void yyset_extra ( YY_EXTRA_TYPE user_defined );
  636. FILE *yyget_in ( void );
  637. void yyset_in ( FILE * _in_str );
  638. FILE *yyget_out ( void );
  639. void yyset_out ( FILE * _out_str );
  640. int yyget_leng ( void );
  641. char *yyget_text ( void );
  642. int yyget_lineno ( void );
  643. void yyset_lineno ( int _line_number );
  644. YYSTYPE * yyget_lval ( void );
  645. void yyset_lval ( YYSTYPE * yylval_param );
  646. YYLTYPE *yyget_lloc ( void );
  647. void yyset_lloc ( YYLTYPE * yylloc_param );
  648. /* Macros after this point can all be overridden by user definitions in
  649. * section 1.
  650. */
  651. #ifndef YY_SKIP_YYWRAP
  652. #ifdef __cplusplus
  653. extern "C" int yywrap ( void );
  654. #else
  655. extern int yywrap ( void );
  656. #endif
  657. #endif
  658. #ifndef YY_NO_UNPUT
  659. static void yyunput ( int c, char *buf_ptr );
  660. #endif
  661. #ifndef yytext_ptr
  662. static void yy_flex_strncpy ( char *, const char *, int );
  663. #endif
  664. #ifdef YY_NEED_STRLEN
  665. static int yy_flex_strlen ( const char * );
  666. #endif
  667. #ifndef YY_NO_INPUT
  668. #ifdef __cplusplus
  669. static int yyinput ( void );
  670. #else
  671. static int input ( void );
  672. #endif
  673. #endif
  674. /* Amount of stuff to slurp up with each read. */
  675. #ifndef YY_READ_BUF_SIZE
  676. #ifdef __ia64__
  677. /* On IA-64, the buffer size is 16k, not 8k */
  678. #define YY_READ_BUF_SIZE 16384
  679. #else
  680. #define YY_READ_BUF_SIZE 8192
  681. #endif /* __ia64__ */
  682. #endif
  683. /* Copy whatever the last rule matched to the standard output. */
  684. #ifndef ECHO
  685. /* This used to be an fputs(), but since the string might contain NUL's,
  686. * we now use fwrite().
  687. */
  688. #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
  689. #endif
  690. /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
  691. * is returned in "result".
  692. */
  693. #ifndef YY_INPUT
  694. #define YY_INPUT(buf,result,max_size) \
  695. if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
  696. { \
  697. int c = '*'; \
  698. int n; \
  699. for ( n = 0; n < max_size && \
  700. (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
  701. buf[n] = (char) c; \
  702. if ( c == '\n' ) \
  703. buf[n++] = (char) c; \
  704. if ( c == EOF && ferror( yyin ) ) \
  705. YY_FATAL_ERROR( "input in flex scanner failed" ); \
  706. result = n; \
  707. } \
  708. else \
  709. { \
  710. errno=0; \
  711. while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
  712. { \
  713. if( errno != EINTR) \
  714. { \
  715. YY_FATAL_ERROR( "input in flex scanner failed" ); \
  716. break; \
  717. } \
  718. errno=0; \
  719. clearerr(yyin); \
  720. } \
  721. }\
  722. \
  723. #endif
  724. /* No semi-colon after return; correct usage is to write "yyterminate();" -
  725. * we don't want an extra ';' after the "return" because that will cause
  726. * some compilers to complain about unreachable statements.
  727. */
  728. #ifndef yyterminate
  729. #define yyterminate() return YY_NULL
  730. #endif
  731. /* Number of entries by which start-condition stack grows. */
  732. #ifndef YY_START_STACK_INCR
  733. #define YY_START_STACK_INCR 25
  734. #endif
  735. /* Report a fatal error. */
  736. #ifndef YY_FATAL_ERROR
  737. #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
  738. #endif
  739. /* end tables serialization structures and prototypes */
  740. /* Default declaration of generated scanner - a define so the user can
  741. * easily add parameters.
  742. */
  743. #ifndef YY_DECL
  744. #define YY_DECL_IS_OURS 1
  745. extern int yylex \
  746. (YYSTYPE * yylval_param, YYLTYPE * yylloc_param );
  747. #define YY_DECL int yylex \
  748. (YYSTYPE * yylval_param, YYLTYPE * yylloc_param )
  749. #endif /* !YY_DECL */
  750. /* Code executed at the beginning of each rule, after yytext and yyleng
  751. * have been set up.
  752. */
  753. #ifndef YY_USER_ACTION
  754. #define YY_USER_ACTION
  755. #endif
  756. /* Code executed at the end of each rule. */
  757. #ifndef YY_BREAK
  758. #define YY_BREAK /*LINTED*/break;
  759. #endif
  760. #define YY_RULE_SETUP \
  761. if ( yyleng > 0 ) \
  762. YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
  763. (yytext[yyleng - 1] == '\n'); \
  764. YY_USER_ACTION
  765. /** The main scanner function which does all the work.
  766. */
  767. YY_DECL
  768. {
  769. yy_state_type yy_current_state;
  770. char *yy_cp, *yy_bp;
  771. int yy_act;
  772. YYSTYPE * yylval;
  773. YYLTYPE * yylloc;
  774. yylval = yylval_param;
  775. yylloc = yylloc_param;
  776. if ( !(yy_init) )
  777. {
  778. (yy_init) = 1;
  779. #ifdef YY_USER_INIT
  780. YY_USER_INIT;
  781. #endif
  782. if ( ! (yy_start) )
  783. (yy_start) = 1; /* first start state */
  784. if ( ! yyin )
  785. yyin = stdin;
  786. if ( ! yyout )
  787. yyout = stdout;
  788. if ( ! YY_CURRENT_BUFFER ) {
  789. yyensure_buffer_stack ();
  790. YY_CURRENT_BUFFER_LVALUE =
  791. yy_create_buffer( yyin, YY_BUF_SIZE );
  792. }
  793. yy_load_buffer_state( );
  794. }
  795. {
  796. #line 160 "tokenizer.lex"
  797. #line 958 "lex.yy.c"
  798. while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
  799. {
  800. yy_cp = (yy_c_buf_p);
  801. /* Support of yytext. */
  802. *yy_cp = (yy_hold_char);
  803. /* yy_bp points to the position in yy_ch_buf of the start of
  804. * the current run.
  805. */
  806. yy_bp = yy_cp;
  807. yy_current_state = (yy_start);
  808. yy_current_state += YY_AT_BOL();
  809. yy_match:
  810. do
  811. {
  812. YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
  813. if ( yy_accept[yy_current_state] )
  814. {
  815. (yy_last_accepting_state) = yy_current_state;
  816. (yy_last_accepting_cpos) = yy_cp;
  817. }
  818. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  819. {
  820. yy_current_state = (int) yy_def[yy_current_state];
  821. if ( yy_current_state >= 158 )
  822. yy_c = yy_meta[yy_c];
  823. }
  824. yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  825. ++yy_cp;
  826. }
  827. while ( yy_base[yy_current_state] != 176 );
  828. yy_find_action:
  829. yy_act = yy_accept[yy_current_state];
  830. if ( yy_act == 0 )
  831. { /* have to back up */
  832. yy_cp = (yy_last_accepting_cpos);
  833. yy_current_state = (yy_last_accepting_state);
  834. yy_act = yy_accept[yy_current_state];
  835. }
  836. YY_DO_BEFORE_ACTION;
  837. do_action: /* This label is used only to access EOF actions. */
  838. switch ( yy_act )
  839. { /* beginning of action switch */
  840. case 0: /* must back up */
  841. /* undo the effects of YY_DO_BEFORE_ACTION */
  842. *yy_cp = (yy_hold_char);
  843. yy_cp = (yy_last_accepting_cpos);
  844. yy_current_state = (yy_last_accepting_state);
  845. goto yy_find_action;
  846. case 1:
  847. YY_RULE_SETUP
  848. #line 162 "tokenizer.lex"
  849. { *yylval = malloc(sizeof(double)); *((double *) *yylval) = atof(yytext); return FLOAT; }
  850. YY_BREAK
  851. case 2:
  852. YY_RULE_SETUP
  853. #line 164 "tokenizer.lex"
  854. { *yylval = malloc(sizeof(long)); *((long *) *yylval) = atol(yytext); return INT; }
  855. YY_BREAK
  856. case 3:
  857. /* rule 3 can match eol */
  858. #line 167 "tokenizer.lex"
  859. case 4:
  860. /* rule 4 can match eol */
  861. YY_RULE_SETUP
  862. #line 167 "tokenizer.lex"
  863. { *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; }
  864. YY_BREAK
  865. case 5:
  866. YY_RULE_SETUP
  867. #line 169 "tokenizer.lex"
  868. { return IF; }
  869. YY_BREAK
  870. case 6:
  871. YY_RULE_SETUP
  872. #line 171 "tokenizer.lex"
  873. { return THEN; }
  874. YY_BREAK
  875. case 7:
  876. YY_RULE_SETUP
  877. #line 173 "tokenizer.lex"
  878. { return ELSE; }
  879. YY_BREAK
  880. case 8:
  881. YY_RULE_SETUP
  882. #line 175 "tokenizer.lex"
  883. { return ELSEIF; }
  884. YY_BREAK
  885. case 9:
  886. YY_RULE_SETUP
  887. #line 177 "tokenizer.lex"
  888. { return WHILE; }
  889. YY_BREAK
  890. case 10:
  891. YY_RULE_SETUP
  892. #line 179 "tokenizer.lex"
  893. { return FOR; }
  894. YY_BREAK
  895. case 11:
  896. YY_RULE_SETUP
  897. #line 181 "tokenizer.lex"
  898. { return IN; }
  899. YY_BREAK
  900. case 12:
  901. YY_RULE_SETUP
  902. #line 183 "tokenizer.lex"
  903. { return DO; }
  904. YY_BREAK
  905. case 13:
  906. YY_RULE_SETUP
  907. #line 185 "tokenizer.lex"
  908. { return FUNC; }
  909. YY_BREAK
  910. case 14:
  911. YY_RULE_SETUP
  912. #line 187 "tokenizer.lex"
  913. { return MACRO; }
  914. YY_BREAK
  915. case 15:
  916. YY_RULE_SETUP
  917. #line 189 "tokenizer.lex"
  918. { return LAMBDA; }
  919. YY_BREAK
  920. case 16:
  921. YY_RULE_SETUP
  922. #line 191 "tokenizer.lex"
  923. { return RETURN; }
  924. YY_BREAK
  925. case 17:
  926. YY_RULE_SETUP
  927. #line 193 "tokenizer.lex"
  928. { return BREAK; }
  929. YY_BREAK
  930. case 18:
  931. YY_RULE_SETUP
  932. #line 195 "tokenizer.lex"
  933. { return CONTINUE; }
  934. YY_BREAK
  935. case 19:
  936. YY_RULE_SETUP
  937. #line 197 "tokenizer.lex"
  938. { return END; }
  939. YY_BREAK
  940. case 20:
  941. YY_RULE_SETUP
  942. #line 199 "tokenizer.lex"
  943. { return NONE; }
  944. YY_BREAK
  945. case 21:
  946. YY_RULE_SETUP
  947. #line 201 "tokenizer.lex"
  948. { return PLUS; }
  949. YY_BREAK
  950. case 22:
  951. YY_RULE_SETUP
  952. #line 203 "tokenizer.lex"
  953. { return MINUS; }
  954. YY_BREAK
  955. case 23:
  956. YY_RULE_SETUP
  957. #line 205 "tokenizer.lex"
  958. { return STAR; }
  959. YY_BREAK
  960. case 24:
  961. YY_RULE_SETUP
  962. #line 207 "tokenizer.lex"
  963. { return SLASH; }
  964. YY_BREAK
  965. case 25:
  966. YY_RULE_SETUP
  967. #line 209 "tokenizer.lex"
  968. { return PERCENT; }
  969. YY_BREAK
  970. case 26:
  971. YY_RULE_SETUP
  972. #line 211 "tokenizer.lex"
  973. { return PERCENT; }
  974. YY_BREAK
  975. case 27:
  976. YY_RULE_SETUP
  977. #line 213 "tokenizer.lex"
  978. { return DSTAR; }
  979. YY_BREAK
  980. case 28:
  981. YY_RULE_SETUP
  982. #line 215 "tokenizer.lex"
  983. { return BAND; }
  984. YY_BREAK
  985. case 29:
  986. YY_RULE_SETUP
  987. #line 217 "tokenizer.lex"
  988. { return BOR; }
  989. YY_BREAK
  990. case 30:
  991. YY_RULE_SETUP
  992. #line 219 "tokenizer.lex"
  993. { return BXOR; }
  994. YY_BREAK
  995. case 31:
  996. YY_RULE_SETUP
  997. #line 221 "tokenizer.lex"
  998. { return BNOT; }
  999. YY_BREAK
  1000. case 32:
  1001. YY_RULE_SETUP
  1002. #line 223 "tokenizer.lex"
  1003. { return LAND; }
  1004. YY_BREAK
  1005. case 33:
  1006. YY_RULE_SETUP
  1007. #line 225 "tokenizer.lex"
  1008. { return LAND; }
  1009. YY_BREAK
  1010. case 34:
  1011. YY_RULE_SETUP
  1012. #line 227 "tokenizer.lex"
  1013. { return LOR; }
  1014. YY_BREAK
  1015. case 35:
  1016. YY_RULE_SETUP
  1017. #line 229 "tokenizer.lex"
  1018. { return LOR; }
  1019. YY_BREAK
  1020. case 36:
  1021. YY_RULE_SETUP
  1022. #line 231 "tokenizer.lex"
  1023. { return LNOT; }
  1024. YY_BREAK
  1025. case 37:
  1026. YY_RULE_SETUP
  1027. #line 233 "tokenizer.lex"
  1028. { return LNOT; }
  1029. YY_BREAK
  1030. case 38:
  1031. YY_RULE_SETUP
  1032. #line 235 "tokenizer.lex"
  1033. { *yylval = malloc(sizeof(long)); *((long *) *yylval) = 1; return INT; }
  1034. YY_BREAK
  1035. case 39:
  1036. YY_RULE_SETUP
  1037. #line 237 "tokenizer.lex"
  1038. { *yylval = malloc(sizeof(long)); *((long *) *yylval) = 1; return INT; }
  1039. YY_BREAK
  1040. case 40:
  1041. YY_RULE_SETUP
  1042. #line 239 "tokenizer.lex"
  1043. { *yylval = malloc(sizeof(long)); *((long *) *yylval) = 0; return INT; }
  1044. YY_BREAK
  1045. case 41:
  1046. YY_RULE_SETUP
  1047. #line 241 "tokenizer.lex"
  1048. { *yylval = malloc(sizeof(long)); *((long *) *yylval) = 0; return INT; }
  1049. YY_BREAK
  1050. case 42:
  1051. YY_RULE_SETUP
  1052. #line 243 "tokenizer.lex"
  1053. { return ASSIGN; }
  1054. YY_BREAK
  1055. case 43:
  1056. YY_RULE_SETUP
  1057. #line 245 "tokenizer.lex"
  1058. { return ASSIGNPLUS; }
  1059. YY_BREAK
  1060. case 44:
  1061. YY_RULE_SETUP
  1062. #line 247 "tokenizer.lex"
  1063. { return ASSIGNMINUS; }
  1064. YY_BREAK
  1065. case 45:
  1066. YY_RULE_SETUP
  1067. #line 249 "tokenizer.lex"
  1068. { return ASSIGNSTAR; }
  1069. YY_BREAK
  1070. case 46:
  1071. YY_RULE_SETUP
  1072. #line 251 "tokenizer.lex"
  1073. { return ASSIGNSLASH; }
  1074. YY_BREAK
  1075. case 47:
  1076. YY_RULE_SETUP
  1077. #line 253 "tokenizer.lex"
  1078. { return ASSIGNDSTAR; }
  1079. YY_BREAK
  1080. case 48:
  1081. YY_RULE_SETUP
  1082. #line 255 "tokenizer.lex"
  1083. { return ASSIGNBAND; }
  1084. YY_BREAK
  1085. case 49:
  1086. YY_RULE_SETUP
  1087. #line 257 "tokenizer.lex"
  1088. { return ASSIGNBOR; }
  1089. YY_BREAK
  1090. case 50:
  1091. YY_RULE_SETUP
  1092. #line 259 "tokenizer.lex"
  1093. { return ASSIGNBXOR; }
  1094. YY_BREAK
  1095. case 51:
  1096. YY_RULE_SETUP
  1097. #line 261 "tokenizer.lex"
  1098. { return EQUAL; }
  1099. YY_BREAK
  1100. case 52:
  1101. YY_RULE_SETUP
  1102. #line 263 "tokenizer.lex"
  1103. { return NEQUAL; }
  1104. YY_BREAK
  1105. case 53:
  1106. YY_RULE_SETUP
  1107. #line 265 "tokenizer.lex"
  1108. { return LESS; }
  1109. YY_BREAK
  1110. case 54:
  1111. YY_RULE_SETUP
  1112. #line 267 "tokenizer.lex"
  1113. { return GREATER; }
  1114. YY_BREAK
  1115. case 55:
  1116. YY_RULE_SETUP
  1117. #line 269 "tokenizer.lex"
  1118. { return LESSEQ; }
  1119. YY_BREAK
  1120. case 56:
  1121. YY_RULE_SETUP
  1122. #line 271 "tokenizer.lex"
  1123. { return GREATEREQ; }
  1124. YY_BREAK
  1125. case 57:
  1126. YY_RULE_SETUP
  1127. #line 273 "tokenizer.lex"
  1128. { return RSHIFT; }
  1129. YY_BREAK
  1130. case 58:
  1131. YY_RULE_SETUP
  1132. #line 275 "tokenizer.lex"
  1133. { return LSHIFT; }
  1134. YY_BREAK
  1135. case 59:
  1136. YY_RULE_SETUP
  1137. #line 277 "tokenizer.lex"
  1138. { return LBRACE; }
  1139. YY_BREAK
  1140. case 60:
  1141. YY_RULE_SETUP
  1142. #line 279 "tokenizer.lex"
  1143. { return RBRACE; }
  1144. YY_BREAK
  1145. case 61:
  1146. YY_RULE_SETUP
  1147. #line 281 "tokenizer.lex"
  1148. { return LBRACKET; }
  1149. YY_BREAK
  1150. case 62:
  1151. YY_RULE_SETUP
  1152. #line 283 "tokenizer.lex"
  1153. { return RBRACKET; }
  1154. YY_BREAK
  1155. case 63:
  1156. YY_RULE_SETUP
  1157. #line 285 "tokenizer.lex"
  1158. { return BLPAREN; } /* "Breaking" paren, not allowed to introduce a call_expr */
  1159. YY_BREAK
  1160. case 64:
  1161. YY_RULE_SETUP
  1162. #line 287 "tokenizer.lex"
  1163. { return LPAREN; }
  1164. YY_BREAK
  1165. case 65:
  1166. YY_RULE_SETUP
  1167. #line 289 "tokenizer.lex"
  1168. { return RPAREN; }
  1169. YY_BREAK
  1170. case 66:
  1171. YY_RULE_SETUP
  1172. #line 291 "tokenizer.lex"
  1173. { return DOT; }
  1174. YY_BREAK
  1175. case 67:
  1176. YY_RULE_SETUP
  1177. #line 293 "tokenizer.lex"
  1178. { return COLON; }
  1179. YY_BREAK
  1180. case 68:
  1181. YY_RULE_SETUP
  1182. #line 295 "tokenizer.lex"
  1183. { return SEMICOLON; }
  1184. YY_BREAK
  1185. case 69:
  1186. YY_RULE_SETUP
  1187. #line 297 "tokenizer.lex"
  1188. { return COMMA; }
  1189. YY_BREAK
  1190. case 70:
  1191. YY_RULE_SETUP
  1192. #line 299 "tokenizer.lex"
  1193. { return POUND; }
  1194. YY_BREAK
  1195. case 71:
  1196. YY_RULE_SETUP
  1197. #line 301 "tokenizer.lex"
  1198. { return TBANG; }
  1199. YY_BREAK
  1200. case 72:
  1201. YY_RULE_SETUP
  1202. #line 303 "tokenizer.lex"
  1203. { *yylval = (void *) strdup(yytext); return IDENT; }
  1204. YY_BREAK
  1205. case 73:
  1206. /* rule 73 can match eol */
  1207. YY_RULE_SETUP
  1208. #line 305 "tokenizer.lex"
  1209. /* Skip comments */
  1210. YY_BREAK
  1211. case 74:
  1212. /* rule 74 can match eol */
  1213. YY_RULE_SETUP
  1214. #line 307 "tokenizer.lex"
  1215. /* Skip whitespace */
  1216. YY_BREAK
  1217. case 75:
  1218. YY_RULE_SETUP
  1219. #line 309 "tokenizer.lex"
  1220. ECHO;
  1221. YY_BREAK
  1222. #line 1392 "lex.yy.c"
  1223. case YY_STATE_EOF(INITIAL):
  1224. yyterminate();
  1225. case YY_END_OF_BUFFER:
  1226. {
  1227. /* Amount of text matched not including the EOB char. */
  1228. int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
  1229. /* Undo the effects of YY_DO_BEFORE_ACTION. */
  1230. *yy_cp = (yy_hold_char);
  1231. YY_RESTORE_YY_MORE_OFFSET
  1232. if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
  1233. {
  1234. /* We're scanning a new file or input source. It's
  1235. * possible that this happened because the user
  1236. * just pointed yyin at a new source and called
  1237. * yylex(). If so, then we have to assure
  1238. * consistency between YY_CURRENT_BUFFER and our
  1239. * globals. Here is the right place to do so, because
  1240. * this is the first action (other than possibly a
  1241. * back-up) that will match for the new input source.
  1242. */
  1243. (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  1244. YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
  1245. YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
  1246. }
  1247. /* Note that here we test for yy_c_buf_p "<=" to the position
  1248. * of the first EOB in the buffer, since yy_c_buf_p will
  1249. * already have been incremented past the NUL character
  1250. * (since all states make transitions on EOB to the
  1251. * end-of-buffer state). Contrast this with the test
  1252. * in input().
  1253. */
  1254. if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
  1255. { /* This was really a NUL. */
  1256. yy_state_type yy_next_state;
  1257. (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
  1258. yy_current_state = yy_get_previous_state( );
  1259. /* Okay, we're now positioned to make the NUL
  1260. * transition. We couldn't have
  1261. * yy_get_previous_state() go ahead and do it
  1262. * for us because it doesn't know how to deal
  1263. * with the possibility of jamming (and we don't
  1264. * want to build jamming into it because then it
  1265. * will run more slowly).
  1266. */
  1267. yy_next_state = yy_try_NUL_trans( yy_current_state );
  1268. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  1269. if ( yy_next_state )
  1270. {
  1271. /* Consume the NUL. */
  1272. yy_cp = ++(yy_c_buf_p);
  1273. yy_current_state = yy_next_state;
  1274. goto yy_match;
  1275. }
  1276. else
  1277. {
  1278. yy_cp = (yy_c_buf_p);
  1279. goto yy_find_action;
  1280. }
  1281. }
  1282. else switch ( yy_get_next_buffer( ) )
  1283. {
  1284. case EOB_ACT_END_OF_FILE:
  1285. {
  1286. (yy_did_buffer_switch_on_eof) = 0;
  1287. if ( yywrap( ) )
  1288. {
  1289. /* Note: because we've taken care in
  1290. * yy_get_next_buffer() to have set up
  1291. * yytext, we can now set up
  1292. * yy_c_buf_p so that if some total
  1293. * hoser (like flex itself) wants to
  1294. * call the scanner after we return the
  1295. * YY_NULL, it'll still work - another
  1296. * YY_NULL will get returned.
  1297. */
  1298. (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
  1299. yy_act = YY_STATE_EOF(YY_START);
  1300. goto do_action;
  1301. }
  1302. else
  1303. {
  1304. if ( ! (yy_did_buffer_switch_on_eof) )
  1305. YY_NEW_FILE;
  1306. }
  1307. break;
  1308. }
  1309. case EOB_ACT_CONTINUE_SCAN:
  1310. (yy_c_buf_p) =
  1311. (yytext_ptr) + yy_amount_of_matched_text;
  1312. yy_current_state = yy_get_previous_state( );
  1313. yy_cp = (yy_c_buf_p);
  1314. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  1315. goto yy_match;
  1316. case EOB_ACT_LAST_MATCH:
  1317. (yy_c_buf_p) =
  1318. &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
  1319. yy_current_state = yy_get_previous_state( );
  1320. yy_cp = (yy_c_buf_p);
  1321. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  1322. goto yy_find_action;
  1323. }
  1324. break;
  1325. }
  1326. default:
  1327. YY_FATAL_ERROR(
  1328. "fatal flex scanner internal error--no action found" );
  1329. } /* end of action switch */
  1330. } /* end of scanning one token */
  1331. } /* end of user's declarations */
  1332. } /* end of yylex */
  1333. /* yy_get_next_buffer - try to read in a new buffer
  1334. *
  1335. * Returns a code representing an action:
  1336. * EOB_ACT_LAST_MATCH -
  1337. * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  1338. * EOB_ACT_END_OF_FILE - end of file
  1339. */
  1340. static int yy_get_next_buffer (void)
  1341. {
  1342. char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
  1343. char *source = (yytext_ptr);
  1344. int number_to_move, i;
  1345. int ret_val;
  1346. if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
  1347. YY_FATAL_ERROR(
  1348. "fatal flex scanner internal error--end of buffer missed" );
  1349. if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
  1350. { /* Don't try to fill the buffer, so this is an EOF. */
  1351. if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
  1352. {
  1353. /* We matched a single character, the EOB, so
  1354. * treat this as a final EOF.
  1355. */
  1356. return EOB_ACT_END_OF_FILE;
  1357. }
  1358. else
  1359. {
  1360. /* We matched some text prior to the EOB, first
  1361. * process it.
  1362. */
  1363. return EOB_ACT_LAST_MATCH;
  1364. }
  1365. }
  1366. /* Try to read more data. */
  1367. /* First move last chars to start of buffer. */
  1368. number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1);
  1369. for ( i = 0; i < number_to_move; ++i )
  1370. *(dest++) = *(source++);
  1371. if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
  1372. /* don't do the read, it's not guaranteed to return an EOF,
  1373. * just force an EOF
  1374. */
  1375. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
  1376. else
  1377. {
  1378. int num_to_read =
  1379. YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
  1380. while ( num_to_read <= 0 )
  1381. { /* Not enough room in the buffer - grow it. */
  1382. /* just a shorter name for the current buffer */
  1383. YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
  1384. int yy_c_buf_p_offset =
  1385. (int) ((yy_c_buf_p) - b->yy_ch_buf);
  1386. if ( b->yy_is_our_buffer )
  1387. {
  1388. int new_size = b->yy_buf_size * 2;
  1389. if ( new_size <= 0 )
  1390. b->yy_buf_size += b->yy_buf_size / 8;
  1391. else
  1392. b->yy_buf_size *= 2;
  1393. b->yy_ch_buf = (char *)
  1394. /* Include room in for 2 EOB chars. */
  1395. yyrealloc( (void *) b->yy_ch_buf,
  1396. (yy_size_t) (b->yy_buf_size + 2) );
  1397. }
  1398. else
  1399. /* Can't grow it, we don't own it. */
  1400. b->yy_ch_buf = NULL;
  1401. if ( ! b->yy_ch_buf )
  1402. YY_FATAL_ERROR(
  1403. "fatal error - scanner input buffer overflow" );
  1404. (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
  1405. num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
  1406. number_to_move - 1;
  1407. }
  1408. if ( num_to_read > YY_READ_BUF_SIZE )
  1409. num_to_read = YY_READ_BUF_SIZE;
  1410. /* Read in more data. */
  1411. YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
  1412. (yy_n_chars), num_to_read );
  1413. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1414. }
  1415. if ( (yy_n_chars) == 0 )
  1416. {
  1417. if ( number_to_move == YY_MORE_ADJ )
  1418. {
  1419. ret_val = EOB_ACT_END_OF_FILE;
  1420. yyrestart( yyin );
  1421. }
  1422. else
  1423. {
  1424. ret_val = EOB_ACT_LAST_MATCH;
  1425. YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
  1426. YY_BUFFER_EOF_PENDING;
  1427. }
  1428. }
  1429. else
  1430. ret_val = EOB_ACT_CONTINUE_SCAN;
  1431. if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
  1432. /* Extend the array by 50%, plus the number we really need. */
  1433. int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
  1434. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
  1435. (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size );
  1436. if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
  1437. YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
  1438. /* "- 2" to take care of EOB's */
  1439. YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
  1440. }
  1441. (yy_n_chars) += number_to_move;
  1442. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
  1443. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
  1444. (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
  1445. return ret_val;
  1446. }
  1447. /* yy_get_previous_state - get the state just before the EOB char was reached */
  1448. static yy_state_type yy_get_previous_state (void)
  1449. {
  1450. yy_state_type yy_current_state;
  1451. char *yy_cp;
  1452. yy_current_state = (yy_start);
  1453. yy_current_state += YY_AT_BOL();
  1454. for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
  1455. {
  1456. YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
  1457. if ( yy_accept[yy_current_state] )
  1458. {
  1459. (yy_last_accepting_state) = yy_current_state;
  1460. (yy_last_accepting_cpos) = yy_cp;
  1461. }
  1462. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1463. {
  1464. yy_current_state = (int) yy_def[yy_current_state];
  1465. if ( yy_current_state >= 158 )
  1466. yy_c = yy_meta[yy_c];
  1467. }
  1468. yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  1469. }
  1470. return yy_current_state;
  1471. }
  1472. /* yy_try_NUL_trans - try to make a transition on the NUL character
  1473. *
  1474. * synopsis
  1475. * next_state = yy_try_NUL_trans( current_state );
  1476. */
  1477. static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
  1478. {
  1479. int yy_is_jam;
  1480. char *yy_cp = (yy_c_buf_p);
  1481. YY_CHAR yy_c = 1;
  1482. if ( yy_accept[yy_current_state] )
  1483. {
  1484. (yy_last_accepting_state) = yy_current_state;
  1485. (yy_last_accepting_cpos) = yy_cp;
  1486. }
  1487. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1488. {
  1489. yy_current_state = (int) yy_def[yy_current_state];
  1490. if ( yy_current_state >= 158 )
  1491. yy_c = yy_meta[yy_c];
  1492. }
  1493. yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  1494. yy_is_jam = (yy_current_state == 157);
  1495. return yy_is_jam ? 0 : yy_current_state;
  1496. }
  1497. #ifndef YY_NO_UNPUT
  1498. static void yyunput (int c, char * yy_bp )
  1499. {
  1500. char *yy_cp;
  1501. yy_cp = (yy_c_buf_p);
  1502. /* undo effects of setting up yytext */
  1503. *yy_cp = (yy_hold_char);
  1504. if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
  1505. { /* need to shift things up to make room */
  1506. /* +2 for EOB chars. */
  1507. int number_to_move = (yy_n_chars) + 2;
  1508. char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
  1509. YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
  1510. char *source =
  1511. &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
  1512. while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
  1513. *--dest = *--source;
  1514. yy_cp += (int) (dest - source);
  1515. yy_bp += (int) (dest - source);
  1516. YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
  1517. (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
  1518. if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
  1519. YY_FATAL_ERROR( "flex scanner push-back overflow" );
  1520. }
  1521. *--yy_cp = (char) c;
  1522. (yytext_ptr) = yy_bp;
  1523. (yy_hold_char) = *yy_cp;
  1524. (yy_c_buf_p) = yy_cp;
  1525. }
  1526. #endif
  1527. #ifndef YY_NO_INPUT
  1528. #ifdef __cplusplus
  1529. static int yyinput (void)
  1530. #else
  1531. static int input (void)
  1532. #endif
  1533. {
  1534. int c;
  1535. *(yy_c_buf_p) = (yy_hold_char);
  1536. if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
  1537. {
  1538. /* yy_c_buf_p now points to the character we want to return.
  1539. * If this occurs *before* the EOB characters, then it's a
  1540. * valid NUL; if not, then we've hit the end of the buffer.
  1541. */
  1542. if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
  1543. /* This was really a NUL. */
  1544. *(yy_c_buf_p) = '\0';
  1545. else
  1546. { /* need more input */
  1547. int offset = (int) ((yy_c_buf_p) - (yytext_ptr));
  1548. ++(yy_c_buf_p);
  1549. switch ( yy_get_next_buffer( ) )
  1550. {
  1551. case EOB_ACT_LAST_MATCH:
  1552. /* This happens because yy_g_n_b()
  1553. * sees that we've accumulated a
  1554. * token and flags that we need to
  1555. * try matching the token before
  1556. * proceeding. But for input(),
  1557. * there's no matching to consider.
  1558. * So convert the EOB_ACT_LAST_MATCH
  1559. * to EOB_ACT_END_OF_FILE.
  1560. */
  1561. /* Reset buffer status. */
  1562. yyrestart( yyin );
  1563. /*FALLTHROUGH*/
  1564. case EOB_ACT_END_OF_FILE:
  1565. {
  1566. if ( yywrap( ) )
  1567. return 0;
  1568. if ( ! (yy_did_buffer_switch_on_eof) )
  1569. YY_NEW_FILE;
  1570. #ifdef __cplusplus
  1571. return yyinput();
  1572. #else
  1573. return input();
  1574. #endif
  1575. }
  1576. case EOB_ACT_CONTINUE_SCAN:
  1577. (yy_c_buf_p) = (yytext_ptr) + offset;
  1578. break;
  1579. }
  1580. }
  1581. }
  1582. c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
  1583. *(yy_c_buf_p) = '\0'; /* preserve yytext */
  1584. (yy_hold_char) = *++(yy_c_buf_p);
  1585. YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
  1586. return c;
  1587. }
  1588. #endif /* ifndef YY_NO_INPUT */
  1589. /** Immediately switch to a different input stream.
  1590. * @param input_file A readable stream.
  1591. *
  1592. * @note This function does not reset the start condition to @c INITIAL .
  1593. */
  1594. void yyrestart (FILE * input_file )
  1595. {
  1596. if ( ! YY_CURRENT_BUFFER ){
  1597. yyensure_buffer_stack ();
  1598. YY_CURRENT_BUFFER_LVALUE =
  1599. yy_create_buffer( yyin, YY_BUF_SIZE );
  1600. }
  1601. yy_init_buffer( YY_CURRENT_BUFFER, input_file );
  1602. yy_load_buffer_state( );
  1603. }
  1604. /** Switch to a different input buffer.
  1605. * @param new_buffer The new input buffer.
  1606. *
  1607. */
  1608. void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
  1609. {
  1610. /* TODO. We should be able to replace this entire function body
  1611. * with
  1612. * yypop_buffer_state();
  1613. * yypush_buffer_state(new_buffer);
  1614. */
  1615. yyensure_buffer_stack ();
  1616. if ( YY_CURRENT_BUFFER == new_buffer )
  1617. return;
  1618. if ( YY_CURRENT_BUFFER )
  1619. {
  1620. /* Flush out information for old buffer. */
  1621. *(yy_c_buf_p) = (yy_hold_char);
  1622. YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
  1623. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1624. }
  1625. YY_CURRENT_BUFFER_LVALUE = new_buffer;
  1626. yy_load_buffer_state( );
  1627. /* We don't actually know whether we did this switch during
  1628. * EOF (yywrap()) processing, but the only time this flag
  1629. * is looked at is after yywrap() is called, so it's safe
  1630. * to go ahead and always set it.
  1631. */
  1632. (yy_did_buffer_switch_on_eof) = 1;
  1633. }
  1634. static void yy_load_buffer_state (void)
  1635. {
  1636. (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  1637. (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
  1638. yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
  1639. (yy_hold_char) = *(yy_c_buf_p);
  1640. }
  1641. /** Allocate and initialize an input buffer state.
  1642. * @param file A readable stream.
  1643. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
  1644. *
  1645. * @return the allocated buffer state.
  1646. */
  1647. YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
  1648. {
  1649. YY_BUFFER_STATE b;
  1650. b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
  1651. if ( ! b )
  1652. YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1653. b->yy_buf_size = size;
  1654. /* yy_ch_buf has to be 2 characters longer than the size given because
  1655. * we need to put in 2 end-of-buffer characters.
  1656. */
  1657. b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) );
  1658. if ( ! b->yy_ch_buf )
  1659. YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1660. b->yy_is_our_buffer = 1;
  1661. yy_init_buffer( b, file );
  1662. return b;
  1663. }
  1664. /** Destroy the buffer.
  1665. * @param b a buffer created with yy_create_buffer()
  1666. *
  1667. */
  1668. void yy_delete_buffer (YY_BUFFER_STATE b )
  1669. {
  1670. if ( ! b )
  1671. return;
  1672. if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
  1673. YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
  1674. if ( b->yy_is_our_buffer )
  1675. yyfree( (void *) b->yy_ch_buf );
  1676. yyfree( (void *) b );
  1677. }
  1678. /* Initializes or reinitializes a buffer.
  1679. * This function is sometimes called more than once on the same buffer,
  1680. * such as during a yyrestart() or at EOF.
  1681. */
  1682. static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
  1683. {
  1684. int oerrno = errno;
  1685. yy_flush_buffer( b );
  1686. b->yy_input_file = file;
  1687. b->yy_fill_buffer = 1;
  1688. /* If b is the current buffer, then yy_init_buffer was _probably_
  1689. * called from yyrestart() or through yy_get_next_buffer.
  1690. * In that case, we don't want to reset the lineno or column.
  1691. */
  1692. if (b != YY_CURRENT_BUFFER){
  1693. b->yy_bs_lineno = 1;
  1694. b->yy_bs_column = 0;
  1695. }
  1696. b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
  1697. errno = oerrno;
  1698. }
  1699. /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
  1700. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
  1701. *
  1702. */
  1703. void yy_flush_buffer (YY_BUFFER_STATE b )
  1704. {
  1705. if ( ! b )
  1706. return;
  1707. b->yy_n_chars = 0;
  1708. /* We always need two end-of-buffer characters. The first causes
  1709. * a transition to the end-of-buffer state. The second causes
  1710. * a jam in that state.
  1711. */
  1712. b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
  1713. b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  1714. b->yy_buf_pos = &b->yy_ch_buf[0];
  1715. b->yy_at_bol = 1;
  1716. b->yy_buffer_status = YY_BUFFER_NEW;
  1717. if ( b == YY_CURRENT_BUFFER )
  1718. yy_load_buffer_state( );
  1719. }
  1720. /** Pushes the new state onto the stack. The new state becomes
  1721. * the current state. This function will allocate the stack
  1722. * if necessary.
  1723. * @param new_buffer The new state.
  1724. *
  1725. */
  1726. void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
  1727. {
  1728. if (new_buffer == NULL)
  1729. return;
  1730. yyensure_buffer_stack();
  1731. /* This block is copied from yy_switch_to_buffer. */
  1732. if ( YY_CURRENT_BUFFER )
  1733. {
  1734. /* Flush out information for old buffer. */
  1735. *(yy_c_buf_p) = (yy_hold_char);
  1736. YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
  1737. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1738. }
  1739. /* Only push if top exists. Otherwise, replace top. */
  1740. if (YY_CURRENT_BUFFER)
  1741. (yy_buffer_stack_top)++;
  1742. YY_CURRENT_BUFFER_LVALUE = new_buffer;
  1743. /* copied from yy_switch_to_buffer. */
  1744. yy_load_buffer_state( );
  1745. (yy_did_buffer_switch_on_eof) = 1;
  1746. }
  1747. /** Removes and deletes the top of the stack, if present.
  1748. * The next element becomes the new top.
  1749. *
  1750. */
  1751. void yypop_buffer_state (void)
  1752. {
  1753. if (!YY_CURRENT_BUFFER)
  1754. return;
  1755. yy_delete_buffer(YY_CURRENT_BUFFER );
  1756. YY_CURRENT_BUFFER_LVALUE = NULL;
  1757. if ((yy_buffer_stack_top) > 0)
  1758. --(yy_buffer_stack_top);
  1759. if (YY_CURRENT_BUFFER) {
  1760. yy_load_buffer_state( );
  1761. (yy_did_buffer_switch_on_eof) = 1;
  1762. }
  1763. }
  1764. /* Allocates the stack if it does not exist.
  1765. * Guarantees space for at least one push.
  1766. */
  1767. static void yyensure_buffer_stack (void)
  1768. {
  1769. yy_size_t num_to_alloc;
  1770. if (!(yy_buffer_stack)) {
  1771. /* First allocation is just for 2 elements, since we don't know if this
  1772. * scanner will even need a stack. We use 2 instead of 1 to avoid an
  1773. * immediate realloc on the next call.
  1774. */
  1775. num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
  1776. (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
  1777. (num_to_alloc * sizeof(struct yy_buffer_state*)
  1778. );
  1779. if ( ! (yy_buffer_stack) )
  1780. YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
  1781. memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
  1782. (yy_buffer_stack_max) = num_to_alloc;
  1783. (yy_buffer_stack_top) = 0;
  1784. return;
  1785. }
  1786. if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
  1787. /* Increase the buffer to prepare for a possible push. */
  1788. yy_size_t grow_size = 8 /* arbitrary grow size */;
  1789. num_to_alloc = (yy_buffer_stack_max) + grow_size;
  1790. (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
  1791. ((yy_buffer_stack),
  1792. num_to_alloc * sizeof(struct yy_buffer_state*)
  1793. );
  1794. if ( ! (yy_buffer_stack) )
  1795. YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
  1796. /* zero only the new slots.*/
  1797. memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
  1798. (yy_buffer_stack_max) = num_to_alloc;
  1799. }
  1800. }
  1801. /** Setup the input buffer state to scan directly from a user-specified character buffer.
  1802. * @param base the character buffer
  1803. * @param size the size in bytes of the character buffer
  1804. *
  1805. * @return the newly allocated buffer state object.
  1806. */
  1807. YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
  1808. {
  1809. YY_BUFFER_STATE b;
  1810. if ( size < 2 ||
  1811. base[size-2] != YY_END_OF_BUFFER_CHAR ||
  1812. base[size-1] != YY_END_OF_BUFFER_CHAR )
  1813. /* They forgot to leave room for the EOB's. */
  1814. return NULL;
  1815. b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
  1816. if ( ! b )
  1817. YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
  1818. b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
  1819. b->yy_buf_pos = b->yy_ch_buf = base;
  1820. b->yy_is_our_buffer = 0;
  1821. b->yy_input_file = NULL;
  1822. b->yy_n_chars = b->yy_buf_size;
  1823. b->yy_is_interactive = 0;
  1824. b->yy_at_bol = 1;
  1825. b->yy_fill_buffer = 0;
  1826. b->yy_buffer_status = YY_BUFFER_NEW;
  1827. yy_switch_to_buffer( b );
  1828. return b;
  1829. }
  1830. /** Setup the input buffer state to scan a string. The next call to yylex() will
  1831. * scan from a @e copy of @a str.
  1832. * @param yystr a NUL-terminated string to scan
  1833. *
  1834. * @return the newly allocated buffer state object.
  1835. * @note If you want to scan bytes that may contain NUL values, then use
  1836. * yy_scan_bytes() instead.
  1837. */
  1838. YY_BUFFER_STATE yy_scan_string (const char * yystr )
  1839. {
  1840. return yy_scan_bytes( yystr, (int) strlen(yystr) );
  1841. }
  1842. /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
  1843. * scan from a @e copy of @a bytes.
  1844. * @param yybytes the byte buffer to scan
  1845. * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
  1846. *
  1847. * @return the newly allocated buffer state object.
  1848. */
  1849. YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len )
  1850. {
  1851. YY_BUFFER_STATE b;
  1852. char *buf;
  1853. yy_size_t n;
  1854. int i;
  1855. /* Get memory for full buffer, including space for trailing EOB's. */
  1856. n = (yy_size_t) (_yybytes_len + 2);
  1857. buf = (char *) yyalloc( n );
  1858. if ( ! buf )
  1859. YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
  1860. for ( i = 0; i < _yybytes_len; ++i )
  1861. buf[i] = yybytes[i];
  1862. buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
  1863. b = yy_scan_buffer( buf, n );
  1864. if ( ! b )
  1865. YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
  1866. /* It's okay to grow etc. this buffer, and we should throw it
  1867. * away when we're done.
  1868. */
  1869. b->yy_is_our_buffer = 1;
  1870. return b;
  1871. }
  1872. #ifndef YY_EXIT_FAILURE
  1873. #define YY_EXIT_FAILURE 2
  1874. #endif
  1875. static void yynoreturn yy_fatal_error (const char* msg )
  1876. {
  1877. fprintf( stderr, "%s\n", msg );
  1878. exit( YY_EXIT_FAILURE );
  1879. }
  1880. /* Redefine yyless() so it works in section 3 code. */
  1881. #undef yyless
  1882. #define yyless(n) \
  1883. do \
  1884. { \
  1885. /* Undo effects of setting up yytext. */ \
  1886. int yyless_macro_arg = (n); \
  1887. YY_LESS_LINENO(yyless_macro_arg);\
  1888. yytext[yyleng] = (yy_hold_char); \
  1889. (yy_c_buf_p) = yytext + yyless_macro_arg; \
  1890. (yy_hold_char) = *(yy_c_buf_p); \
  1891. *(yy_c_buf_p) = '\0'; \
  1892. yyleng = yyless_macro_arg; \
  1893. } \
  1894. while ( 0 )
  1895. /* Accessor methods (get/set functions) to struct members. */
  1896. /** Get the current line number.
  1897. *
  1898. */
  1899. int yyget_lineno (void)
  1900. {
  1901. return yylineno;
  1902. }
  1903. /** Get the input stream.
  1904. *
  1905. */
  1906. FILE *yyget_in (void)
  1907. {
  1908. return yyin;
  1909. }
  1910. /** Get the output stream.
  1911. *
  1912. */
  1913. FILE *yyget_out (void)
  1914. {
  1915. return yyout;
  1916. }
  1917. /** Get the length of the current token.
  1918. *
  1919. */
  1920. int yyget_leng (void)
  1921. {
  1922. return yyleng;
  1923. }
  1924. /** Get the current token.
  1925. *
  1926. */
  1927. char *yyget_text (void)
  1928. {
  1929. return yytext;
  1930. }
  1931. /** Set the current line number.
  1932. * @param _line_number line number
  1933. *
  1934. */
  1935. void yyset_lineno (int _line_number )
  1936. {
  1937. yylineno = _line_number;
  1938. }
  1939. /** Set the input stream. This does not discard the current
  1940. * input buffer.
  1941. * @param _in_str A readable stream.
  1942. *
  1943. * @see yy_switch_to_buffer
  1944. */
  1945. void yyset_in (FILE * _in_str )
  1946. {
  1947. yyin = _in_str ;
  1948. }
  1949. void yyset_out (FILE * _out_str )
  1950. {
  1951. yyout = _out_str ;
  1952. }
  1953. int yyget_debug (void)
  1954. {
  1955. return yy_flex_debug;
  1956. }
  1957. void yyset_debug (int _bdebug )
  1958. {
  1959. yy_flex_debug = _bdebug ;
  1960. }
  1961. static int yy_init_globals (void)
  1962. {
  1963. /* Initialization is the same as for the non-reentrant scanner.
  1964. * This function is called from yylex_destroy(), so don't allocate here.
  1965. */
  1966. (yy_buffer_stack) = NULL;
  1967. (yy_buffer_stack_top) = 0;
  1968. (yy_buffer_stack_max) = 0;
  1969. (yy_c_buf_p) = NULL;
  1970. (yy_init) = 0;
  1971. (yy_start) = 0;
  1972. /* Defined in main.c */
  1973. #ifdef YY_STDINIT
  1974. yyin = stdin;
  1975. yyout = stdout;
  1976. #else
  1977. yyin = NULL;
  1978. yyout = NULL;
  1979. #endif
  1980. /* For future reference: Set errno on error, since we are called by
  1981. * yylex_init()
  1982. */
  1983. return 0;
  1984. }
  1985. /* yylex_destroy is for both reentrant and non-reentrant scanners. */
  1986. int yylex_destroy (void)
  1987. {
  1988. /* Pop the buffer stack, destroying each element. */
  1989. while(YY_CURRENT_BUFFER){
  1990. yy_delete_buffer( YY_CURRENT_BUFFER );
  1991. YY_CURRENT_BUFFER_LVALUE = NULL;
  1992. yypop_buffer_state();
  1993. }
  1994. /* Destroy the stack itself. */
  1995. yyfree((yy_buffer_stack) );
  1996. (yy_buffer_stack) = NULL;
  1997. /* Reset the globals. This is important in a non-reentrant scanner so the next time
  1998. * yylex() is called, initialization will occur. */
  1999. yy_init_globals( );
  2000. return 0;
  2001. }
  2002. /*
  2003. * Internal utility routines.
  2004. */
  2005. #ifndef yytext_ptr
  2006. static void yy_flex_strncpy (char* s1, const char * s2, int n )
  2007. {
  2008. int i;
  2009. for ( i = 0; i < n; ++i )
  2010. s1[i] = s2[i];
  2011. }
  2012. #endif
  2013. #ifdef YY_NEED_STRLEN
  2014. static int yy_flex_strlen (const char * s )
  2015. {
  2016. int n;
  2017. for ( n = 0; s[n]; ++n )
  2018. ;
  2019. return n;
  2020. }
  2021. #endif
  2022. void *yyalloc (yy_size_t size )
  2023. {
  2024. return malloc(size);
  2025. }
  2026. void *yyrealloc (void * ptr, yy_size_t size )
  2027. {
  2028. /* The cast to (char *) in the following accommodates both
  2029. * implementations that use char* generic pointers, and those
  2030. * that use void* generic pointers. It works with the latter
  2031. * because both ANSI C and C++ allow castless assignment from
  2032. * any pointer type to void*, and deal with argument conversions
  2033. * as though doing an assignment.
  2034. */
  2035. return realloc(ptr, size);
  2036. }
  2037. void yyfree (void * ptr )
  2038. {
  2039. free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
  2040. }
  2041. #define YYTABLES_NAME "yytables"
  2042. #line 309 "tokenizer.lex"
  2043. int yywrap(void) {
  2044. return 1;
  2045. }
  2046. void yyerror(YYLTYPE *locp, stmt_node **prog, char *err) {
  2047. fputs(err, stderr);
  2048. fprintf(stderr, "\n(at lines %d-%d, cols %d-%d)\n", locp->first_line, locp->last_line, locp->first_column, locp->last_column);
  2049. if(prog && *prog) {
  2050. fprintf(stderr, "(while building a stmt of type %d)\n", (*prog)->type);
  2051. }
  2052. }
  2053. stmt_node *sol_compile(const char *prgstr) {
  2054. stmt_node *program = NULL;
  2055. YY_BUFFER_STATE buf = yy_scan_string(prgstr);
  2056. yyparse(&program);
  2057. yy_delete_buffer(buf);
  2058. return program;
  2059. }
  2060. stmt_node *sol_compile_buffer(const char *prgbuf, size_t sz) {
  2061. stmt_node *program = NULL;
  2062. YY_BUFFER_STATE buf = yy_scan_bytes(prgbuf, sz);
  2063. yyparse(&program);
  2064. yy_delete_buffer(buf);
  2065. return program;
  2066. }
  2067. stmt_node *sol_compile_file(FILE *prgfile) {
  2068. stmt_node *program = NULL;
  2069. YY_BUFFER_STATE buf = yy_create_buffer(prgfile, YY_BUF_SIZE);
  2070. yy_switch_to_buffer(buf);
  2071. yyparse(&program);
  2072. yy_delete_buffer(buf);
  2073. return program;
  2074. }
  2075. void sol_write_html(FILE *prgfile) {
  2076. stmt_node *program = NULL;
  2077. YY_BUFFER_STATE buf = yy_create_buffer(prgfile, YY_BUF_SIZE);
  2078. writing_html = 1;
  2079. printf("<html><head><title>Sol Source File</title></head><body style=\"white-space: pre-wrap;\">\n");
  2080. yy_switch_to_buffer(buf);
  2081. yyparse(&program);
  2082. yy_delete_buffer(buf);
  2083. //stmt_free(program);
  2084. printf("</body></html>\n");
  2085. }