anchor.diff:              scan_error({illegal,integer}, Line, Col, Line, Ncol, Cs)
       end.
   
  -scan_based_int([C|Cs], St, Line, Col, Toks, {B,Ncs,Bcs})
  -    when ?DIGIT(C), C < $0+B ->
  +remove_digit_separators(Number) ->
  +    [C || C <- Number, C =/= $_].
  +
  +-define(BASED_DIGIT(C, B),
  +        ((?DIGIT(C) andalso C < $0 + B)
  +         orelse (C >= $A andalso B > 10 andalso C < $A + B - 10)
  +         orelse (C >= $a andalso B > 10 andalso C < $a + B - 10))).
  +
  +scan_based_int([C|Cs], St, Line, Col, Toks, {B,Ncs,Bcs}) when
  +      ?BASED_DIGIT(C, B) ->
       scan_based_int(Cs, St, Line, Col, Toks, {B,[C|Ncs],Bcs});
  -scan_based_int([C|Cs], St, Line, Col, Toks, {B,Ncs,Bcs})
  -    when C >= $A, B > 10, C < $A+B-10 ->
  -    scan_based_int(Cs, St, Line, Col, Toks, {B,[C|Ncs],Bcs});
  -scan_based_int([C|Cs], St, Line, Col, Toks, {B,Ncs,Bcs})
  -    when C >= $a, B > 10, C < $a+B-10 ->
  -    scan_based_int(Cs, St, Line, Col, Toks, {B,[C|Ncs],Bcs});
  -scan_based_int([$_|Cs], St, Line, Col, Toks, {B,Ncs,Bcs}) ->
  -    scan_based_int(Cs, St, Line, Col, Toks, {B,Ncs,Bcs});
  +scan_based_int([$_,Next|Cs], St, Line, Col, Toks, {B,[Prev|_]=Ncs,Bcs}) when
  +      ?BASED_DIGIT(Next, B) andalso ?BASED_DIGIT(Prev, B) ->
  +    scan_based_int(Cs, St, Line, Col, Toks, {B,[Next,$_|Ncs],Bcs});
   scan_based_int([]=Cs, _St, Line, Col, Toks, State) ->
       {more,{Cs,Col,Toks,Line,State,fun scan_based_int/6}};
   scan_based_int(Cs, St, Line, Col, Toks, {B,Ncs0,Bcs}) ->
       Ncs = lists:reverse(Ncs0),
  -    case catch erlang:list_to_integer(Ncs, B) of
  +    case catch erlang:list_to_integer(remove_digit_separators(Ncs), B) of
           N when is_integer(N) ->
               tok3(Cs, St, Line, Col, Toks, integer, Bcs++Ncs, N);
           _ ->
  
positive.code: 
  scan_exponent([C|Cs], St, Line, Col, Toks, Ncs) when ?DIGIT(C) ->
      scan_exponent(Cs, St, Line, Col, Toks, [C|Ncs]);
  scan_exponent([$_|Cs], St, Line, Col, Toks, Ncs) ->
      scan_exponent(Cs, St, Line, Col, Toks, Ncs);
  scan_exponent([]=Cs, _St, Line, Col, Toks, Ncs) ->
      {more,{Cs,Col,Toks,Line,Ncs,fun scan_exponent/6}};
  scan_exponent(Cs, St, Line, Col, Toks, Ncs) ->
  
negative.code: 
  float_end(Cs, St, Line, Col, Toks, Ncs0) ->
      Ncs = lists:reverse(Ncs0),
      case catch list_to_float(remove_digit_separators(Ncs)) of
          F when is_float(F) ->
              tok3(Cs, St, Line, Col, Toks, float, Ncs, F);
          _ ->
  