on master help sign in
Fix name parsing for nested namespaces
commit9f6571330be0b46a7fd89b56358efc6084f01359 authorEdwin Brady <eb@cs.st-andrews.ac.uk> dateTue 29 Nov 2011, 11:01 (15 years ago) parentfa5f1cd
2 files changed+3−3
src/Core/CoreParser.hs+2−2 src/Core/TT.hs+1−1
src/Core/CoreParser.hs+2−2
@@ -60,11 +60,11 @@ pTestFile = do p <- many1 pDef ; eof
6060iName :: [String] -> CParser a Name
6161iName bad = do x <- identifier
6262 when (x `elem` bad) $ fail "Reserved identifier"
63− return $ mkNS (parseName x)
63+ return $ mkNS (reverse (parseName x))
6464 where
6565 mkNS [x] = UN x
6666 mkNS (x:xs) = NS (UN x) xs
67− parseName x = reverse $ case span (/= '.') x of
67+ parseName x = case span (/= '.') x of
6868 (x, "") -> [x]
6969 (x, '.':y) -> x : parseName y
7070
src/Core/TT.hs+1−1
@@ -97,7 +97,7 @@ data Name = UN String
9797
9898instance Show Name where
9999 show (UN n) = n
100− show (NS n s) = showSep "." s ++ "." ++ show n
100+ show (NS n s) = showSep "." (reverse s) ++ "." ++ show n
101101 show (MN i s) = "{" ++ s ++ show i ++ "}"
102102
103103