anchor.diff:           , unit/0
            , wget_parse/1,wget_print/1]).
   
  +-define(ok(X),$a=<X,X=<$z;$A=<X,X=<$Z;$0=<X,X=<$9;X==$_;X==$-;X==$:).
   -define(ws(X),X==$\s ;X==$\r;X==$\n;X==$\t).
   -define(endv(S),?ws(hd(S));hd(S)==$>;hd(S)==$/,hd(tl(S))==$>;hd(S)==$=).
   -define(dq(Z),Z==$").
   -define(sq(Z),Z==$').
   
   sax(Str,Fun,Acc) ->
  -  try parse({Fun,Acc,[]},tz(nil,Str))
  -  catch C:R -> err(C,R,Str)
  -  end.
  -
  -err(C,R,Str) ->
  -  case erlang:get_stacktrace() of
  -    [{M,tz,[State,EStr]}|_] -> {{C,R},M,tz,State,err_pos(Str,EStr)};
  -    ST -> io:fwrite("~p:~p~n~p~n~p~n",[C,R,ST,Str])
  -  end.
  -
  -err_pos(Str1,Str2) -> err_pos(Str1,Str2,20).
  -err_pos(Str1,Str2,Sz) ->
  -  Str = lists:sublist(Str1,length(Str1)-length(Str2)),
  -  {lists:reverse(lists:sublist(lists:reverse(Str),Sz)),lists:sublist(Str2,Sz)}.
  -
  -parse(State,{TZ,Str})  -> parse(State,tz(TZ,Str));
  -parse({Fun,Acc,Stack}=State,{TZ,Str,Token}) -> 
  +  parse(Str,Fun,Acc).
  +
  +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  +%% parser
  +parse(Str,Fun,Acc) ->
  +  parse({Fun,Acc,[]},tokenize(Str)).
  +
  +parse(State,[Token1,Token2,T]) ->
  +  parse(maybe_emit(Token2,maybe_emit(Token1,State)),T);
  +parse(State,[Token,T]) ->
  +  parse(maybe_emit(Token,State),T);
  +parse({Fun,Acc,Stack}=State,{Token,T}) -> 
     case Token of
       eof -> eof(unroll(Stack,{Fun,Acc,[]}));
  -    _   -> parse(maybe_emit(Token,State),tz(TZ,Str))
  +    _   -> parse(maybe_emit(Token,State),tokenize(T))
     end.
   
   eof({_Fun,Acc,_Stack}) -> Acc.
  
positive.code: ff(What,Str) ->
    case ff(Str,ff(What),[1,2]) of
      [Scr,Rest] -> {{tag,""},ws(Rest),{text,Scr}};
      [] -> {{text,Str},""}
    end.
  
  ff(script)-> "(.*)<(\\s*/\\s*script\\s*>.*)\$";
  
negative.code:      {"<tag catt xatt=\"\" batt>",
        [{tag,"tag",[{"catt",""},{"xatt",""},{"batt",""}]},
         {end_tag,"tag"}]},
       {"<a>...<...</a>",
        [{tag,"a",[]},
         {text,"...&lt;..."},
         {end_tag,"a"}]},
       {"<P a=b c=d>hej<!-- tobbe --><b>svejsan</b>foo</p>grump<x x=y />",
        [{tag,"p",[{"a","b"},{"c","d"}]},
         {text,"hej"},
  