skel.c 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558
  1. /* File created from flex.skl via mkskel.sh */
  2. #include "flexdef.h"
  3. const char *skel[] = {
  4. "/* A lexical scanner generated by flex */",
  5. "",
  6. "/* Scanner skeleton version:",
  7. " * $Header: /opt/vlysenkov/CVSROOT/arcadia/contrib/tools/flex-old/skel.c,v 1.3 2008-08-04 15:30:40 leo Exp $",
  8. " */",
  9. "",
  10. "#define FLEX_SCANNER",
  11. "#define YY_FLEX_MAJOR_VERSION 2",
  12. "#define YY_FLEX_MINOR_VERSION 5",
  13. "",
  14. "%-",
  15. "#include <stdio.h>",
  16. "#include <errno.h>",
  17. "%*",
  18. "",
  19. "/* cfront 1.2 defines \"c_plusplus\" instead of \"__cplusplus\" */",
  20. "#ifdef c_plusplus",
  21. "#ifndef __cplusplus",
  22. "#define __cplusplus",
  23. "#endif",
  24. "#endif",
  25. "",
  26. "",
  27. "#ifdef __cplusplus",
  28. "",
  29. "#include <stdlib.h>",
  30. "%+",
  31. "#include <fstream>",
  32. "using std::istream;",
  33. "using std::ostream;",
  34. "%*",
  35. "#ifndef _WIN32",
  36. "#include <unistd.h>",
  37. "#endif",
  38. "",
  39. "#include <util/system/compiler.h>",
  40. "/* Use prototypes in function declarations. */",
  41. "#define YY_USE_PROTOS",
  42. "",
  43. "/* The \"const\" storage-class-modifier is valid. */",
  44. "#define YY_USE_CONST",
  45. "",
  46. "#else /* ! __cplusplus */",
  47. "",
  48. "#if __STDC__",
  49. "",
  50. "#define YY_USE_PROTOS",
  51. "#define YY_USE_CONST",
  52. "",
  53. "#endif /* __STDC__ */",
  54. "#endif /* ! __cplusplus */",
  55. "",
  56. "#ifdef __TURBOC__",
  57. " #pragma warn -rch",
  58. " #pragma warn -use",
  59. "#include <io.h>",
  60. "#include <stdlib.h>",
  61. "#define YY_USE_CONST",
  62. "#define YY_USE_PROTOS",
  63. "#endif",
  64. "",
  65. "#ifdef YY_USE_CONST",
  66. "#define yyconst const",
  67. "#else",
  68. "#define yyconst",
  69. "#endif",
  70. "",
  71. "",
  72. "#ifdef YY_USE_PROTOS",
  73. "#define YY_PROTO(proto) proto",
  74. "#else",
  75. "#define YY_PROTO(proto) ()",
  76. "#endif",
  77. "",
  78. "",
  79. "/* Returned upon end-of-file. */",
  80. "#define YY_NULL 0",
  81. "",
  82. "/* Promotes a possibly negative, possibly signed char to an unsigned",
  83. " * integer for use as an array index. If the signed char is negative,",
  84. " * we want to instead treat it as an 8-bit unsigned char, hence the",
  85. " * double cast.",
  86. " */",
  87. "#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)",
  88. "",
  89. "/* Enter a start condition. This macro really ought to take a parameter,",
  90. " * but we do it the disgusting crufty way forced on us by the ()-less",
  91. " * definition of BEGIN.",
  92. " */",
  93. "#define BEGIN yy_start = 1 + 2 *",
  94. "",
  95. "/* Translate the current start state into a value that can be later handed",
  96. " * to BEGIN to return to the state. The YYSTATE alias is for lex",
  97. " * compatibility.",
  98. " */",
  99. "#define YY_START ((yy_start - 1) / 2)",
  100. "#define YYSTATE YY_START",
  101. "",
  102. "/* Action number for EOF rule of a given start state. */",
  103. "#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)",
  104. "",
  105. "/* Special action meaning \"start processing a new file\". */",
  106. "#define YY_NEW_FILE yyrestart( yyin )",
  107. "",
  108. "#define YY_END_OF_BUFFER_CHAR 0",
  109. "",
  110. "/* Size of default input buffer. */",
  111. "#define YY_BUF_SIZE 16384",
  112. "",
  113. "typedef struct yy_buffer_state *YY_BUFFER_STATE;",
  114. "",
  115. "extern int yyleng;",
  116. "%-",
  117. "extern FILE *yyin, *yyout;",
  118. "%*",
  119. "",
  120. "#define EOB_ACT_CONTINUE_SCAN 0",
  121. "#define EOB_ACT_END_OF_FILE 1",
  122. "#define EOB_ACT_LAST_MATCH 2",
  123. "",
  124. "/* The funky do-while in the following #define is used to turn the definition",
  125. " * int a single C statement (which needs a semi-colon terminator). This",
  126. " * avoids problems with code like:",
  127. " *",
  128. " * if ( condition_holds )",
  129. " * yyless( 5 );",
  130. " * else",
  131. " * do_something_else();",
  132. " *",
  133. " * Prior to using the do-while the compiler would get upset at the",
  134. " * \"else\" because it interpreted the \"if\" statement as being all",
  135. " * done when it reached the ';' after the yyless() call.",
  136. " */",
  137. "",
  138. "/* Return all but the first 'n' matched characters back to the input stream. */",
  139. "",
  140. "#define yyless(n) \\",
  141. " do \\",
  142. " { \\",
  143. " /* Undo effects of setting up yytext. */ \\",
  144. " *yy_cp = yy_hold_char; \\",
  145. " YY_RESTORE_YY_MORE_OFFSET \\",
  146. " yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \\",
  147. " YY_DO_BEFORE_ACTION; /* set up yytext again */ \\",
  148. " } \\",
  149. " while ( 0 )",
  150. "",
  151. "#define unput(c) yyunput( c, yytext_ptr )",
  152. "",
  153. "/* The following is because we cannot portably get our hands on size_t",
  154. " * (without autoconf's help, which isn't available because we want",
  155. " * flex-generated scanners to compile on their own).",
  156. " */",
  157. "typedef unsigned int yy_size_t;",
  158. "",
  159. "",
  160. "struct yy_buffer_state",
  161. " {",
  162. "%-",
  163. " FILE *yy_input_file;",
  164. "%+",
  165. " istream* yy_input_file;",
  166. "%*",
  167. "",
  168. " char *yy_ch_buf; /* input buffer */",
  169. " char *yy_buf_pos; /* current position in input buffer */",
  170. "",
  171. " /* Size of input buffer in bytes, not including room for EOB",
  172. " * characters.",
  173. " */",
  174. " yy_size_t yy_buf_size;",
  175. "",
  176. " /* Number of characters read into yy_ch_buf, not including EOB",
  177. " * characters.",
  178. " */",
  179. " int yy_n_chars;",
  180. "",
  181. " /* Whether we \"own\" the buffer - i.e., we know we created it,",
  182. " * and can realloc() it to grow it, and should free() it to",
  183. " * delete it.",
  184. " */",
  185. " int yy_is_our_buffer;",
  186. "",
  187. " /* Whether this is an \"interactive\" input source; if so, and",
  188. " * if we're using stdio for input, then we want to use getc()",
  189. " * instead of fread(), to make sure we stop fetching input after",
  190. " * each newline.",
  191. " */",
  192. " int yy_is_interactive;",
  193. "",
  194. " /* Whether we're considered to be at the beginning of a line.",
  195. " * If so, '^' rules will be active on the next match, otherwise",
  196. " * not.",
  197. " */",
  198. " int yy_at_bol;",
  199. "",
  200. " /* Whether to try to fill the input buffer when we reach the",
  201. " * end of it.",
  202. " */",
  203. " int yy_fill_buffer;",
  204. "",
  205. " int yy_buffer_status;",
  206. "#define YY_BUFFER_NEW 0",
  207. "#define YY_BUFFER_NORMAL 1",
  208. " /* When an EOF's been seen but there's still some text to process",
  209. " * then we mark the buffer as YY_EOF_PENDING, to indicate that we",
  210. " * shouldn't try reading from the input source any more. We might",
  211. " * still have a bunch of tokens to match, though, because of",
  212. " * possible backing-up.",
  213. " *",
  214. " * When we actually see the EOF, we change the status to \"new\"",
  215. " * (via yyrestart()), so that the user can continue scanning by",
  216. " * just pointing yyin at a new input file.",
  217. " */",
  218. "#define YY_BUFFER_EOF_PENDING 2",
  219. " };",
  220. "",
  221. "%- Standard (non-C++) definition",
  222. "static YY_BUFFER_STATE yy_current_buffer = 0;",
  223. "%*",
  224. "",
  225. "/* We provide macros for accessing buffer states in case in the",
  226. " * future we want to put the buffer states in a more general",
  227. " * \"scanner state\".",
  228. " */",
  229. "#define YY_CURRENT_BUFFER yy_current_buffer",
  230. "",
  231. "",
  232. "%- Standard (non-C++) definition",
  233. "/* yy_hold_char holds the character lost when yytext is formed. */",
  234. "static char yy_hold_char;",
  235. "",
  236. "static int yy_n_chars; /* number of characters read into yy_ch_buf */",
  237. "",
  238. "",
  239. "int yyleng;",
  240. "",
  241. "/* Points to current character in buffer. */",
  242. "static char *yy_c_buf_p = (char *) 0;",
  243. "static int yy_init = 1; /* whether we need to initialize */",
  244. "static int yy_start = 0; /* start state number */",
  245. "",
  246. "/* Flag which is used to allow yywrap()'s to do buffer switches",
  247. " * instead of setting up a fresh yyin. A bit of a hack ...",
  248. " */",
  249. "static int yy_did_buffer_switch_on_eof;",
  250. "",
  251. "void yyrestart YY_PROTO(( FILE *input_file ));",
  252. "",
  253. "void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));",
  254. "void yy_load_buffer_state YY_PROTO(( void ));",
  255. "YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));",
  256. "void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));",
  257. "void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));",
  258. "void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));",
  259. "#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )",
  260. "",
  261. "YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));",
  262. "YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));",
  263. "YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));",
  264. "%*",
  265. "",
  266. "static void *yy_flex_alloc YY_PROTO(( yy_size_t ));",
  267. "Y_DECLARE_UNUSED",
  268. "static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));",
  269. "static void yy_flex_free YY_PROTO(( void * ));",
  270. "",
  271. "#define yy_new_buffer yy_create_buffer",
  272. "",
  273. "#define yy_set_interactive(is_interactive) \\",
  274. " { \\",
  275. " if ( ! yy_current_buffer ) \\",
  276. " yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \\",
  277. " yy_current_buffer->yy_is_interactive = is_interactive; \\",
  278. " }",
  279. "",
  280. "#define yy_set_bol(at_bol) \\",
  281. " { \\",
  282. " if ( ! yy_current_buffer ) \\",
  283. " yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \\",
  284. " yy_current_buffer->yy_at_bol = at_bol; \\",
  285. " }",
  286. "",
  287. "#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)",
  288. "",
  289. "%% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here",
  290. "",
  291. "%- Standard (non-C++) definition",
  292. "static yy_state_type yy_get_previous_state YY_PROTO(( void ));",
  293. "static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));",
  294. "static int yy_get_next_buffer YY_PROTO(( void ));",
  295. "static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));",
  296. "%*",
  297. "",
  298. "/* Done after the current pattern has been matched and before the",
  299. " * corresponding action - sets up yytext.",
  300. " */",
  301. "#define YY_DO_BEFORE_ACTION \\",
  302. " yytext_ptr = yy_bp; \\",
  303. "%% code to fiddle yytext and yyleng for yymore() goes here",
  304. " yy_hold_char = *yy_cp; \\",
  305. " *yy_cp = '\\0'; \\",
  306. "%% code to copy yytext_ptr to yytext[] goes here, if %array",
  307. " yy_c_buf_p = yy_cp;",
  308. "",
  309. "%% data tables for the DFA and the user's section 1 definitions go here",
  310. "",
  311. "/* Macros after this point can all be overridden by user definitions in",
  312. " * section 1.",
  313. " */",
  314. "",
  315. "#ifndef YY_SKIP_YYWRAP",
  316. "#ifdef __cplusplus",
  317. "extern \"C\" int yywrap YY_PROTO(( void ));",
  318. "#else",
  319. "extern int yywrap YY_PROTO(( void ));",
  320. "#endif",
  321. "#endif",
  322. "",
  323. "%-",
  324. "#ifndef YY_NO_UNPUT",
  325. "static void yyunput YY_PROTO(( int c, char *buf_ptr ));",
  326. "#endif",
  327. "%*",
  328. "",
  329. "#ifndef yytext_ptr",
  330. "static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));",
  331. "#endif",
  332. "",
  333. "#ifdef YY_NEED_STRLEN",
  334. "static int yy_flex_strlen YY_PROTO(( yyconst char * ));",
  335. "#endif",
  336. "",
  337. "#ifndef YY_NO_INPUT",
  338. "%- Standard (non-C++) definition",
  339. "#ifdef __cplusplus",
  340. "static int yyinput YY_PROTO(( void ));",
  341. "#else",
  342. "static int input YY_PROTO(( void ));",
  343. "#endif",
  344. "%*",
  345. "#endif",
  346. "",
  347. "#if YY_STACK_USED",
  348. "static int yy_start_stack_ptr = 0;",
  349. "static int yy_start_stack_depth = 0;",
  350. "static int *yy_start_stack = 0;",
  351. "#ifndef YY_NO_PUSH_STATE",
  352. "Y_DECLARE_UNUSED",
  353. "static void yy_push_state YY_PROTO(( int new_state ));",
  354. "#endif",
  355. "#ifndef YY_NO_POP_STATE",
  356. "Y_DECLARE_UNUSED",
  357. "static void yy_pop_state YY_PROTO(( void ));",
  358. "#endif",
  359. "#ifndef YY_NO_TOP_STATE",
  360. "Y_DECLARE_UNUSED",
  361. "static int yy_top_state YY_PROTO(( void ));",
  362. "#endif",
  363. "",
  364. "#else",
  365. "#define YY_NO_PUSH_STATE 1",
  366. "#define YY_NO_POP_STATE 1",
  367. "#define YY_NO_TOP_STATE 1",
  368. "#endif",
  369. "",
  370. "#ifdef YY_MALLOC_DECL",
  371. "YY_MALLOC_DECL",
  372. "#else",
  373. "#if __STDC__",
  374. "#ifndef __cplusplus",
  375. "#include <stdlib.h>",
  376. "#endif",
  377. "#else",
  378. "/* Just try to get by without declaring the routines. This will fail",
  379. " * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)",
  380. " * or sizeof(void*) != sizeof(int).",
  381. " */",
  382. "#endif",
  383. "#endif",
  384. "",
  385. "/* Amount of stuff to slurp up with each read. */",
  386. "#ifndef YY_READ_BUF_SIZE",
  387. "#define YY_READ_BUF_SIZE 8192",
  388. "#endif",
  389. "",
  390. "/* Copy whatever the last rule matched to the standard output. */",
  391. "",
  392. "#ifndef ECHO",
  393. "%- Standard (non-C++) definition",
  394. "/* This used to be an fputs(), but since the string might contain NUL's,",
  395. " * we now use fwrite().",
  396. " */",
  397. "#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )",
  398. "%+ C++ definition",
  399. "#define ECHO LexerOutput( yytext, yyleng )",
  400. "%*",
  401. "#endif",
  402. "",
  403. "/* Gets input and stuffs it into \"buf\". number of characters read, or YY_NULL,",
  404. " * is returned in \"result\".",
  405. " */",
  406. "#ifndef YY_INPUT",
  407. "#define YY_INPUT(buf,result,max_size) \\",
  408. "%% fread()/read() definition of YY_INPUT goes here unless we're doing C++",
  409. "%+ C++ definition",
  410. " if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \\",
  411. " YY_FATAL_ERROR( \"input in flex scanner failed\" );",
  412. "%*",
  413. "#endif",
  414. "",
  415. "/* No semi-colon after return; correct usage is to write \"yyterminate();\" -",
  416. " * we don't want an extra ';' after the \"return\" because that will cause",
  417. " * some compilers to complain about unreachable statements.",
  418. " */",
  419. "#ifndef yyterminate",
  420. "#define yyterminate() return YY_NULL",
  421. "#endif",
  422. "",
  423. "/* Number of entries by which start-condition stack grows. */",
  424. "#ifndef YY_START_STACK_INCR",
  425. "#define YY_START_STACK_INCR 25",
  426. "#endif",
  427. "",
  428. "/* Report a fatal error. */",
  429. "#ifndef YY_FATAL_ERROR",
  430. "%-",
  431. "#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )",
  432. "%+",
  433. "#define YY_FATAL_ERROR(msg) LexerError( msg )",
  434. "%*",
  435. "#endif",
  436. "",
  437. "/* Default declaration of generated scanner - a define so the user can",
  438. " * easily add parameters.",
  439. " */",
  440. "#ifndef YY_DECL",
  441. "%- Standard (non-C++) definition",
  442. "#define YY_DECL int yylex YY_PROTO(( void ))",
  443. "%+ C++ definition",
  444. "#define YY_DECL int yyFlexLexer::yylex()",
  445. "%*",
  446. "#endif",
  447. "",
  448. "/* Code executed at the beginning of each rule, after yytext and yyleng",
  449. " * have been set up.",
  450. " */",
  451. "#ifndef YY_USER_ACTION",
  452. "#define YY_USER_ACTION",
  453. "#endif",
  454. "",
  455. "/* Code executed at the end of each rule. */",
  456. "#ifndef YY_BREAK",
  457. "#define YY_BREAK break;",
  458. "#endif",
  459. "",
  460. "%% YY_RULE_SETUP definition goes here",
  461. "",
  462. "YY_DECL",
  463. " {",
  464. " yy_state_type yy_current_state;",
  465. " char *yy_cp, *yy_bp;",
  466. " int yy_act;",
  467. "",
  468. "%% user's declarations go here",
  469. "",
  470. " if ( yy_init )",
  471. " {",
  472. " yy_init = 0;",
  473. "",
  474. "#ifdef YY_USER_INIT",
  475. " YY_USER_INIT;",
  476. "#endif",
  477. "",
  478. " if ( ! yy_start )",
  479. " yy_start = 1; /* first start state */",
  480. "",
  481. " if ( ! yyin )",
  482. "%-",
  483. " yyin = stdin;",
  484. "%+",
  485. " yyin = &cin;",
  486. "%*",
  487. "",
  488. " if ( ! yyout )",
  489. "%-",
  490. " yyout = stdout;",
  491. "%+",
  492. " yyout = &cout;",
  493. "%*",
  494. "",
  495. " if ( ! yy_current_buffer )",
  496. " yy_current_buffer =",
  497. " yy_create_buffer( yyin, YY_BUF_SIZE );",
  498. "",
  499. " yy_load_buffer_state();",
  500. " }",
  501. "",
  502. " while ( 1 ) /* loops until end-of-file is reached */",
  503. " {",
  504. "%% yymore()-related code goes here",
  505. " yy_cp = yy_c_buf_p;",
  506. "",
  507. " /* Support of yytext. */",
  508. " *yy_cp = yy_hold_char;",
  509. "",
  510. " /* yy_bp points to the position in yy_ch_buf of the start of",
  511. " * the current run.",
  512. " */",
  513. " yy_bp = yy_cp;",
  514. "",
  515. "%% code to set up and find next match goes here",
  516. "",
  517. "yy_find_action:",
  518. "%% code to find the action number goes here",
  519. "",
  520. " YY_DO_BEFORE_ACTION;",
  521. "",
  522. "%% code for yylineno update goes here",
  523. "",
  524. "do_action: /* This label is used only to access EOF actions. */",
  525. "",
  526. "%% debug code goes here",
  527. "",
  528. " switch ( yy_act )",
  529. " { /* beginning of action switch */",
  530. "%% actions go here",
  531. "",
  532. " case YY_END_OF_BUFFER:",
  533. " {",
  534. " /* Amount of text matched not including the EOB char. */",
  535. " int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;",
  536. "",
  537. " /* Undo the effects of YY_DO_BEFORE_ACTION. */",
  538. " *yy_cp = yy_hold_char;",
  539. " YY_RESTORE_YY_MORE_OFFSET",
  540. "",
  541. " if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )",
  542. " {",
  543. " /* We're scanning a new file or input source. It's",
  544. " * possible that this happened because the user",
  545. " * just pointed yyin at a new source and called",
  546. " * yylex(). If so, then we have to assure",
  547. " * consistency between yy_current_buffer and our",
  548. " * globals. Here is the right place to do so, because",
  549. " * this is the first action (other than possibly a",
  550. " * back-up) that will match for the new input source.",
  551. " */",
  552. " yy_n_chars = yy_current_buffer->yy_n_chars;",
  553. " yy_current_buffer->yy_input_file = yyin;",
  554. " yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;",
  555. " }",
  556. "",
  557. " /* Note that here we test for yy_c_buf_p \"<=\" to the position",
  558. " * of the first EOB in the buffer, since yy_c_buf_p will",
  559. " * already have been incremented past the NUL character",
  560. " * (since all states make transitions on EOB to the",
  561. " * end-of-buffer state). Contrast this with the test",
  562. " * in input().",
  563. " */",
  564. " if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )",
  565. " { /* This was really a NUL. */",
  566. " yy_state_type yy_next_state;",
  567. "",
  568. " yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;",
  569. "",
  570. " yy_current_state = yy_get_previous_state();",
  571. "",
  572. " /* Okay, we're now positioned to make the NUL",
  573. " * transition. We couldn't have",
  574. " * yy_get_previous_state() go ahead and do it",
  575. " * for us because it doesn't know how to deal",
  576. " * with the possibility of jamming (and we don't",
  577. " * want to build jamming into it because then it",
  578. " * will run more slowly).",
  579. " */",
  580. "",
  581. " yy_next_state = yy_try_NUL_trans( yy_current_state );",
  582. "",
  583. " yy_bp = yytext_ptr + YY_MORE_ADJ;",
  584. "",
  585. " if ( yy_next_state )",
  586. " {",
  587. " /* Consume the NUL. */",
  588. " yy_cp = ++yy_c_buf_p;",
  589. " yy_current_state = yy_next_state;",
  590. " goto yy_match;",
  591. " }",
  592. "",
  593. " else",
  594. " {",
  595. "%% code to do back-up for compressed tables and set up yy_cp goes here",
  596. " goto yy_find_action;",
  597. " }",
  598. " }",
  599. "",
  600. " else switch ( yy_get_next_buffer() )",
  601. " {",
  602. " case EOB_ACT_END_OF_FILE:",
  603. " {",
  604. " yy_did_buffer_switch_on_eof = 0;",
  605. "",
  606. " if ( yywrap() )",
  607. " {",
  608. " /* Note: because we've taken care in",
  609. " * yy_get_next_buffer() to have set up",
  610. " * yytext, we can now set up",
  611. " * yy_c_buf_p so that if some total",
  612. " * hoser (like flex itself) wants to",
  613. " * call the scanner after we return the",
  614. " * YY_NULL, it'll still work - another",
  615. " * YY_NULL will get returned.",
  616. " */",
  617. " yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;",
  618. "",
  619. " yy_act = YY_STATE_EOF(YY_START);",
  620. " goto do_action;",
  621. " }",
  622. "",
  623. " else",
  624. " {",
  625. " if ( ! yy_did_buffer_switch_on_eof )",
  626. " YY_NEW_FILE;",
  627. " }",
  628. " break;",
  629. " }",
  630. "",
  631. " case EOB_ACT_CONTINUE_SCAN:",
  632. " yy_c_buf_p =",
  633. " yytext_ptr + yy_amount_of_matched_text;",
  634. "",
  635. " yy_current_state = yy_get_previous_state();",
  636. "",
  637. " yy_cp = yy_c_buf_p;",
  638. " yy_bp = yytext_ptr + YY_MORE_ADJ;",
  639. " goto yy_match;",
  640. "",
  641. " case EOB_ACT_LAST_MATCH:",
  642. " yy_c_buf_p =",
  643. " &yy_current_buffer->yy_ch_buf[yy_n_chars];",
  644. "",
  645. " yy_current_state = yy_get_previous_state();",
  646. "",
  647. " yy_cp = yy_c_buf_p;",
  648. " yy_bp = yytext_ptr + YY_MORE_ADJ;",
  649. " goto yy_find_action;",
  650. " }",
  651. " break;",
  652. " }",
  653. "",
  654. " default:",
  655. " YY_FATAL_ERROR(",
  656. " \"fatal flex scanner internal error--no action found\" );",
  657. " } /* end of action switch */",
  658. " } /* end of scanning one token */",
  659. " } /* end of yylex */",
  660. "",
  661. "%+",
  662. "yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout )",
  663. " {",
  664. " yyin = arg_yyin;",
  665. " yyout = arg_yyout;",
  666. " yy_c_buf_p = 0;",
  667. " yy_init = 1;",
  668. " yy_start = 0;",
  669. " yy_flex_debug = 0;",
  670. " yylineno = 1; // this will only get updated if %option yylineno",
  671. "",
  672. " yy_did_buffer_switch_on_eof = 0;",
  673. "",
  674. " yy_looking_for_trail_begin = 0;",
  675. " yy_more_flag = 0;",
  676. " yy_more_len = 0;",
  677. " yy_more_offset = yy_prev_more_offset = 0;",
  678. "",
  679. " yy_start_stack_ptr = yy_start_stack_depth = 0;",
  680. " yy_start_stack = 0;",
  681. "",
  682. " yy_current_buffer = 0;",
  683. "",
  684. "#ifdef YY_USES_REJECT",
  685. " yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2];",
  686. "#else",
  687. " yy_state_buf = 0;",
  688. "#endif",
  689. " }",
  690. "",
  691. "yyFlexLexer::~yyFlexLexer()",
  692. " {",
  693. " delete[] yy_state_buf;",
  694. " yy_delete_buffer( yy_current_buffer );",
  695. " }",
  696. "",
  697. "void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out )",
  698. " {",
  699. " if ( new_in )",
  700. " {",
  701. " yy_delete_buffer( yy_current_buffer );",
  702. " yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) );",
  703. " }",
  704. "",
  705. " if ( new_out )",
  706. " yyout = new_out;",
  707. " }",
  708. "",
  709. "#ifdef YY_INTERACTIVE",
  710. "int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )",
  711. "#else",
  712. "int yyFlexLexer::LexerInput( char* buf, int max_size )",
  713. "#endif",
  714. " {",
  715. " if ( yyin->eof() || yyin->fail() )",
  716. " return 0;",
  717. "",
  718. "#ifdef YY_INTERACTIVE",
  719. " yyin->get( buf[0] );",
  720. "",
  721. " if ( yyin->eof() )",
  722. " return 0;",
  723. "",
  724. " if ( yyin->bad() )",
  725. " return -1;",
  726. "",
  727. " return 1;",
  728. "",
  729. "#else",
  730. " (void) yyin->read( buf, max_size );",
  731. "",
  732. " if ( yyin->bad() )",
  733. " return -1;",
  734. " else",
  735. " return yyin->gcount();",
  736. "#endif",
  737. " }",
  738. "",
  739. "void yyFlexLexer::LexerOutput( const char* buf, int size )",
  740. " {",
  741. " (void) yyout->write( buf, size );",
  742. " }",
  743. "%*",
  744. "",
  745. "/* yy_get_next_buffer - try to read in a new buffer",
  746. " *",
  747. " * Returns a code representing an action:",
  748. " * EOB_ACT_LAST_MATCH -",
  749. " * EOB_ACT_CONTINUE_SCAN - continue scanning from current position",
  750. " * EOB_ACT_END_OF_FILE - end of file",
  751. " */",
  752. "",
  753. "%-",
  754. "static int yy_get_next_buffer()",
  755. "%+",
  756. "int yyFlexLexer::yy_get_next_buffer()",
  757. "%*",
  758. " {",
  759. " char *dest = yy_current_buffer->yy_ch_buf;",
  760. " char *source = yytext_ptr;",
  761. " int number_to_move, i;",
  762. " int ret_val;",
  763. "",
  764. " if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )",
  765. " YY_FATAL_ERROR(",
  766. " \"fatal flex scanner internal error--end of buffer missed\" );",
  767. "",
  768. " if ( yy_current_buffer->yy_fill_buffer == 0 )",
  769. " { /* Don't try to fill the buffer, so this is an EOF. */",
  770. " if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )",
  771. " {",
  772. " /* We matched a single character, the EOB, so",
  773. " * treat this as a final EOF.",
  774. " */",
  775. " return EOB_ACT_END_OF_FILE;",
  776. " }",
  777. "",
  778. " else",
  779. " {",
  780. " /* We matched some text prior to the EOB, first",
  781. " * process it.",
  782. " */",
  783. " return EOB_ACT_LAST_MATCH;",
  784. " }",
  785. " }",
  786. "",
  787. " /* Try to read more data. */",
  788. "",
  789. " /* First move last chars to start of buffer. */",
  790. " number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;",
  791. "",
  792. " for ( i = 0; i < number_to_move; ++i )",
  793. " *(dest++) = *(source++);",
  794. "",
  795. " if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )",
  796. " /* don't do the read, it's not guaranteed to return an EOF,",
  797. " * just force an EOF",
  798. " */",
  799. " yy_current_buffer->yy_n_chars = yy_n_chars = 0;",
  800. "",
  801. " else",
  802. " {",
  803. " int num_to_read =",
  804. " yy_current_buffer->yy_buf_size - number_to_move - 1;",
  805. "",
  806. " while ( num_to_read <= 0 )",
  807. " { /* Not enough room in the buffer - grow it. */",
  808. "#ifdef YY_USES_REJECT",
  809. " YY_FATAL_ERROR(",
  810. "\"input buffer overflow, can't enlarge buffer because scanner uses REJECT\" );",
  811. "#else",
  812. "",
  813. " /* just a shorter name for the current buffer */",
  814. " YY_BUFFER_STATE b = yy_current_buffer;",
  815. "",
  816. " int yy_c_buf_p_offset =",
  817. " (int) (yy_c_buf_p - b->yy_ch_buf);",
  818. "",
  819. " if ( b->yy_is_our_buffer )",
  820. " {",
  821. " int new_size = b->yy_buf_size * 2;",
  822. "",
  823. " if ( new_size <= 0 )",
  824. " b->yy_buf_size += b->yy_buf_size / 8;",
  825. " else",
  826. " b->yy_buf_size *= 2;",
  827. "",
  828. " b->yy_ch_buf = (char *)",
  829. " /* Include room in for 2 EOB chars. */",
  830. " yy_flex_realloc( (void *) b->yy_ch_buf,",
  831. " b->yy_buf_size + 2 );",
  832. " }",
  833. " else",
  834. " /* Can't grow it, we don't own it. */",
  835. " b->yy_ch_buf = 0;",
  836. "",
  837. " if ( ! b->yy_ch_buf )",
  838. " YY_FATAL_ERROR(",
  839. " \"fatal error - scanner input buffer overflow\" );",
  840. "",
  841. " yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];",
  842. "",
  843. " num_to_read = yy_current_buffer->yy_buf_size -",
  844. " number_to_move - 1;",
  845. "#endif",
  846. " }",
  847. "",
  848. " if ( num_to_read > YY_READ_BUF_SIZE )",
  849. " num_to_read = YY_READ_BUF_SIZE;",
  850. "",
  851. " /* Read in more data. */",
  852. " YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),",
  853. " yy_n_chars, num_to_read );",
  854. "",
  855. " yy_current_buffer->yy_n_chars = yy_n_chars;",
  856. " }",
  857. "",
  858. " if ( yy_n_chars == 0 )",
  859. " {",
  860. " if ( number_to_move == YY_MORE_ADJ )",
  861. " {",
  862. " ret_val = EOB_ACT_END_OF_FILE;",
  863. " yyrestart( yyin );",
  864. " }",
  865. "",
  866. " else",
  867. " {",
  868. " ret_val = EOB_ACT_LAST_MATCH;",
  869. " yy_current_buffer->yy_buffer_status =",
  870. " YY_BUFFER_EOF_PENDING;",
  871. " }",
  872. " }",
  873. "",
  874. " else",
  875. " ret_val = EOB_ACT_CONTINUE_SCAN;",
  876. "",
  877. " yy_n_chars += number_to_move;",
  878. " yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;",
  879. " yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;",
  880. "",
  881. " yytext_ptr = &yy_current_buffer->yy_ch_buf[0];",
  882. "",
  883. " return ret_val;",
  884. " }",
  885. "",
  886. "",
  887. "/* yy_get_previous_state - get the state just before the EOB char was reached */",
  888. "",
  889. "%-",
  890. "static yy_state_type yy_get_previous_state()",
  891. "%+",
  892. "yy_state_type yyFlexLexer::yy_get_previous_state()",
  893. "%*",
  894. " {",
  895. " yy_state_type yy_current_state;",
  896. " char *yy_cp;",
  897. "",
  898. "%% code to get the start state into yy_current_state goes here",
  899. "",
  900. " for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )",
  901. " {",
  902. "%% code to find the next state goes here",
  903. " }",
  904. "",
  905. " return yy_current_state;",
  906. " }",
  907. "",
  908. "",
  909. "/* yy_try_NUL_trans - try to make a transition on the NUL character",
  910. " *",
  911. " * synopsis",
  912. " * next_state = yy_try_NUL_trans( current_state );",
  913. " */",
  914. "",
  915. "%-",
  916. "#ifdef YY_USE_PROTOS",
  917. "static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )",
  918. "#else",
  919. "static yy_state_type yy_try_NUL_trans( yy_current_state )",
  920. "yy_state_type yy_current_state;",
  921. "#endif",
  922. "%+",
  923. "yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )",
  924. "%*",
  925. " {",
  926. " int yy_is_jam;",
  927. "%% code to find the next state, and perhaps do backing up, goes here",
  928. "",
  929. " return yy_is_jam ? 0 : yy_current_state;",
  930. " }",
  931. "",
  932. "",
  933. "%-",
  934. "#ifndef YY_NO_UNPUT",
  935. "#ifdef YY_USE_PROTOS",
  936. "Y_DECLARE_UNUSED",
  937. "static void yyunput( int c, char *yy_bp )",
  938. "#else",
  939. "static void yyunput( c, yy_bp )",
  940. "int c;",
  941. "char *yy_bp;",
  942. "#endif",
  943. "%+",
  944. "void yyFlexLexer::yyunput( int c, char* yy_bp )",
  945. "%*",
  946. " {",
  947. " char *yy_cp = yy_c_buf_p;",
  948. "",
  949. " /* undo effects of setting up yytext */",
  950. " *yy_cp = yy_hold_char;",
  951. "",
  952. " if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )",
  953. " { /* need to shift things up to make room */",
  954. " /* +2 for EOB chars. */",
  955. " int number_to_move = yy_n_chars + 2;",
  956. " char *dest = &yy_current_buffer->yy_ch_buf[",
  957. " yy_current_buffer->yy_buf_size + 2];",
  958. " char *source =",
  959. " &yy_current_buffer->yy_ch_buf[number_to_move];",
  960. "",
  961. " while ( source > yy_current_buffer->yy_ch_buf )",
  962. " *--dest = *--source;",
  963. "",
  964. " yy_cp += (int) (dest - source);",
  965. " yy_bp += (int) (dest - source);",
  966. " yy_current_buffer->yy_n_chars =",
  967. " yy_n_chars = yy_current_buffer->yy_buf_size;",
  968. "",
  969. " if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )",
  970. " YY_FATAL_ERROR( \"flex scanner push-back overflow\" );",
  971. " }",
  972. "",
  973. " *--yy_cp = (char) c;",
  974. "",
  975. "%% update yylineno here",
  976. "",
  977. " yytext_ptr = yy_bp;",
  978. " yy_hold_char = *yy_cp;",
  979. " yy_c_buf_p = yy_cp;",
  980. " }",
  981. "%-",
  982. "#endif /* ifndef YY_NO_UNPUT */",
  983. "%*",
  984. "",
  985. "",
  986. "%-",
  987. "#ifdef __cplusplus",
  988. "static int yyinput()",
  989. "#else",
  990. "static int input()",
  991. "#endif",
  992. "%+",
  993. "int yyFlexLexer::yyinput()",
  994. "%*",
  995. " {",
  996. " int c;",
  997. "",
  998. " *yy_c_buf_p = yy_hold_char;",
  999. "",
  1000. " if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )",
  1001. " {",
  1002. " /* yy_c_buf_p now points to the character we want to return.",
  1003. " * If this occurs *before* the EOB characters, then it's a",
  1004. " * valid NUL; if not, then we've hit the end of the buffer.",
  1005. " */",
  1006. " if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )",
  1007. " /* This was really a NUL. */",
  1008. " *yy_c_buf_p = '\\0';",
  1009. "",
  1010. " else",
  1011. " { /* need more input */",
  1012. " int offset = yy_c_buf_p - yytext_ptr;",
  1013. " ++yy_c_buf_p;",
  1014. "",
  1015. " switch ( yy_get_next_buffer() )",
  1016. " {",
  1017. " case EOB_ACT_LAST_MATCH:",
  1018. " /* This happens because yy_g_n_b()",
  1019. " * sees that we've accumulated a",
  1020. " * token and flags that we need to",
  1021. " * try matching the token before",
  1022. " * proceeding. But for input(),",
  1023. " * there's no matching to consider.",
  1024. " * So convert the EOB_ACT_LAST_MATCH",
  1025. " * to EOB_ACT_END_OF_FILE.",
  1026. " */",
  1027. "",
  1028. " /* Reset buffer status. */",
  1029. " yyrestart( yyin );",
  1030. "",
  1031. " /* fall through */",
  1032. "",
  1033. " case EOB_ACT_END_OF_FILE:",
  1034. " {",
  1035. " if ( yywrap() )",
  1036. " return EOF;",
  1037. "",
  1038. " if ( ! yy_did_buffer_switch_on_eof )",
  1039. " YY_NEW_FILE;",
  1040. "#ifdef __cplusplus",
  1041. " return yyinput();",
  1042. "#else",
  1043. " return input();",
  1044. "#endif",
  1045. " }",
  1046. "",
  1047. " case EOB_ACT_CONTINUE_SCAN:",
  1048. " yy_c_buf_p = yytext_ptr + offset;",
  1049. " break;",
  1050. " }",
  1051. " }",
  1052. " }",
  1053. "",
  1054. " c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */",
  1055. " *yy_c_buf_p = '\\0'; /* preserve yytext */",
  1056. " yy_hold_char = *++yy_c_buf_p;",
  1057. "",
  1058. "%% update BOL and yylineno",
  1059. "",
  1060. " return c;",
  1061. " }",
  1062. "",
  1063. "",
  1064. "%-",
  1065. "#ifdef YY_USE_PROTOS",
  1066. "void yyrestart( FILE *input_file )",
  1067. "#else",
  1068. "void yyrestart( input_file )",
  1069. "FILE *input_file;",
  1070. "#endif",
  1071. "%+",
  1072. "void yyFlexLexer::yyrestart( istream* input_file )",
  1073. "%*",
  1074. " {",
  1075. " if ( ! yy_current_buffer )",
  1076. " yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );",
  1077. "",
  1078. " yy_init_buffer( yy_current_buffer, input_file );",
  1079. " yy_load_buffer_state();",
  1080. " }",
  1081. "",
  1082. "",
  1083. "%-",
  1084. "#ifdef YY_USE_PROTOS",
  1085. "void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )",
  1086. "#else",
  1087. "void yy_switch_to_buffer( new_buffer )",
  1088. "YY_BUFFER_STATE new_buffer;",
  1089. "#endif",
  1090. "%+",
  1091. "void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )",
  1092. "%*",
  1093. " {",
  1094. " if ( yy_current_buffer == new_buffer )",
  1095. " return;",
  1096. "",
  1097. " if ( yy_current_buffer )",
  1098. " {",
  1099. " /* Flush out information for old buffer. */",
  1100. " *yy_c_buf_p = yy_hold_char;",
  1101. " yy_current_buffer->yy_buf_pos = yy_c_buf_p;",
  1102. " yy_current_buffer->yy_n_chars = yy_n_chars;",
  1103. " }",
  1104. "",
  1105. " yy_current_buffer = new_buffer;",
  1106. " yy_load_buffer_state();",
  1107. "",
  1108. " /* We don't actually know whether we did this switch during",
  1109. " * EOF (yywrap()) processing, but the only time this flag",
  1110. " * is looked at is after yywrap() is called, so it's safe",
  1111. " * to go ahead and always set it.",
  1112. " */",
  1113. " yy_did_buffer_switch_on_eof = 1;",
  1114. " }",
  1115. "",
  1116. "",
  1117. "%-",
  1118. "#ifdef YY_USE_PROTOS",
  1119. "void yy_load_buffer_state( void )",
  1120. "#else",
  1121. "void yy_load_buffer_state()",
  1122. "#endif",
  1123. "%+",
  1124. "void yyFlexLexer::yy_load_buffer_state()",
  1125. "%*",
  1126. " {",
  1127. " yy_n_chars = yy_current_buffer->yy_n_chars;",
  1128. " yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;",
  1129. " yyin = yy_current_buffer->yy_input_file;",
  1130. " yy_hold_char = *yy_c_buf_p;",
  1131. " }",
  1132. "",
  1133. "",
  1134. "%-",
  1135. "#ifdef YY_USE_PROTOS",
  1136. "YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )",
  1137. "#else",
  1138. "YY_BUFFER_STATE yy_create_buffer( file, size )",
  1139. "FILE *file;",
  1140. "int size;",
  1141. "#endif",
  1142. "%+",
  1143. "YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size )",
  1144. "%*",
  1145. " {",
  1146. " YY_BUFFER_STATE b;",
  1147. "",
  1148. " b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );",
  1149. " if ( ! b )",
  1150. " YY_FATAL_ERROR( \"out of dynamic memory in yy_create_buffer()\" );",
  1151. "",
  1152. " b->yy_buf_size = size;",
  1153. "",
  1154. " /* yy_ch_buf has to be 2 characters longer than the size given because",
  1155. " * we need to put in 2 end-of-buffer characters.",
  1156. " */",
  1157. " b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );",
  1158. " if ( ! b->yy_ch_buf )",
  1159. " YY_FATAL_ERROR( \"out of dynamic memory in yy_create_buffer()\" );",
  1160. "",
  1161. " b->yy_is_our_buffer = 1;",
  1162. "",
  1163. " yy_init_buffer( b, file );",
  1164. "",
  1165. " return b;",
  1166. " }",
  1167. "",
  1168. "",
  1169. "%-",
  1170. "#ifdef YY_USE_PROTOS",
  1171. "void yy_delete_buffer( YY_BUFFER_STATE b )",
  1172. "#else",
  1173. "void yy_delete_buffer( b )",
  1174. "YY_BUFFER_STATE b;",
  1175. "#endif",
  1176. "%+",
  1177. "void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )",
  1178. "%*",
  1179. " {",
  1180. " if ( ! b )",
  1181. " return;",
  1182. "",
  1183. " if ( b == yy_current_buffer )",
  1184. " yy_current_buffer = (YY_BUFFER_STATE) 0;",
  1185. "",
  1186. " if ( b->yy_is_our_buffer )",
  1187. " yy_flex_free( (void *) b->yy_ch_buf );",
  1188. "",
  1189. " yy_flex_free( (void *) b );",
  1190. " }",
  1191. "",
  1192. "",
  1193. "%-",
  1194. "#ifndef _WIN32",
  1195. "#include <unistd.h>",
  1196. "#else",
  1197. "#include <io.h>",
  1198. "#endif",
  1199. "",
  1200. "#ifdef YY_USE_PROTOS",
  1201. "void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )",
  1202. "#else",
  1203. "void yy_init_buffer( b, file )",
  1204. "YY_BUFFER_STATE b;",
  1205. "FILE *file;",
  1206. "#endif",
  1207. "",
  1208. "%+",
  1209. "void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file )",
  1210. "%*",
  1211. "",
  1212. " {",
  1213. " yy_flush_buffer( b );",
  1214. "",
  1215. " b->yy_input_file = file;",
  1216. " b->yy_fill_buffer = 1;",
  1217. "",
  1218. "%-",
  1219. "#if YY_ALWAYS_INTERACTIVE",
  1220. " b->yy_is_interactive = 1;",
  1221. "#else",
  1222. "#if YY_NEVER_INTERACTIVE",
  1223. " b->yy_is_interactive = 0;",
  1224. "#else",
  1225. " b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;",
  1226. "#endif",
  1227. "#endif",
  1228. "%+",
  1229. " b->yy_is_interactive = 0;",
  1230. "%*",
  1231. " }",
  1232. "",
  1233. "",
  1234. "%-",
  1235. "#ifdef YY_USE_PROTOS",
  1236. "void yy_flush_buffer( YY_BUFFER_STATE b )",
  1237. "#else",
  1238. "void yy_flush_buffer( b )",
  1239. "YY_BUFFER_STATE b;",
  1240. "#endif",
  1241. "",
  1242. "%+",
  1243. "void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )",
  1244. "%*",
  1245. " {",
  1246. " if ( ! b )",
  1247. " return;",
  1248. "",
  1249. " b->yy_n_chars = 0;",
  1250. "",
  1251. " /* We always need two end-of-buffer characters. The first causes",
  1252. " * a transition to the end-of-buffer state. The second causes",
  1253. " * a jam in that state.",
  1254. " */",
  1255. " b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;",
  1256. " b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;",
  1257. "",
  1258. " b->yy_buf_pos = &b->yy_ch_buf[0];",
  1259. "",
  1260. " b->yy_at_bol = 1;",
  1261. " b->yy_buffer_status = YY_BUFFER_NEW;",
  1262. "",
  1263. " if ( b == yy_current_buffer )",
  1264. " yy_load_buffer_state();",
  1265. " }",
  1266. "%*",
  1267. "",
  1268. "",
  1269. "#ifndef YY_NO_SCAN_BUFFER",
  1270. "%-",
  1271. "#ifdef YY_USE_PROTOS",
  1272. "YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )",
  1273. "#else",
  1274. "YY_BUFFER_STATE yy_scan_buffer( base, size )",
  1275. "char *base;",
  1276. "yy_size_t size;",
  1277. "#endif",
  1278. " {",
  1279. " YY_BUFFER_STATE b;",
  1280. "",
  1281. " if ( size < 2 ||",
  1282. " base[size-2] != YY_END_OF_BUFFER_CHAR ||",
  1283. " base[size-1] != YY_END_OF_BUFFER_CHAR )",
  1284. " /* They forgot to leave room for the EOB's. */",
  1285. " return 0;",
  1286. "",
  1287. " b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );",
  1288. " if ( ! b )",
  1289. " YY_FATAL_ERROR( \"out of dynamic memory in yy_scan_buffer()\" );",
  1290. "",
  1291. " b->yy_buf_size = size - 2; /* \"- 2\" to take care of EOB's */",
  1292. " b->yy_buf_pos = b->yy_ch_buf = base;",
  1293. " b->yy_is_our_buffer = 0;",
  1294. " b->yy_input_file = 0;",
  1295. " b->yy_n_chars = b->yy_buf_size;",
  1296. " b->yy_is_interactive = 0;",
  1297. " b->yy_at_bol = 1;",
  1298. " b->yy_fill_buffer = 0;",
  1299. " b->yy_buffer_status = YY_BUFFER_NEW;",
  1300. "",
  1301. " yy_switch_to_buffer( b );",
  1302. "",
  1303. " return b;",
  1304. " }",
  1305. "%*",
  1306. "#endif",
  1307. "",
  1308. "",
  1309. "#ifndef YY_NO_SCAN_STRING",
  1310. "%-",
  1311. "#ifdef YY_USE_PROTOS",
  1312. "YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )",
  1313. "#else",
  1314. "YY_BUFFER_STATE yy_scan_string( yy_str )",
  1315. "yyconst char *yy_str;",
  1316. "#endif",
  1317. " {",
  1318. " int len;",
  1319. " for ( len = 0; yy_str[len]; ++len )",
  1320. " ;",
  1321. "",
  1322. " return yy_scan_bytes( yy_str, len );",
  1323. " }",
  1324. "%*",
  1325. "#endif",
  1326. "",
  1327. "",
  1328. "#ifndef YY_NO_SCAN_BYTES",
  1329. "%-",
  1330. "#ifdef YY_USE_PROTOS",
  1331. "YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )",
  1332. "#else",
  1333. "YY_BUFFER_STATE yy_scan_bytes( bytes, len )",
  1334. "yyconst char *bytes;",
  1335. "int len;",
  1336. "#endif",
  1337. " {",
  1338. " YY_BUFFER_STATE b;",
  1339. " char *buf;",
  1340. " yy_size_t n;",
  1341. " int i;",
  1342. "",
  1343. " /* Get memory for full buffer, including space for trailing EOB's. */",
  1344. " n = len + 2;",
  1345. " buf = (char *) yy_flex_alloc( n );",
  1346. " if ( ! buf )",
  1347. " YY_FATAL_ERROR( \"out of dynamic memory in yy_scan_bytes()\" );",
  1348. "",
  1349. " for ( i = 0; i < len; ++i )",
  1350. " buf[i] = bytes[i];",
  1351. "",
  1352. " buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;",
  1353. "",
  1354. " b = yy_scan_buffer( buf, n );",
  1355. " if ( ! b )",
  1356. " YY_FATAL_ERROR( \"bad buffer in yy_scan_bytes()\" );",
  1357. "",
  1358. " /* It's okay to grow etc. this buffer, and we should throw it",
  1359. " * away when we're done.",
  1360. " */",
  1361. " b->yy_is_our_buffer = 1;",
  1362. "",
  1363. " return b;",
  1364. " }",
  1365. "%*",
  1366. "#endif",
  1367. "",
  1368. "",
  1369. "#ifndef YY_NO_PUSH_STATE",
  1370. "%-",
  1371. "#ifdef YY_USE_PROTOS",
  1372. "static void yy_push_state( int new_state )",
  1373. "#else",
  1374. "static void yy_push_state( new_state )",
  1375. "int new_state;",
  1376. "#endif",
  1377. "%+",
  1378. "void yyFlexLexer::yy_push_state( int new_state )",
  1379. "%*",
  1380. " {",
  1381. " if ( yy_start_stack_ptr >= yy_start_stack_depth )",
  1382. " {",
  1383. " yy_size_t new_size;",
  1384. "",
  1385. " yy_start_stack_depth += YY_START_STACK_INCR;",
  1386. " new_size = yy_start_stack_depth * sizeof( int );",
  1387. "",
  1388. " if ( ! yy_start_stack )",
  1389. " yy_start_stack = (int *) yy_flex_alloc( new_size );",
  1390. "",
  1391. " else",
  1392. " yy_start_stack = (int *) yy_flex_realloc(",
  1393. " (void *) yy_start_stack, new_size );",
  1394. "",
  1395. " if ( ! yy_start_stack )",
  1396. " YY_FATAL_ERROR(",
  1397. " \"out of memory expanding start-condition stack\" );",
  1398. " }",
  1399. "",
  1400. " yy_start_stack[yy_start_stack_ptr++] = YY_START;",
  1401. "",
  1402. " BEGIN(new_state);",
  1403. " }",
  1404. "#endif",
  1405. "",
  1406. "",
  1407. "#ifndef YY_NO_POP_STATE",
  1408. "%-",
  1409. "static void yy_pop_state()",
  1410. "%+",
  1411. "void yyFlexLexer::yy_pop_state()",
  1412. "%*",
  1413. " {",
  1414. " if ( --yy_start_stack_ptr < 0 )",
  1415. " YY_FATAL_ERROR( \"start-condition stack underflow\" );",
  1416. "",
  1417. " BEGIN(yy_start_stack[yy_start_stack_ptr]);",
  1418. " }",
  1419. "#endif",
  1420. "",
  1421. "",
  1422. "#ifndef YY_NO_TOP_STATE",
  1423. "%-",
  1424. "static int yy_top_state()",
  1425. "%+",
  1426. "int yyFlexLexer::yy_top_state()",
  1427. "%*",
  1428. " {",
  1429. " return yy_start_stack[yy_start_stack_ptr - 1];",
  1430. " }",
  1431. "#endif",
  1432. "",
  1433. "#ifndef YY_EXIT_FAILURE",
  1434. "#define YY_EXIT_FAILURE 2",
  1435. "#endif",
  1436. "",
  1437. "%-",
  1438. "#ifdef YY_USE_PROTOS",
  1439. "static void yy_fatal_error( yyconst char msg[] )",
  1440. "#else",
  1441. "static void yy_fatal_error( msg )",
  1442. "char msg[];",
  1443. "#endif",
  1444. " {",
  1445. " (void) fprintf( stderr, \"%s\\n\", msg );",
  1446. " exit( YY_EXIT_FAILURE );",
  1447. " }",
  1448. "",
  1449. "%+",
  1450. "",
  1451. "void yyFlexLexer::LexerError( yyconst char msg[] )",
  1452. " {",
  1453. " cerr << msg << '\\n';",
  1454. " exit( YY_EXIT_FAILURE );",
  1455. " }",
  1456. "%*",
  1457. "",
  1458. "",
  1459. "/* Redefine yyless() so it works in section 3 code. */",
  1460. "",
  1461. "#undef yyless",
  1462. "#define yyless(n) \\",
  1463. " do \\",
  1464. " { \\",
  1465. " /* Undo effects of setting up yytext. */ \\",
  1466. " yytext[yyleng] = yy_hold_char; \\",
  1467. " yy_c_buf_p = yytext + n; \\",
  1468. " yy_hold_char = *yy_c_buf_p; \\",
  1469. " *yy_c_buf_p = '\\0'; \\",
  1470. " yyleng = n; \\",
  1471. " } \\",
  1472. " while ( 0 )",
  1473. "",
  1474. "",
  1475. "/* Internal utility routines. */",
  1476. "",
  1477. "#ifndef yytext_ptr",
  1478. "#ifdef YY_USE_PROTOS",
  1479. "static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )",
  1480. "#else",
  1481. "static void yy_flex_strncpy( s1, s2, n )",
  1482. "char *s1;",
  1483. "yyconst char *s2;",
  1484. "int n;",
  1485. "#endif",
  1486. " {",
  1487. " int i;",
  1488. " for ( i = 0; i < n; ++i )",
  1489. " s1[i] = s2[i];",
  1490. " }",
  1491. "#endif",
  1492. "",
  1493. "#ifdef YY_NEED_STRLEN",
  1494. "#ifdef YY_USE_PROTOS",
  1495. "static int yy_flex_strlen( yyconst char *s )",
  1496. "#else",
  1497. "static int yy_flex_strlen( s )",
  1498. "yyconst char *s;",
  1499. "#endif",
  1500. " {",
  1501. " int n;",
  1502. " for ( n = 0; s[n]; ++n )",
  1503. " ;",
  1504. "",
  1505. " return n;",
  1506. " }",
  1507. "#endif",
  1508. "",
  1509. "",
  1510. "#ifdef YY_USE_PROTOS",
  1511. "static void *yy_flex_alloc( yy_size_t size )",
  1512. "#else",
  1513. "static void *yy_flex_alloc( size )",
  1514. "yy_size_t size;",
  1515. "#endif",
  1516. " {",
  1517. " return (void *) malloc( size );",
  1518. " }",
  1519. "",
  1520. "#ifdef YY_USE_PROTOS",
  1521. "static void *yy_flex_realloc( void *ptr, yy_size_t size )",
  1522. "#else",
  1523. "static void *yy_flex_realloc( ptr, size )",
  1524. "void *ptr;",
  1525. "yy_size_t size;",
  1526. "#endif",
  1527. " {",
  1528. " /* The cast to (char *) in the following accommodates both",
  1529. " * implementations that use char* generic pointers, and those",
  1530. " * that use void* generic pointers. It works with the latter",
  1531. " * because both ANSI C and C++ allow castless assignment from",
  1532. " * any pointer type to void*, and deal with argument conversions",
  1533. " * as though doing an assignment.",
  1534. " */",
  1535. " return (void *) realloc( (char *) ptr, size );",
  1536. " }",
  1537. "",
  1538. "#ifdef YY_USE_PROTOS",
  1539. "static void yy_flex_free( void *ptr )",
  1540. "#else",
  1541. "static void yy_flex_free( ptr )",
  1542. "void *ptr;",
  1543. "#endif",
  1544. " {",
  1545. " free( ptr );",
  1546. " }",
  1547. "",
  1548. "#if YY_MAIN",
  1549. "int main()",
  1550. " {",
  1551. " yylex();",
  1552. " return 0;",
  1553. " }",
  1554. "#endif",
  1555. 0
  1556. };