Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

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