rvirding/lfe — pull request #62 by redpine50 (2014-04-09 16:50:00+00:00)
Title: Develop

Made integer with radix 17 ~ 36 to work like Erlang. Currently it does not, for example.
```
> #36rFF
555
> #36rGG
exception exit: #(error #(1 lfe_scan #(user "illegal based number")) 1)
in (lfe_io scan_and_parse 3)
in (lfe_shell server_loop 1)
in (erl_eval do_apply 6)
in (shell exprs 7)
in (shell eval_exprs 7)
in (shell eval_loop 3)

> #37rFF
570
```

Changes in lfe_scan.xrl
```
#([0]?[2-9]|[12][0-9]|3[0-6])[rR]{B36}+ :
%% Have to scan all possible digit chars and fail if wrong.
{Base,[_|Ds]} = base1(string:substr(TokenChars, 2), 10, 0),
base_token(Ds, Base, TokenLine).

base1([C|Cs], Base, SoFar) when C >= $0, C =< $9, C < Base + $0 ->
Next = SoFar * Base + (C - $0),
base1(Cs, Base, Next);
base1([C|Cs], Base, SoFar) when C >= $a, C =< $z, C < Base + $a - 10 ->
Next = SoFar * Base + (C - $a + 10),
base1(Cs, Base, Next);
base1([C|Cs], Base, SoFar) when C >= $A, C =< $Z, C < Base + $A - 10 ->
Next = SoFar * Base + (C - $A + 10),
base1(Cs, Base, Next);
base1([C|Cs], _Base, SoFar) -> {SoFar,[C|Cs]};
base1([], _Base, N) -> {N,[]}.
```

After the change it works like below.
```
> #36rFF
555
> #36Rgg
592
> #37rFF
exception exit: #(error #(1 lfe_scan #(illegal "#37")) 1)
in (lfe_io scan_and_parse 3)
in (lfe_shell server_loop 1)
in (erl_eval do_apply 6)
in (shell exprs 7)
in (shell eval_exprs 7)
in (shell eval_loop 3)

>
```