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

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