diff options
author | Ori Bernstein <ori@eigenstate.org> | 2014-01-21 23:32:24 -0500 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2014-01-21 23:32:24 -0500 |
commit | 913e7e12f5b204bc53b3761e9cd89a5cd5722c6a (patch) | |
tree | df2fe83c9af23e9b0ca22e425cf05d13789cd371 /libstd/intparse.myr | |
parent | 906384e5b4f4d1dfbf045184717668fe99610d53 (diff) | |
download | mc-913e7e12f5b204bc53b3761e9cd89a5cd5722c6a.tar.gz |
Shuffle things around so that it works with the chartype commit.
Diffstat (limited to 'libstd/intparse.myr')
-rw-r--r-- | libstd/intparse.myr | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/libstd/intparse.myr b/libstd/intparse.myr index 9739cab..991a336 100644 --- a/libstd/intparse.myr +++ b/libstd/intparse.myr @@ -1,3 +1,4 @@ +use "chartype.use" use "die.use" use "fmt.use" use "hasprefix.use" @@ -64,20 +65,3 @@ generic doparse = {s, isneg, base -> `Some v ;; } - -generic charval = {c, base - var v = -1 - - if c >= '0' && c <= '9' - v = (c - '0') castto(@a::(tcint,tcnum,tctest)) - elif c >= 'a' && c <= 'z' - v = (c - 'a' + 10) castto(@a::(tcint,tcnum,tctest)) - elif c >= 'A' && c <= 'Z' - v = (c - 'A' + 10) castto(@a::(tcint,tcnum,tctest)) - ;; - - if v < 0 || v > (base castto(@a::(tcint,tcnum,tctest))) - -> -1 - ;; - -> v -} |