@@ -11,11 +11,11 @@ module Parse.Number
14−import qualified Data.Utf8 as Utf8
15import Data.Word (Word8)
14import Data.Word (Word8)
16import Foreign.Ptr (Ptr, plusPtr, minusPtr)
15import Foreign.Ptr (Ptr, plusPtr, minusPtr)
18import qualified AST.Utils.Binop as Binop
17import qualified AST.Utils.Binop as Binop
18+import qualified Elm.Float as EF
19import Parse.Primitives (Parser, Row, Col)
19import Parse.Primitives (Parser, Row, Col)
20import qualified Parse.Variable as Var
20import qualified Parse.Variable as Var
21import qualified Parse.Primitives as P
21import qualified Parse.Primitives as P
@@ -43,12 +43,12 @@ isDecimalDigit word =
44data Number
44data Number
46− | Float (Utf8.Under256 Float)
46+ | Float EF.Float
49number :: (Row -> Col -> x) -> (E.Number -> Row -> Col -> x) -> Parser x Number
49number :: (Row -> Col -> x) -> (E.Number -> Row -> Col -> x) -> Parser x Number
50number toExpectation toError =
50number 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 ->
52 if pos >= end then
52 if pos >= end then
53 eerr row col toExpectation
53 eerr row col toExpectation
@@ -76,16 +76,16 @@ number toExpectation toError =
77 !newCol = col + fromIntegral (minusPtr newPos pos)
77 !newCol = col + fromIntegral (minusPtr newPos pos)
78 !integer = Int n
78 !integer = Int n
79− !newState = P.State newPos end indent row newCol
79+ !newState = P.State src newPos end indent row newCol
81 cok integer newState
81 cok integer newState
83 OkFloat newPos ->
83 OkFloat newPos ->
85 !newCol = col + fromIntegral (minusPtr newPos pos)
85 !newCol = col + fromIntegral (minusPtr newPos pos)
86− !copy = Utf8.fromPtr pos newPos
86+ !copy = EF.fromPtr pos newPos
87 !float = Float copy
87 !float = Float copy
88− !newState = P.State newPos end indent row newCol
88+ !newState = P.State src newPos end indent row newCol
90 cok float newState
90 cok float newState
@@ -290,7 +290,7 @@ stepHex pos end word acc
291precedence :: (Row -> Col -> x) -> Parser x Binop.Precedence
291precedence :: (Row -> Col -> x) -> Parser x Binop.Precedence
292precedence toExpectation =
292precedence 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 ->
294 if pos >= end then
294 if pos >= end then
295 eerr row col toExpectation
295 eerr row col toExpectation
@@ -299,7 +299,7 @@ precedence toExpectation =
299 if isDecimalDigit word then
299 if isDecimalDigit word then
301 (Binop.Precedence (fromIntegral (word - 0x30 {-0-})))
301 (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))
305 eerr row col toExpectation
305 eerr row col toExpectation