Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

1822 Zeilen
48 KiB

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