lex.yy.c 62 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511
  1. #line 3 "lex.yy.c"
  2. #define YY_INT_ALIGNED short int
  3. /* A lexical scanner generated by flex */
  4. /* %not-for-header */
  5. /* %if-c-only */
  6. /* %if-not-reentrant */
  7. /* %endif */
  8. /* %endif */
  9. /* %ok-for-header */
  10. #define FLEX_SCANNER
  11. #define YY_FLEX_MAJOR_VERSION 2
  12. #define YY_FLEX_MINOR_VERSION 6
  13. #define YY_FLEX_SUBMINOR_VERSION 4
  14. #if YY_FLEX_SUBMINOR_VERSION > 0
  15. #define FLEX_BETA
  16. #endif
  17. /* %if-c++-only */
  18. /* %endif */
  19. /* %if-c-only */
  20. /* %endif */
  21. /* %if-c-only */
  22. /* %endif */
  23. /* First, we deal with platform-specific or compiler-specific issues. */
  24. /* begin standard C headers. */
  25. /* %if-c-only */
  26. #include <stdio.h>
  27. #include <string.h>
  28. #include <errno.h>
  29. #include <stdlib.h>
  30. /* %endif */
  31. /* %if-tables-serialization */
  32. /* %endif */
  33. /* end standard C headers. */
  34. /* begin standard C++ headers. */
  35. /* %if-c++-only */
  36. /* %endif */
  37. /* %if-c-or-c++ */
  38. /* flex integer type definitions */
  39. #ifndef YYFLEX_INTTYPES_DEFINED
  40. #define YYFLEX_INTTYPES_DEFINED
  41. /* Prefer C99 integer types if available. */
  42. #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  43. /* Include <inttypes.h> and not <stdint.h> because Solaris 2.6 has the former
  44. * and not the latter.
  45. */
  46. #include <inttypes.h>
  47. #define YYFLEX_USE_STDINT
  48. #else
  49. #if defined(_MSC_VER) && _MSC_VER >= 1600
  50. /* Visual C++ 2010 does not define __STDC_VERSION__ and has <stdint.h> but not
  51. * <inttypes.h>.
  52. */
  53. #include <stdint.h>
  54. #define YYFLEX_USE_STDINT
  55. #endif
  56. #endif
  57. #ifdef YYFLEX_USE_STDINT
  58. typedef int8_t flex_int8_t;
  59. typedef uint8_t flex_uint8_t;
  60. typedef int16_t flex_int16_t;
  61. typedef uint16_t flex_uint16_t;
  62. typedef int32_t flex_int32_t;
  63. typedef uint32_t flex_uint32_t;
  64. #else
  65. typedef unsigned char flex_uint8_t;
  66. typedef short int flex_int16_t;
  67. typedef unsigned short int flex_uint16_t;
  68. #ifdef __STDC__
  69. typedef signed char flex_int8_t;
  70. /* ISO C only requires at least 16 bits for int. */
  71. #include <limits.h>
  72. #if UINT_MAX >= 4294967295
  73. #define YYFLEX_INT32_DEFINED
  74. typedef int flex_int32_t;
  75. typedef unsigned int flex_uint32_t;
  76. #endif
  77. #else
  78. typedef char flex_int8_t;
  79. #endif
  80. #ifndef YYFLEX_INT32_DEFINED
  81. typedef long int flex_int32_t;
  82. typedef unsigned long int flex_uint32_t;
  83. #endif
  84. #endif
  85. #endif /* YYFLEX_INTTYPES_DEFINED */
  86. /* %endif */
  87. /* TODO: this is always defined, so inline it */
  88. #define yyconst const
  89. #if defined(__GNUC__) && __GNUC__ >= 3
  90. #define yynoreturn __attribute__((__noreturn__))
  91. #else
  92. #define yynoreturn
  93. #endif
  94. /* %not-for-header */
  95. /* Returned upon end-of-file. */
  96. #define YY_NULL 0
  97. /* %ok-for-header */
  98. /* %not-for-header */
  99. /* Promotes a possibly negative, possibly signed char to an
  100. * integer in range [0..255] for use as an array index.
  101. */
  102. #define YY_SC_TO_UI(c) ((YY_CHAR) (c))
  103. /* %ok-for-header */
  104. /* %if-reentrant */
  105. /* %endif */
  106. /* %if-not-reentrant */
  107. /* %endif */
  108. /* Enter a start condition. This macro really ought to take a parameter,
  109. * but we do it the disgusting crufty way forced on us by the ()-less
  110. * definition of BEGIN.
  111. */
  112. #define BEGIN (yy_start) = 1 + 2 *
  113. /* Translate the current start state into a value that can be later handed
  114. * to BEGIN to return to the state. The YYSTATE alias is for lex
  115. * compatibility.
  116. */
  117. #define YY_START (((yy_start) - 1) / 2)
  118. #define YYSTATE YY_START
  119. /* Action number for EOF rule of a given start state. */
  120. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  121. /* Special action meaning "start processing a new file". */
  122. #define YY_NEW_FILE yyrestart( yyin )
  123. #define YY_END_OF_BUFFER_CHAR 0
  124. /* Size of default input buffer. */
  125. #ifndef YY_BUF_SIZE
  126. #ifdef __ia64__
  127. /* On IA-64, the buffer size is 16k, not 8k.
  128. * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
  129. * Ditto for the __ia64__ case accordingly.
  130. */
  131. #define YY_BUF_SIZE 32768
  132. #else
  133. #define YY_BUF_SIZE 16384
  134. #endif /* __ia64__ */
  135. #endif
  136. /* The state buf must be large enough to hold one state per character in the main buffer.
  137. */
  138. #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
  139. #ifndef YY_TYPEDEF_YY_BUFFER_STATE
  140. #define YY_TYPEDEF_YY_BUFFER_STATE
  141. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  142. #endif
  143. #ifndef YY_TYPEDEF_YY_SIZE_T
  144. #define YY_TYPEDEF_YY_SIZE_T
  145. typedef size_t yy_size_t;
  146. #endif
  147. /* %if-not-reentrant */
  148. extern int yyleng;
  149. /* %endif */
  150. /* %if-c-only */
  151. /* %if-not-reentrant */
  152. extern FILE *yyin, *yyout;
  153. /* %endif */
  154. /* %endif */
  155. #define EOB_ACT_CONTINUE_SCAN 0
  156. #define EOB_ACT_END_OF_FILE 1
  157. #define EOB_ACT_LAST_MATCH 2
  158. /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
  159. * access to the local variable yy_act. Since yyless() is a macro, it would break
  160. * existing scanners that call yyless() from OUTSIDE yylex.
  161. * One obvious solution it to make yy_act a global. I tried that, and saw
  162. * a 5% performance hit in a non-yylineno scanner, because yy_act is
  163. * normally declared as a register variable-- so it is not worth it.
  164. */
  165. #define YY_LESS_LINENO(n) \
  166. do { \
  167. int yyl;\
  168. for ( yyl = n; yyl < yyleng; ++yyl )\
  169. if ( yytext[yyl] == '\n' )\
  170. --yylineno;\
  171. }while(0)
  172. #define YY_LINENO_REWIND_TO(dst) \
  173. do {\
  174. const char *p;\
  175. for ( p = yy_cp-1; p >= (dst); --p)\
  176. if ( *p == '\n' )\
  177. --yylineno;\
  178. }while(0)
  179. /* Return all but the first "n" matched characters back to the input stream. */
  180. #define yyless(n) \
  181. do \
  182. { \
  183. /* Undo effects of setting up yytext. */ \
  184. int yyless_macro_arg = (n); \
  185. YY_LESS_LINENO(yyless_macro_arg);\
  186. *yy_cp = (yy_hold_char); \
  187. YY_RESTORE_YY_MORE_OFFSET \
  188. (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
  189. YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  190. } \
  191. while ( 0 )
  192. #define unput(c) yyunput( c, (yytext_ptr) )
  193. #ifndef YY_STRUCT_YY_BUFFER_STATE
  194. #define YY_STRUCT_YY_BUFFER_STATE
  195. struct yy_buffer_state {
  196. /* %if-c-only */
  197. FILE *yy_input_file;
  198. /* %endif */
  199. /* %if-c++-only */
  200. /* %endif */
  201. char *yy_ch_buf; /* input buffer */
  202. char *yy_buf_pos; /* current position in input buffer */
  203. /* Size of input buffer in bytes, not including room for EOB
  204. * characters.
  205. */
  206. int yy_buf_size;
  207. /* Number of characters read into yy_ch_buf, not including EOB
  208. * characters.
  209. */
  210. int yy_n_chars;
  211. /* Whether we "own" the buffer - i.e., we know we created it,
  212. * and can realloc() it to grow it, and should free() it to
  213. * delete it.
  214. */
  215. int yy_is_our_buffer;
  216. /* Whether this is an "interactive" input source; if so, and
  217. * if we're using stdio for input, then we want to use getc()
  218. * instead of fread(), to make sure we stop fetching input after
  219. * each newline.
  220. */
  221. int yy_is_interactive;
  222. /* Whether we're considered to be at the beginning of a line.
  223. * If so, '^' rules will be active on the next match, otherwise
  224. * not.
  225. */
  226. int yy_at_bol;
  227. int yy_bs_lineno;
  228. /**< The line count. */
  229. int yy_bs_column;
  230. /**< The column count. */
  231. /* Whether to try to fill the input buffer when we reach the
  232. * end of it.
  233. */
  234. int yy_fill_buffer;
  235. int yy_buffer_status;
  236. #define YY_BUFFER_NEW 0
  237. #define YY_BUFFER_NORMAL 1
  238. /* When an EOF's been seen but there's still some text to process
  239. * then we mark the buffer as YY_EOF_PENDING, to indicate that we
  240. * shouldn't try reading from the input source any more. We might
  241. * still have a bunch of tokens to match, though, because of
  242. * possible backing-up.
  243. *
  244. * When we actually see the EOF, we change the status to "new"
  245. * (via yyrestart()), so that the user can continue scanning by
  246. * just pointing yyin at a new input file.
  247. */
  248. #define YY_BUFFER_EOF_PENDING 2
  249. };
  250. #endif /* !YY_STRUCT_YY_BUFFER_STATE */
  251. /* %if-c-only Standard (non-C++) definition */
  252. /* %not-for-header */
  253. /* %if-not-reentrant */
  254. /* Stack of input buffers. */
  255. static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
  256. static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
  257. static YY_BUFFER_STATE *yy_buffer_stack = NULL; /**< Stack as an array. */
  258. /* %endif */
  259. /* %ok-for-header */
  260. /* %endif */
  261. /* We provide macros for accessing buffer states in case in the
  262. * future we want to put the buffer states in a more general
  263. * "scanner state".
  264. *
  265. * Returns the top of the stack, or NULL.
  266. */
  267. #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
  268. ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
  269. : NULL)
  270. /* Same as previous macro, but useful when we know that the buffer stack is not
  271. * NULL or when we need an lvalue. For internal use only.
  272. */
  273. #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
  274. /* %if-c-only Standard (non-C++) definition */
  275. /* %if-not-reentrant */
  276. /* %not-for-header */
  277. /* yy_hold_char holds the character lost when yytext is formed. */
  278. static char yy_hold_char;
  279. static int yy_n_chars; /* number of characters read into yy_ch_buf */
  280. int yyleng;
  281. /* Points to current character in buffer. */
  282. static char *yy_c_buf_p = NULL;
  283. static int yy_init = 0; /* whether we need to initialize */
  284. static int yy_start = 0; /* start state number */
  285. /* Flag which is used to allow yywrap()'s to do buffer switches
  286. * instead of setting up a fresh yyin. A bit of a hack ...
  287. */
  288. static int yy_did_buffer_switch_on_eof;
  289. /* %ok-for-header */
  290. /* %endif */
  291. void yyrestart(FILE * input_file);
  292. void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer);
  293. YY_BUFFER_STATE yy_create_buffer(FILE * file, int size);
  294. void yy_delete_buffer(YY_BUFFER_STATE b);
  295. void yy_flush_buffer(YY_BUFFER_STATE b);
  296. void yypush_buffer_state(YY_BUFFER_STATE new_buffer);
  297. void yypop_buffer_state(void);
  298. static void yyensure_buffer_stack(void);
  299. static void yy_load_buffer_state(void);
  300. static void yy_init_buffer(YY_BUFFER_STATE b, FILE * file);
  301. #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER )
  302. YY_BUFFER_STATE yy_scan_buffer(char *base, yy_size_t size);
  303. YY_BUFFER_STATE yy_scan_string(const char *yy_str);
  304. YY_BUFFER_STATE yy_scan_bytes(const char *bytes, int len);
  305. /* %endif */
  306. void *yyalloc(yy_size_t);
  307. void *yyrealloc(void *, yy_size_t);
  308. void yyfree(void *);
  309. #define yy_new_buffer yy_create_buffer
  310. #define yy_set_interactive(is_interactive) \
  311. { \
  312. if ( ! YY_CURRENT_BUFFER ){ \
  313. yyensure_buffer_stack (); \
  314. YY_CURRENT_BUFFER_LVALUE = \
  315. yy_create_buffer( yyin, YY_BUF_SIZE ); \
  316. } \
  317. YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
  318. }
  319. #define yy_set_bol(at_bol) \
  320. { \
  321. if ( ! YY_CURRENT_BUFFER ){\
  322. yyensure_buffer_stack (); \
  323. YY_CURRENT_BUFFER_LVALUE = \
  324. yy_create_buffer( yyin, YY_BUF_SIZE ); \
  325. } \
  326. YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
  327. }
  328. #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
  329. /* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */
  330. /* Begin user sect3 */
  331. #define yywrap() (/*CONSTCOND*/1)
  332. #define YY_SKIP_YYWRAP
  333. #define FLEX_DEBUG
  334. typedef flex_uint8_t YY_CHAR;
  335. FILE *yyin = NULL, *yyout = NULL;
  336. typedef int yy_state_type;
  337. extern int yylineno;
  338. int yylineno = 1;
  339. extern char *yytext;
  340. #ifdef yytext_ptr
  341. #undef yytext_ptr
  342. #endif
  343. #define yytext_ptr yytext
  344. /* %% [1.5] DFA */
  345. /* %if-c-only Standard (non-C++) definition */
  346. static yy_state_type yy_get_previous_state(void);
  347. static yy_state_type yy_try_NUL_trans(yy_state_type current_state);
  348. static int yy_get_next_buffer(void);
  349. static void yynoreturn yy_fatal_error(const char *msg);
  350. /* %endif */
  351. /* Done after the current pattern has been matched and before the
  352. * corresponding action - sets up yytext.
  353. */
  354. #define YY_DO_BEFORE_ACTION \
  355. (yytext_ptr) = yy_bp; \
  356. /* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\
  357. yyleng = (int) (yy_cp - yy_bp); \
  358. (yy_hold_char) = *yy_cp; \
  359. *yy_cp = '\0'; \
  360. /* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\
  361. (yy_c_buf_p) = yy_cp;
  362. /* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */
  363. #define YY_NUM_RULES 39
  364. #define YY_END_OF_BUFFER 40
  365. /* This struct is not used in this scanner,
  366. but its presence is necessary. */
  367. struct yy_trans_info {
  368. flex_int32_t yy_verify;
  369. flex_int32_t yy_nxt;
  370. };
  371. static const flex_int16_t yy_accept[99] = { 0,
  372. 0, 0, 37, 37, 40, 38, 7, 8, 6, 9,
  373. 38, 4, 38, 11, 12, 38, 30, 38, 30, 13,
  374. 14, 31, 15, 10, 29, 29, 29, 29, 29, 29,
  375. 16, 17, 18, 19, 38, 37, 33, 32, 39, 6,
  376. 0, 28, 0, 4, 2, 30, 30, 20, 21, 30,
  377. 0, 3, 30, 29, 29, 29, 29, 29, 29, 29,
  378. 0, 37, 37, 36, 34, 35, 0, 0, 3, 30,
  379. 29, 29, 29, 29, 29, 29, 5, 0, 1, 29,
  380. 22, 29, 23, 29, 29, 0, 0, 29, 25, 29,
  381. 29, 29, 27, 29, 24, 29, 26, 0
  382. };
  383. static const YY_CHAR yy_ec[256] = { 0,
  384. 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
  385. 1, 4, 5, 1, 1, 1, 1, 1, 1, 1,
  386. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  387. 1, 4, 1, 6, 7, 1, 1, 1, 1, 1,
  388. 1, 8, 9, 10, 11, 12, 13, 14, 14, 14,
  389. 14, 14, 14, 14, 14, 14, 14, 15, 16, 17,
  390. 18, 19, 1, 20, 21, 22, 23, 24, 25, 26,
  391. 27, 28, 29, 26, 26, 26, 26, 30, 31, 32,
  392. 26, 33, 34, 35, 36, 26, 26, 26, 26, 26,
  393. 37, 38, 39, 1, 40, 1, 21, 22, 23, 24,
  394. 25, 26, 27, 28, 29, 26, 26, 26, 26, 30,
  395. 31, 32, 26, 33, 34, 35, 36, 26, 26, 26,
  396. 26, 26, 41, 1, 42, 1, 1, 1, 1, 1,
  397. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  398. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  399. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  400. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  401. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  402. 1, 1, 1, 1, 1, 1, 43, 1, 1, 1,
  403. 44, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  404. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  405. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  406. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  407. 1, 1, 1, 1, 1, 1, 1, 1, 45, 1,
  408. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  409. 1, 1, 1, 1, 1
  410. };
  411. static const YY_CHAR yy_meta[46] = { 0,
  412. 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
  413. 1, 1, 1, 3, 1, 1, 4, 1, 4, 1,
  414. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  415. 3, 3, 3, 3, 3, 3, 1, 4, 1, 3,
  416. 1, 1, 1, 1, 1
  417. };
  418. static const flex_int16_t yy_base[109] = { 0,
  419. 0, 0, 29, 30, 151, 152, 152, 152, 146, 152,
  420. 44, 0, 136, 39, 152, 43, 134, 48, 46, 152,
  421. 152, 152, 152, 152, 0, 118, 122, 112, 113, 28,
  422. 152, 152, 152, 152, 100, 0, 152, 152, 56, 138,
  423. 46, 152, 0, 0, 152, 127, 57, 152, 152, 126,
  424. 131, 0, 124, 0, 110, 109, 114, 110, 100, 110,
  425. 87, 0, 152, 152, 152, 152, 122, 57, 0, 115,
  426. 95, 102, 94, 100, 95, 96, 152, 114, 152, 100,
  427. 0, 92, 0, 86, 61, 75, 64, 49, 0, 45,
  428. 58, 50, 0, 44, 0, 46, 0, 152, 84, 88,
  429. 92, 63, 96, 99, 103, 107, 111, 115
  430. };
  431. static const flex_int16_t yy_def[109] = { 0,
  432. 98, 1, 99, 99, 98, 98, 98, 98, 98, 98,
  433. 100, 101, 98, 98, 98, 98, 98, 98, 98, 98,
  434. 98, 98, 98, 98, 102, 102, 102, 102, 102, 102,
  435. 98, 98, 98, 98, 98, 103, 98, 98, 104, 98,
  436. 100, 98, 100, 101, 98, 98, 98, 98, 98, 98,
  437. 105, 106, 98, 102, 102, 102, 102, 102, 102, 102,
  438. 98, 103, 98, 98, 98, 98, 105, 107, 106, 98,
  439. 102, 102, 102, 102, 102, 102, 98, 108, 98, 102,
  440. 102, 102, 102, 102, 102, 108, 107, 102, 102, 102,
  441. 102, 102, 102, 102, 102, 102, 102, 0, 98, 98,
  442. 98, 98, 98, 98, 98, 98, 98, 98
  443. };
  444. static const flex_int16_t yy_nxt[198] = { 0,
  445. 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
  446. 16, 17, 18, 19, 20, 21, 22, 23, 6, 24,
  447. 25, 25, 25, 26, 27, 25, 28, 25, 25, 29,
  448. 25, 25, 25, 30, 25, 25, 31, 6, 32, 25,
  449. 33, 34, 6, 6, 35, 37, 37, 38, 38, 42,
  450. 46, 42, 47, 48, 46, 51, 47, 53, 64, 47,
  451. 52, 49, 59, 60, 68, 54, 39, 39, 53, 79,
  452. 47, 87, 65, 97, 66, 96, 79, 95, 94, 93,
  453. 92, 43, 87, 43, 36, 36, 36, 36, 41, 41,
  454. 41, 41, 44, 91, 44, 44, 62, 62, 62, 63,
  455. 63, 63, 63, 67, 67, 67, 67, 69, 90, 69,
  456. 69, 78, 78, 78, 78, 86, 86, 86, 86, 89,
  457. 88, 87, 85, 84, 83, 82, 81, 80, 70, 68,
  458. 77, 76, 75, 74, 73, 72, 71, 70, 68, 50,
  459. 50, 40, 61, 58, 57, 56, 55, 50, 45, 40,
  460. 98, 5, 98, 98, 98, 98, 98, 98, 98, 98,
  461. 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,
  462. 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,
  463. 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,
  464. 98, 98, 98, 98, 98, 98, 98
  465. };
  466. static const flex_int16_t yy_chk[198] = { 0,
  467. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  468. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  469. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  470. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  471. 1, 1, 1, 1, 1, 3, 4, 3, 4, 11,
  472. 14, 41, 14, 16, 16, 18, 16, 19, 39, 19,
  473. 18, 16, 30, 30, 68, 102, 3, 4, 47, 68,
  474. 47, 87, 39, 96, 39, 94, 87, 92, 91, 90,
  475. 88, 11, 86, 41, 99, 99, 99, 99, 100, 100,
  476. 100, 100, 101, 85, 101, 101, 103, 103, 103, 104,
  477. 104, 104, 104, 105, 105, 105, 105, 106, 84, 106,
  478. 106, 107, 107, 107, 107, 108, 108, 108, 108, 82,
  479. 80, 78, 76, 75, 74, 73, 72, 71, 70, 67,
  480. 61, 60, 59, 58, 57, 56, 55, 53, 51, 50,
  481. 46, 40, 35, 29, 28, 27, 26, 17, 13, 9,
  482. 5, 98, 98, 98, 98, 98, 98, 98, 98, 98,
  483. 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,
  484. 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,
  485. 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,
  486. 98, 98, 98, 98, 98, 98, 98
  487. };
  488. /* Table of booleans, true if rule could match eol. */
  489. static const flex_int32_t yy_rule_can_match_eol[40] = { 0,
  490. 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  491. 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0,
  492. };
  493. static yy_state_type yy_last_accepting_state;
  494. static char *yy_last_accepting_cpos;
  495. extern int yy_flex_debug;
  496. int yy_flex_debug = 1;
  497. static const flex_int16_t yy_rule_linenum[39] = { 0,
  498. 125, 126, 127, 129, 130, 131, 132, 133, 134, 136,
  499. 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
  500. 147, 149, 150, 151, 152, 153, 154, 156, 227, 232,
  501. 238, 243, 256, 260, 263, 266, 269, 274
  502. };
  503. /* The intent behind this definition is that it'll catch
  504. * any uses of REJECT which flex missed.
  505. */
  506. #define REJECT reject_used_but_not_detected
  507. #define yymore() yymore_used_but_not_detected
  508. #define YY_MORE_ADJ 0
  509. #define YY_RESTORE_YY_MORE_OFFSET
  510. char *yytext;
  511. #line 1 "dot.l"
  512. /*
  513. * Copyright 2021
  514. *
  515. * This program is free software: you can redistribute it and/or modify
  516. * it under the terms of the GNU General Public License as published by
  517. * the Free Software Foundation, either version 3 of the License, or
  518. * (at your option) any later version.
  519. *
  520. * This program is distributed in the hope that it will be useful,
  521. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  522. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  523. * GNU General Public License for more details.
  524. *
  525. * You should have received a copy of the GNU General Public License
  526. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  527. *
  528. * SPDX-License-Identifier: GPL-3.0+
  529. * License-Filename: LICENSE
  530. */
  531. #line 23 "dot.l"
  532. #include "config.h"
  533. #include <stdio.h>
  534. #include <stdlib.h>
  535. #include <zlib.h>
  536. #include "splay-tree.h"
  537. #include "lex.yy.h"
  538. #include "dot.tab.h"
  539. #include "dp.h"
  540. #include "dpus.h"
  541. #include "dpmem.h"
  542. /* use GNU GCC compiler builtin strlen */
  543. #undef YY_NEED_STRLEN
  544. /* increase read buffer */
  545. #undef YY_READ_BUF_SIZE
  546. /* #define YY_READ_BUF_SIZE (16*1024) */
  547. /* fread() with 128kb at once is fastest on Linux */
  548. #define YY_READ_BUF_SIZE (128*1024)
  549. /* Size of default input buffer. Do not tune. */
  550. #undef YY_BUF_SIZE
  551. #define YY_BUF_SIZE 16384
  552. static gzFile gvzin = (gzFile) 0;
  553. /* gzfread cannot be used because of older zlib in the dll */
  554. #undef YY_INPUT
  555. #define YY_INPUT(buf,result,max_size) do { \
  556. if ( (result = gzread(gvzin, (char*)buf, (sizeof(char) * max_size) )) == 0) { \
  557. int estatus = 0; \
  558. const char *es = gzerror (gvzin, &estatus); \
  559. if (estatus == Z_BUF_ERROR) { \
  560. YY_FATAL_ERROR( "gzread() in dot.l flex scanner failed"); \
  561. } else { \
  562. if (estatus) { \
  563. printf ("%s(): zlib error status %d %s in dot.l\n",__func__,(int)estatus,es); \
  564. } \
  565. } \
  566. } } while (0);
  567. static char *tmpp = NULL;
  568. static char *p = NULL;
  569. static char *q = NULL;
  570. static int htmlnest = 0;
  571. static void dp_check_c_comment(char *s);
  572. /* own yyalloc
  573. * void *yyalloc (size_t n) { return(calloc(1,n)); }
  574. * void yyfree (void *ptr) { if (ptr) { free (ptr); } return; }
  575. * void *yyrealloc (void *ptr, size_t n) { return (realloc(ptr,n)); }
  576. */
  577. #line 696 "lex.yy.c"
  578. /* empty string "" with length 0 is troublesome in dot: */
  579. /* digraph {} has no name */
  580. /* digraph "" {} is digraph {} has no name but a space is set */
  581. /* digraph " " {} is digraph with string " " */
  582. /* node label="" is two chars in output drawing */
  583. /* allow in fnum1,2,3 also numbers as "23.1" or "23." and ".23" */
  584. #line 92 "dot.l"
  585. /* use own yyalloc
  586. * %option noyyalloc
  587. * %option noyyfree
  588. * %option noyyrealloc
  589. */
  590. #define YY_NO_INPUT 1
  591. #line 711 "lex.yy.c"
  592. #define INITIAL 0
  593. #define htmlstr 1
  594. #ifndef YY_NO_UNISTD_H
  595. /* Special case for "unistd.h", since it is non-ANSI. We include it way
  596. * down here because we want the user's section 1 to have been scanned first.
  597. * The user has a chance to override it with an option.
  598. */
  599. /* %if-c-only */
  600. #include <unistd.h>
  601. /* %endif */
  602. /* %if-c++-only */
  603. /* %endif */
  604. #endif
  605. #ifndef YY_EXTRA_TYPE
  606. #define YY_EXTRA_TYPE void *
  607. #endif
  608. /* %if-c-only Reentrant structure and macros (non-C++). */
  609. /* %if-reentrant */
  610. /* %if-c-only */
  611. static int yy_init_globals(void);
  612. /* %endif */
  613. /* %if-reentrant */
  614. /* %endif */
  615. /* %endif End reentrant structures and macros. */
  616. /* Accessor methods to globals.
  617. These are made visible to non-reentrant scanners for convenience. */
  618. int yylex_destroy(void);
  619. int yyget_debug(void);
  620. void yyset_debug(int debug_flag);
  621. YY_EXTRA_TYPE yyget_extra(void);
  622. void yyset_extra(YY_EXTRA_TYPE user_defined);
  623. FILE *yyget_in(void);
  624. void yyset_in(FILE * _in_str);
  625. FILE *yyget_out(void);
  626. void yyset_out(FILE * _out_str);
  627. int yyget_leng(void);
  628. char *yyget_text(void);
  629. int yyget_lineno(void);
  630. void yyset_lineno(int _line_number);
  631. /* %if-bison-bridge */
  632. /* %endif */
  633. /* Macros after this point can all be overridden by user definitions in
  634. * section 1.
  635. */
  636. #ifndef YY_SKIP_YYWRAP
  637. #ifdef __cplusplus
  638. extern "C" int yywrap(void);
  639. #else
  640. extern int yywrap(void);
  641. #endif
  642. #endif
  643. /* %not-for-header */
  644. #ifndef YY_NO_UNPUT
  645. #endif
  646. /* %ok-for-header */
  647. /* %endif */
  648. #ifndef yytext_ptr
  649. static void yy_flex_strncpy(char *, const char *, int);
  650. #endif
  651. #ifdef YY_NEED_STRLEN
  652. static int yy_flex_strlen(const char *);
  653. #endif
  654. #ifndef YY_NO_INPUT
  655. /* %if-c-only Standard (non-C++) definition */
  656. /* %not-for-header */
  657. #ifdef __cplusplus
  658. static int yyinput(void);
  659. #else
  660. static int input(void);
  661. #endif
  662. /* %ok-for-header */
  663. /* %endif */
  664. #endif
  665. /* %if-c-only */
  666. /* %endif */
  667. /* Amount of stuff to slurp up with each read. */
  668. #ifndef YY_READ_BUF_SIZE
  669. #ifdef __ia64__
  670. /* On IA-64, the buffer size is 16k, not 8k */
  671. #define YY_READ_BUF_SIZE 16384
  672. #else
  673. #define YY_READ_BUF_SIZE 8192
  674. #endif /* __ia64__ */
  675. #endif
  676. /* Copy whatever the last rule matched to the standard output. */
  677. #ifndef ECHO
  678. /* %if-c-only Standard (non-C++) definition */
  679. /* This used to be an fputs(), but since the string might contain NUL's,
  680. * we now use fwrite().
  681. */
  682. #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
  683. /* %endif */
  684. /* %if-c++-only C++ definition */
  685. /* %endif */
  686. #endif
  687. /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
  688. * is returned in "result".
  689. */
  690. #ifndef YY_INPUT
  691. #define YY_INPUT(buf,result,max_size) \
  692. /* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\
  693. if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
  694. { \
  695. int c = '*'; \
  696. int n; \
  697. for ( n = 0; n < max_size && \
  698. (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
  699. buf[n] = (char) c; \
  700. if ( c == '\n' ) \
  701. buf[n++] = (char) c; \
  702. if ( c == EOF && ferror( yyin ) ) \
  703. YY_FATAL_ERROR( "input in flex scanner failed" ); \
  704. result = n; \
  705. } \
  706. else \
  707. { \
  708. errno=0; \
  709. while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
  710. { \
  711. if( errno != EINTR) \
  712. { \
  713. YY_FATAL_ERROR( "input in flex scanner failed" ); \
  714. break; \
  715. } \
  716. errno=0; \
  717. clearerr(yyin); \
  718. } \
  719. }\
  720. \
  721. /* %if-c++-only C++ definition \ */\
  722. /* %endif */
  723. #endif
  724. /* No semi-colon after return; correct usage is to write "yyterminate();" -
  725. * we don't want an extra ';' after the "return" because that will cause
  726. * some compilers to complain about unreachable statements.
  727. */
  728. #ifndef yyterminate
  729. #define yyterminate() return YY_NULL
  730. #endif
  731. /* Number of entries by which start-condition stack grows. */
  732. #ifndef YY_START_STACK_INCR
  733. #define YY_START_STACK_INCR 25
  734. #endif
  735. /* Report a fatal error. */
  736. #ifndef YY_FATAL_ERROR
  737. /* %if-c-only */
  738. #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
  739. /* %endif */
  740. /* %if-c++-only */
  741. /* %endif */
  742. #endif
  743. /* %if-tables-serialization structures and prototypes */
  744. /* %not-for-header */
  745. /* %ok-for-header */
  746. /* %not-for-header */
  747. /* %tables-yydmap generated elements */
  748. /* %endif */
  749. /* end tables serialization structures and prototypes */
  750. /* %ok-for-header */
  751. /* Default declaration of generated scanner - a define so the user can
  752. * easily add parameters.
  753. */
  754. #ifndef YY_DECL
  755. #define YY_DECL_IS_OURS 1
  756. /* %if-c-only Standard (non-C++) definition */
  757. extern int yylex(void);
  758. #define YY_DECL int yylex (void)
  759. /* %endif */
  760. /* %if-c++-only C++ definition */
  761. /* %endif */
  762. #endif /* !YY_DECL */
  763. /* Code executed at the beginning of each rule, after yytext and yyleng
  764. * have been set up.
  765. */
  766. #ifndef YY_USER_ACTION
  767. #define YY_USER_ACTION
  768. #endif
  769. /* Code executed at the end of each rule. */
  770. #ifndef YY_BREAK
  771. #define YY_BREAK /*LINTED*/break;
  772. #endif
  773. /* %% [6.0] YY_RULE_SETUP definition goes here */
  774. #define YY_RULE_SETUP \
  775. YY_USER_ACTION
  776. /* %not-for-header */
  777. /** The main scanner function which does all the work.
  778. */
  779. YY_DECL {
  780. yy_state_type yy_current_state;
  781. char *yy_cp, *yy_bp;
  782. int yy_act;
  783. if (!(yy_init)) {
  784. (yy_init) = 1;
  785. #ifdef YY_USER_INIT
  786. YY_USER_INIT;
  787. #endif
  788. if (!(yy_start))
  789. (yy_start) = 1; /* first start state */
  790. if (!yyin)
  791. /* %if-c-only */
  792. yyin = stdin;
  793. /* %endif */
  794. /* %if-c++-only */
  795. /* %endif */
  796. if (!yyout)
  797. /* %if-c-only */
  798. yyout = stdout;
  799. /* %endif */
  800. /* %if-c++-only */
  801. /* %endif */
  802. if (!YY_CURRENT_BUFFER) {
  803. yyensure_buffer_stack();
  804. YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE);
  805. }
  806. yy_load_buffer_state();
  807. }
  808. {
  809. /* %% [7.0] user's declarations go here */
  810. #line 123 "dot.l"
  811. #line 993 "lex.yy.c"
  812. while ( /*CONSTCOND*/ 1) { /* loops until end-of-file is reached */
  813. /* %% [8.0] yymore()-related code goes here */
  814. yy_cp = (yy_c_buf_p);
  815. /* Support of yytext. */
  816. *yy_cp = (yy_hold_char);
  817. /* yy_bp points to the position in yy_ch_buf of the start of
  818. * the current run.
  819. */
  820. yy_bp = yy_cp;
  821. /* %% [9.0] code to set up and find next match goes here - scan-build says array subscript is undefined at the generated code yy_nxt[yy_current_state][ YY_SC_TO_UI(*yy_cp) ]) */
  822. yy_current_state = (yy_start);
  823. yy_match:
  824. do {
  825. YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
  826. if (yy_accept[yy_current_state]) {
  827. (yy_last_accepting_state) = yy_current_state;
  828. (yy_last_accepting_cpos) = yy_cp;
  829. }
  830. while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
  831. yy_current_state = (int)yy_def[yy_current_state];
  832. if (yy_current_state >= 99)
  833. yy_c = yy_meta[yy_c];
  834. }
  835. yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  836. ++yy_cp;
  837. }
  838. while (yy_current_state != 98);
  839. yy_cp = (yy_last_accepting_cpos);
  840. yy_current_state = (yy_last_accepting_state);
  841. yy_find_action:
  842. /* %% [10.0] code to find the action number goes here */
  843. yy_act = yy_accept[yy_current_state];
  844. YY_DO_BEFORE_ACTION;
  845. /* %% [11.0] code for yylineno update goes here */
  846. if (yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act]) {
  847. int yyl;
  848. for (yyl = 0; yyl < yyleng; ++yyl)
  849. if (yytext[yyl] == '\n')
  850. yylineno++;
  851. ;
  852. }
  853. do_action: /* This label is used only to access EOF actions. */
  854. /* %% [12.0] debug code goes here */
  855. if (yy_flex_debug) {
  856. if (yy_act == 0)
  857. fprintf(stderr, "--scanner backing up\n");
  858. else if (yy_act < 39)
  859. fprintf(stderr, "--accepting rule at line %ld (\"%s\")\n", (long)yy_rule_linenum[yy_act], yytext);
  860. else if (yy_act == 39)
  861. fprintf(stderr, "--accepting default rule (\"%s\")\n", yytext);
  862. else if (yy_act == 40)
  863. fprintf(stderr, "--(end of buffer or a NUL)\n");
  864. else
  865. fprintf(stderr, "--EOF (start condition %d)\n", YY_START);
  866. }
  867. switch (yy_act) { /* beginning of action switch */
  868. /* %% [13.0] actions go here */
  869. case 0: /* must back up */
  870. /* undo the effects of YY_DO_BEFORE_ACTION */
  871. *yy_cp = (yy_hold_char);
  872. yy_cp = (yy_last_accepting_cpos);
  873. yy_current_state = (yy_last_accepting_state);
  874. goto yy_find_action;
  875. case 1:
  876. /* rule 1 can match eol */
  877. YY_RULE_SETUP
  878. #line 125 "dot.l"
  879. { /* c-comment style *//* lexer does update yylineno */
  880. dp_check_c_comment(yytext + 1);
  881. }
  882. YY_BREAK case 2:YY_RULE_SETUP
  883. #line 126 "dot.l"
  884. { /* end of c comment but no start of c comment shouldnothappen */
  885. printf("%s(): end of c-comment without start of c-comment \"*\\\" at line %d skipped\n", __func__, yylineno);
  886. }
  887. YY_BREAK case 3:YY_RULE_SETUP
  888. #line 127 "dot.l"
  889. { /* c++ comment style *//* lexer does update yylineno */
  890. }
  891. YY_BREAK case 4:YY_RULE_SETUP
  892. #line 129 "dot.l"
  893. { /* dot comment line */
  894. }
  895. YY_BREAK case 5:YY_RULE_SETUP
  896. #line 130 "dot.l"
  897. { /* this is dot specific */
  898. return (TOKEN_UTF8BOM);
  899. }
  900. YY_BREAK case 6:YY_RULE_SETUP
  901. #line 131 "dot.l"
  902. { /* skip form feed chars and spaces */
  903. }
  904. YY_BREAK case 7:YY_RULE_SETUP
  905. #line 132 "dot.l"
  906. { /* skip tabs */
  907. }
  908. YY_BREAK case 8:
  909. /* rule 8 can match eol */
  910. YY_RULE_SETUP
  911. #line 133 "dot.l"
  912. { /* skip new line *//* lexer does update yylineno */
  913. }
  914. YY_BREAK case 9:YY_RULE_SETUP
  915. #line 134 "dot.l"
  916. { /* skip carriage return */
  917. }
  918. YY_BREAK case 10:YY_RULE_SETUP
  919. #line 136 "dot.l"
  920. {
  921. return (EOF);
  922. }
  923. YY_BREAK case 11:YY_RULE_SETUP
  924. #line 137 "dot.l"
  925. {
  926. return (TOKEN_PLUS);
  927. }
  928. YY_BREAK case 12:YY_RULE_SETUP
  929. #line 138 "dot.l"
  930. {
  931. return (TOKEN_COMMA);
  932. }
  933. YY_BREAK case 13:YY_RULE_SETUP
  934. #line 139 "dot.l"
  935. {
  936. return (TOKEN_COLON);
  937. }
  938. YY_BREAK case 14:YY_RULE_SETUP
  939. #line 140 "dot.l"
  940. {
  941. return (TOKEN_SC);
  942. }
  943. YY_BREAK case 15:YY_RULE_SETUP
  944. #line 141 "dot.l"
  945. {
  946. return (TOKEN_IS);
  947. }
  948. YY_BREAK case 16:YY_RULE_SETUP
  949. #line 142 "dot.l"
  950. {
  951. return (TOKEN_BRACKETOPEN);
  952. }
  953. YY_BREAK case 17:YY_RULE_SETUP
  954. #line 143 "dot.l"
  955. {
  956. return (TOKEN_BRACKETCLOSE);
  957. }
  958. YY_BREAK case 18:YY_RULE_SETUP
  959. #line 144 "dot.l"
  960. {
  961. return (TOKEN_BRACEOPEN);
  962. }
  963. YY_BREAK case 19:YY_RULE_SETUP
  964. #line 145 "dot.l"
  965. {
  966. return (TOKEN_BRACECLOSE);
  967. }
  968. YY_BREAK case 20:YY_RULE_SETUP
  969. #line 146 "dot.l"
  970. {
  971. yylval.string = (char *)dp_uniqstr((char *)"--");
  972. return (TOKEN_EOP);
  973. }
  974. YY_BREAK case 21:YY_RULE_SETUP
  975. #line 147 "dot.l"
  976. {
  977. yylval.string = (char *)dp_uniqstr((char *)"->");
  978. return (TOKEN_EOP);
  979. }
  980. YY_BREAK case 22:YY_RULE_SETUP
  981. #line 149 "dot.l"
  982. {
  983. return (TOKEN_EDGE);
  984. }
  985. YY_BREAK case 23:YY_RULE_SETUP
  986. #line 150 "dot.l"
  987. {
  988. return (TOKEN_NODE);
  989. }
  990. YY_BREAK case 24:YY_RULE_SETUP
  991. #line 151 "dot.l"
  992. {
  993. return (TOKEN_DIGRAPH);
  994. }
  995. YY_BREAK case 25:YY_RULE_SETUP
  996. #line 152 "dot.l"
  997. {
  998. return (TOKEN_GRAPH);
  999. }
  1000. YY_BREAK case 26:YY_RULE_SETUP
  1001. #line 153 "dot.l"
  1002. {
  1003. return (TOKEN_SUBGRAPH);
  1004. }
  1005. YY_BREAK case 27:YY_RULE_SETUP
  1006. #line 154 "dot.l"
  1007. {
  1008. return (TOKEN_STRICT);
  1009. }
  1010. YY_BREAK case 28:
  1011. /* rule 28 can match eol */
  1012. YY_RULE_SETUP
  1013. #line 156 "dot.l"
  1014. {
  1015. if (yyleng == 2) {
  1016. /* string is "" */
  1017. yylval.string = (char *)dp_uniqstr((char *)"");
  1018. return (TOKEN_QTEXT);
  1019. }
  1020. /* copy and filter the text, and clear last " */ yytext[yyleng - 1] = 0;
  1021. tmpp = (char *)dp_calloc(1, yyleng);
  1022. p = yytext;
  1023. p++; /* skip first " */
  1024. q = tmpp;
  1025. while (*p) {
  1026. if (*p == '\\') {
  1027. if (*(p + 1) == 0) {
  1028. *q = '\\';
  1029. q++;
  1030. p++; /* "\" as last char */
  1031. } else if (*(p + 1) == '\n') {
  1032. p = p + 2; /* skip "\\n" sequence */
  1033. } else if (*(p + 1) == ' ') {
  1034. *q = ' '; /* "\ " is " " special in html label */
  1035. q++;
  1036. p = p + 2;
  1037. } else if (*(p + 1) == '|') {
  1038. *q = '\\'; /* special in record label */
  1039. q++;
  1040. *q = '|';
  1041. q++;
  1042. p = p + 2;
  1043. } else if (*(p + 1) == '{') {
  1044. *q = '\\'; /* special in record label */
  1045. q++;
  1046. *q = '{';
  1047. q++;
  1048. p = p + 2;
  1049. } else if (*(p + 1) == '}') {
  1050. *q = '\\'; /* special in record label */
  1051. q++;
  1052. *q = '}';
  1053. q++;
  1054. p = p + 2;
  1055. } else if (*(p + 1) == '\\') {
  1056. /* \\ is translated into a single \ */
  1057. *q = '\\';
  1058. q++;
  1059. p = p + 2;
  1060. } else if (*(p + 1) == '"') {
  1061. /* \" becomes " */
  1062. *q = '"';
  1063. q++;
  1064. p = p + 2;
  1065. } else {
  1066. *q = *p; /* copy other esc sequences */
  1067. p++;
  1068. q++;
  1069. }
  1070. } else {
  1071. *q = *p; /* copy regular chars */
  1072. p++;
  1073. q++;
  1074. }
  1075. }
  1076. yylval.string = (char *)dp_uniqstr((char *)tmpp);
  1077. tmpp = (char *)dp_free((void *)tmpp);
  1078. p = NULL;
  1079. q = NULL;
  1080. return (TOKEN_QTEXT);
  1081. }
  1082. YY_BREAK case 29:YY_RULE_SETUP
  1083. #line 227 "dot.l"
  1084. {
  1085. yylval.string = (char *)dp_uniqstr((char *)yytext);
  1086. return (TOKEN_TEXT);
  1087. }
  1088. YY_BREAK case 30:YY_RULE_SETUP
  1089. #line 232 "dot.l"
  1090. {
  1091. yylval.string = (char *)dp_uniqstr((char *)yytext);
  1092. return (TOKEN_NUM);
  1093. }
  1094. YY_BREAK
  1095. /* html label, but if it is <> return "" */
  1096. case 31:YY_RULE_SETUP
  1097. #line 238 "dot.l"
  1098. {
  1099. BEGIN(htmlstr);
  1100. htmlnest = 1;
  1101. yylval.string = (char *)"<";
  1102. }
  1103. YY_BREAK case 32:YY_RULE_SETUP
  1104. #line 243 "dot.l"
  1105. {
  1106. htmlnest--;
  1107. if (htmlnest) {
  1108. yylval.string = (char *)dp_ccat((char *)yylval.string, (char *)yytext);
  1109. } else {
  1110. yylval.string = dp_ccat((char *)yylval.string, (char *)">");
  1111. BEGIN(INITIAL);
  1112. if (strlen(yylval.string) == 2) {
  1113. yylval.string = (char *)"";
  1114. }
  1115. return (TOKEN_HTEXT);
  1116. }
  1117. }
  1118. YY_BREAK case 33:YY_RULE_SETUP
  1119. #line 256 "dot.l"
  1120. {
  1121. htmlnest++;
  1122. yylval.string = (char *)dp_ccat((char *)yylval.string, (char *)yytext);
  1123. } YY_BREAK case 34:YY_RULE_SETUP
  1124. #line 260 "dot.l"
  1125. {
  1126. yylval.string = (char *)dp_ccat((char *)yylval.string, (char *)"&lt;");
  1127. } YY_BREAK case 35:YY_RULE_SETUP
  1128. #line 263 "dot.l"
  1129. {
  1130. yylval.string = (char *)dp_ccat((char *)yylval.string, (char *)"&gt;");
  1131. } YY_BREAK case 36:
  1132. /* rule 36 can match eol */
  1133. YY_RULE_SETUP
  1134. #line 266 "dot.l"
  1135. {
  1136. /* yylineno++ is update by lexer code */ ;
  1137. }
  1138. YY_BREAK case 37:
  1139. /* rule 37 can match eol */
  1140. YY_RULE_SETUP
  1141. #line 269 "dot.l"
  1142. {
  1143. yylval.string = (char *)dp_ccat((char *)yylval.string, (char *)yytext);
  1144. } YY_BREAK case 38:YY_RULE_SETUP
  1145. #line 274 "dot.l"
  1146. {
  1147. return ((int)yytext[0]);
  1148. } YY_BREAK case 39:YY_RULE_SETUP
  1149. #line 276 "dot.l"
  1150. ECHO;
  1151. YY_BREAK
  1152. #line 1382 "lex.yy.c"
  1153. case YY_STATE_EOF(INITIAL):
  1154. case YY_STATE_EOF(htmlstr):
  1155. yyterminate();
  1156. case YY_END_OF_BUFFER:
  1157. {
  1158. /* Amount of text matched not including the EOB char. */
  1159. int yy_amount_of_matched_text = (int)(yy_cp - (yytext_ptr)) - 1;
  1160. /* Undo the effects of YY_DO_BEFORE_ACTION. */
  1161. *yy_cp = (yy_hold_char);
  1162. YY_RESTORE_YY_MORE_OFFSET if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW) {
  1163. /* We're scanning a new file or input source. It's
  1164. * possible that this happened because the user
  1165. * just pointed yyin at a new source and called
  1166. * yylex(). If so, then we have to assure
  1167. * consistency between YY_CURRENT_BUFFER and our
  1168. * globals. Here is the right place to do so, because
  1169. * this is the first action (other than possibly a
  1170. * back-up) that will match for the new input source.
  1171. */
  1172. (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  1173. /* %if-c-only */
  1174. YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
  1175. /* %endif */
  1176. /* %if-c++-only */
  1177. /* %endif */
  1178. YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
  1179. }
  1180. /* Note that here we test for yy_c_buf_p "<=" to the position
  1181. * of the first EOB in the buffer, since yy_c_buf_p will
  1182. * already have been incremented past the NUL character
  1183. * (since all states make transitions on EOB to the
  1184. * end-of-buffer state). Contrast this with the test
  1185. * in input().
  1186. */
  1187. if ((yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]) { /* This was really a NUL. */
  1188. yy_state_type yy_next_state;
  1189. (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
  1190. yy_current_state = yy_get_previous_state();
  1191. /* Okay, we're now positioned to make the NUL
  1192. * transition. We couldn't have
  1193. * yy_get_previous_state() go ahead and do it
  1194. * for us because it doesn't know how to deal
  1195. * with the possibility of jamming (and we don't
  1196. * want to build jamming into it because then it
  1197. * will run more slowly).
  1198. */
  1199. yy_next_state = yy_try_NUL_trans(yy_current_state);
  1200. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  1201. if (yy_next_state) {
  1202. /* Consume the NUL. */
  1203. yy_cp = ++(yy_c_buf_p);
  1204. yy_current_state = yy_next_state;
  1205. goto yy_match;
  1206. }
  1207. else {
  1208. /* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */
  1209. yy_cp = (yy_last_accepting_cpos);
  1210. yy_current_state = (yy_last_accepting_state);
  1211. goto yy_find_action;
  1212. }
  1213. }
  1214. else
  1215. switch (yy_get_next_buffer()) {
  1216. case EOB_ACT_END_OF_FILE:
  1217. {
  1218. (yy_did_buffer_switch_on_eof) = 0;
  1219. if (yywrap()) {
  1220. /* Note: because we've taken care in
  1221. * yy_get_next_buffer() to have set up
  1222. * yytext, we can now set up
  1223. * yy_c_buf_p so that if some total
  1224. * hoser (like flex itself) wants to
  1225. * call the scanner after we return the
  1226. * YY_NULL, it'll still work - another
  1227. * YY_NULL will get returned.
  1228. */
  1229. (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
  1230. yy_act = YY_STATE_EOF(YY_START);
  1231. goto do_action;
  1232. }
  1233. else {
  1234. if (!(yy_did_buffer_switch_on_eof))
  1235. YY_NEW_FILE;
  1236. }
  1237. break;
  1238. }
  1239. case EOB_ACT_CONTINUE_SCAN:
  1240. (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
  1241. yy_current_state = yy_get_previous_state();
  1242. yy_cp = (yy_c_buf_p);
  1243. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  1244. goto yy_match;
  1245. case EOB_ACT_LAST_MATCH:
  1246. (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
  1247. yy_current_state = yy_get_previous_state();
  1248. yy_cp = (yy_c_buf_p);
  1249. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  1250. goto yy_find_action;
  1251. }
  1252. break;
  1253. }
  1254. default:
  1255. YY_FATAL_ERROR("fatal flex scanner internal error--no action found");
  1256. break;
  1257. } /* end of action switch */
  1258. } /* end of scanning one token */
  1259. } /* end of user's declarations */
  1260. } /* end of yylex */
  1261. /* %ok-for-header */
  1262. /* %if-c++-only */
  1263. /* %not-for-header */
  1264. /* %ok-for-header */
  1265. /* %endif */
  1266. /* yy_get_next_buffer - try to read in a new buffer
  1267. *
  1268. * Returns a code representing an action:
  1269. * EOB_ACT_LAST_MATCH -
  1270. * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  1271. * EOB_ACT_END_OF_FILE - end of file
  1272. */
  1273. /* %if-c-only */
  1274. static int yy_get_next_buffer(void)
  1275. /* %endif */
  1276. /* %if-c++-only */
  1277. /* %endif */
  1278. {
  1279. char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
  1280. char *source = (yytext_ptr);
  1281. int number_to_move, i;
  1282. int ret_val;
  1283. if ((yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1])
  1284. YY_FATAL_ERROR("fatal flex scanner internal error--end of buffer missed");
  1285. if (YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0) { /* Don't try to fill the buffer, so this is an EOF. */
  1286. if ((yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1) {
  1287. /* We matched a single character, the EOB, so
  1288. * treat this as a final EOF.
  1289. */
  1290. return EOB_ACT_END_OF_FILE;
  1291. }
  1292. else {
  1293. /* We matched some text prior to the EOB, first
  1294. * process it.
  1295. */
  1296. return EOB_ACT_LAST_MATCH;
  1297. }
  1298. }
  1299. /* Try to read more data. */
  1300. /* First move last chars to start of buffer. */
  1301. number_to_move = (int)((yy_c_buf_p) - (yytext_ptr) - 1);
  1302. for (i = 0; i < number_to_move; ++i)
  1303. *(dest++) = *(source++);
  1304. if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING)
  1305. /* don't do the read, it's not guaranteed to return an EOF,
  1306. * just force an EOF
  1307. */
  1308. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
  1309. else {
  1310. int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
  1311. while (num_to_read <= 0) { /* Not enough room in the buffer - grow it. */
  1312. /* just a shorter name for the current buffer */
  1313. YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
  1314. int yy_c_buf_p_offset = (int)((yy_c_buf_p) - b->yy_ch_buf);
  1315. if (b->yy_is_our_buffer) {
  1316. int new_size = b->yy_buf_size * 2;
  1317. if (new_size <= 0)
  1318. b->yy_buf_size += b->yy_buf_size / 8;
  1319. else
  1320. b->yy_buf_size *= 2;
  1321. b->yy_ch_buf = (char *)
  1322. /* Include room in for 2 EOB chars. */
  1323. yyrealloc((void *)b->yy_ch_buf, (yy_size_t) (b->yy_buf_size + 2));
  1324. } else
  1325. /* Can't grow it, we don't own it. */
  1326. b->yy_ch_buf = NULL;
  1327. if (!b->yy_ch_buf)
  1328. YY_FATAL_ERROR("fatal error - scanner input buffer overflow");
  1329. (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
  1330. num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
  1331. }
  1332. if (num_to_read > YY_READ_BUF_SIZE)
  1333. num_to_read = YY_READ_BUF_SIZE;
  1334. /* Read in more data. */
  1335. YY_INPUT((&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), num_to_read);
  1336. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1337. }
  1338. if ((yy_n_chars) == 0) {
  1339. if (number_to_move == YY_MORE_ADJ) {
  1340. ret_val = EOB_ACT_END_OF_FILE;
  1341. yyrestart(yyin);
  1342. }
  1343. else {
  1344. ret_val = EOB_ACT_LAST_MATCH;
  1345. YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING;
  1346. }
  1347. }
  1348. else
  1349. ret_val = EOB_ACT_CONTINUE_SCAN;
  1350. if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
  1351. /* Extend the array by 50%, plus the number we really need. */
  1352. int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
  1353. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *)yyrealloc((void *)YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size);
  1354. if (!YY_CURRENT_BUFFER_LVALUE->yy_ch_buf)
  1355. YY_FATAL_ERROR("out of dynamic memory in yy_get_next_buffer()");
  1356. /* "- 2" to take care of EOB's */
  1357. YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int)(new_size - 2);
  1358. }
  1359. (yy_n_chars) += number_to_move;
  1360. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
  1361. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
  1362. (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
  1363. return ret_val;
  1364. }
  1365. /* yy_get_previous_state - get the state just before the EOB char was reached */
  1366. /* %if-c-only */
  1367. /* %not-for-header */
  1368. static yy_state_type yy_get_previous_state(void)
  1369. /* %endif */
  1370. /* %if-c++-only */
  1371. /* %endif */
  1372. {
  1373. yy_state_type yy_current_state;
  1374. char *yy_cp;
  1375. /* %% [15.0] code to get the start state into yy_current_state goes here */
  1376. yy_current_state = (yy_start);
  1377. for (yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp) {
  1378. /* %% [16.0] code to find the next state goes here */
  1379. YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
  1380. if (yy_accept[yy_current_state]) {
  1381. (yy_last_accepting_state) = yy_current_state;
  1382. (yy_last_accepting_cpos) = yy_cp;
  1383. }
  1384. while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
  1385. yy_current_state = (int)yy_def[yy_current_state];
  1386. if (yy_current_state >= 99)
  1387. yy_c = yy_meta[yy_c];
  1388. }
  1389. yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  1390. }
  1391. return yy_current_state;
  1392. }
  1393. /* yy_try_NUL_trans - try to make a transition on the NUL character
  1394. *
  1395. * synopsis
  1396. * next_state = yy_try_NUL_trans( current_state );
  1397. */
  1398. /* %if-c-only */
  1399. static yy_state_type yy_try_NUL_trans(yy_state_type yy_current_state)
  1400. /* %endif */
  1401. /* %if-c++-only */
  1402. /* %endif */
  1403. {
  1404. int yy_is_jam;
  1405. /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */
  1406. char *yy_cp = (yy_c_buf_p);
  1407. YY_CHAR yy_c = 1;
  1408. if (yy_accept[yy_current_state]) {
  1409. (yy_last_accepting_state) = yy_current_state;
  1410. (yy_last_accepting_cpos) = yy_cp;
  1411. }
  1412. while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
  1413. yy_current_state = (int)yy_def[yy_current_state];
  1414. if (yy_current_state >= 99)
  1415. yy_c = yy_meta[yy_c];
  1416. }
  1417. yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  1418. yy_is_jam = (yy_current_state == 98);
  1419. return yy_is_jam ? 0 : yy_current_state;
  1420. }
  1421. #ifndef YY_NO_UNPUT
  1422. /* %if-c-only */
  1423. /* %endif */
  1424. #endif
  1425. /* %if-c-only */
  1426. #ifndef YY_NO_INPUT
  1427. #ifdef __cplusplus
  1428. static int yyinput(void)
  1429. #else
  1430. static int input(void)
  1431. #endif
  1432. /* %endif */
  1433. /* %if-c++-only */
  1434. /* %endif */
  1435. {
  1436. int c;
  1437. *(yy_c_buf_p) = (yy_hold_char);
  1438. if (*(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR) {
  1439. /* yy_c_buf_p now points to the character we want to return.
  1440. * If this occurs *before* the EOB characters, then it's a
  1441. * valid NUL; if not, then we've hit the end of the buffer.
  1442. */
  1443. if ((yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)])
  1444. /* This was really a NUL. */
  1445. *(yy_c_buf_p) = '\0';
  1446. else { /* need more input */
  1447. int offset = (int)((yy_c_buf_p) - (yytext_ptr));
  1448. ++(yy_c_buf_p);
  1449. switch (yy_get_next_buffer()) {
  1450. case EOB_ACT_LAST_MATCH:
  1451. /* This happens because yy_g_n_b()
  1452. * sees that we've accumulated a
  1453. * token and flags that we need to
  1454. * try matching the token before
  1455. * proceeding. But for input(),
  1456. * there's no matching to consider.
  1457. * So convert the EOB_ACT_LAST_MATCH
  1458. * to EOB_ACT_END_OF_FILE.
  1459. */
  1460. /* Reset buffer status. */
  1461. yyrestart(yyin);
  1462. /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE:
  1463. {
  1464. if (yywrap())
  1465. return 0;
  1466. if (!(yy_did_buffer_switch_on_eof))
  1467. YY_NEW_FILE;
  1468. #ifdef __cplusplus
  1469. return yyinput();
  1470. #else
  1471. return input();
  1472. #endif
  1473. }
  1474. case EOB_ACT_CONTINUE_SCAN:
  1475. (yy_c_buf_p) = (yytext_ptr) + offset;
  1476. break;
  1477. }
  1478. }
  1479. }
  1480. c = *(unsigned char *)(yy_c_buf_p); /* cast for 8-bit char's */
  1481. *(yy_c_buf_p) = '\0'; /* preserve yytext */
  1482. (yy_hold_char) = *++(yy_c_buf_p);
  1483. /* %% [19.0] update BOL and yylineno */
  1484. if (c == '\n')
  1485. yylineno++;
  1486. ;
  1487. return c;
  1488. }
  1489. /* %if-c-only */
  1490. #endif /* ifndef YY_NO_INPUT */
  1491. /* %endif */
  1492. /** Immediately switch to a different input stream.
  1493. * @param input_file A readable stream.
  1494. *
  1495. * @note This function does not reset the start condition to @c INITIAL .
  1496. */
  1497. /* %if-c-only */
  1498. void yyrestart(FILE * input_file)
  1499. /* %endif */
  1500. /* %if-c++-only */
  1501. /* %endif */
  1502. {
  1503. if (!YY_CURRENT_BUFFER) {
  1504. yyensure_buffer_stack();
  1505. YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE);
  1506. }
  1507. yy_init_buffer(YY_CURRENT_BUFFER, input_file);
  1508. yy_load_buffer_state();
  1509. }
  1510. /* %if-c++-only */
  1511. /* %endif */
  1512. /** Switch to a different input buffer.
  1513. * @param new_buffer The new input buffer.
  1514. *
  1515. */
  1516. /* %if-c-only */
  1517. void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer)
  1518. /* %endif */
  1519. /* %if-c++-only */
  1520. /* %endif */
  1521. {
  1522. /* TODO. We should be able to replace this entire function body
  1523. * with
  1524. * yypop_buffer_state();
  1525. * yypush_buffer_state(new_buffer);
  1526. */
  1527. yyensure_buffer_stack();
  1528. if (YY_CURRENT_BUFFER == new_buffer)
  1529. return;
  1530. if (YY_CURRENT_BUFFER) {
  1531. /* Flush out information for old buffer. */
  1532. *(yy_c_buf_p) = (yy_hold_char);
  1533. YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
  1534. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1535. }
  1536. YY_CURRENT_BUFFER_LVALUE = new_buffer;
  1537. yy_load_buffer_state();
  1538. /* We don't actually know whether we did this switch during
  1539. * EOF (yywrap()) processing, but the only time this flag
  1540. * is looked at is after yywrap() is called, so it's safe
  1541. * to go ahead and always set it.
  1542. */
  1543. (yy_did_buffer_switch_on_eof) = 1;
  1544. }
  1545. /* %if-c-only */
  1546. static void yy_load_buffer_state(void)
  1547. /* %endif */
  1548. /* %if-c++-only */
  1549. /* %endif */
  1550. {
  1551. (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  1552. (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
  1553. /* %if-c-only */
  1554. yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
  1555. /* %endif */
  1556. /* %if-c++-only */
  1557. /* %endif */
  1558. (yy_hold_char) = *(yy_c_buf_p);
  1559. }
  1560. /** Allocate and initialize an input buffer state.
  1561. * @param file A readable stream.
  1562. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
  1563. *
  1564. * @return the allocated buffer state.
  1565. */
  1566. /* %if-c-only */
  1567. YY_BUFFER_STATE yy_create_buffer(FILE * file, int size)
  1568. /* %endif */
  1569. /* %if-c++-only */
  1570. /* %endif */
  1571. {
  1572. YY_BUFFER_STATE b;
  1573. b = (YY_BUFFER_STATE) yyalloc(sizeof(struct yy_buffer_state));
  1574. if (!b)
  1575. YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()");
  1576. b->yy_buf_size = size;
  1577. /* yy_ch_buf has to be 2 characters longer than the size given because
  1578. * we need to put in 2 end-of-buffer characters.
  1579. */
  1580. b->yy_ch_buf = (char *)yyalloc((yy_size_t) (b->yy_buf_size + 2));
  1581. if (!b->yy_ch_buf) {
  1582. yyfree(b);
  1583. YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()");
  1584. }
  1585. b->yy_is_our_buffer = 1;
  1586. yy_init_buffer(b, file);
  1587. return b;
  1588. }
  1589. /* %if-c++-only */
  1590. /* %endif */
  1591. /** Destroy the buffer.
  1592. * @param b a buffer created with yy_create_buffer()
  1593. *
  1594. */
  1595. /* %if-c-only */
  1596. void yy_delete_buffer(YY_BUFFER_STATE b)
  1597. /* %endif */
  1598. /* %if-c++-only */
  1599. /* %endif */
  1600. {
  1601. if (!b)
  1602. return;
  1603. if (b == YY_CURRENT_BUFFER) /* Not sure if we should pop here. */
  1604. YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
  1605. if (b->yy_is_our_buffer)
  1606. yyfree((void *)b->yy_ch_buf);
  1607. yyfree((void *)b);
  1608. }
  1609. /* Initializes or reinitializes a buffer.
  1610. * This function is sometimes called more than once on the same buffer,
  1611. * such as during a yyrestart() or at EOF.
  1612. */
  1613. /* %if-c-only */
  1614. static void yy_init_buffer(YY_BUFFER_STATE b, FILE * file)
  1615. /* %endif */
  1616. /* %if-c++-only */
  1617. /* %endif */
  1618. {
  1619. int oerrno = errno;
  1620. if (b == NULL) {
  1621. /* shouldnothappen */
  1622. return;
  1623. }
  1624. yy_flush_buffer(b);
  1625. /* %if-c-only */
  1626. b->yy_input_file = file;
  1627. /* %endif */
  1628. /* %if-c++-only */
  1629. /* %endif */
  1630. b->yy_fill_buffer = 1;
  1631. /* If b is the current buffer, then yy_init_buffer was _probably_
  1632. * called from yyrestart() or through yy_get_next_buffer.
  1633. * In that case, we don't want to reset the lineno or column.
  1634. */
  1635. if (b != YY_CURRENT_BUFFER) {
  1636. b->yy_bs_lineno = 1;
  1637. b->yy_bs_column = 0;
  1638. }
  1639. /* %if-c-only */
  1640. b->yy_is_interactive = 0;
  1641. /* %endif */
  1642. /* %if-c++-only */
  1643. /* %endif */
  1644. errno = oerrno;
  1645. }
  1646. /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
  1647. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
  1648. *
  1649. */
  1650. /* %if-c-only */
  1651. void yy_flush_buffer(YY_BUFFER_STATE b)
  1652. /* %endif */
  1653. /* %if-c++-only */
  1654. /* %endif */
  1655. {
  1656. if (!b)
  1657. return;
  1658. b->yy_n_chars = 0;
  1659. /* We always need two end-of-buffer characters. The first causes
  1660. * a transition to the end-of-buffer state. The second causes
  1661. * a jam in that state.
  1662. */
  1663. b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
  1664. b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  1665. b->yy_buf_pos = &b->yy_ch_buf[0];
  1666. b->yy_at_bol = 1;
  1667. b->yy_buffer_status = YY_BUFFER_NEW;
  1668. if (b == YY_CURRENT_BUFFER)
  1669. yy_load_buffer_state();
  1670. }
  1671. /* %if-c-or-c++ */
  1672. /** Pushes the new state onto the stack. The new state becomes
  1673. * the current state. This function will allocate the stack
  1674. * if necessary.
  1675. * @param new_buffer The new state.
  1676. *
  1677. */
  1678. /* %if-c-only */
  1679. void yypush_buffer_state(YY_BUFFER_STATE new_buffer)
  1680. /* %endif */
  1681. /* %if-c++-only */
  1682. /* %endif */
  1683. {
  1684. if (new_buffer == NULL)
  1685. return;
  1686. yyensure_buffer_stack();
  1687. /* This block is copied from yy_switch_to_buffer. */
  1688. if (YY_CURRENT_BUFFER) {
  1689. /* Flush out information for old buffer. */
  1690. *(yy_c_buf_p) = (yy_hold_char);
  1691. YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
  1692. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1693. }
  1694. /* Only push if top exists. Otherwise, replace top. */
  1695. if (YY_CURRENT_BUFFER)
  1696. (yy_buffer_stack_top)++;
  1697. YY_CURRENT_BUFFER_LVALUE = new_buffer;
  1698. /* copied from yy_switch_to_buffer. */
  1699. yy_load_buffer_state();
  1700. (yy_did_buffer_switch_on_eof) = 1;
  1701. }
  1702. /* %endif */
  1703. /* %if-c-or-c++ */
  1704. /** Removes and deletes the top of the stack, if present.
  1705. * The next element becomes the new top.
  1706. *
  1707. */
  1708. /* %if-c-only */
  1709. void yypop_buffer_state(void)
  1710. /* %endif */
  1711. /* %if-c++-only */
  1712. /* %endif */
  1713. {
  1714. if (!YY_CURRENT_BUFFER)
  1715. return;
  1716. yy_delete_buffer(YY_CURRENT_BUFFER);
  1717. YY_CURRENT_BUFFER_LVALUE = NULL;
  1718. if ((yy_buffer_stack_top) > 0)
  1719. --(yy_buffer_stack_top);
  1720. if (YY_CURRENT_BUFFER) {
  1721. yy_load_buffer_state();
  1722. (yy_did_buffer_switch_on_eof) = 1;
  1723. }
  1724. }
  1725. /* %endif */
  1726. /* %if-c-or-c++ */
  1727. /* Allocates the stack if it does not exist.
  1728. * Guarantees space for at least one push.
  1729. */
  1730. /* %if-c-only */
  1731. static void yyensure_buffer_stack(void)
  1732. /* %endif */
  1733. /* %if-c++-only */
  1734. /* %endif */
  1735. {
  1736. yy_size_t num_to_alloc;
  1737. if (!(yy_buffer_stack)) {
  1738. /* First allocation is just for 2 elements, since we don't know if this
  1739. * scanner will even need a stack. We use 2 instead of 1 to avoid an
  1740. * immediate realloc on the next call.
  1741. */
  1742. num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
  1743. (yy_buffer_stack) = (struct yy_buffer_state **)yyalloc(num_to_alloc * sizeof(struct yy_buffer_state *)
  1744. );
  1745. if (!(yy_buffer_stack))
  1746. YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()");
  1747. memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state *));
  1748. (yy_buffer_stack_max) = num_to_alloc;
  1749. (yy_buffer_stack_top) = 0;
  1750. return;
  1751. }
  1752. if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1) {
  1753. /* Increase the buffer to prepare for a possible push. */
  1754. yy_size_t grow_size = 8 /* arbitrary grow size */ ;
  1755. num_to_alloc = (yy_buffer_stack_max) + grow_size;
  1756. (yy_buffer_stack) = (struct yy_buffer_state **)yyrealloc((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state *)
  1757. );
  1758. if (!(yy_buffer_stack))
  1759. YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()");
  1760. /* zero only the new slots. */
  1761. memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state *));
  1762. (yy_buffer_stack_max) = num_to_alloc;
  1763. }
  1764. }
  1765. /* %endif */
  1766. /* %if-c-only */
  1767. /** Setup the input buffer state to scan directly from a user-specified character buffer.
  1768. * @param base the character buffer
  1769. * @param size the size in bytes of the character buffer
  1770. *
  1771. * @return the newly allocated buffer state object.
  1772. */
  1773. YY_BUFFER_STATE yy_scan_buffer(char *base, yy_size_t size)
  1774. {
  1775. YY_BUFFER_STATE b;
  1776. if (size < 2 || base[size - 2] != YY_END_OF_BUFFER_CHAR || base[size - 1] != YY_END_OF_BUFFER_CHAR)
  1777. /* They forgot to leave room for the EOB's. */
  1778. return NULL;
  1779. b = (YY_BUFFER_STATE) yyalloc(sizeof(struct yy_buffer_state));
  1780. if (!b) {
  1781. YY_FATAL_ERROR("out of dynamic memory in yy_scan_buffer()");
  1782. }
  1783. b->yy_buf_size = (int)(size - 2); /* "- 2" to take care of EOB's */
  1784. b->yy_buf_pos = b->yy_ch_buf = base;
  1785. b->yy_is_our_buffer = 0;
  1786. b->yy_input_file = NULL;
  1787. b->yy_n_chars = b->yy_buf_size;
  1788. b->yy_is_interactive = 0;
  1789. b->yy_at_bol = 1;
  1790. b->yy_fill_buffer = 0;
  1791. b->yy_buffer_status = YY_BUFFER_NEW;
  1792. yy_switch_to_buffer(b);
  1793. return b;
  1794. }
  1795. /* %endif */
  1796. /* %if-c-only */
  1797. /** Setup the input buffer state to scan a string. The next call to yylex() will
  1798. * scan from a @e copy of @a str.
  1799. * @param yystr a NUL-terminated string to scan
  1800. *
  1801. * @return the newly allocated buffer state object.
  1802. * @note If you want to scan bytes that may contain NUL values, then use
  1803. * yy_scan_bytes() instead.
  1804. */
  1805. YY_BUFFER_STATE yy_scan_string(const char *yystr)
  1806. {
  1807. return yy_scan_bytes(yystr, (int)strlen(yystr));
  1808. }
  1809. /* %endif */
  1810. /* %if-c-only */
  1811. /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
  1812. * scan from a @e copy of @a bytes.
  1813. * @param yybytes the byte buffer to scan
  1814. * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
  1815. *
  1816. * @return the newly allocated buffer state object.
  1817. */
  1818. YY_BUFFER_STATE yy_scan_bytes(const char *yybytes, int _yybytes_len)
  1819. {
  1820. YY_BUFFER_STATE b;
  1821. char *buf;
  1822. yy_size_t n;
  1823. int i;
  1824. /* Get memory for full buffer, including space for trailing EOB's. */
  1825. n = (yy_size_t) (_yybytes_len + 2);
  1826. buf = (char *)yyalloc(n);
  1827. if (!buf)
  1828. YY_FATAL_ERROR("out of dynamic memory in yy_scan_bytes()");
  1829. for (i = 0; i < _yybytes_len; ++i)
  1830. buf[i] = yybytes[i];
  1831. buf[_yybytes_len] = buf[_yybytes_len + 1] = YY_END_OF_BUFFER_CHAR;
  1832. b = yy_scan_buffer(buf, n);
  1833. if (!b) {
  1834. yyfree(buf);
  1835. YY_FATAL_ERROR("bad buffer in yy_scan_bytes()");
  1836. }
  1837. /* It's okay to grow etc. this buffer, and we should throw it
  1838. * away when we're done.
  1839. */
  1840. b->yy_is_our_buffer = 1;
  1841. return b;
  1842. }
  1843. /* %endif */
  1844. #ifndef YY_EXIT_FAILURE
  1845. #define YY_EXIT_FAILURE 2
  1846. #endif
  1847. /* %if-c-only */
  1848. static void yynoreturn yy_fatal_error(const char *msg)
  1849. {
  1850. fprintf(stderr, "%s\n", msg);
  1851. exit(YY_EXIT_FAILURE);
  1852. }
  1853. /* %endif */
  1854. /* %if-c++-only */
  1855. /* %endif */
  1856. /* Redefine yyless() so it works in section 3 code. */
  1857. #undef yyless
  1858. #define yyless(n) \
  1859. do \
  1860. { \
  1861. /* Undo effects of setting up yytext. */ \
  1862. int yyless_macro_arg = (n); \
  1863. YY_LESS_LINENO(yyless_macro_arg);\
  1864. yytext[yyleng] = (yy_hold_char); \
  1865. (yy_c_buf_p) = yytext + yyless_macro_arg; \
  1866. (yy_hold_char) = *(yy_c_buf_p); \
  1867. *(yy_c_buf_p) = '\0'; \
  1868. yyleng = yyless_macro_arg; \
  1869. } \
  1870. while ( 0 )
  1871. /* Accessor methods (get/set functions) to struct members. */
  1872. /* %if-c-only */
  1873. /* %if-reentrant */
  1874. /* %endif */
  1875. /** Get the current line number.
  1876. *
  1877. */
  1878. int yyget_lineno(void)
  1879. {
  1880. return yylineno;
  1881. }
  1882. /** Get the input stream.
  1883. *
  1884. */
  1885. FILE *yyget_in(void)
  1886. {
  1887. return yyin;
  1888. }
  1889. /** Get the output stream.
  1890. *
  1891. */
  1892. FILE *yyget_out(void)
  1893. {
  1894. return yyout;
  1895. }
  1896. /** Get the length of the current token.
  1897. *
  1898. */
  1899. int yyget_leng(void)
  1900. {
  1901. return yyleng;
  1902. }
  1903. /** Get the current token.
  1904. *
  1905. */
  1906. char *yyget_text(void)
  1907. {
  1908. return yytext;
  1909. }
  1910. /* %if-reentrant */
  1911. /* %endif */
  1912. /** Set the current line number.
  1913. * @param _line_number line number
  1914. *
  1915. */
  1916. void yyset_lineno(int _line_number)
  1917. {
  1918. yylineno = _line_number;
  1919. }
  1920. /** Set the input stream. This does not discard the current
  1921. * input buffer.
  1922. * @param _in_str A readable stream.
  1923. *
  1924. * @see yy_switch_to_buffer
  1925. */
  1926. void yyset_in(FILE * _in_str)
  1927. {
  1928. yyin = _in_str;
  1929. }
  1930. void yyset_out(FILE * _out_str)
  1931. {
  1932. yyout = _out_str;
  1933. }
  1934. int yyget_debug(void)
  1935. {
  1936. return yy_flex_debug;
  1937. }
  1938. void yyset_debug(int _bdebug)
  1939. {
  1940. yy_flex_debug = _bdebug;
  1941. }
  1942. /* %endif */
  1943. /* %if-reentrant */
  1944. /* %if-bison-bridge */
  1945. /* %endif */
  1946. /* %endif if-c-only */
  1947. /* %if-c-only */
  1948. static int yy_init_globals(void)
  1949. {
  1950. /* Initialization is the same as for the non-reentrant scanner.
  1951. * This function is called from yylex_destroy(), so don't allocate here.
  1952. */
  1953. /* We do not touch yylineno unless the option is enabled. */
  1954. yylineno = 1;
  1955. (yy_buffer_stack) = NULL;
  1956. (yy_buffer_stack_top) = 0;
  1957. (yy_buffer_stack_max) = 0;
  1958. (yy_c_buf_p) = NULL;
  1959. (yy_init) = 0;
  1960. (yy_start) = 0;
  1961. /* Defined in main.c */
  1962. #ifdef YY_STDINIT
  1963. yyin = stdin;
  1964. yyout = stdout;
  1965. #else
  1966. yyin = NULL;
  1967. yyout = NULL;
  1968. #endif
  1969. /* For future reference: Set errno on error, since we are called by
  1970. * yylex_init()
  1971. */
  1972. return 0;
  1973. }
  1974. /* %endif */
  1975. /* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */
  1976. /* yylex_destroy is for both reentrant and non-reentrant scanners. */
  1977. int yylex_destroy(void)
  1978. {
  1979. /* Pop the buffer stack, destroying each element. */
  1980. while (YY_CURRENT_BUFFER) {
  1981. yy_delete_buffer(YY_CURRENT_BUFFER);
  1982. YY_CURRENT_BUFFER_LVALUE = NULL;
  1983. yypop_buffer_state();
  1984. }
  1985. /* Destroy the stack itself. */
  1986. yyfree((yy_buffer_stack));
  1987. (yy_buffer_stack) = NULL;
  1988. /* Reset the globals. This is important in a non-reentrant scanner so the next time
  1989. * yylex() is called, initialization will occur. */
  1990. yy_init_globals();
  1991. /* %if-reentrant */
  1992. /* %endif */
  1993. return 0;
  1994. }
  1995. /* %endif */
  1996. /*
  1997. * Internal utility routines.
  1998. */
  1999. #ifndef yytext_ptr
  2000. static void yy_flex_strncpy(char *s1, const char *s2, int n)
  2001. {
  2002. int i;
  2003. for (i = 0; i < n; ++i)
  2004. s1[i] = s2[i];
  2005. }
  2006. #endif
  2007. #ifdef YY_NEED_STRLEN
  2008. static int yy_flex_strlen(const char *s)
  2009. {
  2010. int n;
  2011. for (n = 0; s[n]; ++n) ;
  2012. return n;
  2013. }
  2014. #endif
  2015. void *yyalloc(yy_size_t size)
  2016. {
  2017. void *ret = NULL;
  2018. ret = calloc(1, size);
  2019. if (ret == NULL) {
  2020. /* option here to do exit (1); */
  2021. }
  2022. return (ret);
  2023. }
  2024. void *yyrealloc(void *ptr, yy_size_t size)
  2025. {
  2026. void *ret = NULL;
  2027. /* The cast to (char *) in the following accommodates both
  2028. * implementations that use char* generic pointers, and those
  2029. * that use void* generic pointers. It works with the latter
  2030. * because both ANSI C and C++ allow castless assignment from
  2031. * any pointer type to void*, and deal with argument conversions
  2032. * as though doing an assignment.
  2033. */
  2034. ret = realloc(ptr, size);
  2035. if (size) {
  2036. if (ret == NULL) {
  2037. /* option here to do exit (1); */
  2038. }
  2039. }
  2040. return (ret);
  2041. }
  2042. void yyfree(void *ptr)
  2043. {
  2044. if (ptr) {
  2045. free((char *)ptr);
  2046. } /* see yyrealloc() for (char *) cast */
  2047. }
  2048. /* %if-tables-serialization definitions */
  2049. /* %define-yytables The name for this specific scanner's tables. */
  2050. #define YYTABLES_NAME "yytables"
  2051. /* %endif */
  2052. /* %ok-for-header */
  2053. #line 276 "dot.l"
  2054. /* */
  2055. void dp_lex_init(gzFile f, int debugflag)
  2056. {
  2057. yylineno = 1;
  2058. gvzin = f;
  2059. yyin = NULL;
  2060. /* activate debug in lexer */
  2061. yy_flex_debug = debugflag;
  2062. /* activate debug in glr parser */
  2063. /* yydebug is now set in main() */
  2064. /* yydebug = debugflag; */
  2065. htmlnest = 0;
  2066. /* yyset_debug (debugflag); */
  2067. return;
  2068. }
  2069. /* */
  2070. static void dp_lex_clear(void)
  2071. {
  2072. if (tmpp) {
  2073. tmpp = (char *)dp_free((void *)tmpp);
  2074. }
  2075. p = NULL;
  2076. q = NULL;
  2077. htmlnest = 0;
  2078. return;
  2079. }
  2080. void dp_lex_deinit(void)
  2081. {
  2082. yy_flex_debug = 0;
  2083. dp_lex_clear();
  2084. yylex_destroy();
  2085. gvzin = (gzFile) 0;
  2086. yyin = NULL;
  2087. return;
  2088. }
  2089. void dp_yydebug(int debugflag)
  2090. {
  2091. /* activate debug in lexer */
  2092. yy_flex_debug = debugflag;
  2093. /* activate debug in glr parser */
  2094. yydebug = debugflag;
  2095. return;
  2096. }
  2097. /* check for comment inside comment */
  2098. static void dp_check_c_comment(char *str)
  2099. {
  2100. char *ptr0 = NULL;
  2101. char *ptr = NULL;
  2102. if (str == NULL) {
  2103. return;
  2104. }
  2105. if (strlen(str) < 1) {
  2106. return;
  2107. }
  2108. ptr = str;
  2109. while (*ptr) {
  2110. ptr0 = strchr(ptr, '/');
  2111. if (ptr0) {
  2112. if ((*(ptr0 + 1)) == '*') {
  2113. printf("%s(): start of c-comment \"/*\" inside c-comment at line %d\n", __func__, yylineno);
  2114. ptr0++;
  2115. } else if ((*(ptr0 + 1)) == '/') {
  2116. printf("%s(): start of c++-comment \"//\" inside c-comment at line %d\n", __func__, yylineno);
  2117. ptr0++;
  2118. } else {
  2119. /* nop */
  2120. }
  2121. ptr = ptr0;
  2122. }
  2123. ptr++;
  2124. }
  2125. return;
  2126. }
  2127. /* end */