Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 

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