2015 righe
52 KiB

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