all tests are green

This commit is contained in:
Ilya Rezvov
2021-04-19 17:17:25 -07:00
parent 5f28711f6d
commit 54c3cfd697
3 changed files with 10 additions and 4 deletions
+6 -1
View File
@@ -7,7 +7,8 @@ module Language.Wasm.Lexer (
AlexPosn(..),
scanner,
asFloat,
asDouble
asDouble,
doubleFromInteger
) where
import qualified Data.ByteString.Lazy as LBS
@@ -20,6 +21,7 @@ import Data.Word (Word8, Word64)
import Data.List (isPrefixOf)
import Text.Read (readEither)
import Data.Bits
import Numeric (showHex)
}
@@ -267,6 +269,9 @@ asDouble (NanRep (NanHex isPos payload)) =
then return $ (if isPos then id else negate) $ makeNaN payload
else Left "constant out of range"
doubleFromInteger :: Integer -> Either String Double
doubleFromInteger int = asDouble . HexRep . ((if int < 0 then "-0x" else "0x") ++) . flip showHex "" $ abs int
startBlockComment :: AlexAction Lexeme
startBlockComment _inp _len = do
depth <- getLexerCommentDepth