Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add unbox function

  • Loading branch information...
commit 67500c8b1f920253f16614b3434d71c7c4f23b8f 1 parent f3aba7e
Joni Freeman authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 BytecodeParser.hs
View
7 BytecodeParser.hs
@@ -64,6 +64,9 @@ data CPEntry = Classref NameIdx
newtype Parse a = Parse(L.ByteString -> (a, L.ByteString))
+unbox :: Parse a -> L.ByteString -> a
+unbox (Parse p) bs = fst $ p bs
+
identity :: a -> Parse a
identity a = Parse(\s -> (a, s))
@@ -78,8 +81,7 @@ instance Monad Parse where
-- FIXME cleanup all fromIntegral conversions (perhaps by using Word8?)
parse :: L.ByteString -> Class
-parse = undefined
---parse bs = fst $ parse0 bs
+parse bs = unbox parse0 bs
parse0 :: Parse Class
parse0 = do header <- skipHeader
@@ -141,7 +143,6 @@ skipCodeAttributes = do count <- getNum16
len <- getNum32
Parse(\s -> ((), L.drop (fromIntegral len) s))
--- FIXME notice similarity with 'readFields', 'readMethods', 'readAttributes' and 'readConstantPoolEntries', ...
readInterfaces :: ConstantPool -> Parse [String]
readInterfaces cp = do count <- getNum16
repeatF count (readClassname cp)
Please sign in to comment.
Something went wrong with that request. Please try again.