Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

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