B Ò6}™CÊsã@s dZddlZddlZe d¡Zd dd„Zdd„Zedkrœeej ƒd krVe ej d ƒZ nej Z eej ƒd kr|e ej d d ƒZ nejZ e  ¡ZeeƒZee eƒdS) a¥ Utility for parsing HTML entity definitions available from: http://www.w3.org/ as e.g. http://www.w3.org/TR/REC-html40/HTMLlat1.ent Input is read from stdin, output is written to stdout in form of a Python snippet defining a dictionary "entitydefs" mapping literal entity name to character or numeric entity. Marc-Andre Lemburg, mal@lemburg.com, 1999. Use as you like. NO WARRANTIES. éNz8cCsXd}|dkrt|ƒ}i}x:t |||¡}|s.P| ¡\}}}||f||<| ¡}qW|S)Nr)ÚlenÚentityREÚsearchÚgroupsÚend)ÚtextÚposÚendposÚdÚmÚnameÚcharcodeÚcomment©rú@/opt/alt/python37/lib64/python3.7/Tools/scripts/parseentities.pyÚparses  rcCs | d¡t| ¡ƒ}xz|D]r\}\}}|dd…dkrdt|dd…ƒ}|dkrZd|}qlt|ƒ}nt|ƒ}d | ¡¡}| d|||f¡qW| d ¡dS) Nzentitydefs = { éz&#éÿÿÿÿéz'\%o'ú z '%s': %s, # %s z } )ÚwriteÚsortedÚitemsÚintÚreprÚjoinÚsplit)ÚfÚdefsrr r rÚcoderrrÚ writefile"s    r Ú__main__érÚw)rN)Ú__doc__ÚreÚsysÚcompilerrr Ú__name__rÚargvÚopenZinfileÚstdinZoutfileÚstdoutÚreadrrrrrrÚs