projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Handle hierarchical module names in External Core tools
[ghc-hetmet.git]
/
utils
/
ext-core
/
ParseGlue.hs
diff --git
a/utils/ext-core/ParseGlue.hs
b/utils/ext-core/ParseGlue.hs
index
9bd3c4f
..
7335656
100644
(file)
--- a/
utils/ext-core/ParseGlue.hs
+++ b/
utils/ext-core/ParseGlue.hs
@@
-1,8
+1,16
@@
module ParseGlue where
module ParseGlue where
+import Encoding
+
+import Data.List
+
data ParseResult a = OkP a | FailP String
type P a = String -> Int -> ParseResult a
data ParseResult a = OkP a | FailP String
type P a = String -> Int -> ParseResult a
+instance Show a => Show (ParseResult a)
+ where show (OkP r) = show r
+ show (FailP s) = s
+
thenP :: P a -> (a -> P b) -> P b
m `thenP` k = \ s l ->
case m s l of
thenP :: P a -> (a -> P b) -> P b
m `thenP` k = \ s l ->
case m s l of
@@
-53,7
+61,13
@@
data Token =
| TKchar Char
| TKEOF
| TKchar Char
| TKEOF
-
+-- ugh
+splitModuleName mn =
+ let decoded = zDecodeString mn
+ parts = filter (notElem '.') $ groupBy
+ (\ c1 c2 -> c1 /= '.' && c2 /= '.')
+ decoded in
+ (take (length parts - 1) parts, last parts)