anchor.diff:      %% This does all the work for us.
       erl_parse:abstract(Lit, L).
   
  -is_posint_list([I|Is]) when is_integer(I), I >= 0 ->
  -    is_posint_list(Is);
  -is_posint_list([]) -> true;
  -is_posint_list(_) -> false.
  -
   %% mapfoldl2(Fun, Acc1, Acc2, List) -> {List,Acc1,Acc2}.
   %%  Like normal mapfoldl but with 2 accumulators.
   
  
positive.code:     {Ep2,Pvs2,Vt2,St2} = to_pat(P2, L, Pvs1, Vt1, St1),
      {{match,L,Ep1,Ep2},Pvs2, Vt2,St2};
  to_pat([_|_]=List, L, Pvs, Vt, St) ->
      case is_posint_list(List) of
          true -> {to_lit(List, L),Pvs,Vt,St};
          false -> illegal_code_error(L, string)
      end.
  
negative.code: to_pats_s(_, L, Pvs, Vt, St, []) -> {{nil,L},Pvs,Vt,St}.
  
  %% to_bitsegs(Segs, LineNumber, VarTable, State) -> {Segs,State}.
  %%  We don't do any real checking here but just assume that everything
  %%  is correct and in worst case pass the buck to the Erlang compiler.
  
  
  to_bitsegs(Ss, L, Vt, St) ->
      Fun = fun (S, St0) -> to_bitseg(S, L, Vt, St0) end,
      mapfoldl(Fun, St, Ss).
  
  to_bitseg([Val|Specs]=Seg, L, Vt, St) ->
      case lfe_lib:is_posint_list(Seg) of
          true ->
              {{bin_element,L,{string,L,Seg},default,default},St};
          false ->
              to_bin_element(Val, Specs, L, Vt, St)
      end;
  to_bitseg(Val, L, Vt, St) ->
      to_bin_element(Val, [], L, Vt, St).
  
  to_bin_element(Val, Specs, L, Vt, St0) ->
      {Eval,St1} = to_expr(Val, L, Vt, St0),
      {Size,Type} = to_bitseg_type(Specs, default, []),
      {Esiz,St2} = to_bin_size(Size, L, Vt, St1),
      {{bin_element,L,Eval,Esiz,Type},St2}.
  
  to_bitseg_type([[size,Size]|Specs], _, Type) ->
      to_bitseg_type(Specs, Size, Type);
  to_bitseg_type([[unit,Unit]|Specs], Size, Type) ->
      to_bitseg_type(Specs, Size, Type ++ [{unit,Unit}]);
  to_bitseg_type([Spec|Specs], Size, Type) ->
      to_bitseg_type(Specs, Size, Type ++ [Spec]);
  to_bitseg_type([], Size, []) -> {Size,default};
  to_bitseg_type([], Size, Type) -> {Size,Type}.
  
  to_bin_size(all, _, _, St) -> {default,St};
  to_bin_size(default, _, _, St) -> {default,St};
  to_bin_size(undefined, _, _, St) -> {default,St};
  to_bin_size(Size, L, Vt, St) -> to_expr(Size, L, Vt, St).
  
  %% to_map_set(Map, Pairs, L, Vt, State) -> {MapSet,State}.
  %% to_map_update(Map, Pairs, L, Vt, State) -> {MapUpdate,State}.
  %% to_map_remove(Map, Keys, L, Vt, State) -> {MapRemove,State}.
  