on master help sign in
Fix name parsing for nested namespaces
9f65713Edwin Brady
src/Core/CoreParser.hs+2−2
@@ -60,11 +60,11 @@ pTestFile = do p <- many1 pDef ; eof
60iName :: [String] -> CParser a Name
60iName :: [String] -> CParser a Name
61iName bad = do x <- identifier
61iName bad = do x <- identifier
62 when (x `elem` bad) $ fail "Reserved identifier"
62 when (x `elem` bad) $ fail "Reserved identifier"
63− return $ mkNS (parseName x)
63+ return $ mkNS (reverse (parseName x))
64 where
64 where
65 mkNS [x] = UN x
65 mkNS [x] = UN x
66 mkNS (x:xs) = NS (UN x) xs
66 mkNS (x:xs) = NS (UN x) xs
67− parseName x = reverse $ case span (/= '.') x of
67+ parseName x = case span (/= '.') x of
68 (x, "") -> [x]
68 (x, "") -> [x]
69 (x, '.':y) -> x : parseName y
69 (x, '.':y) -> x : parseName y
70
70
src/Core/TT.hs+1−1
@@ -97,7 +97,7 @@ data Name = UN String
97
97
98instance Show Name where
98instance Show Name where
99 show (UN n) = n
99 show (UN n) = n
100− show (NS n s) = showSep "." s ++ "." ++ show n
100+ show (NS n s) = showSep "." (reverse s) ++ "." ++ show n
101 show (MN i s) = "{" ++ s ++ show i ++ "}"
101 show (MN i s) = "{" ++ s ++ show i ++ "}"
102
102
103
103