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.

2183 lines
54 KiB

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