lex.hl.c 71 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029
  1. #line 3 "lex.hl.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. #define yy_create_buffer hl_create_buffer
  8. #define yy_delete_buffer hl_delete_buffer
  9. #define yy_scan_buffer hl_scan_buffer
  10. #define yy_scan_string hl_scan_string
  11. #define yy_scan_bytes hl_scan_bytes
  12. #define yy_init_buffer hl_init_buffer
  13. #define yy_flush_buffer hl_flush_buffer
  14. #define yy_load_buffer_state hl_load_buffer_state
  15. #define yy_switch_to_buffer hl_switch_to_buffer
  16. #define yypush_buffer_state hlpush_buffer_state
  17. #define yypop_buffer_state hlpop_buffer_state
  18. #define yyensure_buffer_stack hlensure_buffer_stack
  19. #define yy_flex_debug hl_flex_debug
  20. #define yyin hlin
  21. #define yyleng hlleng
  22. #define yylex hllex
  23. #define yylineno hllineno
  24. #define yyout hlout
  25. #define yyrestart hlrestart
  26. #define yytext hltext
  27. #define yywrap hlwrap
  28. #define yyalloc hlalloc
  29. #define yyrealloc hlrealloc
  30. #define yyfree hlfree
  31. /* %endif */
  32. /* %endif */
  33. /* %ok-for-header */
  34. #define FLEX_SCANNER
  35. #define YY_FLEX_MAJOR_VERSION 2
  36. #define YY_FLEX_MINOR_VERSION 6
  37. #define YY_FLEX_SUBMINOR_VERSION 4
  38. #if YY_FLEX_SUBMINOR_VERSION > 0
  39. #define FLEX_BETA
  40. #endif
  41. /* %if-c++-only */
  42. /* %endif */
  43. /* %if-c-only */
  44. #ifdef yy_create_buffer
  45. #define hl_create_buffer_ALREADY_DEFINED
  46. #else
  47. #define yy_create_buffer hl_create_buffer
  48. #endif
  49. #ifdef yy_delete_buffer
  50. #define hl_delete_buffer_ALREADY_DEFINED
  51. #else
  52. #define yy_delete_buffer hl_delete_buffer
  53. #endif
  54. #ifdef yy_scan_buffer
  55. #define hl_scan_buffer_ALREADY_DEFINED
  56. #else
  57. #define yy_scan_buffer hl_scan_buffer
  58. #endif
  59. #ifdef yy_scan_string
  60. #define hl_scan_string_ALREADY_DEFINED
  61. #else
  62. #define yy_scan_string hl_scan_string
  63. #endif
  64. #ifdef yy_scan_bytes
  65. #define hl_scan_bytes_ALREADY_DEFINED
  66. #else
  67. #define yy_scan_bytes hl_scan_bytes
  68. #endif
  69. #ifdef yy_init_buffer
  70. #define hl_init_buffer_ALREADY_DEFINED
  71. #else
  72. #define yy_init_buffer hl_init_buffer
  73. #endif
  74. #ifdef yy_flush_buffer
  75. #define hl_flush_buffer_ALREADY_DEFINED
  76. #else
  77. #define yy_flush_buffer hl_flush_buffer
  78. #endif
  79. #ifdef yy_load_buffer_state
  80. #define hl_load_buffer_state_ALREADY_DEFINED
  81. #else
  82. #define yy_load_buffer_state hl_load_buffer_state
  83. #endif
  84. #ifdef yy_switch_to_buffer
  85. #define hl_switch_to_buffer_ALREADY_DEFINED
  86. #else
  87. #define yy_switch_to_buffer hl_switch_to_buffer
  88. #endif
  89. #ifdef yypush_buffer_state
  90. #define hlpush_buffer_state_ALREADY_DEFINED
  91. #else
  92. #define yypush_buffer_state hlpush_buffer_state
  93. #endif
  94. #ifdef yypop_buffer_state
  95. #define hlpop_buffer_state_ALREADY_DEFINED
  96. #else
  97. #define yypop_buffer_state hlpop_buffer_state
  98. #endif
  99. #ifdef yyensure_buffer_stack
  100. #define hlensure_buffer_stack_ALREADY_DEFINED
  101. #else
  102. #define yyensure_buffer_stack hlensure_buffer_stack
  103. #endif
  104. #ifdef yylex
  105. #define hllex_ALREADY_DEFINED
  106. #else
  107. #define yylex hllex
  108. #endif
  109. #ifdef yyrestart
  110. #define hlrestart_ALREADY_DEFINED
  111. #else
  112. #define yyrestart hlrestart
  113. #endif
  114. #ifdef yylex_init
  115. #define hllex_init_ALREADY_DEFINED
  116. #else
  117. #define yylex_init hllex_init
  118. #endif
  119. #ifdef yylex_init_extra
  120. #define hllex_init_extra_ALREADY_DEFINED
  121. #else
  122. #define yylex_init_extra hllex_init_extra
  123. #endif
  124. #ifdef yylex_destroy
  125. #define hllex_destroy_ALREADY_DEFINED
  126. #else
  127. #define yylex_destroy hllex_destroy
  128. #endif
  129. #ifdef yyget_debug
  130. #define hlget_debug_ALREADY_DEFINED
  131. #else
  132. #define yyget_debug hlget_debug
  133. #endif
  134. #ifdef yyset_debug
  135. #define hlset_debug_ALREADY_DEFINED
  136. #else
  137. #define yyset_debug hlset_debug
  138. #endif
  139. #ifdef yyget_extra
  140. #define hlget_extra_ALREADY_DEFINED
  141. #else
  142. #define yyget_extra hlget_extra
  143. #endif
  144. #ifdef yyset_extra
  145. #define hlset_extra_ALREADY_DEFINED
  146. #else
  147. #define yyset_extra hlset_extra
  148. #endif
  149. #ifdef yyget_in
  150. #define hlget_in_ALREADY_DEFINED
  151. #else
  152. #define yyget_in hlget_in
  153. #endif
  154. #ifdef yyset_in
  155. #define hlset_in_ALREADY_DEFINED
  156. #else
  157. #define yyset_in hlset_in
  158. #endif
  159. #ifdef yyget_out
  160. #define hlget_out_ALREADY_DEFINED
  161. #else
  162. #define yyget_out hlget_out
  163. #endif
  164. #ifdef yyset_out
  165. #define hlset_out_ALREADY_DEFINED
  166. #else
  167. #define yyset_out hlset_out
  168. #endif
  169. #ifdef yyget_leng
  170. #define hlget_leng_ALREADY_DEFINED
  171. #else
  172. #define yyget_leng hlget_leng
  173. #endif
  174. #ifdef yyget_text
  175. #define hlget_text_ALREADY_DEFINED
  176. #else
  177. #define yyget_text hlget_text
  178. #endif
  179. #ifdef yyget_lineno
  180. #define hlget_lineno_ALREADY_DEFINED
  181. #else
  182. #define yyget_lineno hlget_lineno
  183. #endif
  184. #ifdef yyset_lineno
  185. #define hlset_lineno_ALREADY_DEFINED
  186. #else
  187. #define yyset_lineno hlset_lineno
  188. #endif
  189. #ifdef yywrap
  190. #define hlwrap_ALREADY_DEFINED
  191. #else
  192. #define yywrap hlwrap
  193. #endif
  194. /* %endif */
  195. #ifdef yyalloc
  196. #define hlalloc_ALREADY_DEFINED
  197. #else
  198. #define yyalloc hlalloc
  199. #endif
  200. #ifdef yyrealloc
  201. #define hlrealloc_ALREADY_DEFINED
  202. #else
  203. #define yyrealloc hlrealloc
  204. #endif
  205. #ifdef yyfree
  206. #define hlfree_ALREADY_DEFINED
  207. #else
  208. #define yyfree hlfree
  209. #endif
  210. /* %if-c-only */
  211. #ifdef yytext
  212. #define hltext_ALREADY_DEFINED
  213. #else
  214. #define yytext hltext
  215. #endif
  216. #ifdef yyleng
  217. #define hlleng_ALREADY_DEFINED
  218. #else
  219. #define yyleng hlleng
  220. #endif
  221. #ifdef yyin
  222. #define hlin_ALREADY_DEFINED
  223. #else
  224. #define yyin hlin
  225. #endif
  226. #ifdef yyout
  227. #define hlout_ALREADY_DEFINED
  228. #else
  229. #define yyout hlout
  230. #endif
  231. #ifdef yy_flex_debug
  232. #define hl_flex_debug_ALREADY_DEFINED
  233. #else
  234. #define yy_flex_debug hl_flex_debug
  235. #endif
  236. #ifdef yylineno
  237. #define hllineno_ALREADY_DEFINED
  238. #else
  239. #define yylineno hllineno
  240. #endif
  241. /* %endif */
  242. /* First, we deal with platform-specific or compiler-specific issues. */
  243. /* begin standard C headers. */
  244. /* %if-c-only */
  245. #include <stdio.h>
  246. #include <string.h>
  247. #include <errno.h>
  248. #include <stdlib.h>
  249. /* %endif */
  250. /* %if-tables-serialization */
  251. /* %endif */
  252. /* end standard C headers. */
  253. /* begin standard C++ headers. */
  254. /* %if-c++-only */
  255. /* %endif */
  256. /* %if-c-or-c++ */
  257. /* flex integer type definitions */
  258. #ifndef YYFLEX_INTTYPES_DEFINED
  259. #define YYFLEX_INTTYPES_DEFINED
  260. /* Prefer C99 integer types if available. */
  261. #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  262. /* Include <inttypes.h> and not <stdint.h> because Solaris 2.6 has the former
  263. * and not the latter.
  264. */
  265. #include <inttypes.h>
  266. #define YYFLEX_USE_STDINT
  267. #else
  268. #if defined(_MSC_VER) && _MSC_VER >= 1600
  269. /* Visual C++ 2010 does not define __STDC_VERSION__ and has <stdint.h> but not
  270. * <inttypes.h>.
  271. */
  272. #include <stdint.h>
  273. #define YYFLEX_USE_STDINT
  274. #endif
  275. #endif
  276. #ifdef YYFLEX_USE_STDINT
  277. typedef int8_t flex_int8_t;
  278. typedef uint8_t flex_uint8_t;
  279. typedef int16_t flex_int16_t;
  280. typedef uint16_t flex_uint16_t;
  281. typedef int32_t flex_int32_t;
  282. typedef uint32_t flex_uint32_t;
  283. #else
  284. typedef unsigned char flex_uint8_t;
  285. typedef short int flex_int16_t;
  286. typedef unsigned short int flex_uint16_t;
  287. #ifdef __STDC__
  288. typedef signed char flex_int8_t;
  289. /* ISO C only requires at least 16 bits for int. */
  290. #include <limits.h>
  291. #if UINT_MAX >= 4294967295
  292. #define YYFLEX_INT32_DEFINED
  293. typedef int flex_int32_t;
  294. typedef unsigned int flex_uint32_t;
  295. #endif
  296. #else
  297. typedef char flex_int8_t;
  298. #endif
  299. #ifndef YYFLEX_INT32_DEFINED
  300. typedef long int flex_int32_t;
  301. typedef unsigned long int flex_uint32_t;
  302. #endif
  303. #endif
  304. #endif /* YYFLEX_INTTYPES_DEFINED */
  305. /* %endif */
  306. /* TODO: this is always defined, so inline it */
  307. #define yyconst const
  308. #if defined(__GNUC__) && __GNUC__ >= 3
  309. #define yynoreturn __attribute__((__noreturn__))
  310. #else
  311. #define yynoreturn
  312. #endif
  313. /* %not-for-header */
  314. /* Returned upon end-of-file. */
  315. #define YY_NULL 0
  316. /* %ok-for-header */
  317. /* %not-for-header */
  318. /* Promotes a possibly negative, possibly signed char to an
  319. * integer in range [0..255] for use as an array index.
  320. */
  321. #define YY_SC_TO_UI(c) ((YY_CHAR) (c))
  322. /* %ok-for-header */
  323. /* %if-reentrant */
  324. /* %endif */
  325. /* %if-not-reentrant */
  326. /* %endif */
  327. /* Enter a start condition. This macro really ought to take a parameter,
  328. * but we do it the disgusting crufty way forced on us by the ()-less
  329. * definition of BEGIN.
  330. */
  331. #define BEGIN (yy_start) = 1 + 2 *
  332. /* Translate the current start state into a value that can be later handed
  333. * to BEGIN to return to the state. The YYSTATE alias is for lex
  334. * compatibility.
  335. */
  336. #define YY_START (((yy_start) - 1) / 2)
  337. #define YYSTATE YY_START
  338. /* Action number for EOF rule of a given start state. */
  339. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  340. /* Special action meaning "start processing a new file". */
  341. #define YY_NEW_FILE yyrestart( yyin )
  342. #define YY_END_OF_BUFFER_CHAR 0
  343. /* Size of default input buffer. */
  344. #ifndef YY_BUF_SIZE
  345. #ifdef __ia64__
  346. /* On IA-64, the buffer size is 16k, not 8k.
  347. * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
  348. * Ditto for the __ia64__ case accordingly.
  349. */
  350. #define YY_BUF_SIZE 32768
  351. #else
  352. #define YY_BUF_SIZE 16384
  353. #endif /* __ia64__ */
  354. #endif
  355. /* The state buf must be large enough to hold one state per character in the main buffer.
  356. */
  357. #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
  358. #ifndef YY_TYPEDEF_YY_BUFFER_STATE
  359. #define YY_TYPEDEF_YY_BUFFER_STATE
  360. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  361. #endif
  362. #ifndef YY_TYPEDEF_YY_SIZE_T
  363. #define YY_TYPEDEF_YY_SIZE_T
  364. typedef size_t yy_size_t;
  365. #endif
  366. /* %if-not-reentrant */
  367. extern int yyleng;
  368. /* %endif */
  369. /* %if-c-only */
  370. /* %if-not-reentrant */
  371. extern FILE *yyin, *yyout;
  372. /* %endif */
  373. /* %endif */
  374. #define EOB_ACT_CONTINUE_SCAN 0
  375. #define EOB_ACT_END_OF_FILE 1
  376. #define EOB_ACT_LAST_MATCH 2
  377. /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
  378. * access to the local variable yy_act. Since yyless() is a macro, it would break
  379. * existing scanners that call yyless() from OUTSIDE yylex.
  380. * One obvious solution it to make yy_act a global. I tried that, and saw
  381. * a 5% performance hit in a non-yylineno scanner, because yy_act is
  382. * normally declared as a register variable-- so it is not worth it.
  383. */
  384. #define YY_LESS_LINENO(n) \
  385. do { \
  386. int yyl;\
  387. for ( yyl = n; yyl < yyleng; ++yyl )\
  388. if ( yytext[yyl] == '\n' )\
  389. --yylineno;\
  390. }while(0)
  391. #define YY_LINENO_REWIND_TO(dst) \
  392. do {\
  393. const char *p;\
  394. for ( p = yy_cp-1; p >= (dst); --p)\
  395. if ( *p == '\n' )\
  396. --yylineno;\
  397. }while(0)
  398. /* Return all but the first "n" matched characters back to the input stream. */
  399. #define yyless(n) \
  400. do \
  401. { \
  402. /* Undo effects of setting up yytext. */ \
  403. int yyless_macro_arg = (n); \
  404. YY_LESS_LINENO(yyless_macro_arg);\
  405. *yy_cp = (yy_hold_char); \
  406. YY_RESTORE_YY_MORE_OFFSET \
  407. (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
  408. YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  409. } \
  410. while ( 0 )
  411. #define unput(c) yyunput( c, (yytext_ptr) )
  412. #ifndef YY_STRUCT_YY_BUFFER_STATE
  413. #define YY_STRUCT_YY_BUFFER_STATE
  414. struct yy_buffer_state {
  415. /* %if-c-only */
  416. FILE *yy_input_file;
  417. /* %endif */
  418. /* %if-c++-only */
  419. /* %endif */
  420. char *yy_ch_buf; /* input buffer */
  421. char *yy_buf_pos; /* current position in input buffer */
  422. /* Size of input buffer in bytes, not including room for EOB
  423. * characters.
  424. */
  425. int yy_buf_size;
  426. /* Number of characters read into yy_ch_buf, not including EOB
  427. * characters.
  428. */
  429. int yy_n_chars;
  430. /* Whether we "own" the buffer - i.e., we know we created it,
  431. * and can realloc() it to grow it, and should free() it to
  432. * delete it.
  433. */
  434. int yy_is_our_buffer;
  435. /* Whether this is an "interactive" input source; if so, and
  436. * if we're using stdio for input, then we want to use getc()
  437. * instead of fread(), to make sure we stop fetching input after
  438. * each newline.
  439. */
  440. int yy_is_interactive;
  441. /* Whether we're considered to be at the beginning of a line.
  442. * If so, '^' rules will be active on the next match, otherwise
  443. * not.
  444. */
  445. int yy_at_bol;
  446. int yy_bs_lineno;
  447. /**< The line count. */
  448. int yy_bs_column;
  449. /**< The column count. */
  450. /* Whether to try to fill the input buffer when we reach the
  451. * end of it.
  452. */
  453. int yy_fill_buffer;
  454. int yy_buffer_status;
  455. #define YY_BUFFER_NEW 0
  456. #define YY_BUFFER_NORMAL 1
  457. /* When an EOF's been seen but there's still some text to process
  458. * then we mark the buffer as YY_EOF_PENDING, to indicate that we
  459. * shouldn't try reading from the input source any more. We might
  460. * still have a bunch of tokens to match, though, because of
  461. * possible backing-up.
  462. *
  463. * When we actually see the EOF, we change the status to "new"
  464. * (via yyrestart()), so that the user can continue scanning by
  465. * just pointing yyin at a new input file.
  466. */
  467. #define YY_BUFFER_EOF_PENDING 2
  468. };
  469. #endif /* !YY_STRUCT_YY_BUFFER_STATE */
  470. /* %if-c-only Standard (non-C++) definition */
  471. /* %not-for-header */
  472. /* %if-not-reentrant */
  473. /* Stack of input buffers. */
  474. static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
  475. static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
  476. static YY_BUFFER_STATE *yy_buffer_stack = NULL; /**< Stack as an array. */
  477. /* %endif */
  478. /* %ok-for-header */
  479. /* %endif */
  480. /* We provide macros for accessing buffer states in case in the
  481. * future we want to put the buffer states in a more general
  482. * "scanner state".
  483. *
  484. * Returns the top of the stack, or NULL.
  485. */
  486. #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
  487. ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
  488. : NULL)
  489. /* Same as previous macro, but useful when we know that the buffer stack is not
  490. * NULL or when we need an lvalue. For internal use only.
  491. */
  492. #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
  493. /* %if-c-only Standard (non-C++) definition */
  494. /* %if-not-reentrant */
  495. /* %not-for-header */
  496. /* yy_hold_char holds the character lost when yytext is formed. */
  497. static char yy_hold_char;
  498. static int yy_n_chars; /* number of characters read into yy_ch_buf */
  499. int yyleng;
  500. /* Points to current character in buffer. */
  501. static char *yy_c_buf_p = NULL;
  502. static int yy_init = 0; /* whether we need to initialize */
  503. static int yy_start = 0; /* start state number */
  504. /* Flag which is used to allow yywrap()'s to do buffer switches
  505. * instead of setting up a fresh yyin. A bit of a hack ...
  506. */
  507. static int yy_did_buffer_switch_on_eof;
  508. /* %ok-for-header */
  509. /* %endif */
  510. void yyrestart(FILE * input_file);
  511. void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer);
  512. YY_BUFFER_STATE yy_create_buffer(FILE * file, int size);
  513. void yy_delete_buffer(YY_BUFFER_STATE b);
  514. void yy_flush_buffer(YY_BUFFER_STATE b);
  515. void yypush_buffer_state(YY_BUFFER_STATE new_buffer);
  516. void yypop_buffer_state(void);
  517. static void yyensure_buffer_stack(void);
  518. static void yy_load_buffer_state(void);
  519. static void yy_init_buffer(YY_BUFFER_STATE b, FILE * file);
  520. #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER )
  521. YY_BUFFER_STATE yy_scan_buffer(char *base, yy_size_t size);
  522. YY_BUFFER_STATE yy_scan_string(const char *yy_str);
  523. YY_BUFFER_STATE yy_scan_bytes(const char *bytes, int len);
  524. /* %endif */
  525. void *yyalloc(yy_size_t);
  526. void *yyrealloc(void *, yy_size_t);
  527. void yyfree(void *);
  528. #define yy_new_buffer yy_create_buffer
  529. #define yy_set_interactive(is_interactive) \
  530. { \
  531. if ( ! YY_CURRENT_BUFFER ){ \
  532. yyensure_buffer_stack (); \
  533. YY_CURRENT_BUFFER_LVALUE = \
  534. yy_create_buffer( yyin, YY_BUF_SIZE ); \
  535. } \
  536. YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
  537. }
  538. #define yy_set_bol(at_bol) \
  539. { \
  540. if ( ! YY_CURRENT_BUFFER ){\
  541. yyensure_buffer_stack (); \
  542. YY_CURRENT_BUFFER_LVALUE = \
  543. yy_create_buffer( yyin, YY_BUF_SIZE ); \
  544. } \
  545. YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
  546. }
  547. #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
  548. /* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */
  549. /* Begin user sect3 */
  550. #define hlwrap() (/*CONSTCOND*/1)
  551. #define YY_SKIP_YYWRAP
  552. #define FLEX_DEBUG
  553. typedef flex_uint8_t YY_CHAR;
  554. FILE *yyin = NULL, *yyout = NULL;
  555. typedef int yy_state_type;
  556. extern int yylineno;
  557. int yylineno = 1;
  558. extern char *yytext;
  559. #ifdef yytext_ptr
  560. #undef yytext_ptr
  561. #endif
  562. #define yytext_ptr yytext
  563. /* %% [1.5] DFA */
  564. /* %if-c-only Standard (non-C++) definition */
  565. static yy_state_type yy_get_previous_state(void);
  566. static yy_state_type yy_try_NUL_trans(yy_state_type current_state);
  567. static int yy_get_next_buffer(void);
  568. static void yynoreturn yy_fatal_error(const char *msg);
  569. /* %endif */
  570. /* Done after the current pattern has been matched and before the
  571. * corresponding action - sets up yytext.
  572. */
  573. #define YY_DO_BEFORE_ACTION \
  574. (yytext_ptr) = yy_bp; \
  575. /* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\
  576. yyleng = (int) (yy_cp - yy_bp); \
  577. (yy_hold_char) = *yy_cp; \
  578. *yy_cp = '\0'; \
  579. /* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\
  580. (yy_c_buf_p) = yy_cp;
  581. /* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */
  582. #define YY_NUM_RULES 15
  583. #define YY_END_OF_BUFFER 16
  584. /* This struct is not used in this scanner,
  585. but its presence is necessary. */
  586. struct yy_trans_info {
  587. flex_int32_t yy_verify;
  588. flex_int32_t yy_nxt;
  589. };
  590. static const flex_int16_t yy_accept[40] = { 0,
  591. 13, 13, 16, 14, 3, 4, 2, 5, 14, 14,
  592. 13, 14, 6, 10, 9, 0, 2, 0, 0, 11,
  593. 0, 0, 12, 0, 13, 8, 0, 7, 6, 0,
  594. 7, 0, 0, 0, 0, 1, 1, 1, 0
  595. };
  596. static const YY_CHAR yy_ec[256] = { 0,
  597. 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
  598. 1, 4, 5, 1, 1, 1, 1, 1, 1, 1,
  599. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  600. 1, 4, 6, 7, 1, 1, 1, 1, 8, 1,
  601. 1, 1, 1, 1, 9, 1, 10, 1, 1, 1,
  602. 1, 1, 1, 1, 1, 1, 1, 1, 1, 11,
  603. 12, 13, 1, 1, 14, 14, 14, 14, 14, 14,
  604. 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
  605. 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
  606. 1, 15, 1, 1, 1, 1, 14, 14, 14, 14,
  607. 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
  608. 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
  609. 14, 14, 1, 1, 1, 1, 1, 1, 1, 1,
  610. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  611. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  612. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  613. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  614. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  615. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  616. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  617. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  618. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  619. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  620. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  621. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  622. 1, 1, 1, 1, 1
  623. };
  624. static const YY_CHAR yy_meta[16] = { 0,
  625. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  626. 1, 1, 1, 1, 1
  627. };
  628. static const flex_int16_t yy_base[43] = { 0,
  629. 0, 0, 54, 55, 55, 42, 48, 13, 10, 11,
  630. 9, 38, 21, 55, 55, 44, 45, 37, 13, 55,
  631. 0, 14, 55, 0, 23, 55, 38, 32, 31, 35,
  632. 29, 33, 32, 31, 26, 31, 55, 35, 55, 32,
  633. 29, 20
  634. };
  635. static const flex_int16_t yy_def[43] = { 0,
  636. 39, 1, 39, 39, 39, 39, 39, 39, 40, 41,
  637. 39, 39, 39, 39, 39, 39, 39, 39, 40, 39,
  638. 40, 41, 39, 41, 39, 39, 39, 39, 39, 39,
  639. 39, 42, 42, 42, 39, 39, 39, 39, 0, 39,
  640. 39, 39
  641. };
  642. static const flex_int16_t yy_nxt[71] = { 0,
  643. 4, 5, 6, 7, 8, 4, 9, 10, 11, 12,
  644. 13, 14, 15, 11, 4, 18, 20, 25, 23, 20,
  645. 33, 23, 25, 16, 21, 24, 27, 21, 24, 22,
  646. 28, 25, 19, 37, 29, 38, 25, 37, 36, 35,
  647. 34, 34, 31, 32, 29, 31, 30, 16, 17, 27,
  648. 26, 17, 16, 39, 3, 39, 39, 39, 39, 39,
  649. 39, 39, 39, 39, 39, 39, 39, 39, 39, 39
  650. };
  651. static const flex_int16_t yy_chk[71] = { 0,
  652. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  653. 1, 1, 1, 1, 1, 8, 9, 11, 10, 19,
  654. 42, 22, 11, 8, 9, 10, 13, 19, 22, 41,
  655. 13, 25, 40, 36, 13, 36, 25, 38, 35, 34,
  656. 33, 32, 31, 30, 29, 28, 27, 18, 17, 16,
  657. 12, 7, 6, 3, 39, 39, 39, 39, 39, 39,
  658. 39, 39, 39, 39, 39, 39, 39, 39, 39, 39
  659. };
  660. /* Table of booleans, true if rule could match eol. */
  661. static const flex_int32_t yy_rule_can_match_eol[16] = { 0,
  662. 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0,
  663. };
  664. static yy_state_type yy_last_accepting_state;
  665. static char *yy_last_accepting_cpos;
  666. extern int yy_flex_debug;
  667. int yy_flex_debug = 1;
  668. static const flex_int16_t yy_rule_linenum[15] = { 0,
  669. 129, 131, 132, 133, 134, 136, 194, 244, 250, 256,
  670. 262, 317, 372, 518
  671. };
  672. /* The intent behind this definition is that it'll catch
  673. * any uses of REJECT which flex missed.
  674. */
  675. #define REJECT reject_used_but_not_detected
  676. #define yymore() yymore_used_but_not_detected
  677. #define YY_MORE_ADJ 0
  678. #define YY_RESTORE_YY_MORE_OFFSET
  679. char *yytext;
  680. #line 1 "dphl.l"
  681. /*
  682. * Copyright 2021
  683. *
  684. * This program is free software: you can redistribute it and/or modify
  685. * it under the terms of the GNU General Public License as published by
  686. * the Free Software Foundation, either version 3 of the License, or
  687. * (at your option) any later version.
  688. *
  689. * This program is distributed in the hope that it will be useful,
  690. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  691. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  692. * GNU General Public License for more details.
  693. *
  694. * You should have received a copy of the GNU General Public License
  695. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  696. *
  697. * SPDX-License-Identifier: GPL-3.0+
  698. * License-Filename: LICENSE
  699. */
  700. /* dphl.* is about Dot Parsing Html Labels */
  701. /*
  702. * <br /> is oke but < br/> not or <br/ > is not oke
  703. * <br/> is lexed as token "<br" and token "/>"
  704. */
  705. /* gcc-11 analyzer has several problems with the flex-2.4.6 generated lexers, even with own customized skeleton */
  706. /* at malloc error lexer will leak memory and do exit() */
  707. #line 33 "dphl.l"
  708. #include "config.h"
  709. #include <stdio.h>
  710. #include <stdlib.h>
  711. #include <strings.h>
  712. #include <zlib.h>
  713. #include "splay-tree.h"
  714. #include "lex.yy.h"
  715. #include "dot.tab.h"
  716. #include "dp.h"
  717. #include "dpus.h"
  718. #include "dphlparser.h"
  719. #include "dphl.h"
  720. #include "dpmem.h"
  721. /* use GNU GCC compiler builtin strlen */
  722. #undef YY_NEED_STRLEN
  723. /* temp buffer */
  724. static char *tmp = NULL;
  725. static char *pt = NULL;
  726. static char *q = NULL;
  727. /* ws */
  728. static int skipws = 1;
  729. /* own yyalloc
  730. * void *yyalloc (size_t n) { return(calloc(1,n)); }
  731. * void yyfree (void *ptr) { if(ptr) { free (ptr); } return; }
  732. * void *yyrealloc (void *ptr, size_t n) { return (realloc (ptr,n)); }
  733. */
  734. #line 879 "lex.hl.c"
  735. #line 70 "dphl.l"
  736. /* use own yyalloc
  737. * %option noyyalloc
  738. * %option noyyfree
  739. * %option noyyrealloc
  740. */
  741. /* no yywrap() at end-of-file */
  742. /* do not push back chars in stream function() */
  743. /* no input() function */
  744. #define YY_NO_INPUT 1
  745. /* input does not come from a tty. */
  746. /* no yywrap() at end of file */
  747. /* 8-bits scanner */
  748. /* use nameprefix for routines */
  749. /* add debug output */
  750. /* use clib to read data */
  751. /* line no */
  752. /* "string" as in var="value" */
  753. /* 'string' as in var='value' */
  754. /* chars in a <var> */
  755. /* chars in a tag with a '-' for point-size */
  756. #line 901 "lex.hl.c"
  757. #define INITIAL 0
  758. #ifndef YY_NO_UNISTD_H
  759. /* Special case for "unistd.h", since it is non-ANSI. We include it way
  760. * down here because we want the user's section 1 to have been scanned first.
  761. * The user has a chance to override it with an option.
  762. */
  763. /* %if-c-only */
  764. #include <unistd.h>
  765. /* %endif */
  766. /* %if-c++-only */
  767. /* %endif */
  768. #endif
  769. #ifndef YY_EXTRA_TYPE
  770. #define YY_EXTRA_TYPE void *
  771. #endif
  772. /* %if-c-only Reentrant structure and macros (non-C++). */
  773. /* %if-reentrant */
  774. /* %if-c-only */
  775. static int yy_init_globals(void);
  776. /* %endif */
  777. /* %if-reentrant */
  778. /* %endif */
  779. /* %endif End reentrant structures and macros. */
  780. /* Accessor methods to globals.
  781. These are made visible to non-reentrant scanners for convenience. */
  782. int yylex_destroy(void);
  783. int yyget_debug(void);
  784. void yyset_debug(int debug_flag);
  785. YY_EXTRA_TYPE yyget_extra(void);
  786. void yyset_extra(YY_EXTRA_TYPE user_defined);
  787. FILE *yyget_in(void);
  788. void yyset_in(FILE * _in_str);
  789. FILE *yyget_out(void);
  790. void yyset_out(FILE * _out_str);
  791. int yyget_leng(void);
  792. char *yyget_text(void);
  793. int yyget_lineno(void);
  794. void yyset_lineno(int _line_number);
  795. /* %if-bison-bridge */
  796. /* %endif */
  797. /* Macros after this point can all be overridden by user definitions in
  798. * section 1.
  799. */
  800. #ifndef YY_SKIP_YYWRAP
  801. #ifdef __cplusplus
  802. extern "C" int yywrap(void);
  803. #else
  804. extern int yywrap(void);
  805. #endif
  806. #endif
  807. /* %not-for-header */
  808. #ifndef YY_NO_UNPUT
  809. #endif
  810. /* %ok-for-header */
  811. /* %endif */
  812. #ifndef yytext_ptr
  813. static void yy_flex_strncpy(char *, const char *, int);
  814. #endif
  815. #ifdef YY_NEED_STRLEN
  816. static int yy_flex_strlen(const char *);
  817. #endif
  818. #ifndef YY_NO_INPUT
  819. /* %if-c-only Standard (non-C++) definition */
  820. /* %not-for-header */
  821. #ifdef __cplusplus
  822. static int yyinput(void);
  823. #else
  824. static int input(void);
  825. #endif
  826. /* %ok-for-header */
  827. /* %endif */
  828. #endif
  829. /* %if-c-only */
  830. /* %endif */
  831. /* Amount of stuff to slurp up with each read. */
  832. #ifndef YY_READ_BUF_SIZE
  833. #ifdef __ia64__
  834. /* On IA-64, the buffer size is 16k, not 8k */
  835. #define YY_READ_BUF_SIZE 16384
  836. #else
  837. #define YY_READ_BUF_SIZE 8192
  838. #endif /* __ia64__ */
  839. #endif
  840. /* Copy whatever the last rule matched to the standard output. */
  841. #ifndef ECHO
  842. /* %if-c-only Standard (non-C++) definition */
  843. /* This used to be an fputs(), but since the string might contain NUL's,
  844. * we now use fwrite().
  845. */
  846. #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
  847. /* %endif */
  848. /* %if-c++-only C++ definition */
  849. /* %endif */
  850. #endif
  851. /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
  852. * is returned in "result".
  853. */
  854. #ifndef YY_INPUT
  855. #define YY_INPUT(buf,result,max_size) \
  856. /* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\
  857. if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
  858. { \
  859. int c = '*'; \
  860. int n; \
  861. for ( n = 0; n < max_size && \
  862. (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
  863. buf[n] = (char) c; \
  864. if ( c == '\n' ) \
  865. buf[n++] = (char) c; \
  866. if ( c == EOF && ferror( yyin ) ) \
  867. YY_FATAL_ERROR( "input in flex scanner failed" ); \
  868. result = n; \
  869. } \
  870. else \
  871. { \
  872. errno=0; \
  873. while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
  874. { \
  875. if( errno != EINTR) \
  876. { \
  877. YY_FATAL_ERROR( "input in flex scanner failed" ); \
  878. break; \
  879. } \
  880. errno=0; \
  881. clearerr(yyin); \
  882. } \
  883. }\
  884. \
  885. /* %if-c++-only C++ definition \ */\
  886. /* %endif */
  887. #endif
  888. /* No semi-colon after return; correct usage is to write "yyterminate();" -
  889. * we don't want an extra ';' after the "return" because that will cause
  890. * some compilers to complain about unreachable statements.
  891. */
  892. #ifndef yyterminate
  893. #define yyterminate() return YY_NULL
  894. #endif
  895. /* Number of entries by which start-condition stack grows. */
  896. #ifndef YY_START_STACK_INCR
  897. #define YY_START_STACK_INCR 25
  898. #endif
  899. /* Report a fatal error. */
  900. #ifndef YY_FATAL_ERROR
  901. /* %if-c-only */
  902. #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
  903. /* %endif */
  904. /* %if-c++-only */
  905. /* %endif */
  906. #endif
  907. /* %if-tables-serialization structures and prototypes */
  908. /* %not-for-header */
  909. /* %ok-for-header */
  910. /* %not-for-header */
  911. /* %tables-yydmap generated elements */
  912. /* %endif */
  913. /* end tables serialization structures and prototypes */
  914. /* %ok-for-header */
  915. /* Default declaration of generated scanner - a define so the user can
  916. * easily add parameters.
  917. */
  918. #ifndef YY_DECL
  919. #define YY_DECL_IS_OURS 1
  920. /* %if-c-only Standard (non-C++) definition */
  921. extern int yylex(void);
  922. #define YY_DECL int yylex (void)
  923. /* %endif */
  924. /* %if-c++-only C++ definition */
  925. /* %endif */
  926. #endif /* !YY_DECL */
  927. /* Code executed at the beginning of each rule, after yytext and yyleng
  928. * have been set up.
  929. */
  930. #ifndef YY_USER_ACTION
  931. #define YY_USER_ACTION
  932. #endif
  933. /* Code executed at the end of each rule. */
  934. #ifndef YY_BREAK
  935. #define YY_BREAK /*LINTED*/break;
  936. #endif
  937. /* %% [6.0] YY_RULE_SETUP definition goes here */
  938. #define YY_RULE_SETUP \
  939. YY_USER_ACTION
  940. /* %not-for-header */
  941. /** The main scanner function which does all the work.
  942. */
  943. YY_DECL {
  944. yy_state_type yy_current_state;
  945. char *yy_cp, *yy_bp;
  946. int yy_act;
  947. if (!(yy_init)) {
  948. (yy_init) = 1;
  949. #ifdef YY_USER_INIT
  950. YY_USER_INIT;
  951. #endif
  952. if (!(yy_start))
  953. (yy_start) = 1; /* first start state */
  954. if (!yyin)
  955. /* %if-c-only */
  956. yyin = stdin;
  957. /* %endif */
  958. /* %if-c++-only */
  959. /* %endif */
  960. if (!yyout)
  961. /* %if-c-only */
  962. yyout = stdout;
  963. /* %endif */
  964. /* %if-c++-only */
  965. /* %endif */
  966. if (!YY_CURRENT_BUFFER) {
  967. yyensure_buffer_stack();
  968. YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE);
  969. }
  970. yy_load_buffer_state();
  971. }
  972. {
  973. /* %% [7.0] user's declarations go here */
  974. #line 127 "dphl.l"
  975. #line 1182 "lex.hl.c"
  976. while ( /*CONSTCOND*/ 1) { /* loops until end-of-file is reached */
  977. /* %% [8.0] yymore()-related code goes here */
  978. yy_cp = (yy_c_buf_p);
  979. /* Support of yytext. */
  980. *yy_cp = (yy_hold_char);
  981. /* yy_bp points to the position in yy_ch_buf of the start of
  982. * the current run.
  983. */
  984. yy_bp = yy_cp;
  985. /* %% [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) ]) */
  986. yy_current_state = (yy_start);
  987. yy_match:
  988. do {
  989. YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
  990. if (yy_accept[yy_current_state]) {
  991. (yy_last_accepting_state) = yy_current_state;
  992. (yy_last_accepting_cpos) = yy_cp;
  993. }
  994. while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
  995. yy_current_state = (int)yy_def[yy_current_state];
  996. if (yy_current_state >= 40)
  997. yy_c = yy_meta[yy_c];
  998. }
  999. yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  1000. ++yy_cp;
  1001. }
  1002. while (yy_current_state != 39);
  1003. yy_cp = (yy_last_accepting_cpos);
  1004. yy_current_state = (yy_last_accepting_state);
  1005. yy_find_action:
  1006. /* %% [10.0] code to find the action number goes here */
  1007. yy_act = yy_accept[yy_current_state];
  1008. YY_DO_BEFORE_ACTION;
  1009. /* %% [11.0] code for yylineno update goes here */
  1010. if (yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act]) {
  1011. int yyl;
  1012. for (yyl = 0; yyl < yyleng; ++yyl)
  1013. if (yytext[yyl] == '\n')
  1014. yylineno++;
  1015. ;
  1016. }
  1017. do_action: /* This label is used only to access EOF actions. */
  1018. /* %% [12.0] debug code goes here */
  1019. if (yy_flex_debug) {
  1020. if (yy_act == 0)
  1021. fprintf(stderr, "--scanner backing up\n");
  1022. else if (yy_act < 15)
  1023. fprintf(stderr, "--accepting rule at line %ld (\"%s\")\n", (long)yy_rule_linenum[yy_act], yytext);
  1024. else if (yy_act == 15)
  1025. fprintf(stderr, "--accepting default rule (\"%s\")\n", yytext);
  1026. else if (yy_act == 16)
  1027. fprintf(stderr, "--(end of buffer or a NUL)\n");
  1028. else
  1029. fprintf(stderr, "--EOF (start condition %d)\n", YY_START);
  1030. }
  1031. switch (yy_act) { /* beginning of action switch */
  1032. /* %% [13.0] actions go here */
  1033. case 0: /* must back up */
  1034. /* undo the effects of YY_DO_BEFORE_ACTION */
  1035. *yy_cp = (yy_hold_char);
  1036. yy_cp = (yy_last_accepting_cpos);
  1037. yy_current_state = (yy_last_accepting_state);
  1038. goto yy_find_action;
  1039. case 1:
  1040. /* rule 1 can match eol */
  1041. YY_RULE_SETUP
  1042. #line 129 "dphl.l"
  1043. { /* skip comment and it does not allow <> chars in it or nested comments */
  1044. }
  1045. YY_BREAK case 2:YY_RULE_SETUP
  1046. #line 131 "dphl.l"
  1047. { /* skip form feed chars and spaces */
  1048. }
  1049. YY_BREAK case 3:YY_RULE_SETUP
  1050. #line 132 "dphl.l"
  1051. { /* skip tabs */
  1052. }
  1053. YY_BREAK case 4:
  1054. /* rule 4 can match eol */
  1055. YY_RULE_SETUP
  1056. #line 133 "dphl.l"
  1057. { /* skip new line *//* lexer does update yylineno */
  1058. }
  1059. YY_BREAK case 5:YY_RULE_SETUP
  1060. #line 134 "dphl.l"
  1061. { /* skip carriage return */
  1062. }
  1063. YY_BREAK case 6:YY_RULE_SETUP
  1064. #line 136 "dphl.l"
  1065. {
  1066. hlylval.string = dp_uniqstr(yytext);
  1067. /* start of tag */
  1068. if (strcasecmp(yytext, "<b") == 0) {
  1069. skipws = 0;
  1070. return (HL_B);
  1071. } else if (strcasecmp(yytext, "<br") == 0) {
  1072. skipws = 0;
  1073. dphl_rbr();
  1074. return (HL_BR);
  1075. } else if (strcasecmp(yytext, "<font") == 0) {
  1076. skipws = 0;
  1077. return (HL_FONT);
  1078. } else if (strcasecmp(yytext, "<hr") == 0) {
  1079. dphl_rhr();
  1080. return (HL_HR);
  1081. } else if (strcasecmp(yytext, "<html") == 0) {
  1082. return (HL_HTML);
  1083. } else if (strcasecmp(yytext, "<i") == 0) {
  1084. skipws = 0;
  1085. return (HL_I);
  1086. } else if (strcasecmp(yytext, "<img") == 0) {
  1087. return (HL_IMG);
  1088. } else if (strcasecmp(yytext, "<o") == 0) {
  1089. skipws = 0;
  1090. return (HL_O);
  1091. } else if (strcasecmp(yytext, "<s") == 0) {
  1092. skipws = 0;
  1093. return (HL_S);
  1094. } else if (strcasecmp(yytext, "<sub") == 0) {
  1095. skipws = 0;
  1096. return (HL_SUB);
  1097. } else if (strcasecmp(yytext, "<sup") == 0) {
  1098. skipws = 0;
  1099. return (HL_SUP);
  1100. } else if (strcasecmp(yytext, "<table") == 0) {
  1101. return (HL_TABLE);
  1102. } else if (strcasecmp(yytext, "<th") == 0) {
  1103. /* undocumented that "th" is same as "td" */
  1104. return (HL_TD);
  1105. } else if (strcasecmp(yytext, "<td") == 0) {
  1106. return (HL_TD);
  1107. } else if (strcasecmp(yytext, "<tr") == 0) {
  1108. return (HL_TR);
  1109. } else if (strcasecmp(yytext, "<u") == 0) {
  1110. skipws = 0;
  1111. return (HL_U);
  1112. } else if (strcasecmp(yytext, "<vr") == 0) {
  1113. dphl_rvr();
  1114. return (HL_VR);
  1115. } else {
  1116. /* this is a unknown tag at start */
  1117. memset(dp_errmsg, 0, 256);
  1118. snprintf(dp_errmsg, (256 - 1),
  1119. "%s(): unknown start tag `%s' in html string at line %d\n", __func__, yytext, hllineno);
  1120. return (EOF);
  1121. }
  1122. }
  1123. YY_BREAK case 7:YY_RULE_SETUP
  1124. #line 194 "dphl.l"
  1125. {
  1126. hlylval.string = dp_uniqstr(yytext);
  1127. /* end tag */
  1128. if (strcasecmp(yytext, "</b") == 0) {
  1129. return (HL_C_B);
  1130. } else if (strcasecmp(yytext, "</br") == 0) {
  1131. /* undocumented that <br></br> is same as <br/> */
  1132. return (HL_C_BR);
  1133. } else if (strcasecmp(yytext, "</font") == 0) {
  1134. return (HL_C_FONT);
  1135. } else if (strcasecmp(yytext, "</html") == 0) {
  1136. return (HL_C_HTML);
  1137. } else if (strcasecmp(yytext, "</hr") == 0) {
  1138. /* it seems <hr></hr> could be same as <hr/> */
  1139. return (HL_C_HR);
  1140. } else if (strcasecmp(yytext, "</i") == 0) {
  1141. return (HL_C_I);
  1142. } else if (strcasecmp(yytext, "</img") == 0) {
  1143. /* it seems <img></img> couble be same ad <img/> */
  1144. return (HL_C_IMG);
  1145. } else if (strcasecmp(yytext, "</o") == 0) {
  1146. return (HL_C_O);
  1147. } else if (strcasecmp(yytext, "</s") == 0) {
  1148. return (HL_C_S);
  1149. } else if (strcasecmp(yytext, "</sub") == 0) {
  1150. return (HL_C_SUB);
  1151. } else if (strcasecmp(yytext, "</sup") == 0) {
  1152. return (HL_C_SUP);
  1153. } else if (strcasecmp(yytext, "</table") == 0) {
  1154. return (HL_C_TABLE);
  1155. } else if (strcasecmp(yytext, "</th") == 0) {
  1156. /* undocumented that "th" is same as "td" */
  1157. return (HL_C_TD);
  1158. } else if (strcasecmp(yytext, "</td") == 0) {
  1159. return (HL_C_TD);
  1160. } else if (strcasecmp(yytext, "</tr") == 0) {
  1161. return (HL_C_TR);
  1162. } else if (strcasecmp(yytext, "</u") == 0) {
  1163. return (HL_C_U);
  1164. } else if (strcasecmp(yytext, "</vr") == 0) {
  1165. /* it seems <vr></vr> could be same as <vr/> */
  1166. return (HL_C_VR);
  1167. } else {
  1168. /* this is a unknown end tag */
  1169. memset(dp_errmsg, 0, 256);
  1170. snprintf(dp_errmsg, (256 - 1),
  1171. "%s(): unknown end tag `%s' in html string at line %d\n", __func__, yytext, hllineno);
  1172. return (EOF);
  1173. }
  1174. }
  1175. YY_BREAK case 8:YY_RULE_SETUP
  1176. #line 244 "dphl.l"
  1177. {
  1178. /* end tag for br and hr, vr and img */
  1179. hlylval.string = dp_uniqstr(yytext);
  1180. return (HL_SC);
  1181. }
  1182. YY_BREAK case 9:YY_RULE_SETUP
  1183. #line 250 "dphl.l"
  1184. {
  1185. /* end tag for others */
  1186. hlylval.string = dp_uniqstr(yytext);
  1187. return (HL_C);
  1188. }
  1189. YY_BREAK case 10:YY_RULE_SETUP
  1190. #line 256 "dphl.l"
  1191. {
  1192. /* as in var=value */
  1193. hlylval.string = dp_uniqstr(yytext);
  1194. return (HL_IS);
  1195. }
  1196. YY_BREAK case 11:
  1197. /* rule 11 can match eol */
  1198. YY_RULE_SETUP
  1199. #line 262 "dphl.l"
  1200. {
  1201. /* "string" as in var="value" */
  1202. if (strlen(yytext) == 2) {
  1203. hlylval.string = dp_uniqstr((char *)"");
  1204. return (HL_QSTR);
  1205. }
  1206. /* create copy buffer */ tmp = (char *)dp_calloc(1, (yyleng + 1));
  1207. /* wipe last double quote */
  1208. yytext[yyleng - 1] = 0;
  1209. /* copy past first char */
  1210. pt = yytext;
  1211. pt++;
  1212. q = tmp;
  1213. while (*pt) {
  1214. if (*pt == '\\') {
  1215. if (*(pt + 1) == 0) {
  1216. *q = '\\';
  1217. q++;
  1218. pt++;
  1219. } else if (*(pt + 1) == '\n') {
  1220. /* skip \\n */
  1221. pt = pt + 2;
  1222. } else if (*(pt + 1) == '"') {
  1223. /* \" becomes " */
  1224. *q = '"';
  1225. q++;
  1226. pt = pt + 2;
  1227. } else if (*(pt + 1) == '\\') {
  1228. /* \\ becomes \ */
  1229. *q = '\\';
  1230. q++;
  1231. pt = pt + 2;
  1232. } else {
  1233. *q = '\\';
  1234. q++;
  1235. *q = *(pt + 1);
  1236. q++;
  1237. pt = pt + 2;
  1238. }
  1239. } else {
  1240. /* copy regular chars */
  1241. *q = *pt;
  1242. pt++;
  1243. q++;
  1244. }
  1245. }
  1246. hlylval.string = dp_uniqstr(tmp);
  1247. tmp = (char *)dp_free((void *)tmp);
  1248. pt = NULL;
  1249. q = NULL;
  1250. return (HL_QSTR);
  1251. }
  1252. YY_BREAK case 12:
  1253. /* rule 12 can match eol */
  1254. YY_RULE_SETUP
  1255. #line 317 "dphl.l"
  1256. {
  1257. /* 'string' as in var='value' */
  1258. if (strlen(yytext) == 2) {
  1259. hlylval.string = dp_uniqstr((char *)"");
  1260. return (HL_QSTR);
  1261. }
  1262. /* create copy buffer */ tmp = (char *)dp_calloc(1, (yyleng + 1));
  1263. /* wipe last quote */
  1264. yytext[yyleng - 1] = 0;
  1265. /* copy past first char */
  1266. pt = yytext;
  1267. pt++;
  1268. q = tmp;
  1269. while (*pt) {
  1270. if (*pt == '\\') {
  1271. if (*(pt + 1) == 0) {
  1272. *q = '\\';
  1273. q++;
  1274. pt++;
  1275. } else if (*(pt + 1) == '\n') {
  1276. /* skip \\n */
  1277. pt = pt + 2;
  1278. } else if (*(pt + 1) == '\'') {
  1279. /* \' becomes ' */
  1280. *q = '\'';
  1281. q++;
  1282. pt = pt + 2;
  1283. } else if (*(pt + 1) == '\\') {
  1284. /* \\ becomes \ */
  1285. *q = '\\';
  1286. q++;
  1287. pt = pt + 2;
  1288. } else {
  1289. *q = '\\';
  1290. q++;
  1291. *q = *(pt + 1);
  1292. q++;
  1293. pt = pt + 2;
  1294. }
  1295. } else {
  1296. /* copy regular chars */
  1297. *q = *pt;
  1298. pt++;
  1299. q++;
  1300. }
  1301. }
  1302. hlylval.string = dp_uniqstr(tmp);
  1303. tmp = (char *)dp_free((void *)tmp);
  1304. pt = NULL;
  1305. q = NULL;
  1306. return (HL_QSTR);
  1307. }
  1308. YY_BREAK case 13:YY_RULE_SETUP
  1309. #line 372 "dphl.l"
  1310. {
  1311. /* var */
  1312. hlylval.string = dp_uniqstr(yytext);
  1313. switch (*yytext) {
  1314. case 'a':
  1315. case 'A':
  1316. if (strcasecmp(yytext, "align") == 0) {
  1317. return (HL_ALIGN);
  1318. }
  1319. break;
  1320. case 'b':
  1321. case 'B':
  1322. if (strcasecmp(yytext, "balign") == 0) {
  1323. return (HL_BALIGN);
  1324. } else if (strcasecmp(yytext, "bgcolor") == 0) {
  1325. return (HL_BGCOLOR);
  1326. } else if (strcasecmp(yytext, "border") == 0) {
  1327. return (HL_BORDER);
  1328. } else {
  1329. /* unknown */
  1330. }
  1331. break;
  1332. case 'c':
  1333. case 'C':
  1334. if (strcasecmp(yytext, "cellborder") == 0) {
  1335. return (HL_CELLBORDER);
  1336. } else if (strcasecmp(yytext, "cellpadding") == 0) {
  1337. return (HL_CELLPADDING);
  1338. } else if (strcasecmp(yytext, "cellspacing") == 0) {
  1339. return (HL_CELLSPACING);
  1340. } else if (strcasecmp(yytext, "color") == 0) {
  1341. return (HL_COLOR);
  1342. } else if (strcasecmp(yytext, "columns") == 0) {
  1343. return (HL_COLUMNS);
  1344. } else if (strcasecmp(yytext, "colspan") == 0) {
  1345. return (HL_COLSPAN);
  1346. } else {
  1347. /* unknown */
  1348. }
  1349. break;
  1350. case 'f':
  1351. case 'F':
  1352. if (strcasecmp(yytext, "face") == 0) {
  1353. return (HL_FACE);
  1354. } else if (strcasecmp(yytext, "fixedsize") == 0) {
  1355. return (HL_FIXEDSIZE);
  1356. } else {
  1357. /* unknown */
  1358. }
  1359. break;
  1360. case 'g':
  1361. case 'G':
  1362. if (strcasecmp(yytext, "gradientangle") == 0) {
  1363. return (HL_GRADIENTANGLE);
  1364. }
  1365. break;
  1366. case 'h':
  1367. case 'H':
  1368. if (strcasecmp(yytext, "height") == 0) {
  1369. return (HL_HEIGHT);
  1370. } else if (strcasecmp(yytext, "href") == 0) {
  1371. return (HL_HREF);
  1372. } else {
  1373. /* unknown */
  1374. }
  1375. break;
  1376. case 'i':
  1377. case 'I':
  1378. if (strcasecmp(yytext, "id") == 0) {
  1379. return (HL_ID);
  1380. }
  1381. break;
  1382. case 'p':
  1383. case 'P':
  1384. if (strcasecmp(yytext, "point-size") == 0) {
  1385. return (HL_POINTSIZE);
  1386. } else if (strcasecmp(yytext, "pointsize") == 0) {
  1387. return (HL_POINTSIZE);
  1388. } else if (strcasecmp(yytext, "port") == 0) {
  1389. return (HL_PORT);
  1390. } else {
  1391. /* unknown */
  1392. }
  1393. break;
  1394. case 'r':
  1395. case 'R':
  1396. if (strcasecmp(yytext, "rows") == 0) {
  1397. return (HL_ROWS);
  1398. } else if (strcasecmp(yytext, "rowspan") == 0) {
  1399. return (HL_ROWSPAN);
  1400. } else {
  1401. /* unknown */
  1402. }
  1403. break;
  1404. case 's':
  1405. case 'S':
  1406. if (strcasecmp(yytext, "scale") == 0) {
  1407. return (HL_SCALE);
  1408. } else if (strcasecmp(yytext, "sides") == 0) {
  1409. return (HL_SIDES);
  1410. } else if (strcasecmp(yytext, "src") == 0) {
  1411. return (HL_SRC);
  1412. } else if (strcasecmp(yytext, "style") == 0) {
  1413. return (HL_STYLE);
  1414. } else {
  1415. /* unknown */
  1416. }
  1417. break;
  1418. case 't':
  1419. case 'T':
  1420. if (strcasecmp(yytext, "target") == 0) {
  1421. return (HL_TARGET);
  1422. } else if (strcasecmp(yytext, "title") == 0) {
  1423. return (HL_TITLE);
  1424. } else if (strcasecmp(yytext, "tooltip") == 0) {
  1425. return (HL_TOOLTIP);
  1426. } else {
  1427. /* unknown */
  1428. }
  1429. break;
  1430. case 'v':
  1431. case 'V':
  1432. if (strcasecmp(yytext, "valign") == 0) {
  1433. return (HL_VALIGN);
  1434. }
  1435. break;
  1436. case 'w':
  1437. case 'W':
  1438. if (strcasecmp(yytext, "width") == 0) {
  1439. return (HL_WIDTH);
  1440. }
  1441. break;
  1442. default:
  1443. /* unknown */
  1444. break;
  1445. }
  1446. /* unknown */
  1447. return (HL_STR);
  1448. }
  1449. YY_BREAK case YY_STATE_EOF(INITIAL):
  1450. #line 513 "dphl.l"
  1451. {
  1452. /* end of buffer */
  1453. return (EOF);
  1454. }
  1455. YY_BREAK case 14:YY_RULE_SETUP
  1456. #line 518 "dphl.l"
  1457. {
  1458. /* something unknown causes parse error */
  1459. return ((int)yytext[0]);
  1460. } YY_BREAK case 15:YY_RULE_SETUP
  1461. #line 523 "dphl.l"
  1462. ECHO;
  1463. YY_BREAK
  1464. #line 1718 "lex.hl.c"
  1465. case YY_END_OF_BUFFER:
  1466. {
  1467. /* Amount of text matched not including the EOB char. */
  1468. int yy_amount_of_matched_text = (int)(yy_cp - (yytext_ptr)) - 1;
  1469. /* Undo the effects of YY_DO_BEFORE_ACTION. */
  1470. *yy_cp = (yy_hold_char);
  1471. YY_RESTORE_YY_MORE_OFFSET if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW) {
  1472. /* We're scanning a new file or input source. It's
  1473. * possible that this happened because the user
  1474. * just pointed yyin at a new source and called
  1475. * yylex(). If so, then we have to assure
  1476. * consistency between YY_CURRENT_BUFFER and our
  1477. * globals. Here is the right place to do so, because
  1478. * this is the first action (other than possibly a
  1479. * back-up) that will match for the new input source.
  1480. */
  1481. (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  1482. /* %if-c-only */
  1483. YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
  1484. /* %endif */
  1485. /* %if-c++-only */
  1486. /* %endif */
  1487. YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
  1488. }
  1489. /* Note that here we test for yy_c_buf_p "<=" to the position
  1490. * of the first EOB in the buffer, since yy_c_buf_p will
  1491. * already have been incremented past the NUL character
  1492. * (since all states make transitions on EOB to the
  1493. * end-of-buffer state). Contrast this with the test
  1494. * in input().
  1495. */
  1496. if ((yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]) { /* This was really a NUL. */
  1497. yy_state_type yy_next_state;
  1498. (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
  1499. yy_current_state = yy_get_previous_state();
  1500. /* Okay, we're now positioned to make the NUL
  1501. * transition. We couldn't have
  1502. * yy_get_previous_state() go ahead and do it
  1503. * for us because it doesn't know how to deal
  1504. * with the possibility of jamming (and we don't
  1505. * want to build jamming into it because then it
  1506. * will run more slowly).
  1507. */
  1508. yy_next_state = yy_try_NUL_trans(yy_current_state);
  1509. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  1510. if (yy_next_state) {
  1511. /* Consume the NUL. */
  1512. yy_cp = ++(yy_c_buf_p);
  1513. yy_current_state = yy_next_state;
  1514. goto yy_match;
  1515. }
  1516. else {
  1517. /* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */
  1518. yy_cp = (yy_last_accepting_cpos);
  1519. yy_current_state = (yy_last_accepting_state);
  1520. goto yy_find_action;
  1521. }
  1522. }
  1523. else
  1524. switch (yy_get_next_buffer()) {
  1525. case EOB_ACT_END_OF_FILE:
  1526. {
  1527. (yy_did_buffer_switch_on_eof) = 0;
  1528. if (yywrap()) {
  1529. /* Note: because we've taken care in
  1530. * yy_get_next_buffer() to have set up
  1531. * yytext, we can now set up
  1532. * yy_c_buf_p so that if some total
  1533. * hoser (like flex itself) wants to
  1534. * call the scanner after we return the
  1535. * YY_NULL, it'll still work - another
  1536. * YY_NULL will get returned.
  1537. */
  1538. (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
  1539. yy_act = YY_STATE_EOF(YY_START);
  1540. goto do_action;
  1541. }
  1542. else {
  1543. if (!(yy_did_buffer_switch_on_eof))
  1544. YY_NEW_FILE;
  1545. }
  1546. break;
  1547. }
  1548. case EOB_ACT_CONTINUE_SCAN:
  1549. (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
  1550. yy_current_state = yy_get_previous_state();
  1551. yy_cp = (yy_c_buf_p);
  1552. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  1553. goto yy_match;
  1554. case EOB_ACT_LAST_MATCH:
  1555. (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
  1556. yy_current_state = yy_get_previous_state();
  1557. yy_cp = (yy_c_buf_p);
  1558. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  1559. goto yy_find_action;
  1560. }
  1561. break;
  1562. }
  1563. default:
  1564. YY_FATAL_ERROR("fatal flex scanner internal error--no action found");
  1565. break;
  1566. } /* end of action switch */
  1567. } /* end of scanning one token */
  1568. } /* end of user's declarations */
  1569. } /* end of yylex */
  1570. /* %ok-for-header */
  1571. /* %if-c++-only */
  1572. /* %not-for-header */
  1573. /* %ok-for-header */
  1574. /* %endif */
  1575. /* yy_get_next_buffer - try to read in a new buffer
  1576. *
  1577. * Returns a code representing an action:
  1578. * EOB_ACT_LAST_MATCH -
  1579. * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  1580. * EOB_ACT_END_OF_FILE - end of file
  1581. */
  1582. /* %if-c-only */
  1583. static int yy_get_next_buffer(void)
  1584. /* %endif */
  1585. /* %if-c++-only */
  1586. /* %endif */
  1587. {
  1588. char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
  1589. char *source = (yytext_ptr);
  1590. int number_to_move, i;
  1591. int ret_val;
  1592. if ((yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1])
  1593. YY_FATAL_ERROR("fatal flex scanner internal error--end of buffer missed");
  1594. if (YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0) { /* Don't try to fill the buffer, so this is an EOF. */
  1595. if ((yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1) {
  1596. /* We matched a single character, the EOB, so
  1597. * treat this as a final EOF.
  1598. */
  1599. return EOB_ACT_END_OF_FILE;
  1600. }
  1601. else {
  1602. /* We matched some text prior to the EOB, first
  1603. * process it.
  1604. */
  1605. return EOB_ACT_LAST_MATCH;
  1606. }
  1607. }
  1608. /* Try to read more data. */
  1609. /* First move last chars to start of buffer. */
  1610. number_to_move = (int)((yy_c_buf_p) - (yytext_ptr) - 1);
  1611. for (i = 0; i < number_to_move; ++i)
  1612. *(dest++) = *(source++);
  1613. if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING)
  1614. /* don't do the read, it's not guaranteed to return an EOF,
  1615. * just force an EOF
  1616. */
  1617. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
  1618. else {
  1619. int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
  1620. while (num_to_read <= 0) { /* Not enough room in the buffer - grow it. */
  1621. /* just a shorter name for the current buffer */
  1622. YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
  1623. int yy_c_buf_p_offset = (int)((yy_c_buf_p) - b->yy_ch_buf);
  1624. if (b->yy_is_our_buffer) {
  1625. int new_size = b->yy_buf_size * 2;
  1626. if (new_size <= 0)
  1627. b->yy_buf_size += b->yy_buf_size / 8;
  1628. else
  1629. b->yy_buf_size *= 2;
  1630. b->yy_ch_buf = (char *)
  1631. /* Include room in for 2 EOB chars. */
  1632. yyrealloc((void *)b->yy_ch_buf, (yy_size_t) (b->yy_buf_size + 2));
  1633. } else
  1634. /* Can't grow it, we don't own it. */
  1635. b->yy_ch_buf = NULL;
  1636. if (!b->yy_ch_buf)
  1637. YY_FATAL_ERROR("fatal error - scanner input buffer overflow");
  1638. (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
  1639. num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
  1640. }
  1641. if (num_to_read > YY_READ_BUF_SIZE)
  1642. num_to_read = YY_READ_BUF_SIZE;
  1643. /* Read in more data. */
  1644. YY_INPUT((&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), num_to_read);
  1645. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1646. }
  1647. if ((yy_n_chars) == 0) {
  1648. if (number_to_move == YY_MORE_ADJ) {
  1649. ret_val = EOB_ACT_END_OF_FILE;
  1650. yyrestart(yyin);
  1651. }
  1652. else {
  1653. ret_val = EOB_ACT_LAST_MATCH;
  1654. YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING;
  1655. }
  1656. }
  1657. else
  1658. ret_val = EOB_ACT_CONTINUE_SCAN;
  1659. if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
  1660. /* Extend the array by 50%, plus the number we really need. */
  1661. int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
  1662. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *)yyrealloc((void *)YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size);
  1663. if (!YY_CURRENT_BUFFER_LVALUE->yy_ch_buf)
  1664. YY_FATAL_ERROR("out of dynamic memory in yy_get_next_buffer()");
  1665. /* "- 2" to take care of EOB's */
  1666. YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int)(new_size - 2);
  1667. }
  1668. (yy_n_chars) += number_to_move;
  1669. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
  1670. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
  1671. (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
  1672. return ret_val;
  1673. }
  1674. /* yy_get_previous_state - get the state just before the EOB char was reached */
  1675. /* %if-c-only */
  1676. /* %not-for-header */
  1677. static yy_state_type yy_get_previous_state(void)
  1678. /* %endif */
  1679. /* %if-c++-only */
  1680. /* %endif */
  1681. {
  1682. yy_state_type yy_current_state;
  1683. char *yy_cp;
  1684. /* %% [15.0] code to get the start state into yy_current_state goes here */
  1685. yy_current_state = (yy_start);
  1686. for (yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp) {
  1687. /* %% [16.0] code to find the next state goes here */
  1688. YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
  1689. if (yy_accept[yy_current_state]) {
  1690. (yy_last_accepting_state) = yy_current_state;
  1691. (yy_last_accepting_cpos) = yy_cp;
  1692. }
  1693. while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
  1694. yy_current_state = (int)yy_def[yy_current_state];
  1695. if (yy_current_state >= 40)
  1696. yy_c = yy_meta[yy_c];
  1697. }
  1698. yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  1699. }
  1700. return yy_current_state;
  1701. }
  1702. /* yy_try_NUL_trans - try to make a transition on the NUL character
  1703. *
  1704. * synopsis
  1705. * next_state = yy_try_NUL_trans( current_state );
  1706. */
  1707. /* %if-c-only */
  1708. static yy_state_type yy_try_NUL_trans(yy_state_type yy_current_state)
  1709. /* %endif */
  1710. /* %if-c++-only */
  1711. /* %endif */
  1712. {
  1713. int yy_is_jam;
  1714. /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */
  1715. char *yy_cp = (yy_c_buf_p);
  1716. YY_CHAR yy_c = 1;
  1717. if (yy_accept[yy_current_state]) {
  1718. (yy_last_accepting_state) = yy_current_state;
  1719. (yy_last_accepting_cpos) = yy_cp;
  1720. }
  1721. while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
  1722. yy_current_state = (int)yy_def[yy_current_state];
  1723. if (yy_current_state >= 40)
  1724. yy_c = yy_meta[yy_c];
  1725. }
  1726. yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  1727. yy_is_jam = (yy_current_state == 39);
  1728. return yy_is_jam ? 0 : yy_current_state;
  1729. }
  1730. #ifndef YY_NO_UNPUT
  1731. /* %if-c-only */
  1732. /* %endif */
  1733. #endif
  1734. /* %if-c-only */
  1735. #ifndef YY_NO_INPUT
  1736. #ifdef __cplusplus
  1737. static int yyinput(void)
  1738. #else
  1739. static int input(void)
  1740. #endif
  1741. /* %endif */
  1742. /* %if-c++-only */
  1743. /* %endif */
  1744. {
  1745. int c;
  1746. *(yy_c_buf_p) = (yy_hold_char);
  1747. if (*(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR) {
  1748. /* yy_c_buf_p now points to the character we want to return.
  1749. * If this occurs *before* the EOB characters, then it's a
  1750. * valid NUL; if not, then we've hit the end of the buffer.
  1751. */
  1752. if ((yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)])
  1753. /* This was really a NUL. */
  1754. *(yy_c_buf_p) = '\0';
  1755. else { /* need more input */
  1756. int offset = (int)((yy_c_buf_p) - (yytext_ptr));
  1757. ++(yy_c_buf_p);
  1758. switch (yy_get_next_buffer()) {
  1759. case EOB_ACT_LAST_MATCH:
  1760. /* This happens because yy_g_n_b()
  1761. * sees that we've accumulated a
  1762. * token and flags that we need to
  1763. * try matching the token before
  1764. * proceeding. But for input(),
  1765. * there's no matching to consider.
  1766. * So convert the EOB_ACT_LAST_MATCH
  1767. * to EOB_ACT_END_OF_FILE.
  1768. */
  1769. /* Reset buffer status. */
  1770. yyrestart(yyin);
  1771. /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE:
  1772. {
  1773. if (yywrap())
  1774. return 0;
  1775. if (!(yy_did_buffer_switch_on_eof))
  1776. YY_NEW_FILE;
  1777. #ifdef __cplusplus
  1778. return yyinput();
  1779. #else
  1780. return input();
  1781. #endif
  1782. }
  1783. case EOB_ACT_CONTINUE_SCAN:
  1784. (yy_c_buf_p) = (yytext_ptr) + offset;
  1785. break;
  1786. }
  1787. }
  1788. }
  1789. c = *(unsigned char *)(yy_c_buf_p); /* cast for 8-bit char's */
  1790. *(yy_c_buf_p) = '\0'; /* preserve yytext */
  1791. (yy_hold_char) = *++(yy_c_buf_p);
  1792. /* %% [19.0] update BOL and yylineno */
  1793. if (c == '\n')
  1794. yylineno++;
  1795. ;
  1796. return c;
  1797. }
  1798. /* %if-c-only */
  1799. #endif /* ifndef YY_NO_INPUT */
  1800. /* %endif */
  1801. /** Immediately switch to a different input stream.
  1802. * @param input_file A readable stream.
  1803. *
  1804. * @note This function does not reset the start condition to @c INITIAL .
  1805. */
  1806. /* %if-c-only */
  1807. void yyrestart(FILE * input_file)
  1808. /* %endif */
  1809. /* %if-c++-only */
  1810. /* %endif */
  1811. {
  1812. if (!YY_CURRENT_BUFFER) {
  1813. yyensure_buffer_stack();
  1814. YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE);
  1815. }
  1816. yy_init_buffer(YY_CURRENT_BUFFER, input_file);
  1817. yy_load_buffer_state();
  1818. }
  1819. /* %if-c++-only */
  1820. /* %endif */
  1821. /** Switch to a different input buffer.
  1822. * @param new_buffer The new input buffer.
  1823. *
  1824. */
  1825. /* %if-c-only */
  1826. void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer)
  1827. /* %endif */
  1828. /* %if-c++-only */
  1829. /* %endif */
  1830. {
  1831. /* TODO. We should be able to replace this entire function body
  1832. * with
  1833. * yypop_buffer_state();
  1834. * yypush_buffer_state(new_buffer);
  1835. */
  1836. yyensure_buffer_stack();
  1837. if (YY_CURRENT_BUFFER == new_buffer)
  1838. return;
  1839. if (YY_CURRENT_BUFFER) {
  1840. /* Flush out information for old buffer. */
  1841. *(yy_c_buf_p) = (yy_hold_char);
  1842. YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
  1843. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1844. }
  1845. YY_CURRENT_BUFFER_LVALUE = new_buffer;
  1846. yy_load_buffer_state();
  1847. /* We don't actually know whether we did this switch during
  1848. * EOF (yywrap()) processing, but the only time this flag
  1849. * is looked at is after yywrap() is called, so it's safe
  1850. * to go ahead and always set it.
  1851. */
  1852. (yy_did_buffer_switch_on_eof) = 1;
  1853. }
  1854. /* %if-c-only */
  1855. static void yy_load_buffer_state(void)
  1856. /* %endif */
  1857. /* %if-c++-only */
  1858. /* %endif */
  1859. {
  1860. (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  1861. (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
  1862. /* %if-c-only */
  1863. yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
  1864. /* %endif */
  1865. /* %if-c++-only */
  1866. /* %endif */
  1867. (yy_hold_char) = *(yy_c_buf_p);
  1868. }
  1869. /** Allocate and initialize an input buffer state.
  1870. * @param file A readable stream.
  1871. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
  1872. *
  1873. * @return the allocated buffer state.
  1874. */
  1875. /* %if-c-only */
  1876. YY_BUFFER_STATE yy_create_buffer(FILE * file, int size)
  1877. /* %endif */
  1878. /* %if-c++-only */
  1879. /* %endif */
  1880. {
  1881. YY_BUFFER_STATE b;
  1882. b = (YY_BUFFER_STATE) yyalloc(sizeof(struct yy_buffer_state));
  1883. if (!b)
  1884. YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()");
  1885. b->yy_buf_size = size;
  1886. /* yy_ch_buf has to be 2 characters longer than the size given because
  1887. * we need to put in 2 end-of-buffer characters.
  1888. */
  1889. b->yy_ch_buf = (char *)yyalloc((yy_size_t) (b->yy_buf_size + 2));
  1890. if (!b->yy_ch_buf) {
  1891. yyfree(b);
  1892. YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()");
  1893. }
  1894. b->yy_is_our_buffer = 1;
  1895. yy_init_buffer(b, file);
  1896. return b;
  1897. }
  1898. /* %if-c++-only */
  1899. /* %endif */
  1900. /** Destroy the buffer.
  1901. * @param b a buffer created with yy_create_buffer()
  1902. *
  1903. */
  1904. /* %if-c-only */
  1905. void yy_delete_buffer(YY_BUFFER_STATE b)
  1906. /* %endif */
  1907. /* %if-c++-only */
  1908. /* %endif */
  1909. {
  1910. if (!b)
  1911. return;
  1912. if (b == YY_CURRENT_BUFFER) /* Not sure if we should pop here. */
  1913. YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
  1914. if (b->yy_is_our_buffer)
  1915. yyfree((void *)b->yy_ch_buf);
  1916. yyfree((void *)b);
  1917. }
  1918. /* Initializes or reinitializes a buffer.
  1919. * This function is sometimes called more than once on the same buffer,
  1920. * such as during a yyrestart() or at EOF.
  1921. */
  1922. /* %if-c-only */
  1923. static void yy_init_buffer(YY_BUFFER_STATE b, FILE * file)
  1924. /* %endif */
  1925. /* %if-c++-only */
  1926. /* %endif */
  1927. {
  1928. int oerrno = errno;
  1929. if (b == NULL) {
  1930. /* shouldnothappen */
  1931. return;
  1932. }
  1933. yy_flush_buffer(b);
  1934. /* %if-c-only */
  1935. b->yy_input_file = file;
  1936. /* %endif */
  1937. /* %if-c++-only */
  1938. /* %endif */
  1939. b->yy_fill_buffer = 1;
  1940. /* If b is the current buffer, then yy_init_buffer was _probably_
  1941. * called from yyrestart() or through yy_get_next_buffer.
  1942. * In that case, we don't want to reset the lineno or column.
  1943. */
  1944. if (b != YY_CURRENT_BUFFER) {
  1945. b->yy_bs_lineno = 1;
  1946. b->yy_bs_column = 0;
  1947. }
  1948. /* %if-c-only */
  1949. b->yy_is_interactive = 0;
  1950. /* %endif */
  1951. /* %if-c++-only */
  1952. /* %endif */
  1953. errno = oerrno;
  1954. }
  1955. /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
  1956. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
  1957. *
  1958. */
  1959. /* %if-c-only */
  1960. void yy_flush_buffer(YY_BUFFER_STATE b)
  1961. /* %endif */
  1962. /* %if-c++-only */
  1963. /* %endif */
  1964. {
  1965. if (!b)
  1966. return;
  1967. b->yy_n_chars = 0;
  1968. /* We always need two end-of-buffer characters. The first causes
  1969. * a transition to the end-of-buffer state. The second causes
  1970. * a jam in that state.
  1971. */
  1972. b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
  1973. b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  1974. b->yy_buf_pos = &b->yy_ch_buf[0];
  1975. b->yy_at_bol = 1;
  1976. b->yy_buffer_status = YY_BUFFER_NEW;
  1977. if (b == YY_CURRENT_BUFFER)
  1978. yy_load_buffer_state();
  1979. }
  1980. /* %if-c-or-c++ */
  1981. /** Pushes the new state onto the stack. The new state becomes
  1982. * the current state. This function will allocate the stack
  1983. * if necessary.
  1984. * @param new_buffer The new state.
  1985. *
  1986. */
  1987. /* %if-c-only */
  1988. void yypush_buffer_state(YY_BUFFER_STATE new_buffer)
  1989. /* %endif */
  1990. /* %if-c++-only */
  1991. /* %endif */
  1992. {
  1993. if (new_buffer == NULL)
  1994. return;
  1995. yyensure_buffer_stack();
  1996. /* This block is copied from yy_switch_to_buffer. */
  1997. if (YY_CURRENT_BUFFER) {
  1998. /* Flush out information for old buffer. */
  1999. *(yy_c_buf_p) = (yy_hold_char);
  2000. YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
  2001. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  2002. }
  2003. /* Only push if top exists. Otherwise, replace top. */
  2004. if (YY_CURRENT_BUFFER)
  2005. (yy_buffer_stack_top)++;
  2006. YY_CURRENT_BUFFER_LVALUE = new_buffer;
  2007. /* copied from yy_switch_to_buffer. */
  2008. yy_load_buffer_state();
  2009. (yy_did_buffer_switch_on_eof) = 1;
  2010. }
  2011. /* %endif */
  2012. /* %if-c-or-c++ */
  2013. /** Removes and deletes the top of the stack, if present.
  2014. * The next element becomes the new top.
  2015. *
  2016. */
  2017. /* %if-c-only */
  2018. void yypop_buffer_state(void)
  2019. /* %endif */
  2020. /* %if-c++-only */
  2021. /* %endif */
  2022. {
  2023. if (!YY_CURRENT_BUFFER)
  2024. return;
  2025. yy_delete_buffer(YY_CURRENT_BUFFER);
  2026. YY_CURRENT_BUFFER_LVALUE = NULL;
  2027. if ((yy_buffer_stack_top) > 0)
  2028. --(yy_buffer_stack_top);
  2029. if (YY_CURRENT_BUFFER) {
  2030. yy_load_buffer_state();
  2031. (yy_did_buffer_switch_on_eof) = 1;
  2032. }
  2033. }
  2034. /* %endif */
  2035. /* %if-c-or-c++ */
  2036. /* Allocates the stack if it does not exist.
  2037. * Guarantees space for at least one push.
  2038. */
  2039. /* %if-c-only */
  2040. static void yyensure_buffer_stack(void)
  2041. /* %endif */
  2042. /* %if-c++-only */
  2043. /* %endif */
  2044. {
  2045. yy_size_t num_to_alloc;
  2046. if (!(yy_buffer_stack)) {
  2047. /* First allocation is just for 2 elements, since we don't know if this
  2048. * scanner will even need a stack. We use 2 instead of 1 to avoid an
  2049. * immediate realloc on the next call.
  2050. */
  2051. num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
  2052. (yy_buffer_stack) = (struct yy_buffer_state **)yyalloc(num_to_alloc * sizeof(struct yy_buffer_state *)
  2053. );
  2054. if (!(yy_buffer_stack))
  2055. YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()");
  2056. memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state *));
  2057. (yy_buffer_stack_max) = num_to_alloc;
  2058. (yy_buffer_stack_top) = 0;
  2059. return;
  2060. }
  2061. if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1) {
  2062. /* Increase the buffer to prepare for a possible push. */
  2063. yy_size_t grow_size = 8 /* arbitrary grow size */ ;
  2064. num_to_alloc = (yy_buffer_stack_max) + grow_size;
  2065. (yy_buffer_stack) = (struct yy_buffer_state **)yyrealloc((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state *)
  2066. );
  2067. if (!(yy_buffer_stack))
  2068. YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()");
  2069. /* zero only the new slots. */
  2070. memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state *));
  2071. (yy_buffer_stack_max) = num_to_alloc;
  2072. }
  2073. }
  2074. /* %endif */
  2075. /* %if-c-only */
  2076. /** Setup the input buffer state to scan directly from a user-specified character buffer.
  2077. * @param base the character buffer
  2078. * @param size the size in bytes of the character buffer
  2079. *
  2080. * @return the newly allocated buffer state object.
  2081. */
  2082. YY_BUFFER_STATE yy_scan_buffer(char *base, yy_size_t size)
  2083. {
  2084. YY_BUFFER_STATE b;
  2085. if (size < 2 || base[size - 2] != YY_END_OF_BUFFER_CHAR || base[size - 1] != YY_END_OF_BUFFER_CHAR)
  2086. /* They forgot to leave room for the EOB's. */
  2087. return NULL;
  2088. b = (YY_BUFFER_STATE) yyalloc(sizeof(struct yy_buffer_state));
  2089. if (!b) {
  2090. YY_FATAL_ERROR("out of dynamic memory in yy_scan_buffer()");
  2091. }
  2092. b->yy_buf_size = (int)(size - 2); /* "- 2" to take care of EOB's */
  2093. b->yy_buf_pos = b->yy_ch_buf = base;
  2094. b->yy_is_our_buffer = 0;
  2095. b->yy_input_file = NULL;
  2096. b->yy_n_chars = b->yy_buf_size;
  2097. b->yy_is_interactive = 0;
  2098. b->yy_at_bol = 1;
  2099. b->yy_fill_buffer = 0;
  2100. b->yy_buffer_status = YY_BUFFER_NEW;
  2101. yy_switch_to_buffer(b);
  2102. return b;
  2103. }
  2104. /* %endif */
  2105. /* %if-c-only */
  2106. /** Setup the input buffer state to scan a string. The next call to yylex() will
  2107. * scan from a @e copy of @a str.
  2108. * @param yystr a NUL-terminated string to scan
  2109. *
  2110. * @return the newly allocated buffer state object.
  2111. * @note If you want to scan bytes that may contain NUL values, then use
  2112. * yy_scan_bytes() instead.
  2113. */
  2114. YY_BUFFER_STATE yy_scan_string(const char *yystr)
  2115. {
  2116. return yy_scan_bytes(yystr, (int)strlen(yystr));
  2117. }
  2118. /* %endif */
  2119. /* %if-c-only */
  2120. /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
  2121. * scan from a @e copy of @a bytes.
  2122. * @param yybytes the byte buffer to scan
  2123. * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
  2124. *
  2125. * @return the newly allocated buffer state object.
  2126. */
  2127. YY_BUFFER_STATE yy_scan_bytes(const char *yybytes, int _yybytes_len)
  2128. {
  2129. YY_BUFFER_STATE b;
  2130. char *buf;
  2131. yy_size_t n;
  2132. int i;
  2133. /* Get memory for full buffer, including space for trailing EOB's. */
  2134. n = (yy_size_t) (_yybytes_len + 2);
  2135. buf = (char *)yyalloc(n);
  2136. if (!buf)
  2137. YY_FATAL_ERROR("out of dynamic memory in yy_scan_bytes()");
  2138. for (i = 0; i < _yybytes_len; ++i)
  2139. buf[i] = yybytes[i];
  2140. buf[_yybytes_len] = buf[_yybytes_len + 1] = YY_END_OF_BUFFER_CHAR;
  2141. b = yy_scan_buffer(buf, n);
  2142. if (!b) {
  2143. yyfree(buf);
  2144. YY_FATAL_ERROR("bad buffer in yy_scan_bytes()");
  2145. }
  2146. /* It's okay to grow etc. this buffer, and we should throw it
  2147. * away when we're done.
  2148. */
  2149. b->yy_is_our_buffer = 1;
  2150. return b;
  2151. }
  2152. /* %endif */
  2153. #ifndef YY_EXIT_FAILURE
  2154. #define YY_EXIT_FAILURE 2
  2155. #endif
  2156. /* %if-c-only */
  2157. static void yynoreturn yy_fatal_error(const char *msg)
  2158. {
  2159. fprintf(stderr, "%s\n", msg);
  2160. exit(YY_EXIT_FAILURE);
  2161. }
  2162. /* %endif */
  2163. /* %if-c++-only */
  2164. /* %endif */
  2165. /* Redefine yyless() so it works in section 3 code. */
  2166. #undef yyless
  2167. #define yyless(n) \
  2168. do \
  2169. { \
  2170. /* Undo effects of setting up yytext. */ \
  2171. int yyless_macro_arg = (n); \
  2172. YY_LESS_LINENO(yyless_macro_arg);\
  2173. yytext[yyleng] = (yy_hold_char); \
  2174. (yy_c_buf_p) = yytext + yyless_macro_arg; \
  2175. (yy_hold_char) = *(yy_c_buf_p); \
  2176. *(yy_c_buf_p) = '\0'; \
  2177. yyleng = yyless_macro_arg; \
  2178. } \
  2179. while ( 0 )
  2180. /* Accessor methods (get/set functions) to struct members. */
  2181. /* %if-c-only */
  2182. /* %if-reentrant */
  2183. /* %endif */
  2184. /** Get the current line number.
  2185. *
  2186. */
  2187. int yyget_lineno(void)
  2188. {
  2189. return yylineno;
  2190. }
  2191. /** Get the input stream.
  2192. *
  2193. */
  2194. FILE *yyget_in(void)
  2195. {
  2196. return yyin;
  2197. }
  2198. /** Get the output stream.
  2199. *
  2200. */
  2201. FILE *yyget_out(void)
  2202. {
  2203. return yyout;
  2204. }
  2205. /** Get the length of the current token.
  2206. *
  2207. */
  2208. int yyget_leng(void)
  2209. {
  2210. return yyleng;
  2211. }
  2212. /** Get the current token.
  2213. *
  2214. */
  2215. char *yyget_text(void)
  2216. {
  2217. return yytext;
  2218. }
  2219. /* %if-reentrant */
  2220. /* %endif */
  2221. /** Set the current line number.
  2222. * @param _line_number line number
  2223. *
  2224. */
  2225. void yyset_lineno(int _line_number)
  2226. {
  2227. yylineno = _line_number;
  2228. }
  2229. /** Set the input stream. This does not discard the current
  2230. * input buffer.
  2231. * @param _in_str A readable stream.
  2232. *
  2233. * @see yy_switch_to_buffer
  2234. */
  2235. void yyset_in(FILE * _in_str)
  2236. {
  2237. yyin = _in_str;
  2238. }
  2239. void yyset_out(FILE * _out_str)
  2240. {
  2241. yyout = _out_str;
  2242. }
  2243. int yyget_debug(void)
  2244. {
  2245. return yy_flex_debug;
  2246. }
  2247. void yyset_debug(int _bdebug)
  2248. {
  2249. yy_flex_debug = _bdebug;
  2250. }
  2251. /* %endif */
  2252. /* %if-reentrant */
  2253. /* %if-bison-bridge */
  2254. /* %endif */
  2255. /* %endif if-c-only */
  2256. /* %if-c-only */
  2257. static int yy_init_globals(void)
  2258. {
  2259. /* Initialization is the same as for the non-reentrant scanner.
  2260. * This function is called from yylex_destroy(), so don't allocate here.
  2261. */
  2262. /* We do not touch yylineno unless the option is enabled. */
  2263. yylineno = 1;
  2264. (yy_buffer_stack) = NULL;
  2265. (yy_buffer_stack_top) = 0;
  2266. (yy_buffer_stack_max) = 0;
  2267. (yy_c_buf_p) = NULL;
  2268. (yy_init) = 0;
  2269. (yy_start) = 0;
  2270. /* Defined in main.c */
  2271. #ifdef YY_STDINIT
  2272. yyin = stdin;
  2273. yyout = stdout;
  2274. #else
  2275. yyin = NULL;
  2276. yyout = NULL;
  2277. #endif
  2278. /* For future reference: Set errno on error, since we are called by
  2279. * yylex_init()
  2280. */
  2281. return 0;
  2282. }
  2283. /* %endif */
  2284. /* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */
  2285. /* yylex_destroy is for both reentrant and non-reentrant scanners. */
  2286. int yylex_destroy(void)
  2287. {
  2288. /* Pop the buffer stack, destroying each element. */
  2289. while (YY_CURRENT_BUFFER) {
  2290. yy_delete_buffer(YY_CURRENT_BUFFER);
  2291. YY_CURRENT_BUFFER_LVALUE = NULL;
  2292. yypop_buffer_state();
  2293. }
  2294. /* Destroy the stack itself. */
  2295. yyfree((yy_buffer_stack));
  2296. (yy_buffer_stack) = NULL;
  2297. /* Reset the globals. This is important in a non-reentrant scanner so the next time
  2298. * yylex() is called, initialization will occur. */
  2299. yy_init_globals();
  2300. /* %if-reentrant */
  2301. /* %endif */
  2302. return 0;
  2303. }
  2304. /* %endif */
  2305. /*
  2306. * Internal utility routines.
  2307. */
  2308. #ifndef yytext_ptr
  2309. static void yy_flex_strncpy(char *s1, const char *s2, int n)
  2310. {
  2311. int i;
  2312. for (i = 0; i < n; ++i)
  2313. s1[i] = s2[i];
  2314. }
  2315. #endif
  2316. #ifdef YY_NEED_STRLEN
  2317. static int yy_flex_strlen(const char *s)
  2318. {
  2319. int n;
  2320. for (n = 0; s[n]; ++n) ;
  2321. return n;
  2322. }
  2323. #endif
  2324. void *yyalloc(yy_size_t size)
  2325. {
  2326. void *ret = NULL;
  2327. ret = calloc(1, size);
  2328. if (ret == NULL) {
  2329. /* option here to do exit (1); */
  2330. }
  2331. return (ret);
  2332. }
  2333. void *yyrealloc(void *ptr, yy_size_t size)
  2334. {
  2335. void *ret = NULL;
  2336. /* The cast to (char *) in the following accommodates both
  2337. * implementations that use char* generic pointers, and those
  2338. * that use void* generic pointers. It works with the latter
  2339. * because both ANSI C and C++ allow castless assignment from
  2340. * any pointer type to void*, and deal with argument conversions
  2341. * as though doing an assignment.
  2342. */
  2343. ret = realloc(ptr, size);
  2344. if (size) {
  2345. if (ret == NULL) {
  2346. /* option here to do exit (1); */
  2347. }
  2348. }
  2349. return (ret);
  2350. }
  2351. void yyfree(void *ptr)
  2352. {
  2353. if (ptr) {
  2354. free((char *)ptr);
  2355. } /* see yyrealloc() for (char *) cast */
  2356. }
  2357. /* %if-tables-serialization definitions */
  2358. /* %define-yytables The name for this specific scanner's tables. */
  2359. #define YYTABLES_NAME "yytables"
  2360. /* %endif */
  2361. /* %ok-for-header */
  2362. #line 523 "dphl.l"
  2363. /* lex buffer */
  2364. static YY_BUFFER_STATE buffer = NULL;
  2365. /* clear buffer */
  2366. static int clearit = 0;
  2367. /* lex buffer pending */
  2368. static int pending = 0;
  2369. /* lex buffer length */
  2370. static int buflen = 0;
  2371. /* data buffer */
  2372. static char *dbuf = (char *)0;
  2373. /* tag buffer */
  2374. static char *tbuf = (char *)0;
  2375. /* input buffer */
  2376. static char *ibuf = (char *)0;
  2377. /* pointer in ibuf */
  2378. static char *bufptr = (char *)0;
  2379. /* init
  2380. * the string has at least 1 char as in "< >"
  2381. */
  2382. void html_lex_init(int dbg, char *str, int line)
  2383. {
  2384. if (dbg || 0) {
  2385. hl_flex_debug = 1;
  2386. hlydebug = 1;
  2387. } else {
  2388. hl_flex_debug = 0;
  2389. hlydebug = 0;
  2390. }
  2391. /* set lineno to where the node is defind */
  2392. hllineno = line;
  2393. /* extra space for \0\0 */
  2394. buflen = strlen(str) + 2;
  2395. ibuf = (char *)dp_calloc(1, buflen);
  2396. if (ibuf == NULL) {
  2397. return;
  2398. }
  2399. /* copy, skip first < */
  2400. strcpy(ibuf, (str + 1));
  2401. /* wipe last > */
  2402. ibuf[strlen(ibuf) - 1] = 0;
  2403. /* set where to start lexing */
  2404. bufptr = ibuf;
  2405. /* skip leading ws todo XXX is this always correct? */
  2406. while (*bufptr) {
  2407. if (*bufptr == ' ') {
  2408. } else if (*bufptr == '\n') {
  2409. hllineno++;
  2410. } else if (*bufptr == '\r') {
  2411. } else if (*bufptr == '\f') {
  2412. } else if (*bufptr == '\t') {
  2413. } else {
  2414. break;
  2415. }
  2416. bufptr++;
  2417. }
  2418. skipws = 1;
  2419. /* data buffer */
  2420. dbuf = (char *)dp_calloc(1, buflen);
  2421. if (dbuf == NULL) {
  2422. return;
  2423. }
  2424. /* tag buffer */
  2425. tbuf = (char *)dp_calloc(1, buflen);
  2426. if (tbuf == NULL) {
  2427. return;
  2428. }
  2429. /* lex buffer pending */
  2430. pending = 0;
  2431. /* clear buffer */
  2432. clearit = 0;
  2433. return;
  2434. }
  2435. /* de-init */
  2436. void html_lex_deinit(void)
  2437. {
  2438. hl_flex_debug = 0;
  2439. /* clear buffer */
  2440. if (clearit || 1) {
  2441. /* this may fix valgrind issue */
  2442. yylex_destroy();
  2443. /* yy_delete_buffer (buffer); */
  2444. buffer = NULL;
  2445. clearit = 0;
  2446. }
  2447. /* lex buffer pending */
  2448. pending = 0;
  2449. /* lex buffer length */
  2450. buflen = 0;
  2451. /* data buffer */
  2452. if (dbuf) {
  2453. dbuf = (char *)dp_free((void *)dbuf);
  2454. }
  2455. /* tag buffer */
  2456. if (tbuf) {
  2457. tbuf = (char *)dp_free((void *)tbuf);
  2458. }
  2459. /* input buffer */
  2460. if (ibuf) {
  2461. ibuf = (char *)dp_free((void *)ibuf);
  2462. }
  2463. /* pointer in ibuf */
  2464. bufptr = (char *)0;
  2465. return;
  2466. }
  2467. /* lex one token */
  2468. int html_lex(void)
  2469. {
  2470. int token = 0;
  2471. int i = 0;
  2472. int j = 0;
  2473. char *p = NULL;
  2474. for (i = 0; i < 100; i++) {
  2475. /* lex buffer pending */
  2476. if (pending == 1) {
  2477. /* lex from buffer */
  2478. token = hllex();
  2479. /* at end-of-string in tbuf */
  2480. if (token == EOF) {
  2481. /* this may fix valgrind issue */
  2482. yylex_destroy();
  2483. /* yy_delete_buffer (buffer); */
  2484. buffer = NULL;
  2485. clearit = 0;
  2486. pending = 0;
  2487. continue;
  2488. }
  2489. /* at regular token */
  2490. pending = 1;
  2491. /* hlylval.string is set in the actions */
  2492. return (token);
  2493. } else {
  2494. /* refill buffer */
  2495. if (*bufptr == 0) {
  2496. /* no data anymore */
  2497. return (EOF);
  2498. }
  2499. if (skipws) {
  2500. /* skip leading ws */
  2501. while (*bufptr) {
  2502. if (*bufptr == ' ') {
  2503. } else if (*bufptr == '\n') {
  2504. hllineno++;
  2505. } else if (*bufptr == '\r') {
  2506. } else if (*bufptr == '\f') {
  2507. } else if (*bufptr == '\t') {
  2508. } else {
  2509. break;
  2510. }
  2511. bufptr++;
  2512. }
  2513. } else {
  2514. skipws = 1;
  2515. }
  2516. if (*bufptr == 0) {
  2517. /* no data anymore */
  2518. return (EOF);
  2519. }
  2520. if (*bufptr == '<') {
  2521. /* fill tag buffer */
  2522. for (j = 0; j < buflen; j++) {
  2523. tbuf[j] = 0;
  2524. }
  2525. j = 0;
  2526. while (*bufptr) {
  2527. if (*bufptr == '>') {
  2528. tbuf[j] = *bufptr;
  2529. j++;
  2530. bufptr++;
  2531. break;
  2532. }
  2533. tbuf[j] = *bufptr;
  2534. j++;
  2535. bufptr++;
  2536. }
  2537. if (j == 0) {
  2538. return (EOF);
  2539. }
  2540. /* start lexing from buffer */
  2541. buffer = yy_scan_string(tbuf);
  2542. clearit = 1;
  2543. /* lex tag buffer */
  2544. pending = 1;
  2545. continue;
  2546. } else {
  2547. /* fill data buffer */
  2548. for (j = 0; j < buflen; j++) {
  2549. dbuf[j] = 0;
  2550. }
  2551. j = 0;
  2552. p = dbuf;
  2553. while (*bufptr) {
  2554. if (*bufptr == '<') {
  2555. break;
  2556. }
  2557. /* update yylineno */
  2558. if (*bufptr == '\n') {
  2559. hllineno++;
  2560. }
  2561. p[j] = *bufptr;
  2562. j++;
  2563. bufptr++;
  2564. }
  2565. if (j == 0) {
  2566. return (EOF);
  2567. }
  2568. pending = 0;
  2569. /* return copy of the data area */
  2570. hlylval.string = dp_uniqstr(dbuf);
  2571. if (hlydebug) {
  2572. printf("token HL_DATA \"%s\"\n", hlylval.string);
  2573. }
  2574. return (HL_DATA);
  2575. }
  2576. }
  2577. }
  2578. /* shouldnothappen */
  2579. printf("%s(): huh?\n", __func__);
  2580. return (EOF);
  2581. }
  2582. /* end */