/.emacs.d/cscope-15.7a/src/scanner.c

https://bitbucket.org/shuangxinyu/emacspack · C · 2954 lines · 2513 code · 195 blank · 246 comment · 203 complexity · ac06096c8fe29ca21dd7d1ebc5803b08 MD5 · raw file

Large files are truncated click here to view the full file

  1. #line 3 "scanner.c"
  2. #define YY_INT_ALIGNED short int
  3. /* A lexical scanner generated by flex */
  4. #define FLEX_SCANNER
  5. #define YY_FLEX_MAJOR_VERSION 2
  6. #define YY_FLEX_MINOR_VERSION 5
  7. #define YY_FLEX_SUBMINOR_VERSION 35
  8. #if YY_FLEX_SUBMINOR_VERSION > 0
  9. #define FLEX_BETA
  10. #endif
  11. /* First, we deal with platform-specific or compiler-specific issues. */
  12. /* begin standard C headers. */
  13. #include <stdio.h>
  14. #include <string.h>
  15. #include <errno.h>
  16. #include <stdlib.h>
  17. /* end standard C headers. */
  18. /* flex integer type definitions */
  19. #ifndef FLEXINT_H
  20. #define FLEXINT_H
  21. /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
  22. #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  23. /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
  24. * if you want the limit (max/min) macros for int types.
  25. */
  26. #ifndef __STDC_LIMIT_MACROS
  27. #define __STDC_LIMIT_MACROS 1
  28. #endif
  29. #include <inttypes.h>
  30. typedef int8_t flex_int8_t;
  31. typedef uint8_t flex_uint8_t;
  32. typedef int16_t flex_int16_t;
  33. typedef uint16_t flex_uint16_t;
  34. typedef int32_t flex_int32_t;
  35. typedef uint32_t flex_uint32_t;
  36. #else
  37. typedef signed char flex_int8_t;
  38. typedef short int flex_int16_t;
  39. typedef int flex_int32_t;
  40. typedef unsigned char flex_uint8_t;
  41. typedef unsigned short int flex_uint16_t;
  42. typedef unsigned int flex_uint32_t;
  43. #endif /* ! C99 */
  44. /* Limits of integral types. */
  45. #ifndef INT8_MIN
  46. #define INT8_MIN (-128)
  47. #endif
  48. #ifndef INT16_MIN
  49. #define INT16_MIN (-32767-1)
  50. #endif
  51. #ifndef INT32_MIN
  52. #define INT32_MIN (-2147483647-1)
  53. #endif
  54. #ifndef INT8_MAX
  55. #define INT8_MAX (127)
  56. #endif
  57. #ifndef INT16_MAX
  58. #define INT16_MAX (32767)
  59. #endif
  60. #ifndef INT32_MAX
  61. #define INT32_MAX (2147483647)
  62. #endif
  63. #ifndef UINT8_MAX
  64. #define UINT8_MAX (255U)
  65. #endif
  66. #ifndef UINT16_MAX
  67. #define UINT16_MAX (65535U)
  68. #endif
  69. #ifndef UINT32_MAX
  70. #define UINT32_MAX (4294967295U)
  71. #endif
  72. #endif /* ! FLEXINT_H */
  73. #ifdef __cplusplus
  74. /* The "const" storage-class-modifier is valid. */
  75. #define YY_USE_CONST
  76. #else /* ! __cplusplus */
  77. /* C99 requires __STDC__ to be defined as 1. */
  78. #if defined (__STDC__)
  79. #define YY_USE_CONST
  80. #endif /* defined (__STDC__) */
  81. #endif /* ! __cplusplus */
  82. #ifdef YY_USE_CONST
  83. #define yyconst const
  84. #else
  85. #define yyconst
  86. #endif
  87. /* Returned upon end-of-file. */
  88. #define YY_NULL 0
  89. /* Promotes a possibly negative, possibly signed char to an unsigned
  90. * integer for use as an array index. If the signed char is negative,
  91. * we want to instead treat it as an 8-bit unsigned char, hence the
  92. * double cast.
  93. */
  94. #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
  95. /* Enter a start condition. This macro really ought to take a parameter,
  96. * but we do it the disgusting crufty way forced on us by the ()-less
  97. * definition of BEGIN.
  98. */
  99. #define BEGIN (yy_start) = 1 + 2 *
  100. /* Translate the current start state into a value that can be later handed
  101. * to BEGIN to return to the state. The YYSTATE alias is for lex
  102. * compatibility.
  103. */
  104. #define YY_START (((yy_start) - 1) / 2)
  105. #define YYSTATE YY_START
  106. /* Action number for EOF rule of a given start state. */
  107. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  108. /* Special action meaning "start processing a new file". */
  109. #define YY_NEW_FILE yyrestart(yyin )
  110. #define YY_END_OF_BUFFER_CHAR 0
  111. /* Size of default input buffer. */
  112. #ifndef YY_BUF_SIZE
  113. #define YY_BUF_SIZE 16384
  114. #endif
  115. /* The state buf must be large enough to hold one state per character in the main buffer.
  116. */
  117. #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
  118. #ifndef YY_TYPEDEF_YY_BUFFER_STATE
  119. #define YY_TYPEDEF_YY_BUFFER_STATE
  120. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  121. #endif
  122. extern int yyleng;
  123. extern FILE *yyin, *yyout;
  124. #define EOB_ACT_CONTINUE_SCAN 0
  125. #define EOB_ACT_END_OF_FILE 1
  126. #define EOB_ACT_LAST_MATCH 2
  127. #define YY_LESS_LINENO(n)
  128. /* Return all but the first "n" matched characters back to the input stream. */
  129. #define yyless(n) \
  130. do \
  131. { \
  132. /* Undo effects of setting up yytext. */ \
  133. int yyless_macro_arg = (n); \
  134. YY_LESS_LINENO(yyless_macro_arg);\
  135. *yy_cp = (yy_hold_char); \
  136. YY_RESTORE_YY_MORE_OFFSET \
  137. (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
  138. YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  139. } \
  140. while ( 0 )
  141. #define unput(c) yyunput( c, (yytext_ptr) )
  142. #ifndef YY_TYPEDEF_YY_SIZE_T
  143. #define YY_TYPEDEF_YY_SIZE_T
  144. typedef size_t yy_size_t;
  145. #endif
  146. #ifndef YY_STRUCT_YY_BUFFER_STATE
  147. #define YY_STRUCT_YY_BUFFER_STATE
  148. struct yy_buffer_state
  149. {
  150. FILE *yy_input_file;
  151. char *yy_ch_buf; /* input buffer */
  152. char *yy_buf_pos; /* current position in input buffer */
  153. /* Size of input buffer in bytes, not including room for EOB
  154. * characters.
  155. */
  156. yy_size_t yy_buf_size;
  157. /* Number of characters read into yy_ch_buf, not including EOB
  158. * characters.
  159. */
  160. int yy_n_chars;
  161. /* Whether we "own" the buffer - i.e., we know we created it,
  162. * and can realloc() it to grow it, and should free() it to
  163. * delete it.
  164. */
  165. int yy_is_our_buffer;
  166. /* Whether this is an "interactive" input source; if so, and
  167. * if we're using stdio for input, then we want to use getc()
  168. * instead of fread(), to make sure we stop fetching input after
  169. * each newline.
  170. */
  171. int yy_is_interactive;
  172. /* Whether we're considered to be at the beginning of a line.
  173. * If so, '^' rules will be active on the next match, otherwise
  174. * not.
  175. */
  176. int yy_at_bol;
  177. int yy_bs_lineno; /**< The line count. */
  178. int yy_bs_column; /**< The column count. */
  179. /* Whether to try to fill the input buffer when we reach the
  180. * end of it.
  181. */
  182. int yy_fill_buffer;
  183. int yy_buffer_status;
  184. #define YY_BUFFER_NEW 0
  185. #define YY_BUFFER_NORMAL 1
  186. /* When an EOF's been seen but there's still some text to process
  187. * then we mark the buffer as YY_EOF_PENDING, to indicate that we
  188. * shouldn't try reading from the input source any more. We might
  189. * still have a bunch of tokens to match, though, because of
  190. * possible backing-up.
  191. *
  192. * When we actually see the EOF, we change the status to "new"
  193. * (via yyrestart()), so that the user can continue scanning by
  194. * just pointing yyin at a new input file.
  195. */
  196. #define YY_BUFFER_EOF_PENDING 2
  197. };
  198. #endif /* !YY_STRUCT_YY_BUFFER_STATE */
  199. /* Stack of input buffers. */
  200. static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
  201. static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
  202. static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
  203. /* We provide macros for accessing buffer states in case in the
  204. * future we want to put the buffer states in a more general
  205. * "scanner state".
  206. *
  207. * Returns the top of the stack, or NULL.
  208. */
  209. #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
  210. ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
  211. : NULL)
  212. /* Same as previous macro, but useful when we know that the buffer stack is not
  213. * NULL or when we need an lvalue. For internal use only.
  214. */
  215. #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
  216. /* yy_hold_char holds the character lost when yytext is formed. */
  217. static char yy_hold_char;
  218. static int yy_n_chars; /* number of characters read into yy_ch_buf */
  219. int yyleng;
  220. /* Points to current character in buffer. */
  221. static char *yy_c_buf_p = (char *) 0;
  222. static int yy_init = 0; /* whether we need to initialize */
  223. static int yy_start = 0; /* start state number */
  224. /* Flag which is used to allow yywrap()'s to do buffer switches
  225. * instead of setting up a fresh yyin. A bit of a hack ...
  226. */
  227. static int yy_did_buffer_switch_on_eof;
  228. void yyrestart (FILE *input_file );
  229. void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
  230. YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
  231. void yy_delete_buffer (YY_BUFFER_STATE b );
  232. void yy_flush_buffer (YY_BUFFER_STATE b );
  233. void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
  234. void yypop_buffer_state (void );
  235. static void yyensure_buffer_stack (void );
  236. static void yy_load_buffer_state (void );
  237. static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
  238. #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
  239. YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
  240. YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
  241. YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len );
  242. void *yyalloc (yy_size_t );
  243. void *yyrealloc (void *,yy_size_t );
  244. void yyfree (void * );
  245. #define yy_new_buffer yy_create_buffer
  246. #define yy_set_interactive(is_interactive) \
  247. { \
  248. if ( ! YY_CURRENT_BUFFER ){ \
  249. yyensure_buffer_stack (); \
  250. YY_CURRENT_BUFFER_LVALUE = \
  251. yy_create_buffer(yyin,YY_BUF_SIZE ); \
  252. } \
  253. YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
  254. }
  255. #define yy_set_bol(at_bol) \
  256. { \
  257. if ( ! YY_CURRENT_BUFFER ){\
  258. yyensure_buffer_stack (); \
  259. YY_CURRENT_BUFFER_LVALUE = \
  260. yy_create_buffer(yyin,YY_BUF_SIZE ); \
  261. } \
  262. YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
  263. }
  264. #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
  265. /* Begin user sect3 */
  266. typedef unsigned char YY_CHAR;
  267. FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
  268. typedef int yy_state_type;
  269. extern int yylineno;
  270. int yylineno = 1;
  271. extern char *yytext;
  272. #define yytext_ptr yytext
  273. static yy_state_type yy_get_previous_state (void );
  274. static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
  275. static int yy_get_next_buffer (void );
  276. static void yy_fatal_error (yyconst char msg[] );
  277. /* Done after the current pattern has been matched and before the
  278. * corresponding action - sets up yytext.
  279. */
  280. #define YY_DO_BEFORE_ACTION \
  281. (yytext_ptr) = yy_bp; \
  282. (yytext_ptr) -= (yy_more_len); \
  283. yyleng = (size_t) (yy_cp - (yytext_ptr)); \
  284. (yy_hold_char) = *yy_cp; \
  285. *yy_cp = '\0'; \
  286. (yy_c_buf_p) = yy_cp;
  287. #define YY_NUM_RULES 37
  288. #define YY_END_OF_BUFFER 38
  289. /* This struct is not used in this scanner,
  290. but its presence is necessary. */
  291. struct yy_trans_info
  292. {
  293. flex_int32_t yy_verify;
  294. flex_int32_t yy_nxt;
  295. };
  296. static yyconst flex_int16_t yy_acclist[267] =
  297. { 0,
  298. 38, 36, 37, 29, 37, 31, 36, 37, 36, 37,
  299. 25, 36, 37,16406,16407,16408, 36, 37, 30, 36,
  300. 37, 12, 36, 37, 13, 36, 37, 16, 36, 37,
  301. 36, 37, 35, 36, 37, 15, 36, 37, 17, 36,
  302. 37, 14, 36, 37, 26, 36, 37, 36, 37, 27,
  303. 36, 37, 25, 36, 37,16406,16407,16408, 25, 36,
  304. 37,16406,16407,16408, 25, 36, 37,16406,16407,16408,
  305. 25, 36, 37,16406,16407,16408, 6, 36, 37, 11,
  306. 36, 37, 32, 36, 37, 36, 37, 25, 36, 37,
  307. 16406,16407,16408, 25, 36, 37,16406,16407,16408, 34,
  308. 34, 34, 34, 25,16406,16407,16408, 8215, 1, 2,
  309. 35, 35, 28, 25,16406,16407,16408, 25,16406,16407,
  310. 16408, 25,16406,16407,16408, 25,16406,16407,16408, 32,
  311. 3, 25,16406,16407,16408, 25,16406,16407,16408, 34,
  312. 34, 34, 34, 8, 34, 34, 8216, 25,16406,16407,
  313. 16408, 25,16406,16407,16408, 25,16406,16407,16408, 25,
  314. 16406,16407,16408, 25,16406,16407,16408, 25,16406,16407,
  315. 16408, 34, 34, 34, 34, 34, 8, 34, 34, 8214,
  316. 25,16406,16407,16408, 25,16404,16405,16406,16407,16408,
  317. 25,16406,16407,16408, 25,16406,16407,16408, 25,16406,
  318. 16407,16408, 25,16406,16407,16408, 34, 9, 34, 34,
  319. 34, 34, 25,16406,16407,16408, 8213, 25,16406,16407,
  320. 16408, 25,16406,16407,16408, 25,16406,16407,16408, 34,
  321. 10, 34,16391, 8, 34, 34, 8216, 25,16406,16407,
  322. 16408, 34, 34, 34, 8216, 8212, 25,16406,16407,16408,
  323. 4, 4, 4, 8216, 34, 19, 25,16406,16407,16408,
  324. 4, 18, 5, 18, 8199, 33
  325. } ;
  326. static yyconst flex_int16_t yy_accept[153] =
  327. { 0,
  328. 1, 1, 1, 1, 1, 2, 4, 6, 9, 11,
  329. 17, 19, 22, 25, 28, 31, 33, 36, 39, 42,
  330. 45, 48, 50, 53, 59, 65, 71, 77, 80, 83,
  331. 86, 88, 94, 100, 100, 101, 102, 103, 104, 104,
  332. 104, 108, 109, 110, 111, 112, 113, 114, 118, 122,
  333. 126, 130, 131, 132, 136, 140, 141, 142, 143, 144,
  334. 146, 147, 148, 148, 148, 148, 152, 156, 160, 164,
  335. 168, 172, 173, 174, 175, 176, 177, 179, 180, 180,
  336. 181, 181, 185, 191, 195, 199, 203, 207, 208, 210,
  337. 211, 212, 213, 213, 217, 217, 217, 218, 222, 226,
  338. 230, 231, 234, 236, 237, 237, 237, 237, 238, 242,
  339. 242, 243, 243, 243, 244, 245, 245, 245, 246, 246,
  340. 246, 247, 251, 252, 253, 255, 255, 255, 255, 256,
  341. 256, 256, 256, 256, 257, 261, 262, 263, 263, 263,
  342. 263, 263, 263, 264, 265, 266, 267, 267, 267, 267,
  343. 267, 267
  344. } ;
  345. static yyconst flex_int32_t yy_ec[256] =
  346. { 0,
  347. 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
  348. 4, 4, 4, 1, 1, 1, 1, 1, 1, 1,
  349. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  350. 1, 2, 1, 5, 6, 7, 8, 9, 10, 11,
  351. 12, 13, 1, 14, 15, 16, 1, 17, 18, 18,
  352. 18, 18, 18, 18, 18, 18, 19, 20, 21, 22,
  353. 23, 24, 1, 1, 25, 26, 26, 27, 28, 26,
  354. 29, 29, 29, 29, 29, 26, 29, 30, 29, 29,
  355. 29, 29, 31, 32, 26, 29, 29, 26, 29, 33,
  356. 34, 35, 36, 1, 37, 1, 38, 26, 39, 40,
  357. 41, 42, 29, 29, 43, 29, 29, 44, 45, 46,
  358. 47, 29, 29, 48, 49, 50, 51, 29, 29, 26,
  359. 29, 52, 53, 1, 54, 1, 1, 1, 1, 1,
  360. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  361. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  362. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  363. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  364. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  365. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  366. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  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, 1, 1, 1, 1, 1,
  371. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  372. 1, 1, 1, 1, 1
  373. } ;
  374. static yyconst flex_int32_t yy_meta[55] =
  375. { 0,
  376. 1, 2, 3, 4, 5, 6, 7, 1, 1, 1,
  377. 8, 9, 10, 1, 1, 11, 12, 12, 12, 9,
  378. 1, 1, 1, 5, 13, 13, 13, 13, 14, 14,
  379. 14, 14, 14, 1, 1, 1, 14, 13, 13, 13,
  380. 13, 13, 14, 13, 14, 14, 14, 14, 14, 14,
  381. 13, 14, 15, 1
  382. } ;
  383. static yyconst flex_int16_t yy_base[169] =
  384. { 0,
  385. 0, 53, 28, 56, 306, 813, 813, 813, 61, 64,
  386. 16, 813, 813, 813, 813, 54, 0, 813, 813, 813,
  387. 813, 288, 813, 77, 92, 95, 107, 813, 813, 72,
  388. 70, 124, 128, 115, 0, 247, 39, 40, 146, 159,
  389. 162, 140, 813, 813, 0, 0, 813, 177, 180, 192,
  390. 195, 87, 813, 198, 210, 0, 242, 64, 240, 76,
  391. 233, 813, 214, 165, 255, 226, 240, 243, 246, 258,
  392. 263, 225, 222, 217, 212, 200, 193, 183, 275, 813,
  393. 167, 279, 294, 297, 300, 312, 327, 164, 0, 165,
  394. 162, 138, 146, 330, 354, 406, 813, 349, 366, 372,
  395. 110, 459, 0, 107, 125, 512, 183, 378, 384, 530,
  396. 110, 130, 315, 0, 88, 92, 548, 554, 390, 398,
  397. 813, 401, 0, 424, 0, 132, 430, 220, 416, 98,
  398. 47, 0, 0, 813, 437, 0, 0, 230, 51, 516,
  399. 0, 77, 442, 0, 813, 0, 43, 137, 548, 183,
  400. 813, 606, 619, 623, 630, 643, 656, 670, 684, 697,
  401. 711, 725, 739, 748, 761, 774, 783, 797
  402. } ;
  403. static yyconst flex_int16_t yy_def[169] =
  404. { 0,
  405. 151, 1, 1, 1, 151, 151, 151, 151, 152, 153,
  406. 151, 151, 151, 151, 151, 151, 154, 151, 151, 151,
  407. 151, 151, 151, 153, 153, 153, 153, 151, 151, 151,
  408. 151, 153, 153, 152, 155, 155, 155, 155, 156, 156,
  409. 153, 151, 151, 151, 154, 154, 151, 153, 153, 153,
  410. 153, 151, 151, 153, 153, 155, 155, 155, 155, 155,
  411. 155, 151, 151, 157, 151, 153, 153, 153, 153, 153,
  412. 153, 155, 155, 155, 155, 155, 155, 155, 157, 151,
  413. 151, 153, 153, 153, 153, 153, 153, 155, 155, 155,
  414. 155, 155, 151, 153, 158, 158, 151, 153, 153, 153,
  415. 155, 151, 155, 155, 151, 159, 160, 160, 153, 161,
  416. 155, 162, 151, 102, 155, 151, 163, 163, 151, 160,
  417. 151, 153, 164, 156, 164, 165, 151, 151, 155, 151,
  418. 166, 118, 118, 151, 153, 164, 167, 151, 151, 151,
  419. 168, 151, 156, 167, 151, 168, 151, 151, 151, 151,
  420. 0, 151, 151, 151, 151, 151, 151, 151, 151, 151,
  421. 151, 151, 151, 151, 151, 151, 151, 151
  422. } ;
  423. static yyconst flex_int16_t yy_nxt[868] =
  424. { 0,
  425. 6, 6, 7, 6, 8, 9, 10, 11, 6, 12,
  426. 13, 14, 6, 15, 6, 16, 17, 17, 17, 18,
  427. 19, 6, 20, 6, 10, 10, 10, 10, 10, 10,
  428. 10, 10, 10, 21, 22, 23, 10, 10, 24, 10,
  429. 25, 10, 10, 10, 10, 10, 10, 10, 26, 10,
  430. 27, 10, 28, 29, 30, 32, 30, 30, 33, 30,
  431. 31, 148, 34, 31, 34, 39, 40, 39, 43, 44,
  432. 45, 45, 45, 52, 42, 52, 40, 53, 39, 40,
  433. 39, 60, 58, 32, 59, 61, 33, 42, 52, 40,
  434. 52, 147, 145, 39, 40, 39, 39, 40, 39, 134,
  435. 36, 37, 42, 38, 40, 42, 73, 40, 39, 40,
  436. 39, 126, 74, 126, 142, 76, 34, 42, 34, 40,
  437. 48, 77, 43, 44, 130, 39, 40, 39, 129, 39,
  438. 40, 39, 113, 126, 42, 126, 40, 49, 42, 116,
  439. 40, 63, 63, 63, 50, 149, 115, 39, 40, 39,
  440. 111, 64, 51, 54, 36, 37, 42, 38, 40, 55,
  441. 40, 40, 40, 39, 40, 39, 79, 79, 79, 151,
  442. 105, 40, 42, 150, 40, 79, 79, 65, 39, 40,
  443. 39, 39, 40, 39, 119, 119, 119, 42, 104, 40,
  444. 42, 149, 40, 39, 40, 39, 39, 40, 39, 39,
  445. 40, 39, 42, 103, 40, 42, 102, 40, 42, 101,
  446. 40, 39, 40, 39, 66, 63, 63, 63, 93, 150,
  447. 42, 138, 40, 138, 70, 64, 92, 39, 40, 39,
  448. 67, 138, 76, 138, 71, 121, 42, 69, 40, 68,
  449. 91, 39, 40, 39, 39, 40, 39, 39, 40, 39,
  450. 42, 65, 40, 42, 90, 40, 42, 89, 40, 39,
  451. 40, 39, 139, 89, 39, 40, 39, 88, 42, 81,
  452. 40, 78, 139, 42, 82, 40, 79, 79, 79, 75,
  453. 39, 40, 39, 72, 83, 79, 79, 57, 86, 42,
  454. 47, 40, 85, 84, 87, 95, 96, 95, 39, 40,
  455. 39, 39, 40, 39, 42, 151, 40, 42, 151, 40,
  456. 42, 151, 40, 39, 40, 39, 127, 127, 127, 151,
  457. 128, 151, 42, 151, 40, 151, 151, 94, 39, 40,
  458. 39, 106, 40, 106, 151, 98, 151, 42, 151, 40,
  459. 42, 151, 40, 99, 151, 83, 97, 151, 151, 151,
  460. 39, 40, 39, 151, 100, 95, 96, 95, 151, 42,
  461. 107, 40, 151, 151, 42, 151, 40, 39, 40, 39,
  462. 62, 62, 62, 110, 40, 110, 42, 151, 40, 119,
  463. 119, 119, 42, 151, 40, 39, 40, 39, 151, 151,
  464. 109, 119, 119, 119, 42, 151, 40, 151, 83, 119,
  465. 119, 119, 39, 40, 39, 151, 97, 96, 96, 96,
  466. 151, 42, 107, 40, 151, 122, 151, 140, 40, 140,
  467. 141, 151, 62, 62, 62, 40, 40, 40, 135, 151,
  468. 121, 127, 127, 127, 151, 128, 40, 141, 143, 40,
  469. 143, 151, 121, 39, 40, 39, 151, 42, 151, 40,
  470. 121, 151, 42, 151, 40, 151, 151, 151, 97, 112,
  471. 112, 113, 112, 112, 112, 114, 112, 112, 112, 112,
  472. 112, 112, 112, 112, 112, 114, 114, 114, 112, 112,
  473. 112, 112, 112, 114, 114, 114, 114, 114, 114, 114,
  474. 114, 114, 112, 112, 112, 114, 114, 114, 114, 114,
  475. 114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
  476. 114, 112, 112, 106, 40, 106, 151, 140, 117, 140,
  477. 141, 151, 42, 151, 40, 151, 151, 151, 62, 62,
  478. 62, 110, 40, 110, 151, 151, 123, 141, 151, 151,
  479. 42, 151, 124, 151, 151, 151, 62, 62, 62, 131,
  480. 131, 131, 151, 151, 132, 131, 131, 131, 131, 131,
  481. 132, 63, 151, 63, 131, 131, 151, 131, 151, 151,
  482. 63, 151, 151, 131, 151, 151, 151, 151, 151, 151,
  483. 151, 151, 151, 63, 151, 151, 151, 151, 151, 151,
  484. 151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
  485. 134, 151, 151, 151, 151, 151, 134, 35, 151, 35,
  486. 151, 151, 35, 151, 151, 151, 151, 151, 35, 35,
  487. 41, 41, 41, 151, 151, 41, 41, 151, 41, 151,
  488. 41, 41, 41, 46, 46, 46, 56, 151, 151, 151,
  489. 151, 56, 56, 56, 62, 62, 62, 151, 151, 151,
  490. 62, 151, 62, 151, 62, 62, 62, 80, 80, 80,
  491. 151, 80, 151, 80, 80, 151, 151, 151, 80, 80,
  492. 80, 108, 108, 108, 151, 151, 108, 108, 151, 108,
  493. 151, 108, 108, 108, 108, 118, 118, 118, 151, 151,
  494. 118, 118, 151, 118, 151, 118, 118, 118, 120, 120,
  495. 120, 151, 151, 120, 151, 151, 151, 151, 120, 120,
  496. 120, 120, 125, 125, 125, 151, 151, 125, 125, 151,
  497. 125, 151, 125, 125, 125, 112, 112, 112, 112, 112,
  498. 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
  499. 133, 133, 133, 151, 151, 133, 133, 133, 151, 151,
  500. 133, 133, 133, 133, 136, 151, 151, 151, 151, 136,
  501. 136, 136, 137, 151, 137, 151, 151, 137, 151, 151,
  502. 151, 151, 151, 137, 137, 131, 131, 131, 151, 151,
  503. 151, 131, 131, 151, 151, 131, 131, 131, 131, 144,
  504. 151, 151, 151, 151, 144, 144, 144, 146, 151, 151,
  505. 146, 151, 146, 146, 146, 146, 146, 146, 146, 146,
  506. 146, 146, 5, 151, 151, 151, 151, 151, 151, 151,
  507. 151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
  508. 151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
  509. 151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
  510. 151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
  511. 151, 151, 151, 151, 151, 151, 151
  512. } ;
  513. static yyconst flex_int16_t yy_chk[868] =
  514. { 0,
  515. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  516. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  517. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  518. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  519. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  520. 1, 1, 1, 1, 2, 3, 2, 4, 3, 4,
  521. 2, 147, 9, 4, 9, 10, 10, 10, 11, 11,
  522. 16, 16, 16, 30, 10, 30, 10, 31, 24, 24,
  523. 24, 38, 37, 4, 37, 38, 4, 24, 52, 24,
  524. 52, 142, 139, 25, 25, 25, 26, 26, 26, 131,
  525. 9, 9, 25, 9, 25, 26, 58, 26, 27, 27,
  526. 27, 111, 58, 111, 130, 60, 34, 27, 34, 27,
  527. 24, 60, 31, 31, 116, 32, 32, 32, 115, 33,
  528. 33, 33, 112, 126, 32, 126, 32, 25, 33, 105,
  529. 33, 42, 42, 42, 26, 148, 104, 39, 39, 39,
  530. 101, 42, 27, 32, 34, 34, 39, 34, 39, 33,
  531. 40, 40, 40, 41, 41, 41, 64, 64, 64, 40,
  532. 93, 40, 41, 148, 41, 64, 64, 42, 48, 48,
  533. 48, 49, 49, 49, 107, 107, 107, 48, 92, 48,
  534. 49, 150, 49, 50, 50, 50, 51, 51, 51, 54,
  535. 54, 54, 50, 91, 50, 51, 90, 51, 54, 88,
  536. 54, 55, 55, 55, 48, 63, 63, 63, 81, 150,
  537. 55, 128, 55, 128, 54, 63, 78, 66, 66, 66,
  538. 49, 138, 77, 138, 55, 107, 66, 51, 66, 50,
  539. 76, 67, 67, 67, 68, 68, 68, 69, 69, 69,
  540. 67, 63, 67, 68, 75, 68, 69, 74, 69, 70,
  541. 70, 70, 128, 73, 71, 71, 71, 72, 70, 65,
  542. 70, 61, 138, 71, 66, 71, 79, 79, 79, 59,
  543. 82, 82, 82, 57, 67, 79, 79, 36, 70, 82,
  544. 22, 82, 69, 68, 71, 83, 83, 83, 84, 84,
  545. 84, 85, 85, 85, 83, 5, 83, 84, 0, 84,
  546. 85, 0, 85, 86, 86, 86, 113, 113, 113, 0,
  547. 113, 0, 86, 0, 86, 0, 0, 82, 87, 87,
  548. 87, 94, 94, 94, 0, 84, 0, 87, 0, 87,
  549. 94, 0, 94, 86, 0, 85, 83, 0, 0, 0,
  550. 98, 98, 98, 0, 87, 95, 95, 95, 0, 98,
  551. 95, 98, 0, 0, 95, 0, 95, 99, 99, 99,
  552. 95, 95, 95, 100, 100, 100, 99, 0, 99, 108,
  553. 108, 108, 100, 0, 100, 109, 109, 109, 0, 0,
  554. 99, 119, 119, 119, 109, 0, 109, 0, 98, 120,
  555. 120, 120, 122, 122, 122, 0, 95, 96, 96, 96,
  556. 0, 122, 96, 122, 0, 109, 96, 129, 96, 129,
  557. 129, 0, 96, 96, 96, 124, 124, 124, 122, 0,
  558. 108, 127, 127, 127, 124, 127, 124, 129, 135, 135,
  559. 135, 0, 119, 143, 143, 143, 0, 135, 0, 135,
  560. 120, 0, 143, 0, 143, 0, 0, 0, 96, 102,
  561. 102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
  562. 102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
  563. 102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
  564. 102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
  565. 102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
  566. 102, 102, 102, 106, 106, 106, 0, 140, 106, 140,
  567. 140, 0, 106, 0, 106, 0, 0, 0, 106, 106,
  568. 106, 110, 110, 110, 0, 0, 110, 140, 0, 0,
  569. 110, 0, 110, 0, 0, 0, 110, 110, 110, 117,
  570. 117, 117, 0, 0, 117, 118, 118, 118, 117, 117,
  571. 118, 149, 0, 149, 118, 118, 0, 117, 0, 0,
  572. 149, 0, 0, 118, 0, 0, 0, 0, 0, 0,
  573. 0, 0, 0, 149, 0, 0, 0, 0, 0, 0,
  574. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  575. 117, 0, 0, 0, 0, 0, 118, 152, 0, 152,
  576. 0, 0, 152, 0, 0, 0, 0, 0, 152, 152,
  577. 153, 153, 153, 0, 0, 153, 153, 0, 153, 0,
  578. 153, 153, 153, 154, 154, 154, 155, 0, 0, 0,
  579. 0, 155, 155, 155, 156, 156, 156, 0, 0, 0,
  580. 156, 0, 156, 0, 156, 156, 156, 157, 157, 157,
  581. 0, 157, 0, 157, 157, 0, 0, 0, 157, 157,
  582. 157, 158, 158, 158, 0, 0, 158, 158, 0, 158,
  583. 0, 158, 158, 158, 158, 159, 159, 159, 0, 0,
  584. 159, 159, 0, 159, 0, 159, 159, 159, 160, 160,
  585. 160, 0, 0, 160, 0, 0, 0, 0, 160, 160,
  586. 160, 160, 161, 161, 161, 0, 0, 161, 161, 0,
  587. 161, 0, 161, 161, 161, 162, 162, 162, 162, 162,
  588. 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
  589. 163, 163, 163, 0, 0, 163, 163, 163, 0, 0,
  590. 163, 163, 163, 163, 164, 0, 0, 0, 0, 164,
  591. 164, 164, 165, 0, 165, 0, 0, 165, 0, 0,
  592. 0, 0, 0, 165, 165, 166, 166, 166, 0, 0,
  593. 0, 166, 166, 0, 0, 166, 166, 166, 166, 167,
  594. 0, 0, 0, 0, 167, 167, 167, 168, 0, 0,
  595. 168, 0, 168, 168, 168, 168, 168, 168, 168, 168,
  596. 168, 168, 151, 151, 151, 151, 151, 151, 151, 151,
  597. 151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
  598. 151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
  599. 151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
  600. 151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
  601. 151, 151, 151, 151, 151, 151, 151
  602. } ;
  603. extern int yy_flex_debug;
  604. int yy_flex_debug = 0;
  605. static yy_state_type *yy_state_buf=0, *yy_state_ptr=0;
  606. static char *yy_full_match;
  607. static int yy_lp;
  608. static int yy_looking_for_trail_begin = 0;
  609. static int yy_full_lp;
  610. static int *yy_full_state;
  611. #define YY_TRAILING_MASK 0x2000
  612. #define YY_TRAILING_HEAD_MASK 0x4000
  613. #define REJECT \
  614. { \
  615. *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ \
  616. yy_cp = (yy_full_match); /* restore poss. backed-over text */ \
  617. (yy_lp) = (yy_full_lp); /* restore orig. accepting pos. */ \
  618. (yy_state_ptr) = (yy_full_state); /* restore orig. state */ \
  619. yy_current_state = *(yy_state_ptr); /* restore curr. state */ \
  620. ++(yy_lp); \
  621. goto find_rule; \
  622. }
  623. static int yy_more_flag = 0;
  624. static int yy_more_len = 0;
  625. #define yymore() ((yy_more_flag) = 1)
  626. #define YY_MORE_ADJ (yy_more_len)
  627. #define YY_RESTORE_YY_MORE_OFFSET
  628. char *yytext;
  629. #line 1 "scanner.l"
  630. #line 2 "scanner.l"
  631. /*===========================================================================
  632. Copyright (c) 1998-2000, The Santa Cruz Operation
  633. All rights reserved.
  634. Redistribution and use in source and binary forms, with or without
  635. modification, are permitted provided that the following conditions are met:
  636. *Redistributions of source code must retain the above copyright notice,
  637. this list of conditions and the following disclaimer.
  638. *Redistributions in binary form must reproduce the above copyright notice,
  639. this list of conditions and the following disclaimer in the documentation
  640. and/or other materials provided with the distribution.
  641. *Neither name of The Santa Cruz Operation nor the names of its contributors
  642. may be used to endorse or promote products derived from this software
  643. without specific prior written permission.
  644. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
  645. IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  646. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  647. PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
  648. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  649. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  650. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  651. INTERRUPTION)
  652. HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  653. LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  654. OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  655. DAMAGE.
  656. =========================================================================*/
  657. /* cscope - interactive C symbol cross-reference
  658. *
  659. * C symbol scanner
  660. */
  661. #include "global.h"
  662. #include "scanner.h"
  663. #include "lookup.h"
  664. /* the line counting has been moved from character reading for speed */
  665. /* comments are discarded */
  666. #define IFLEVELINC 5 /* #if nesting level size increment */
  667. static char const rcsid[] = "$Id: scanner.l,v 1.8 2007/03/09 23:54:34 broeker Exp $";
  668. int first; /* buffer index for first char of symbol */
  669. int last; /* buffer index for last char of symbol */
  670. int lineno; /* symbol line number */
  671. int myylineno = 1;
  672. static BOOL arraydimension; /* inside array dimension declaration */
  673. static BOOL bplisting; /* breakpoint listing */
  674. static int braces; /* unmatched left brace count */
  675. static BOOL classdef; /* c++ class definition */
  676. static BOOL elseelif; /* #else or #elif found */
  677. static BOOL esudef; /* enum/struct/union global definition */
  678. static BOOL external; /* external definition */
  679. static int externalbraces; /* external definition outer brace count */
  680. static BOOL fcndef; /* function definition */
  681. static BOOL global; /* file global scope (outside functions) */
  682. static int iflevel; /* #if nesting level */
  683. static BOOL initializer; /* data initializer */
  684. static int initializerbraces; /* data initializer outer brace count */
  685. static BOOL lex; /* lex file */
  686. static int miflevel = IFLEVELINC; /* maximum #if nesting level */
  687. static int *maxifbraces; /* maximum brace count within #if */
  688. static int *preifbraces; /* brace count before #if */
  689. static int parens; /* unmatched left parenthesis count */
  690. static BOOL ppdefine; /* preprocessor define statement */
  691. static BOOL pseudoelif; /* pseudo-#elif */
  692. static BOOL oldtype; /* next identifier is an old type */
  693. static BOOL rules; /* lex/yacc rules */
  694. static BOOL sdl; /* sdl file */
  695. static BOOL structfield; /* structure field declaration */
  696. static int tagdef; /* class/enum/struct/union tag definition */
  697. static BOOL template; /* function template */
  698. static int templateparens; /* function template outer parentheses count */
  699. static int typedefbraces = -1; /* initial typedef brace count */
  700. static int token; /* token found */
  701. void multicharconstant(char terminator);
  702. int skipcomment_input(void);
  703. int comment(void);
  704. #ifdef FLEX_SCANNER
  705. #define YY_INPUT(buf,result,max_size) \
  706. {\
  707. int c = skipcomment_input (); \
  708. result = (c == EOF) ? YY_NULL : (buf[0] = c, 1); \
  709. }
  710. #else
  711. /* Assume this is the AT&T/SCO style lex */
  712. #undef input
  713. #define input() ((yytchar=(yytchar=yysptr>yysbuf?*(unsigned char *)--yysptr:getc(yyin))=='/'?comment():yytchar)==EOF?LEXEOF:yytchar)
  714. #define noncommentinput() ((yytchar=yysptr>yysbuf?*--yysptr:getc(yyin))==EOF?LEXEOF:yytchar)
  715. #undef unput
  716. #define unput(c) (*yysptr++=(c))
  717. #endif
  718. #line 845 "scanner.c"
  719. #define INITIAL 0
  720. #define SDL 1
  721. #ifndef YY_NO_UNISTD_H
  722. /* Special case for "unistd.h", since it is non-ANSI. We include it way
  723. * down here because we want the user's section 1 to have been scanned first.
  724. * The user has a chance to override it with an option.
  725. */
  726. #include <unistd.h>
  727. #endif
  728. #ifndef YY_EXTRA_TYPE
  729. #define YY_EXTRA_TYPE void *
  730. #endif
  731. static int yy_init_globals (void );
  732. /* Accessor methods to globals.
  733. These are made visible to non-reentrant scanners for convenience. */
  734. int yylex_destroy (void );
  735. int yyget_debug (void );
  736. void yyset_debug (int debug_flag );
  737. YY_EXTRA_TYPE yyget_extra (void );
  738. void yyset_extra (YY_EXTRA_TYPE user_defined );
  739. FILE *yyget_in (void );
  740. void yyset_in (FILE * in_str );
  741. FILE *yyget_out (void );
  742. void yyset_out (FILE * out_str );
  743. int yyget_leng (void );
  744. char *yyget_text (void );
  745. int yyget_lineno (void );
  746. void yyset_lineno (int line_number );
  747. /* Macros after this point can all be overridden by user definitions in
  748. * section 1.
  749. */
  750. #ifndef YY_SKIP_YYWRAP
  751. #ifdef __cplusplus
  752. extern "C" int yywrap (void );
  753. #else
  754. extern int yywrap (void );
  755. #endif
  756. #endif
  757. static void yyunput (int c,char *buf_ptr );
  758. #ifndef yytext_ptr
  759. static void yy_flex_strncpy (char *,yyconst char *,int );
  760. #endif
  761. #ifdef YY_NEED_STRLEN
  762. static int yy_flex_strlen (yyconst char * );
  763. #endif
  764. #ifndef YY_NO_INPUT
  765. #ifdef __cplusplus
  766. static int yyinput (void );
  767. #else
  768. static int input (void );
  769. #endif
  770. #endif
  771. /* Amount of stuff to slurp up with each read. */
  772. #ifndef YY_READ_BUF_SIZE
  773. #define YY_READ_BUF_SIZE 8192
  774. #endif
  775. /* Copy whatever the last rule matched to the standard output. */
  776. #ifndef ECHO
  777. /* This used to be an fputs(), but since the string might contain NUL's,
  778. * we now use fwrite().
  779. */
  780. #define ECHO fwrite( yytext, yyleng, 1, yyout )
  781. #endif
  782. /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
  783. * is returned in "result".
  784. */
  785. #ifndef YY_INPUT
  786. #define YY_INPUT(buf,result,max_size) \
  787. if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
  788. { \
  789. int c = '*'; \
  790. int n; \
  791. for ( n = 0; n < max_size && \
  792. (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
  793. buf[n] = (char) c; \
  794. if ( c == '\n' ) \
  795. buf[n++] = (char) c; \
  796. if ( c == EOF && ferror( yyin ) ) \
  797. YY_FATAL_ERROR( "input in flex scanner failed" ); \
  798. result = n; \
  799. } \
  800. else \
  801. { \
  802. errno=0; \
  803. while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
  804. { \
  805. if( errno != EINTR) \
  806. { \
  807. YY_FATAL_ERROR( "input in flex scanner failed" ); \
  808. break; \
  809. } \
  810. errno=0; \
  811. clearerr(yyin); \
  812. } \
  813. }\
  814. \
  815. #endif
  816. /* No semi-colon after return; correct usage is to write "yyterminate();" -
  817. * we don't want an extra ';' after the "return" because that will cause
  818. * some compilers to complain about unreachable statements.
  819. */
  820. #ifndef yyterminate
  821. #define yyterminate() return YY_NULL
  822. #endif
  823. /* Number of entries by which start-condition stack grows. */
  824. #ifndef YY_START_STACK_INCR
  825. #define YY_START_STACK_INCR 25
  826. #endif
  827. /* Report a fatal error. */
  828. #ifndef YY_FATAL_ERROR
  829. #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
  830. #endif
  831. /* end tables serialization structures and prototypes */
  832. /* Default declaration of generated scanner - a define so the user can
  833. * easily add parameters.
  834. */
  835. #ifndef YY_DECL
  836. #define YY_DECL_IS_OURS 1
  837. extern int yylex (void);
  838. #define YY_DECL int yylex (void)
  839. #endif /* !YY_DECL */
  840. /* Code executed at the beginning of each rule, after yytext and yyleng
  841. * have been set up.
  842. */
  843. #ifndef YY_USER_ACTION
  844. #define YY_USER_ACTION
  845. #endif
  846. /* Code executed at the end of each rule. */
  847. #ifndef YY_BREAK
  848. #define YY_BREAK break;
  849. #endif
  850. #define YY_RULE_SETUP \
  851. if ( yyleng > 0 ) \
  852. YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
  853. (yytext[yyleng - 1] == '\n'); \
  854. YY_USER_ACTION
  855. /** The main scanner function which does all the work.
  856. */
  857. YY_DECL
  858. {
  859. register yy_state_type yy_current_state;
  860. register char *yy_cp, *yy_bp;
  861. register int yy_act;
  862. #line 115 "scanner.l"
  863. #line 1033 "scanner.c"
  864. if ( !(yy_init) )
  865. {
  866. (yy_init) = 1;
  867. #ifdef YY_USER_INIT
  868. YY_USER_INIT;
  869. #endif
  870. /* Create the reject buffer large enough to save one state per allowed character. */
  871. if ( ! (yy_state_buf) )
  872. (yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE );
  873. if ( ! (yy_state_buf) )
  874. YY_FATAL_ERROR( "out of dynamic memory in yylex()" );
  875. if ( ! (yy_start) )
  876. (yy_start) = 1; /* first start state */
  877. if ( ! yyin )
  878. yyin = stdin;
  879. if ( ! yyout )
  880. yyout = stdout;
  881. if ( ! YY_CURRENT_BUFFER ) {
  882. yyensure_buffer_stack ();
  883. YY_CURRENT_BUFFER_LVALUE =
  884. yy_create_buffer(yyin,YY_BUF_SIZE );
  885. }
  886. yy_load_buffer_state( );
  887. }
  888. while ( 1 ) /* loops until end-of-file is reached */
  889. {
  890. (yy_more_len) = 0;
  891. if ( (yy_more_flag) )
  892. {
  893. (yy_more_len) = (yy_c_buf_p) - (yytext_ptr);
  894. (yy_more_flag) = 0;
  895. }
  896. yy_cp = (yy_c_buf_p);
  897. /* Support of yytext. */
  898. *yy_cp = (yy_hold_char);
  899. /* yy_bp points to the position in yy_ch_buf of the start of
  900. * the current run.
  901. */
  902. yy_bp = yy_cp;
  903. yy_current_state = (yy_start);
  904. yy_current_state += YY_AT_BOL();
  905. (yy_state_ptr) = (yy_state_buf);
  906. *(yy_state_ptr)++ = yy_current_state;
  907. yy_match:
  908. do
  909. {
  910. register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
  911. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  912. {
  913. yy_current_state = (int) yy_def[yy_current_state];
  914. if ( yy_current_state >= 152 )
  915. yy_c = yy_meta[(unsigned int) yy_c];
  916. }
  917. yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  918. *(yy_state_ptr)++ = yy_current_state;
  919. ++yy_cp;
  920. }
  921. while ( yy_base[yy_current_state] != 813 );
  922. yy_find_action:
  923. yy_current_state = *--(yy_state_ptr);
  924. (yy_lp) = yy_accept[yy_current_state];
  925. find_rule: /* we branch to this label when backing up */
  926. for ( ; ; ) /* until we find what rule we matched */
  927. {
  928. if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] )
  929. {
  930. yy_act = yy_acclist[(yy_lp)];
  931. if ( yy_act & YY_TRAILING_HEAD_MASK ||
  932. (yy_looking_for_trail_begin) )
  933. {
  934. if ( yy_act == (yy_looking_for_trail_begin) )
  935. {
  936. (yy_looking_for_trail_begin) = 0;
  937. yy_act &= ~YY_TRAILING_HEAD_MASK;
  938. break;
  939. }
  940. }
  941. else if ( yy_act & YY_TRAILING_MASK )
  942. {
  943. (yy_looking_for_trail_begin) = yy_act & ~YY_TRAILING_MASK;
  944. (yy_looking_for_trail_begin) |= YY_TRAILING_HEAD_MASK;
  945. (yy_full_match) = yy_cp;
  946. (yy_full_state) = (yy_state_ptr);
  947. (yy_full_lp) = (yy_lp);
  948. }
  949. else
  950. {
  951. (yy_full_match) = yy_cp;
  952. (yy_full_state) = (yy_state_ptr);
  953. (yy_full_lp) = (yy_lp);
  954. break;
  955. }
  956. ++(yy_lp);
  957. goto find_rule;
  958. }
  959. --yy_cp;
  960. yy_current_state = *--(yy_state_ptr);
  961. (yy_lp) = yy_accept[yy_current_state];
  962. }
  963. YY_DO_BEFORE_ACTION;
  964. do_action: /* This label is used only to access EOF actions. */
  965. switch ( yy_act )
  966. { /* beginning of action switch */
  967. case 1:
  968. YY_RULE_SETUP
  969. #line 116 "scanner.l"
  970. { /* lex/yacc C declarations/definitions */
  971. global = YES;
  972. goto more;
  973. /* NOTREACHED */
  974. }
  975. YY_BREAK
  976. case 2:
  977. YY_RULE_SETUP
  978. #line 121 "scanner.l"
  979. {
  980. global = NO;
  981. goto more;
  982. /* NOTREACHED */
  983. }
  984. YY_BREAK
  985. case 3:
  986. YY_RULE_SETUP
  987. #line 126 "scanner.l"
  988. { /* lex/yacc rules delimiter */
  989. braces = 0;
  990. if (rules == NO) {
  991. rules = YES;
  992. /* simulate a yylex() or yyparse() definition */
  993. (void) strcat(yytext, " /* ");
  994. first = strlen(yytext);
  995. if (lex == YES) {
  996. (void) strcat(yytext, "yylex");
  997. }
  998. else { /* yacc: yyparse implicitly calls yylex */
  999. char *s = " yylex()";
  1000. char *cp = s + strlen(s);
  1001. while (--cp >= s) {
  1002. unput(*cp);
  1003. }
  1004. (void) strcat(yytext, "yyparse");
  1005. }
  1006. last = strlen(yytext);
  1007. (void) strcat(yytext, " */");
  1008. yyleng = strlen(yytext);
  1009. yymore();
  1010. return(FCNDEF);
  1011. }
  1012. else {
  1013. rules = NO;
  1014. global = YES;
  1015. last = first;
  1016. yymore();
  1017. return(FCNEND);
  1018. /* NOTREACHED */
  1019. }
  1020. }
  1021. YY_BREAK
  1022. case 4:
  1023. YY_RULE_SETUP
  1024. #line 160 "scanner.l"
  1025. { /* sdl state, treat as function def */
  1026. braces = 1;
  1027. fcndef = YES;
  1028. token = FCNDEF;
  1029. goto findident;
  1030. /* NOTREACHED */
  1031. }
  1032. YY_BREAK
  1033. case 5:
  1034. YY_RULE_SETUP
  1035. #line 167 "scanner.l"
  1036. { /* end of an sdl state, treat as end of a function */
  1037. goto endstate;
  1038. /* NOTREACHED */
  1039. }
  1040. YY_BREAK
  1041. case 6:
  1042. YY_RULE_SETUP
  1043. #line 171 "scanner.l"
  1044. { /* count unmatched left braces for fcn def detection */
  1045. ++braces;
  1046. /* mark an untagged enum/struct/union so its beginning
  1047. can be found */
  1048. if (tagdef) {
  1049. if (braces == 1) {
  1050. esudef = YES;
  1051. }
  1052. token = tagdef;
  1053. tagdef = '\0';
  1054. last = first;
  1055. yymore();
  1056. return(token);
  1057. }
  1058. goto more;
  1059. /* NOTREACHED */
  1060. }
  1061. YY_BREAK
  1062. case 7:
  1063. /* rule 7 can match eol */
  1064. YY_RULE_SETUP
  1065. #line 189 "scanner.l"
  1066. {
  1067. /* attempt to correct erroneous brace count caused by:
  1068. *
  1069. * #if ...
  1070. * ... {
  1071. * #endif
  1072. * #if ...
  1073. * ... {
  1074. * #endif
  1075. */
  1076. /* the current #if must not have an #else or #elif */
  1077. if (elseelif == YES) {
  1078. goto endif;
  1079. /* NOTREACHED */
  1080. }
  1081. pseudoelif = YES;
  1082. goto more;
  1083. /* NOTREACHED */
  1084. }
  1085. YY_BREAK
  1086. case 8:
  1087. YY_RULE_SETUP
  1088. #line 208 "scanner.l"
  1089. { /* #if, #ifdef or #ifndef */
  1090. elseelif = NO;
  1091. if (pseudoelif == YES) {
  1092. pseudoelif = NO;
  1093. goto elif;
  1094. /* NOTREACHED */
  1095. }
  1096. /* make sure there is room for the current brace count */
  1097. if (iflevel == miflevel) {
  1098. miflevel += IFLEVELINC;
  1099. maxifbraces = myrealloc(maxifbraces, miflevel * sizeof(int));
  1100. preifbraces = myrealloc(preifbraces, miflevel * sizeof(int));
  1101. }
  1102. /* push the current brace count */
  1103. preifbraces[iflevel] = braces;
  1104. maxifbraces[iflevel++] = 0;
  1105. goto more;
  1106. /* NOTREACHED */
  1107. }
  1108. YY_BREAK
  1109. case 9:
  1110. YY_RULE_SETUP
  1111. #line 227 "scanner.l"
  1112. { /* #elif or #else */
  1113. elseelif = YES;
  1114. elif:
  1115. if (iflevel > 0) {
  1116. /* save the maximum brace count for this #if */
  1117. if (braces > maxifbraces[iflevel - 1]) {
  1118. maxifbraces[iflevel - 1] = braces;
  1119. }
  1120. /* restore the brace count to before the #if */
  1121. braces = preifbraces[iflevel - 1];
  1122. }
  1123. goto more;
  1124. /* NOTREACHED */
  1125. }
  1126. YY_BREAK
  1127. case 10:
  1128. YY_RULE_SETUP
  1129. #line 242 "scanner.l"
  1130. { /* #endif */
  1131. endif:
  1132. if (iflevel > 0) {
  1133. /* get the maximum brace count for this #if */
  1134. if (braces < maxifbraces[--iflevel]) {
  1135. braces = maxifbraces[iflevel];
  1136. }
  1137. }
  1138. goto more;
  1139. /* NOTREACHED */
  1140. }
  1141. YY_BREAK
  1142. case 11:
  1143. YY_RULE_SETUP
  1144. #line 254 "scanner.l"
  1145. {
  1146. /* could be the last enum member initializer */
  1147. if (braces == initializerbraces) {
  1148. initializerbraces = -1;
  1149. initializer = NO;
  1150. }
  1151. if (--braces <= 0) {
  1152. endstate:
  1153. braces = 0;
  1154. classdef = NO;
  1155. }
  1156. if (braces == 0 || (braces == 1 && classdef == YES)) {
  1157. /* if the end of an enum/struct/union definition */
  1158. if (esudef == YES) {
  1159. esudef = NO;
  1160. }
  1161. /* if the end of the function */
  1162. else if (fcndef == YES) {
  1163. fcndef = NO;
  1164. last = first;
  1165. yymore();
  1166. return(FCNEND);
  1167. }
  1168. }
  1169. goto more;
  1170. /* NOTREACHED */
  1171. }
  1172. YY_BREAK
  1173. case 12:
  1174. YY_RULE_SETUP
  1175. #line 282 "scanner.l"
  1176. { /* count unmatched left parentheses for function templates */
  1177. ++parens;
  1178. goto more;
  1179. /* NOTREACHED */
  1180. }
  1181. YY_BREAK
  1182. case 13:
  1183. YY_RULE_SETUP
  1184. #line 287 "scanner.l"
  1185. {
  1186. if (--parens <= 0) {
  1187. parens = 0;
  1188. }
  1189. /* if the end of a function template */
  1190. if (parens == templateparens) {
  1191. templateparens = -1;
  1192. template = NO;
  1193. }
  1194. goto more;
  1195. /* NOTREACHED */
  1196. }
  1197. YY_BREAK
  1198. case 14:
  1199. YY_RULE_SETUP
  1200. #line 299 "scanner.l"
  1201. { /* if a global definition initializer */
  1202. if (global == YES && ppdefine == NO && yytext[0] != '#') {
  1203. initializerbraces = braces;
  1204. initializer = YES;
  1205. }
  1206. goto more;
  1207. /* NOTREACHED */
  1208. }
  1209. YY_BREAK
  1210. case 15:
  1211. YY_RULE_SETUP
  1212. #line 307 "scanner.l"
  1213. { /* a if global structure field */
  1214. if (global == YES && ppdefine == NO && yytext[0] != '#') {
  1215. structfield = YES;
  1216. }
  1217. goto more;
  1218. /* NOTREACHED */
  1219. }
  1220. YY_BREAK
  1221. case 16:
  1222. YY_RULE_SETUP
  1223. #line 314 "scanner.l"
  1224. {
  1225. if (braces == initializerbraces) {
  1226. initializerbraces = -1;
  1227. initializer = NO;
  1228. }
  1229. structfield = NO;
  1230. goto more;
  1231. /* NOTREACHED */
  1232. }
  1233. YY_BREAK
  1234. case 17:
  1235. YY_RULE_SETUP
  1236. #line 323 "scanner.l"
  1237. { /* if the enum/struct/union was not a definition */
  1238. if (braces == 0) {
  1239. esudef = NO;
  1240. }
  1241. /* if the end of a typedef */
  1242. if (braces == typedefbraces) {
  1243. typedefbraces = -1;
  1244. }
  1245. /* if the end of a external definition */
  1246. if (braces == externalbraces) {
  1247. externalbraces = -1;
  1248. external = NO;
  1249. }
  1250. structfield = NO;
  1251. initializer = NO;
  1252. goto more;
  1253. /* NOTREACHED */
  1254. }
  1255. YY_BREAK
  1256. case 18:
  1257. YY_RULE_SETUP
  1258. #line 341 "scanner.l"
  1259. {
  1260. /* preprocessor macro or constant definition */
  1261. ppdefine = YES;
  1262. token = DEFINE;
  1263. if (compress == YES) {
  1264. yytext[0] = '\1'; /* compress the keyword */
  1265. }
  1266. findident:
  1267. first = yyleng - 1;
  1268. while (yytext[first] != ' ' && yytext[first] != '\t') {
  1269. --first;
  1270. }
  1271. ++first;
  1272. goto fcn;
  1273. /* NOTREACHED */
  1274. }
  1275. YY_BREAK
  1276. case 19:
  1277. /* rule 19 can match eol */
  1278. YY_RULE_SETUP
  1279. #line 358 "scanner.l"
  1280. { /* class definition */
  1281. classdef = YES;
  1282. tagdef = 'c';
  1283. REJECT;
  1284. /* NOTREACHED */
  1285. }
  1286. YY_BREAK
  1287. case 20:
  1288. /* rule 20 can match eol */
  1289. YY_RULE_SETUP
  1290. #line 364 "scanner.l"
  1291. { /* enum/struct/union definition */
  1292. tagdef = *(yytext + first);
  1293. goto ident;
  1294. /* NOTREACHED */
  1295. }
  1296. YY_BREAK
  1297. case 21:
  1298. /* rule 21 can match eol */
  1299. YY_RULE_SETUP
  1300. #line 369 "scanner.l"
  1301. { /* tag-less e/s/u definition */
  1302. tagdef = yytext[first];
  1303. if (braces == 0) {
  1304. esudef = YES;
  1305. }
  1306. last = first;
  1307. tagdef = '\0';
  1308. goto more;
  1309. }
  1310. YY_BREAK
  1311. case 22:
  1312. /* rule 22 can match eol */
  1313. YY_RULE_SETUP
  1314. #line 378 "scanner.l"
  1315. {
  1316. /* warning: "if (...)" must not overflow yytext, so the content
  1317. of function argument definitions is restricted, in particular
  1318. parentheses are not allowed */
  1319. /* if a function definition */
  1320. /* note: "#define a (b) {" and "#if defined(a)\n#" are not */
  1321. if ((braces == 0 && ppdefine == NO && yytext[0] != '#' && rules == NO) ||
  1322. (braces == 1 && classdef == YES)) {
  1323. fcndef = YES;
  1324. token = FCNDEF;
  1325. goto fcn;
  1326. /* NOTREACHED */
  1327. }
  1328. goto fcncal;
  1329. /* NOTREACHED */
  1330. }
  1331. YY_BREAK
  1332. case 23:
  1333. YY_RULE_SETUP
  1334. #line 396 "scanner.l"
  1335. { /* if a function call */
  1336. fcncal: if (fcndef == YES || ppdefine == YES || rules == YES) {
  1337. token = FCNCALL;
  1338. goto fcn;
  1339. /* NOTREACHED */
  1340. }
  1341. if (template == NO) {
  1342. templateparens = parens;
  1343. template = YES;
  1344. }
  1345. goto ident;
  1346. /* NOTREACHED */
  1347. }
  1348. YY_BREAK
  1349. case 24:
  1350. /* rule 24 can match eol */
  1351. YY_RULE_SETUP
  1352. #line 409 "scanner.l"
  1353. { /* typedef name use */
  1354. goto ident;
  1355. /* NOTREACHED */
  1356. }
  1357. YY_BREAK
  1358. case 25:
  1359. YY_RULE_SETUP
  1360. #line 413 "scanner.l"
  1361. {
  1362. char *s;
  1363. if (global == YES && ppdefine == NO && yytext[0] != '#' &&
  1364. external == NO && initializer == NO &&
  1365. arraydimension == NO && structfield == NO &&
  1366. template == NO && fcndef == NO) {
  1367. if (esudef == YES) { /* if enum/struct/union */
  1368. token = MEMBERDEF;
  1369. }
  1370. else {
  1371. token = GLOBALDEF;
  1372. }
  1373. }
  1374. else {
  1375. ident: token = IDENT;
  1376. }
  1377. fcn:
  1378. /* if a long line */
  1379. if (yyleng > STMTMAX) {
  1380. int c;
  1381. /* skip to the end of the line */
  1382. warning("line too long");
  1383. while ((c = skipcomment_input()) != LEXEOF) {
  1384. if (c == '\n') {
  1385. unput(c);
  1386. break;
  1387. }
  1388. }
  1389. }
  1390. /* truncate a long symbol */
  1391. if (yyleng - first > PATLEN) {
  1392. warning("symbol too long");
  1393. yyleng = first + PATLEN;
  1394. yytext[yyleng] = '\0';
  1395. }
  1396. /* if a keyword */
  1397. yymore();
  1398. if ((s = lookup(yytext + first)) != NULL) {
  1399. first = yyleng;
  1400. /* if the start of a typedef */
  1401. if (s == typedeftext) {
  1402. typedefbraces = braces;
  1403. oldtype = YES;
  1404. }
  1405. /* if an enum/struct/union */