Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

rename for clarity

  • Loading branch information...
commit 91923cd87df9a468c575977f783c8ffb8c62b980 1 parent 50cc415
Joni Freeman authored
Showing with 15 additions and 7 deletions.
  1. +15 −7 BytecodeParser.hs
View
22 BytecodeParser.hs
@@ -14,16 +14,19 @@ data Class = Class {
, methods :: [Method]
} deriving (Show)
-type Field = String
+data Field = Field {
+ fieldName :: String
+ , fieldType :: String
+ } deriving (Show)
data Method = Method {
- name :: String
+ methodName :: String
, invocations :: [Invocation]
} deriving (Show)
data Invocation = Invocation {
- classFqn :: String
- , method :: String
+ targetClass :: String
+ , targetMethod :: String
} deriving (Show)
type ConstantPool = Map Int CPEntry
@@ -60,6 +63,11 @@ readClassname cp bs = let (classIdx, rem) = getNum16 bs
in cp ! fqnIdx
in (fqn, rem)
+readUtf8 :: ConstantPool -> L.ByteString -> (String, L.ByteString)
+readUtf8 cp bs = let (idx, rem) = getNum16 bs
+ Utf8 s = cp ! idx
+ in (s, rem)
+
skipHeader :: L.ByteString -> L.ByteString
skipHeader = L8.drop 8
skipAccessFlags = L8.drop 2
@@ -73,9 +81,9 @@ readInterfaces cp bs = uncurry readInterface $ getNum16 bs
in (fqn : xs, rem'')
--readFields :: ConstantPool -> L.ByteString -> ([Field], L.ByteString)
---readFields cp bs = let (count, rem) = getNum16 bs
--- in readField count rem
--- where
+--readFields cp bs = uncurry readFile $ getNum16 bs
+-- where readField 0 rem = ([], rem)
+-- readField n rem = let (name, rem') =
readConstantPool :: Int -> L.ByteString -> (ConstantPool, L.ByteString)
readConstantPool n bs = let (entries, rem) = readConstantPoolEntries n bs
Please sign in to comment.
Something went wrong with that request. Please try again.