25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 

1787 satır
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[78] =
  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, 16, 15,
  280. 15, 15, 15, 15, 15, 15, 15, 0, 0, 16,
  281. 15, 15, 15, 15, 15, 15, 15, 6, 0, 12,
  282. 15, 15, 15, 15, 15, 15, 10, 7, 15, 4,
  283. 15, 11, 15, 15, 0, 15, 5, 3, 15, 8,
  284. 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, 1, 1, 1, 1, 1, 1, 1, 1,
  290. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  291. 1, 3, 1, 4, 5, 1, 1, 1, 1, 6,
  292. 7, 1, 8, 3, 9, 10, 11, 12, 12, 12,
  293. 12, 12, 12, 12, 12, 12, 12, 1, 1, 1,
  294. 1, 1, 1, 1, 13, 13, 13, 13, 14, 13,
  295. 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
  296. 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
  297. 1, 1, 1, 1, 16, 1, 17, 13, 18, 19,
  298. 20, 21, 22, 23, 24, 15, 25, 26, 27, 28,
  299. 29, 30, 15, 31, 32, 33, 34, 15, 15, 15,
  300. 15, 15, 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[35] =
  316. { 0,
  317. 1, 2, 1, 1, 1, 1, 1, 1, 3, 1,
  318. 1, 4, 5, 5, 3, 3, 5, 5, 5, 5,
  319. 5, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  320. 3, 3, 3, 3
  321. } ;
  322. static yyconst flex_int16_t yy_base[89] =
  323. { 0,
  324. 0, 0, 118, 119, 119, 119, 113, 0, 119, 119,
  325. 25, 26, 104, 104, 29, 0, 95, 11, 96, 83,
  326. 82, 79, 105, 119, 0, 96, 32, 34, 0, 0,
  327. 88, 80, 73, 78, 74, 70, 67, 0, 41, 0,
  328. 74, 70, 65, 65, 71, 71, 74, 0, 81, 80,
  329. 67, 59, 60, 68, 70, 53, 0, 0, 63, 0,
  330. 57, 0, 35, 39, 0, 29, 0, 0, 22, 0,
  331. 14, 15, 0, 0, 0, 119, 119, 54, 56, 59,
  332. 61, 66, 68, 70, 72, 74, 76, 78
  333. } ;
  334. static yyconst flex_int16_t yy_def[89] =
  335. { 0,
  336. 77, 1, 77, 77, 77, 77, 78, 79, 77, 77,
  337. 77, 77, 77, 77, 77, 80, 80, 80, 80, 80,
  338. 80, 80, 78, 77, 81, 77, 77, 77, 82, 80,
  339. 80, 80, 80, 80, 80, 80, 80, 83, 77, 82,
  340. 80, 80, 80, 80, 80, 80, 80, 84, 77, 77,
  341. 80, 80, 80, 80, 80, 80, 80, 85, 80, 80,
  342. 80, 80, 80, 80, 86, 80, 80, 80, 80, 87,
  343. 80, 80, 88, 80, 80, 77, 0, 77, 77, 77,
  344. 77, 77, 77, 77, 77, 77, 77, 77
  345. } ;
  346. static yyconst flex_int16_t yy_nxt[154] =
  347. { 0,
  348. 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
  349. 14, 15, 16, 16, 16, 4, 17, 18, 16, 16,
  350. 19, 16, 16, 16, 16, 20, 16, 16, 16, 21,
  351. 16, 16, 22, 16, 26, 26, 27, 27, 26, 32,
  352. 27, 26, 75, 27, 33, 28, 74, 39, 49, 49,
  353. 72, 71, 50, 39, 23, 23, 23, 23, 23, 25,
  354. 25, 30, 69, 30, 38, 38, 40, 68, 40, 40,
  355. 40, 48, 48, 58, 58, 65, 65, 70, 70, 73,
  356. 73, 76, 76, 67, 66, 64, 63, 62, 61, 60,
  357. 59, 50, 50, 57, 56, 55, 54, 53, 52, 51,
  358. 47, 46, 45, 44, 43, 42, 41, 28, 24, 37,
  359. 36, 35, 34, 31, 29, 28, 24, 77, 3, 77,
  360. 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
  361. 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
  362. 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
  363. 77, 77, 77
  364. } ;
  365. static yyconst flex_int16_t yy_chk[154] =
  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, 11, 12, 11, 12, 15, 18,
  371. 15, 27, 72, 27, 18, 28, 71, 28, 39, 39,
  372. 69, 66, 39, 28, 78, 78, 78, 78, 78, 79,
  373. 79, 80, 64, 80, 81, 81, 82, 63, 82, 82,
  374. 82, 83, 83, 84, 84, 85, 85, 86, 86, 87,
  375. 87, 88, 88, 61, 59, 56, 55, 54, 53, 52,
  376. 51, 50, 49, 47, 46, 45, 44, 43, 42, 41,
  377. 37, 36, 35, 34, 33, 32, 31, 26, 23, 22,
  378. 21, 20, 19, 17, 14, 13, 7, 3, 77, 77,
  379. 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
  380. 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
  381. 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
  382. 77, 77, 77
  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 >= 78 )
  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 != 77 );
  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. YY_RULE_SETUP
  682. #line 99 "scenesetup-scanner.l"
  683. { /* ignore this */ }
  684. YY_BREAK
  685. /* Semantics tokens */
  686. case 17:
  687. YY_RULE_SETUP
  688. #line 102 "scenesetup-scanner.l"
  689. { return token_type('-'); }
  690. YY_BREAK
  691. case 18:
  692. YY_RULE_SETUP
  693. #line 103 "scenesetup-scanner.l"
  694. { return token_type('('); }
  695. YY_BREAK
  696. case 19:
  697. YY_RULE_SETUP
  698. #line 104 "scenesetup-scanner.l"
  699. { return token_type(')'); }
  700. YY_BREAK
  701. case 20:
  702. YY_RULE_SETUP
  703. #line 105 "scenesetup-scanner.l"
  704. { /* ignore this */ }
  705. YY_BREAK
  706. case 21:
  707. /* rule 21 can match eol */
  708. YY_RULE_SETUP
  709. #line 106 "scenesetup-scanner.l"
  710. { /* ignore this */ }
  711. YY_BREAK
  712. case 22:
  713. YY_RULE_SETUP
  714. #line 107 "scenesetup-scanner.l"
  715. { return token::T_ERROR; }
  716. YY_BREAK
  717. case 23:
  718. YY_RULE_SETUP
  719. #line 109 "scenesetup-scanner.l"
  720. ECHO;
  721. YY_BREAK
  722. #line 848 "generated/scenesetup-scanner.cpp"
  723. case YY_STATE_EOF(INITIAL):
  724. yyterminate();
  725. case YY_END_OF_BUFFER:
  726. {
  727. /* Amount of text matched not including the EOB char. */
  728. int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
  729. /* Undo the effects of YY_DO_BEFORE_ACTION. */
  730. *yy_cp = (yy_hold_char);
  731. YY_RESTORE_YY_MORE_OFFSET
  732. if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
  733. {
  734. /* We're scanning a new file or input source. It's
  735. * possible that this happened because the user
  736. * just pointed yyin at a new source and called
  737. * yylex(). If so, then we have to assure
  738. * consistency between YY_CURRENT_BUFFER and our
  739. * globals. Here is the right place to do so, because
  740. * this is the first action (other than possibly a
  741. * back-up) that will match for the new input source.
  742. */
  743. (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  744. YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
  745. YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
  746. }
  747. /* Note that here we test for yy_c_buf_p "<=" to the position
  748. * of the first EOB in the buffer, since yy_c_buf_p will
  749. * already have been incremented past the NUL character
  750. * (since all states make transitions on EOB to the
  751. * end-of-buffer state). Contrast this with the test
  752. * in input().
  753. */
  754. if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
  755. { /* This was really a NUL. */
  756. yy_state_type yy_next_state;
  757. (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
  758. yy_current_state = yy_get_previous_state( );
  759. /* Okay, we're now positioned to make the NUL
  760. * transition. We couldn't have
  761. * yy_get_previous_state() go ahead and do it
  762. * for us because it doesn't know how to deal
  763. * with the possibility of jamming (and we don't
  764. * want to build jamming into it because then it
  765. * will run more slowly).
  766. */
  767. yy_next_state = yy_try_NUL_trans( yy_current_state );
  768. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  769. if ( yy_next_state )
  770. {
  771. /* Consume the NUL. */
  772. yy_cp = ++(yy_c_buf_p);
  773. yy_current_state = yy_next_state;
  774. goto yy_match;
  775. }
  776. else
  777. {
  778. yy_cp = (yy_last_accepting_cpos);
  779. yy_current_state = (yy_last_accepting_state);
  780. goto yy_find_action;
  781. }
  782. }
  783. else switch ( yy_get_next_buffer( ) )
  784. {
  785. case EOB_ACT_END_OF_FILE:
  786. {
  787. (yy_did_buffer_switch_on_eof) = 0;
  788. if ( yywrap( ) )
  789. {
  790. /* Note: because we've taken care in
  791. * yy_get_next_buffer() to have set up
  792. * yytext, we can now set up
  793. * yy_c_buf_p so that if some total
  794. * hoser (like flex itself) wants to
  795. * call the scanner after we return the
  796. * YY_NULL, it'll still work - another
  797. * YY_NULL will get returned.
  798. */
  799. (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
  800. yy_act = YY_STATE_EOF(YY_START);
  801. goto do_action;
  802. }
  803. else
  804. {
  805. if ( ! (yy_did_buffer_switch_on_eof) )
  806. YY_NEW_FILE;
  807. }
  808. break;
  809. }
  810. case EOB_ACT_CONTINUE_SCAN:
  811. (yy_c_buf_p) =
  812. (yytext_ptr) + yy_amount_of_matched_text;
  813. yy_current_state = yy_get_previous_state( );
  814. yy_cp = (yy_c_buf_p);
  815. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  816. goto yy_match;
  817. case EOB_ACT_LAST_MATCH:
  818. (yy_c_buf_p) =
  819. &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
  820. yy_current_state = yy_get_previous_state( );
  821. yy_cp = (yy_c_buf_p);
  822. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  823. goto yy_find_action;
  824. }
  825. break;
  826. }
  827. default:
  828. YY_FATAL_ERROR(
  829. "fatal flex scanner internal error--no action found" );
  830. } /* end of action switch */
  831. } /* end of scanning one token */
  832. } /* end of yylex */
  833. /* The contents of this function are C++ specific, so the () macro is not used.
  834. */
  835. yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
  836. {
  837. yyin = arg_yyin;
  838. yyout = arg_yyout;
  839. yy_c_buf_p = 0;
  840. yy_init = 0;
  841. yy_start = 0;
  842. yy_flex_debug = 0;
  843. yylineno = 1; // this will only get updated if %option yylineno
  844. yy_did_buffer_switch_on_eof = 0;
  845. yy_looking_for_trail_begin = 0;
  846. yy_more_flag = 0;
  847. yy_more_len = 0;
  848. yy_more_offset = yy_prev_more_offset = 0;
  849. yy_start_stack_ptr = yy_start_stack_depth = 0;
  850. yy_start_stack = NULL;
  851. yy_buffer_stack = 0;
  852. yy_buffer_stack_top = 0;
  853. yy_buffer_stack_max = 0;
  854. yy_state_buf = 0;
  855. }
  856. /* The contents of this function are C++ specific, so the () macro is not used.
  857. */
  858. yyFlexLexer::~yyFlexLexer()
  859. {
  860. delete [] yy_state_buf;
  861. SceneSetupfree(yy_start_stack );
  862. yy_delete_buffer( YY_CURRENT_BUFFER );
  863. SceneSetupfree(yy_buffer_stack );
  864. }
  865. /* The contents of this function are C++ specific, so the () macro is not used.
  866. */
  867. void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
  868. {
  869. if ( new_in )
  870. {
  871. yy_delete_buffer( YY_CURRENT_BUFFER );
  872. yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) );
  873. }
  874. if ( new_out )
  875. yyout = new_out;
  876. }
  877. #ifdef YY_INTERACTIVE
  878. int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
  879. #else
  880. int yyFlexLexer::LexerInput( char* buf, int max_size )
  881. #endif
  882. {
  883. if ( yyin->eof() || yyin->fail() )
  884. return 0;
  885. #ifdef YY_INTERACTIVE
  886. yyin->get( buf[0] );
  887. if ( yyin->eof() )
  888. return 0;
  889. if ( yyin->bad() )
  890. return -1;
  891. return 1;
  892. #else
  893. (void) yyin->read( buf, max_size );
  894. if ( yyin->bad() )
  895. return -1;
  896. else
  897. return yyin->gcount();
  898. #endif
  899. }
  900. void yyFlexLexer::LexerOutput( const char* buf, int size )
  901. {
  902. (void) yyout->write( buf, size );
  903. }
  904. /* yy_get_next_buffer - try to read in a new buffer
  905. *
  906. * Returns a code representing an action:
  907. * EOB_ACT_LAST_MATCH -
  908. * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  909. * EOB_ACT_END_OF_FILE - end of file
  910. */
  911. int yyFlexLexer::yy_get_next_buffer()
  912. {
  913. register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
  914. register char *source = (yytext_ptr);
  915. register int number_to_move, i;
  916. int ret_val;
  917. if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
  918. YY_FATAL_ERROR(
  919. "fatal flex scanner internal error--end of buffer missed" );
  920. if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
  921. { /* Don't try to fill the buffer, so this is an EOF. */
  922. if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
  923. {
  924. /* We matched a single character, the EOB, so
  925. * treat this as a final EOF.
  926. */
  927. return EOB_ACT_END_OF_FILE;
  928. }
  929. else
  930. {
  931. /* We matched some text prior to the EOB, first
  932. * process it.
  933. */
  934. return EOB_ACT_LAST_MATCH;
  935. }
  936. }
  937. /* Try to read more data. */
  938. /* First move last chars to start of buffer. */
  939. number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
  940. for ( i = 0; i < number_to_move; ++i )
  941. *(dest++) = *(source++);
  942. if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
  943. /* don't do the read, it's not guaranteed to return an EOF,
  944. * just force an EOF
  945. */
  946. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
  947. else
  948. {
  949. int num_to_read =
  950. YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
  951. while ( num_to_read <= 0 )
  952. { /* Not enough room in the buffer - grow it. */
  953. /* just a shorter name for the current buffer */
  954. YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
  955. int yy_c_buf_p_offset =
  956. (int) ((yy_c_buf_p) - b->yy_ch_buf);
  957. if ( b->yy_is_our_buffer )
  958. {
  959. int new_size = b->yy_buf_size * 2;
  960. if ( new_size <= 0 )
  961. b->yy_buf_size += b->yy_buf_size / 8;
  962. else
  963. b->yy_buf_size *= 2;
  964. b->yy_ch_buf = (char *)
  965. /* Include room in for 2 EOB chars. */
  966. SceneSetuprealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
  967. }
  968. else
  969. /* Can't grow it, we don't own it. */
  970. b->yy_ch_buf = 0;
  971. if ( ! b->yy_ch_buf )
  972. YY_FATAL_ERROR(
  973. "fatal error - scanner input buffer overflow" );
  974. (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
  975. num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
  976. number_to_move - 1;
  977. }
  978. if ( num_to_read > YY_READ_BUF_SIZE )
  979. num_to_read = YY_READ_BUF_SIZE;
  980. /* Read in more data. */
  981. YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
  982. (yy_n_chars), (size_t) num_to_read );
  983. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  984. }
  985. if ( (yy_n_chars) == 0 )
  986. {
  987. if ( number_to_move == YY_MORE_ADJ )
  988. {
  989. ret_val = EOB_ACT_END_OF_FILE;
  990. yyrestart( yyin );
  991. }
  992. else
  993. {
  994. ret_val = EOB_ACT_LAST_MATCH;
  995. YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
  996. YY_BUFFER_EOF_PENDING;
  997. }
  998. }
  999. else
  1000. ret_val = EOB_ACT_CONTINUE_SCAN;
  1001. if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
  1002. /* Extend the array by 50%, plus the number we really need. */
  1003. yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
  1004. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) SceneSetuprealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
  1005. if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
  1006. YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
  1007. }
  1008. (yy_n_chars) += number_to_move;
  1009. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
  1010. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
  1011. (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
  1012. return ret_val;
  1013. }
  1014. /* yy_get_previous_state - get the state just before the EOB char was reached */
  1015. yy_state_type yyFlexLexer::yy_get_previous_state()
  1016. {
  1017. register yy_state_type yy_current_state;
  1018. register char *yy_cp;
  1019. yy_current_state = (yy_start);
  1020. for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
  1021. {
  1022. register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
  1023. if ( yy_accept[yy_current_state] )
  1024. {
  1025. (yy_last_accepting_state) = yy_current_state;
  1026. (yy_last_accepting_cpos) = yy_cp;
  1027. }
  1028. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1029. {
  1030. yy_current_state = (int) yy_def[yy_current_state];
  1031. if ( yy_current_state >= 78 )
  1032. yy_c = yy_meta[(unsigned int) yy_c];
  1033. }
  1034. yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  1035. }
  1036. return yy_current_state;
  1037. }
  1038. /* yy_try_NUL_trans - try to make a transition on the NUL character
  1039. *
  1040. * synopsis
  1041. * next_state = yy_try_NUL_trans( current_state );
  1042. */
  1043. yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
  1044. {
  1045. register int yy_is_jam;
  1046. register char *yy_cp = (yy_c_buf_p);
  1047. register YY_CHAR yy_c = 1;
  1048. if ( yy_accept[yy_current_state] )
  1049. {
  1050. (yy_last_accepting_state) = yy_current_state;
  1051. (yy_last_accepting_cpos) = yy_cp;
  1052. }
  1053. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1054. {
  1055. yy_current_state = (int) yy_def[yy_current_state];
  1056. if ( yy_current_state >= 78 )
  1057. yy_c = yy_meta[(unsigned int) yy_c];
  1058. }
  1059. yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  1060. yy_is_jam = (yy_current_state == 77);
  1061. return yy_is_jam ? 0 : yy_current_state;
  1062. }
  1063. void yyFlexLexer::yyunput( int c, register char* yy_bp)
  1064. {
  1065. register char *yy_cp;
  1066. yy_cp = (yy_c_buf_p);
  1067. /* undo effects of setting up yytext */
  1068. *yy_cp = (yy_hold_char);
  1069. if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
  1070. { /* need to shift things up to make room */
  1071. /* +2 for EOB chars. */
  1072. register int number_to_move = (yy_n_chars) + 2;
  1073. register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
  1074. YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
  1075. register char *source =
  1076. &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
  1077. while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
  1078. *--dest = *--source;
  1079. yy_cp += (int) (dest - source);
  1080. yy_bp += (int) (dest - source);
  1081. YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
  1082. (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
  1083. if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
  1084. YY_FATAL_ERROR( "flex scanner push-back overflow" );
  1085. }
  1086. *--yy_cp = (char) c;
  1087. (yytext_ptr) = yy_bp;
  1088. (yy_hold_char) = *yy_cp;
  1089. (yy_c_buf_p) = yy_cp;
  1090. }
  1091. int yyFlexLexer::yyinput()
  1092. {
  1093. int c;
  1094. *(yy_c_buf_p) = (yy_hold_char);
  1095. if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
  1096. {
  1097. /* yy_c_buf_p now points to the character we want to return.
  1098. * If this occurs *before* the EOB characters, then it's a
  1099. * valid NUL; if not, then we've hit the end of the buffer.
  1100. */
  1101. if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
  1102. /* This was really a NUL. */
  1103. *(yy_c_buf_p) = '\0';
  1104. else
  1105. { /* need more input */
  1106. int offset = (yy_c_buf_p) - (yytext_ptr);
  1107. ++(yy_c_buf_p);
  1108. switch ( yy_get_next_buffer( ) )
  1109. {
  1110. case EOB_ACT_LAST_MATCH:
  1111. /* This happens because yy_g_n_b()
  1112. * sees that we've accumulated a
  1113. * token and flags that we need to
  1114. * try matching the token before
  1115. * proceeding. But for input(),
  1116. * there's no matching to consider.
  1117. * So convert the EOB_ACT_LAST_MATCH
  1118. * to EOB_ACT_END_OF_FILE.
  1119. */
  1120. /* Reset buffer status. */
  1121. yyrestart( yyin );
  1122. /*FALLTHROUGH*/
  1123. case EOB_ACT_END_OF_FILE:
  1124. {
  1125. if ( yywrap( ) )
  1126. return EOF;
  1127. if ( ! (yy_did_buffer_switch_on_eof) )
  1128. YY_NEW_FILE;
  1129. #ifdef __cplusplus
  1130. return yyinput();
  1131. #else
  1132. return input();
  1133. #endif
  1134. }
  1135. case EOB_ACT_CONTINUE_SCAN:
  1136. (yy_c_buf_p) = (yytext_ptr) + offset;
  1137. break;
  1138. }
  1139. }
  1140. }
  1141. c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
  1142. *(yy_c_buf_p) = '\0'; /* preserve yytext */
  1143. (yy_hold_char) = *++(yy_c_buf_p);
  1144. return c;
  1145. }
  1146. /** Immediately switch to a different input stream.
  1147. * @param input_file A readable stream.
  1148. *
  1149. * @note This function does not reset the start condition to @c INITIAL .
  1150. */
  1151. void yyFlexLexer::yyrestart( std::istream* input_file )
  1152. {
  1153. if ( ! YY_CURRENT_BUFFER ){
  1154. yyensure_buffer_stack ();
  1155. YY_CURRENT_BUFFER_LVALUE =
  1156. yy_create_buffer( yyin, YY_BUF_SIZE );
  1157. }
  1158. yy_init_buffer( YY_CURRENT_BUFFER, input_file );
  1159. yy_load_buffer_state( );
  1160. }
  1161. /** Switch to a different input buffer.
  1162. * @param new_buffer The new input buffer.
  1163. *
  1164. */
  1165. void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
  1166. {
  1167. /* TODO. We should be able to replace this entire function body
  1168. * with
  1169. * yypop_buffer_state();
  1170. * yypush_buffer_state(new_buffer);
  1171. */
  1172. yyensure_buffer_stack ();
  1173. if ( YY_CURRENT_BUFFER == new_buffer )
  1174. return;
  1175. if ( YY_CURRENT_BUFFER )
  1176. {
  1177. /* Flush out information for old buffer. */
  1178. *(yy_c_buf_p) = (yy_hold_char);
  1179. YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
  1180. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1181. }
  1182. YY_CURRENT_BUFFER_LVALUE = new_buffer;
  1183. yy_load_buffer_state( );
  1184. /* We don't actually know whether we did this switch during
  1185. * EOF (yywrap()) processing, but the only time this flag
  1186. * is looked at is after yywrap() is called, so it's safe
  1187. * to go ahead and always set it.
  1188. */
  1189. (yy_did_buffer_switch_on_eof) = 1;
  1190. }
  1191. void yyFlexLexer::yy_load_buffer_state()
  1192. {
  1193. (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  1194. (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
  1195. yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
  1196. (yy_hold_char) = *(yy_c_buf_p);
  1197. }
  1198. /** Allocate and initialize an input buffer state.
  1199. * @param file A readable stream.
  1200. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
  1201. *
  1202. * @return the allocated buffer state.
  1203. */
  1204. YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
  1205. {
  1206. YY_BUFFER_STATE b;
  1207. b = (YY_BUFFER_STATE) SceneSetupalloc(sizeof( struct yy_buffer_state ) );
  1208. if ( ! b )
  1209. YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1210. b->yy_buf_size = size;
  1211. /* yy_ch_buf has to be 2 characters longer than the size given because
  1212. * we need to put in 2 end-of-buffer characters.
  1213. */
  1214. b->yy_ch_buf = (char *) SceneSetupalloc(b->yy_buf_size + 2 );
  1215. if ( ! b->yy_ch_buf )
  1216. YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1217. b->yy_is_our_buffer = 1;
  1218. yy_init_buffer( b, file );
  1219. return b;
  1220. }
  1221. /** Destroy the buffer.
  1222. * @param b a buffer created with yy_create_buffer()
  1223. *
  1224. */
  1225. void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
  1226. {
  1227. if ( ! b )
  1228. return;
  1229. if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
  1230. YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
  1231. if ( b->yy_is_our_buffer )
  1232. SceneSetupfree((void *) b->yy_ch_buf );
  1233. SceneSetupfree((void *) b );
  1234. }
  1235. extern "C" int isatty (int );
  1236. /* Initializes or reinitializes a buffer.
  1237. * This function is sometimes called more than once on the same buffer,
  1238. * such as during a yyrestart() or at EOF.
  1239. */
  1240. void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
  1241. {
  1242. int oerrno = errno;
  1243. yy_flush_buffer( b );
  1244. b->yy_input_file = file;
  1245. b->yy_fill_buffer = 1;
  1246. /* If b is the current buffer, then yy_init_buffer was _probably_
  1247. * called from yyrestart() or through yy_get_next_buffer.
  1248. * In that case, we don't want to reset the lineno or column.
  1249. */
  1250. if (b != YY_CURRENT_BUFFER){
  1251. b->yy_bs_lineno = 1;
  1252. b->yy_bs_column = 0;
  1253. }
  1254. b->yy_is_interactive = 0;
  1255. errno = oerrno;
  1256. }
  1257. /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
  1258. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
  1259. *
  1260. */
  1261. void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
  1262. {
  1263. if ( ! b )
  1264. return;
  1265. b->yy_n_chars = 0;
  1266. /* We always need two end-of-buffer characters. The first causes
  1267. * a transition to the end-of-buffer state. The second causes
  1268. * a jam in that state.
  1269. */
  1270. b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
  1271. b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  1272. b->yy_buf_pos = &b->yy_ch_buf[0];
  1273. b->yy_at_bol = 1;
  1274. b->yy_buffer_status = YY_BUFFER_NEW;
  1275. if ( b == YY_CURRENT_BUFFER )
  1276. yy_load_buffer_state( );
  1277. }
  1278. /** Pushes the new state onto the stack. The new state becomes
  1279. * the current state. This function will allocate the stack
  1280. * if necessary.
  1281. * @param new_buffer The new state.
  1282. *
  1283. */
  1284. void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
  1285. {
  1286. if (new_buffer == NULL)
  1287. return;
  1288. yyensure_buffer_stack();
  1289. /* This block is copied from yy_switch_to_buffer. */
  1290. if ( YY_CURRENT_BUFFER )
  1291. {
  1292. /* Flush out information for old buffer. */
  1293. *(yy_c_buf_p) = (yy_hold_char);
  1294. YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
  1295. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1296. }
  1297. /* Only push if top exists. Otherwise, replace top. */
  1298. if (YY_CURRENT_BUFFER)
  1299. (yy_buffer_stack_top)++;
  1300. YY_CURRENT_BUFFER_LVALUE = new_buffer;
  1301. /* copied from yy_switch_to_buffer. */
  1302. yy_load_buffer_state( );
  1303. (yy_did_buffer_switch_on_eof) = 1;
  1304. }
  1305. /** Removes and deletes the top of the stack, if present.
  1306. * The next element becomes the new top.
  1307. *
  1308. */
  1309. void yyFlexLexer::yypop_buffer_state (void)
  1310. {
  1311. if (!YY_CURRENT_BUFFER)
  1312. return;
  1313. yy_delete_buffer(YY_CURRENT_BUFFER );
  1314. YY_CURRENT_BUFFER_LVALUE = NULL;
  1315. if ((yy_buffer_stack_top) > 0)
  1316. --(yy_buffer_stack_top);
  1317. if (YY_CURRENT_BUFFER) {
  1318. yy_load_buffer_state( );
  1319. (yy_did_buffer_switch_on_eof) = 1;
  1320. }
  1321. }
  1322. /* Allocates the stack if it does not exist.
  1323. * Guarantees space for at least one push.
  1324. */
  1325. void yyFlexLexer::yyensure_buffer_stack(void)
  1326. {
  1327. int num_to_alloc;
  1328. if (!(yy_buffer_stack)) {
  1329. /* First allocation is just for 2 elements, since we don't know if this
  1330. * scanner will even need a stack. We use 2 instead of 1 to avoid an
  1331. * immediate realloc on the next call.
  1332. */
  1333. num_to_alloc = 1;
  1334. (yy_buffer_stack) = (struct yy_buffer_state**)SceneSetupalloc
  1335. (num_to_alloc * sizeof(struct yy_buffer_state*)
  1336. );
  1337. if ( ! (yy_buffer_stack) )
  1338. YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
  1339. memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
  1340. (yy_buffer_stack_max) = num_to_alloc;
  1341. (yy_buffer_stack_top) = 0;
  1342. return;
  1343. }
  1344. if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
  1345. /* Increase the buffer to prepare for a possible push. */
  1346. int grow_size = 8 /* arbitrary grow size */;
  1347. num_to_alloc = (yy_buffer_stack_max) + grow_size;
  1348. (yy_buffer_stack) = (struct yy_buffer_state**)SceneSetuprealloc
  1349. ((yy_buffer_stack),
  1350. num_to_alloc * sizeof(struct yy_buffer_state*)
  1351. );
  1352. if ( ! (yy_buffer_stack) )
  1353. YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
  1354. /* zero only the new slots.*/
  1355. memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
  1356. (yy_buffer_stack_max) = num_to_alloc;
  1357. }
  1358. }
  1359. void yyFlexLexer::yy_push_state( int new_state )
  1360. {
  1361. if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
  1362. {
  1363. yy_size_t new_size;
  1364. (yy_start_stack_depth) += YY_START_STACK_INCR;
  1365. new_size = (yy_start_stack_depth) * sizeof( int );
  1366. if ( ! (yy_start_stack) )
  1367. (yy_start_stack) = (int *) SceneSetupalloc(new_size );
  1368. else
  1369. (yy_start_stack) = (int *) SceneSetuprealloc((void *) (yy_start_stack),new_size );
  1370. if ( ! (yy_start_stack) )
  1371. YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
  1372. }
  1373. (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
  1374. BEGIN(new_state);
  1375. }
  1376. void yyFlexLexer::yy_pop_state()
  1377. {
  1378. if ( --(yy_start_stack_ptr) < 0 )
  1379. YY_FATAL_ERROR( "start-condition stack underflow" );
  1380. BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
  1381. }
  1382. int yyFlexLexer::yy_top_state()
  1383. {
  1384. return (yy_start_stack)[(yy_start_stack_ptr) - 1];
  1385. }
  1386. #ifndef YY_EXIT_FAILURE
  1387. #define YY_EXIT_FAILURE 2
  1388. #endif
  1389. void yyFlexLexer::LexerError( yyconst char msg[] )
  1390. {
  1391. std::cerr << msg << std::endl;
  1392. exit( YY_EXIT_FAILURE );
  1393. }
  1394. /* Redefine yyless() so it works in section 3 code. */
  1395. #undef yyless
  1396. #define yyless(n) \
  1397. do \
  1398. { \
  1399. /* Undo effects of setting up yytext. */ \
  1400. int yyless_macro_arg = (n); \
  1401. YY_LESS_LINENO(yyless_macro_arg);\
  1402. yytext[yyleng] = (yy_hold_char); \
  1403. (yy_c_buf_p) = yytext + yyless_macro_arg; \
  1404. (yy_hold_char) = *(yy_c_buf_p); \
  1405. *(yy_c_buf_p) = '\0'; \
  1406. yyleng = yyless_macro_arg; \
  1407. } \
  1408. while ( 0 )
  1409. /* Accessor methods (get/set functions) to struct members. */
  1410. /*
  1411. * Internal utility routines.
  1412. */
  1413. #ifndef yytext_ptr
  1414. static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
  1415. {
  1416. register int i;
  1417. for ( i = 0; i < n; ++i )
  1418. s1[i] = s2[i];
  1419. }
  1420. #endif
  1421. #ifdef YY_NEED_STRLEN
  1422. static int yy_flex_strlen (yyconst char * s )
  1423. {
  1424. register int n;
  1425. for ( n = 0; s[n]; ++n )
  1426. ;
  1427. return n;
  1428. }
  1429. #endif
  1430. void *SceneSetupalloc (yy_size_t size )
  1431. {
  1432. return (void *) malloc( size );
  1433. }
  1434. void *SceneSetuprealloc (void * ptr, yy_size_t size )
  1435. {
  1436. /* The cast to (char *) in the following accommodates both
  1437. * implementations that use char* generic pointers, and those
  1438. * that use void* generic pointers. It works with the latter
  1439. * because both ANSI C and C++ allow castless assignment from
  1440. * any pointer type to void*, and deal with argument conversions
  1441. * as though doing an assignment.
  1442. */
  1443. return (void *) realloc( (char *) ptr, size );
  1444. }
  1445. void SceneSetupfree (void * ptr )
  1446. {
  1447. free( (char *) ptr ); /* see SceneSetuprealloc() for (char *) cast */
  1448. }
  1449. #define YYTABLES_NAME "yytables"
  1450. #line 109 "scenesetup-scanner.l"
  1451. lol::SceneSetupScanner::SceneSetupScanner(char const *command)
  1452. : SceneSetupFlexLexer(0, 0),
  1453. m_input(command)
  1454. {
  1455. }
  1456. lol::SceneSetupScanner::~SceneSetupScanner()
  1457. {
  1458. }
  1459. int lol::SceneSetupScanner::LexerInput(char* buf, int max_size)
  1460. {
  1461. (void)max_size; /* unused for now */
  1462. buf[0] = m_input[0];
  1463. if (buf[0])
  1464. ++m_input;
  1465. return buf[0] ? 1 : 0;
  1466. }
  1467. #ifdef yylex
  1468. #undef yylex
  1469. #endif
  1470. int SceneSetupFlexLexer::yylex()
  1471. {
  1472. std::cerr << "in SceneSetupFlexLexer::yylex() !" << std::endl;
  1473. return 0;
  1474. }
  1475. int SceneSetupFlexLexer::yywrap()
  1476. {
  1477. return 1;
  1478. }