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

lex.yy.c 59KB

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