# 18 "htmlscan.mll" module StringSet = Set.Make(String) module StringMap = Map.Make(String) let re_url_encoding = Str.regexp "%\\([0-9A-Fa-f][0-9A-Fa-f]\\)" let decode_url_percent s = let n = int_of_string ("0x" ^ Str.matched_group 1 s) in String.make 1 (Char.chr n) let decode_url s = Str.global_substitute re_url_encoding decode_url_percent s let entity_table = List.fold_left (fun t (s, c) -> StringMap.add s c t) StringMap.empty ["amp", '&'; "lt", '<'; "gt", '>'; "nbsp", '\160'; "Agrave", '\192'; "Aacute", '\193'; "Acirc", '\194'; "Atilde", '\195'; "Auml", '\196'; "Aring", '\197'; "AElig", '\198'; "Ccedil", '\199'; "Egrave", '\200'; "Eacute", '\201'; "Ecirc", '\202'; "Euml", '\203'; "Igrave", '\204'; "Iacute", '\205'; "Icirc", '\206'; "Iuml", '\207'; "ETH", '\208'; "Ntilde", '\209'; "Ograve", '\210'; "Oacute", '\211'; "Ocirc", '\212'; "Otilde", '\213'; "Ouml", '\214'; "times", '\215'; "Oslash", '\216'; "Ugrave", '\217'; "Uacute", '\218'; "Ucirc", '\219'; "Uuml", '\220'; "Yacute", '\221'; "THORN", '\222'; "szlig", '\223'; "agrave", '\224'; "aacute", '\225'; "acirc", '\226'; "atilde", '\227'; "auml", '\228'; "aring", '\229'; "aelig", '\230'; "ccedil", '\231'; "egrave", '\232'; "eacute", '\233'; "ecirc", '\234'; "euml", '\235'; "igrave", '\236'; "iacute", '\237'; "icirc", '\238'; "iuml", '\239'; "eth", '\240'; "ntilde", '\241'; "ograve", '\242'; "oacute", '\243'; "ocirc", '\244'; "otilde", '\245'; "ouml", '\246'; "divide", '\247'; "oslash", '\248'; "ugrave", '\249'; "uacute", '\250'; "ucirc", '\251'; "uuml", '\252'; "yacute", '\253'; "thorn", '\254'; "yuml", '\255'] let word_breaking_tags = List.fold_right StringSet.add [ "p"; "br"; "ul"; "ol"; "dt"; "li"; "dd"; "table"; "tr"; "th"; "td"; "img"; "div"; "blockquote"; "h1"; "h2"; "h3"; "h4"; "h5"; "h6"; "address" ] StringSet.empty module Output = struct type t = { txt: Buffer.t; extra: Buffer.t } let create() = { txt = Buffer.create 2048; extra = Buffer.create 256 } let clear ob = Buffer.clear ob.txt; Buffer.clear ob.extra let contents ob = Buffer.add_char ob.txt '\n'; Buffer.add_buffer ob.txt ob.extra; Buffer.contents ob.txt let char ob c = Buffer.add_char ob.txt c let string ob s = Buffer.add_string ob.txt s let add_extra ob s = Buffer.add_string ob.extra s; Buffer.add_char ob.extra '\n' let tag ob t = if StringSet.mem t word_breaking_tags then char ob ' '; if !Config.html_add_tags then add_extra ob t let tag_attr ob t n s = let n = String.lowercase n in if Str.string_match !Config.html_tag_attr (t ^ "/" ^ n) 0 then if n = "href" || n = "src" then add_extra ob (decode_url s) else add_extra ob s end let ob = Output.create() let tag = ref "" let attr_name = ref "" let attr_value = Buffer.create 128 # 94 "htmlscan.ml" let __ocaml_lex_tables = { Lexing.lex_base = "\000\000\248\255\249\255\000\000\251\255\000\000\131\000\209\000\ \255\255\031\001\250\255\160\000\253\255\254\255\096\001\252\255\ \174\001\000\000\002\000\030\000\032\002\037\002\011\000\014\000\ \035\002\113\002\003\002\024\002\000\000"; Lexing.lex_backtrk = "\255\255\255\255\255\255\006\000\255\255\003\000\255\255\001\000\ \255\255\002\000\255\255\255\255\255\255\255\255\255\255\255\255\ \001\000\001\000\000\000\255\255\003\000\002\000\255\255\255\255\ \002\000\001\000\255\255\000\000\000\000"; Lexing.lex_default = "\002\000\000\000\000\000\255\255\000\000\255\255\255\255\255\255\ \000\000\255\255\000\000\013\000\000\000\000\000\012\000\000\000\ \255\255\255\255\255\255\255\255\021\000\021\000\012\000\012\000\ \255\255\255\255\255\255\255\255\255\255"; Lexing.lex_trans = "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\019\000\019\000\018\000\018\000\019\000\000\000\018\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \019\000\008\000\018\000\000\000\000\000\000\000\004\000\019\000\ \019\000\000\000\000\000\019\000\000\000\000\000\000\000\006\000\ \008\000\013\000\008\000\000\000\013\000\000\000\000\000\000\000\ \000\000\000\000\000\000\008\000\005\000\018\000\019\000\000\000\ \000\000\007\000\007\000\007\000\007\000\007\000\007\000\007\000\ \007\000\007\000\007\000\007\000\007\000\007\000\007\000\007\000\ \007\000\007\000\007\000\007\000\007\000\007\000\007\000\007\000\ \007\000\007\000\007\000\018\000\000\000\000\000\000\000\000\000\ \000\000\007\000\007\000\007\000\007\000\007\000\007\000\007\000\ \007\000\007\000\007\000\007\000\007\000\007\000\007\000\007\000\ \007\000\007\000\007\000\007\000\007\000\007\000\007\000\007\000\ \007\000\007\000\007\000\000\000\000\000\000\000\000\000\000\000\ \010\000\010\000\010\000\010\000\010\000\010\000\010\000\010\000\ \010\000\010\000\010\000\010\000\010\000\010\000\010\000\010\000\ \010\000\010\000\010\000\010\000\010\000\010\000\010\000\010\000\ \010\000\010\000\010\000\010\000\010\000\010\000\010\000\010\000\ \010\000\010\000\010\000\010\000\010\000\010\000\010\000\010\000\ \010\000\010\000\010\000\010\000\010\000\010\000\010\000\010\000\ \010\000\010\000\010\000\010\000\010\000\010\000\010\000\010\000\ \010\000\010\000\010\000\010\000\010\000\010\000\010\000\010\000\ \000\000\000\000\003\000\003\000\009\000\009\000\009\000\009\000\ \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\ \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\ \009\000\009\000\009\000\009\000\009\000\009\000\008\000\000\000\ \000\000\000\000\000\000\000\000\009\000\009\000\009\000\009\000\ \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\ \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\ \009\000\009\000\009\000\009\000\009\000\009\000\007\000\007\000\ \001\000\007\000\007\000\007\000\007\000\007\000\007\000\007\000\ \007\000\007\000\007\000\008\000\000\000\000\000\008\000\000\000\ \000\000\000\000\007\000\007\000\007\000\007\000\007\000\007\000\ \007\000\007\000\007\000\007\000\007\000\007\000\007\000\007\000\ \007\000\007\000\007\000\007\000\007\000\007\000\007\000\007\000\ \007\000\007\000\007\000\007\000\000\000\000\000\000\000\000\000\ \000\000\000\000\007\000\007\000\007\000\007\000\007\000\007\000\ \007\000\007\000\007\000\007\000\007\000\007\000\007\000\007\000\ \007\000\007\000\007\000\007\000\007\000\007\000\007\000\007\000\ \007\000\007\000\007\000\007\000\009\000\009\000\000\000\009\000\ \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\ \009\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\ \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\ \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\ \009\000\009\000\000\000\000\000\000\000\000\000\000\000\000\000\ \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\ \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\ \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\ \009\000\009\000\000\000\000\000\000\000\000\000\008\000\000\000\ \012\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \016\000\016\000\016\000\000\000\000\000\000\000\000\000\000\000\ \000\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \016\000\016\000\016\000\016\000\016\000\000\000\016\000\016\000\ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\016\000\ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \016\000\000\000\000\000\000\000\000\000\000\000\000\000\016\000\ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \016\000\255\255\255\255\000\000\000\000\255\255\255\255\255\255\ \000\000\000\000\255\255\027\000\027\000\027\000\027\000\027\000\ \027\000\027\000\027\000\027\000\027\000\000\000\000\000\000\000\ \255\255\000\000\013\000\000\000\000\000\255\255\026\000\008\000\ \027\000\027\000\027\000\027\000\027\000\027\000\027\000\027\000\ \027\000\027\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\255\255\000\000\ \015\000\000\000\000\000\255\255\025\000\025\000\025\000\025\000\ \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\ \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\ \025\000\025\000\025\000\025\000\025\000\025\000\000\000\000\000\ \000\000\000\000\000\000\000\000\025\000\025\000\025\000\025\000\ \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\ \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\ \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\ \000\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\ \025\000\025\000\025\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\025\000\025\000\025\000\025\000\025\000\025\000\ \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\ \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\ \025\000\025\000\025\000\025\000\000\000\000\000\000\000\000\000\ \000\000\000\000\025\000\025\000\025\000\025\000\025\000\025\000\ \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\ \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\ \025\000\025\000\025\000\025\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \255\255\000\000\000\000\000\000\000\000\255\255\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\ \000\000\000\000"; Lexing.lex_check = "\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\017\000\017\000\018\000\018\000\017\000\255\255\018\000\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \017\000\005\000\018\000\255\255\255\255\255\255\000\000\019\000\ \019\000\255\255\255\255\019\000\255\255\255\255\255\255\005\000\ \023\000\022\000\022\000\255\255\023\000\255\255\255\255\255\255\ \255\255\255\255\255\255\028\000\000\000\017\000\019\000\255\255\ \255\255\005\000\005\000\005\000\005\000\005\000\005\000\005\000\ \005\000\005\000\005\000\005\000\005\000\005\000\005\000\005\000\ \005\000\005\000\005\000\005\000\005\000\005\000\005\000\005\000\ \005\000\005\000\005\000\019\000\255\255\255\255\255\255\255\255\ \255\255\005\000\005\000\005\000\005\000\005\000\005\000\005\000\ \005\000\005\000\005\000\005\000\005\000\005\000\005\000\005\000\ \005\000\005\000\005\000\005\000\005\000\005\000\005\000\005\000\ \005\000\005\000\005\000\255\255\255\255\255\255\255\255\255\255\ \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\ \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\ \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\ \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\ \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\ \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\ \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\ \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\ \255\255\255\255\000\000\000\000\006\000\006\000\006\000\006\000\ \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\ \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\ \006\000\006\000\006\000\006\000\006\000\006\000\011\000\255\255\ \255\255\255\255\255\255\255\255\006\000\006\000\006\000\006\000\ \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\ \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\ \006\000\006\000\006\000\006\000\006\000\006\000\007\000\007\000\ \000\000\007\000\007\000\007\000\007\000\007\000\007\000\007\000\ \007\000\007\000\007\000\022\000\255\255\255\255\023\000\255\255\ \255\255\255\255\007\000\007\000\007\000\007\000\007\000\007\000\ \007\000\007\000\007\000\007\000\007\000\007\000\007\000\007\000\ \007\000\007\000\007\000\007\000\007\000\007\000\007\000\007\000\ \007\000\007\000\007\000\007\000\255\255\255\255\255\255\255\255\ \255\255\255\255\007\000\007\000\007\000\007\000\007\000\007\000\ \007\000\007\000\007\000\007\000\007\000\007\000\007\000\007\000\ \007\000\007\000\007\000\007\000\007\000\007\000\007\000\007\000\ \007\000\007\000\007\000\007\000\009\000\009\000\255\255\009\000\ \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\ \009\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\ \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\ \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\ \009\000\009\000\255\255\255\255\255\255\255\255\255\255\255\255\ \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\ \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\ \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\ \009\000\009\000\255\255\255\255\255\255\255\255\014\000\255\255\ \011\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\ \014\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\ \014\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\ \014\000\014\000\014\000\255\255\255\255\255\255\255\255\255\255\ \255\255\014\000\014\000\014\000\014\000\014\000\014\000\014\000\ \014\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\ \014\000\014\000\014\000\014\000\014\000\014\000\014\000\014\000\ \014\000\014\000\014\000\016\000\016\000\255\255\016\000\016\000\ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\016\000\ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \016\000\255\255\255\255\255\255\255\255\255\255\255\255\016\000\ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\ \016\000\020\000\020\000\255\255\255\255\020\000\021\000\021\000\ \255\255\255\255\021\000\026\000\026\000\026\000\026\000\026\000\ \026\000\026\000\026\000\026\000\026\000\255\255\255\255\255\255\ \020\000\255\255\020\000\255\255\255\255\021\000\024\000\020\000\ \027\000\027\000\027\000\027\000\027\000\027\000\027\000\027\000\ \027\000\027\000\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\020\000\255\255\ \014\000\255\255\255\255\021\000\024\000\024\000\024\000\024\000\ \024\000\024\000\024\000\024\000\024\000\024\000\024\000\024\000\ \024\000\024\000\024\000\024\000\024\000\024\000\024\000\024\000\ \024\000\024\000\024\000\024\000\024\000\024\000\255\255\255\255\ \255\255\255\255\255\255\255\255\024\000\024\000\024\000\024\000\ \024\000\024\000\024\000\024\000\024\000\024\000\024\000\024\000\ \024\000\024\000\024\000\024\000\024\000\024\000\024\000\024\000\ \024\000\024\000\024\000\024\000\024\000\024\000\025\000\025\000\ \255\255\025\000\025\000\025\000\025\000\025\000\025\000\025\000\ \025\000\025\000\025\000\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\025\000\025\000\025\000\025\000\025\000\025\000\ \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\ \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\ \025\000\025\000\025\000\025\000\255\255\255\255\255\255\255\255\ \255\255\255\255\025\000\025\000\025\000\025\000\025\000\025\000\ \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\ \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\ \025\000\025\000\025\000\025\000\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \020\000\255\255\255\255\255\255\255\255\021\000\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\ \255\255\255\255"; Lexing.lex_base_code = ""; Lexing.lex_backtrk_code = ""; Lexing.lex_default_code = ""; Lexing.lex_trans_code = ""; Lexing.lex_check_code = ""; Lexing.lex_code = ""; } let rec main lexbuf = __ocaml_lex_main_rec lexbuf 0 and __ocaml_lex_main_rec lexbuf __ocaml_lex_state = match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with | 0 -> # 117 "htmlscan.mll" ( comment lexbuf; main lexbuf ) # 356 "htmlscan.ml" | 1 -> # 119 "htmlscan.mll" ( let s = Lexing.lexeme lexbuf in tag := String.lowercase(String.sub s 1 (String.length s - 1)); tagbody lexbuf; main lexbuf ) # 364 "htmlscan.ml" | 2 -> # 124 "htmlscan.mll" ( let s = Lexing.lexeme lexbuf in tag := String.lowercase(String.sub s 2 (String.length s - 2)); tagbody lexbuf; main lexbuf ) # 372 "htmlscan.ml" | 3 -> # 129 "htmlscan.mll" ( Output.char ob '<'; main lexbuf ) # 377 "htmlscan.ml" | 4 -> # 131 "htmlscan.mll" ( Output.char ob (entity lexbuf); main lexbuf ) # 382 "htmlscan.ml" | 5 -> # 135 "htmlscan.mll" ( let a = Char.code (Lexing.lexeme_char lexbuf 0) and b = Char.code (Lexing.lexeme_char lexbuf 1) in Output.char ob (Char.chr (((a land 0x3) lsl 6) lor (b land 0x3F))); main lexbuf ) # 390 "htmlscan.ml" | 6 -> # 140 "htmlscan.mll" ( Output.char ob (Lexing.lexeme_char lexbuf 0); main lexbuf ) # 395 "htmlscan.ml" | 7 -> # 142 "htmlscan.mll" ( Output.contents ob ) # 400 "htmlscan.ml" | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_main_rec lexbuf __ocaml_lex_state and comment lexbuf = __ocaml_lex_comment_rec lexbuf 11 and __ocaml_lex_comment_rec lexbuf __ocaml_lex_state = match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with | 0 -> # 146 "htmlscan.mll" ( () ) # 411 "htmlscan.ml" | 1 -> # 148 "htmlscan.mll" ( comment lexbuf ) # 416 "htmlscan.ml" | 2 -> # 150 "htmlscan.mll" ( () ) # 421 "htmlscan.ml" | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_comment_rec lexbuf __ocaml_lex_state and tagbody lexbuf = __ocaml_lex_tagbody_rec lexbuf 14 and __ocaml_lex_tagbody_rec lexbuf __ocaml_lex_state = match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with | 0 -> # 154 "htmlscan.mll" ( Output.tag ob !tag ) # 432 "htmlscan.ml" | 1 -> # 156 "htmlscan.mll" ( attr_name := Lexing.lexeme lexbuf; tagattrib lexbuf; tagbody lexbuf ) # 439 "htmlscan.ml" | 2 -> # 160 "htmlscan.mll" ( tagbody lexbuf ) # 444 "htmlscan.ml" | 3 -> # 162 "htmlscan.mll" ( Output.tag ob !tag ) # 449 "htmlscan.ml" | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_tagbody_rec lexbuf __ocaml_lex_state and tagattrib lexbuf = __ocaml_lex_tagattrib_rec lexbuf 17 and __ocaml_lex_tagattrib_rec lexbuf __ocaml_lex_state = match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with | 0 -> # 166 "htmlscan.mll" ( tagvalue lexbuf ) # 460 "htmlscan.ml" | 1 -> # 168 "htmlscan.mll" ( Output.tag_attr ob !tag !attr_name "" ) # 465 "htmlscan.ml" | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_tagattrib_rec lexbuf __ocaml_lex_state and tagvalue lexbuf = __ocaml_lex_tagvalue_rec lexbuf 20 and __ocaml_lex_tagvalue_rec lexbuf __ocaml_lex_state = match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with | 0 -> # 172 "htmlscan.mll" ( Buffer.clear attr_value; singlequoted lexbuf ) # 476 "htmlscan.ml" | 1 -> # 174 "htmlscan.mll" ( Buffer.clear attr_value; doublequoted lexbuf ) # 481 "htmlscan.ml" | 2 -> # 176 "htmlscan.mll" ( Output.tag_attr ob !tag !attr_name (Lexing.lexeme lexbuf) ) # 486 "htmlscan.ml" | 3 -> # 178 "htmlscan.mll" ( Output.tag_attr ob !tag !attr_name "" ) # 491 "htmlscan.ml" | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_tagvalue_rec lexbuf __ocaml_lex_state and singlequoted lexbuf = __ocaml_lex_singlequoted_rec lexbuf 22 and __ocaml_lex_singlequoted_rec lexbuf __ocaml_lex_state = match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with | 0 -> # 182 "htmlscan.mll" ( Output.tag_attr ob !tag !attr_name (Buffer.contents attr_value) ) # 502 "htmlscan.ml" | 1 -> # 184 "htmlscan.mll" ( Buffer.add_char attr_value (entity lexbuf); singlequoted lexbuf ) # 507 "htmlscan.ml" | 2 -> # 186 "htmlscan.mll" ( Buffer.add_char attr_value (Lexing.lexeme_char lexbuf 0); singlequoted lexbuf ) # 513 "htmlscan.ml" | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_singlequoted_rec lexbuf __ocaml_lex_state and doublequoted lexbuf = __ocaml_lex_doublequoted_rec lexbuf 23 and __ocaml_lex_doublequoted_rec lexbuf __ocaml_lex_state = match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with | 0 -> # 191 "htmlscan.mll" ( Output.tag_attr ob !tag !attr_name (Buffer.contents attr_value) ) # 524 "htmlscan.ml" | 1 -> # 193 "htmlscan.mll" ( Buffer.add_char attr_value (entity lexbuf); doublequoted lexbuf ) # 529 "htmlscan.ml" | 2 -> # 195 "htmlscan.mll" ( Buffer.add_char attr_value (Lexing.lexeme_char lexbuf 0); doublequoted lexbuf ) # 535 "htmlscan.ml" | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_doublequoted_rec lexbuf __ocaml_lex_state and entity lexbuf = __ocaml_lex_entity_rec lexbuf 24 and __ocaml_lex_entity_rec lexbuf __ocaml_lex_state = match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with | 0 -> # 200 "htmlscan.mll" ( let s = Lexing.lexeme lexbuf in let n = int_of_string (String.sub s 1 (String.length s - 1)) in entity_end lexbuf; if n >= 0 && n <= 255 then Char.chr n else '\255' ) # 549 "htmlscan.ml" | 1 -> # 205 "htmlscan.mll" ( let s = Lexing.lexeme lexbuf in entity_end lexbuf; try StringMap.find s entity_table with Not_found -> '\255' ) # 556 "htmlscan.ml" | 2 -> # 209 "htmlscan.mll" ( '&' ) # 561 "htmlscan.ml" | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_entity_rec lexbuf __ocaml_lex_state and entity_end lexbuf = __ocaml_lex_entity_end_rec lexbuf 28 and __ocaml_lex_entity_end_rec lexbuf __ocaml_lex_state = match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with | 0 -> # 213 "htmlscan.mll" ( () ) # 572 "htmlscan.ml" | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_entity_end_rec lexbuf __ocaml_lex_state ;; # 215 "htmlscan.mll" let extract_text s = Output.clear ob; main (Lexing.from_string s) # 583 "htmlscan.ml"