on master help sign in
use EF.Float in when parsing numbers
commit33d1a204903a574a0bf1fb21a398999ff0aad66e authorEvan Czaplicki <evancz@users.noreply.github.com> dateMon 3 Jun 2019, 11:51 (7 years ago) parentbdff44c
1 file changed+8−8
compiler/src/Parse/Number.hs+8−8
compiler/src/Parse/Number.hs+8−8
@@ -11,11 +11,11 @@ module Parse.Number
1111 where
1212
1313
14−import qualified Data.Utf8 as Utf8
1514import Data.Word (Word8)
1615import Foreign.Ptr (Ptr, plusPtr, minusPtr)
1716
1817import qualified AST.Utils.Binop as Binop
18+import qualified Elm.Float as EF
1919import Parse.Primitives (Parser, Row, Col)
2020import qualified Parse.Variable as Var
2121import qualified Parse.Primitives as P
@@ -43,12 +43,12 @@ isDecimalDigit word =
4343
4444data Number
4545 = Int Int
46− | Float (Utf8.Under256 Float)
46+ | Float EF.Float
4747
4848
4949number :: (Row -> Col -> x) -> (E.Number -> Row -> Col -> x) -> Parser x Number
5050number toExpectation toError =
51− P.Parser $ \(P.State pos end indent row col) cok _ cerr eerr ->
51+ P.Parser $ \(P.State src pos end indent row col) cok _ cerr eerr ->
5252 if pos >= end then
5353 eerr row col toExpectation
5454
@@ -76,16 +76,16 @@ number toExpectation toError =
7676 let
7777 !newCol = col + fromIntegral (minusPtr newPos pos)
7878 !integer = Int n
79− !newState = P.State newPos end indent row newCol
79+ !newState = P.State src newPos end indent row newCol
8080 in
8181 cok integer newState
8282
8383 OkFloat newPos ->
8484 let
8585 !newCol = col + fromIntegral (minusPtr newPos pos)
86− !copy = Utf8.fromPtr pos newPos
86+ !copy = EF.fromPtr pos newPos
8787 !float = Float copy
88− !newState = P.State newPos end indent row newCol
88+ !newState = P.State src newPos end indent row newCol
8989 in
9090 cok float newState
9191
@@ -290,7 +290,7 @@ stepHex pos end word acc
290290
291291precedence :: (Row -> Col -> x) -> Parser x Binop.Precedence
292292precedence toExpectation =
293− P.Parser $ \(P.State pos end indent row col) cok _ _ eerr ->
293+ P.Parser $ \(P.State src pos end indent row col) cok _ _ eerr ->
294294 if pos >= end then
295295 eerr row col toExpectation
296296
@@ -299,7 +299,7 @@ precedence toExpectation =
299299 if isDecimalDigit word then
300300 cok
301301 (Binop.Precedence (fromIntegral (word - 0x30 {-0-})))
302− (P.State (plusPtr pos 1) end indent row (col + 1))
302+ (P.State src (plusPtr pos 1) end indent row (col + 1))
303303
304304 else
305305 eerr row col toExpectation