on master help sign in
Merge pull request #55 from raichoo/master
835b438Edwin Brady
src/Idris/Parser.hs+12−8
@@ -279,14 +279,18 @@ parseProg syn fname input pos
279collect :: [PDecl] -> [PDecl]
279collect :: [PDecl] -> [PDecl]
280collect (c@(PClauses _ o _ _) : ds)
280collect (c@(PClauses _ o _ _) : ds)
281 = clauses (cname c) [] (c : ds)
281 = clauses (cname c) [] (c : ds)
282− where clauses n acc (PClauses fc _ _ [PClause fc' n' l ws r w] : ds)
282+ where clauses j@(Just n) acc (PClauses fc _ _ [PClause fc' n' l ws r w] : ds)
283− | n == n' = clauses n (PClause fc' n' l ws r (collect w) : acc) ds
283+ | n == n' = clauses j (PClause fc' n' l ws r (collect w) : acc) ds
284− clauses n acc (PClauses fc _ _ [PWith fc' n' l ws r w] : ds)
284+ clauses j@(Just n) acc (PClauses fc _ _ [PWith fc' n' l ws r w] : ds)
285− | n == n' = clauses n (PWith fc' n' l ws r (collect w) : acc) ds
285+ | n == n' = clauses j (PWith fc' n' l ws r (collect w) : acc) ds
286− clauses n acc xs = PClauses (getfc c) o n (reverse acc) : collect xs
286+ clauses (Just n) acc xs = PClauses (getfc c) o n (reverse acc) : collect xs
287−
287+ clauses Nothing acc (x:xs) = collect xs
288+ clauses Nothing acc [] = []
289+
288− cname (PClauses fc _ _ [PClause _ n _ _ _ _]) = n
290+ cname (PClauses fc _ _ [PClause _ n _ _ _ _]) = Just n
289− cname (PClauses fc _ _ [PWith _ n _ _ _ _]) = n
291+ cname (PClauses fc _ _ [PWith _ n _ _ _ _]) = Just n
292+ cname (PClauses fc _ _ [PClauseR _ _ _ _]) = Nothing
293+ cname (PClauses fc _ _ [PWithR _ _ _ _]) = Nothing
290 getfc (PClauses fc _ _ _) = fc
294 getfc (PClauses fc _ _ _) = fc
291
295
292collect (PParams f ns ps : ds) = PParams f ns (collect ps) : collect ds
296collect (PParams f ns ps : ds) = PParams f ns (collect ps) : collect ds