1
0
forked from GitHub/gf-core

store and propagate the exact source location for all judgements in the grammar. It may not be used accurately in the error messages yet

This commit is contained in:
krasimir
2010-03-22 21:15:29 +00:00
parent d1615144b6
commit d3a84f994b
23 changed files with 322 additions and 323 deletions

View File

@@ -25,13 +25,15 @@ codeSourceModule co (id,mo) = (id,replaceJudgements mo (mapTree codj (jments mo)
CncFun mty pt mpr -> CncFun mty (fmap (codeTerm co) pt) (fmap (codeTerm co) mpr)
_ -> info
codeTerm :: (String -> String) -> Term -> Term
codeTerm co t = case t of
K s -> K (co s)
T ty cs -> T ty [(codp p,codeTerm co v) | (p,v) <- cs]
EPatt p -> EPatt (codp p)
_ -> composSafeOp (codeTerm co) t
codeTerm :: (String -> String) -> L Term -> L Term
codeTerm co (L loc t) = L loc (codt t)
where
codt t = case t of
K s -> K (co s)
T ty cs -> T ty [(codp p,codt v) | (p,v) <- cs]
EPatt p -> EPatt (codp p)
_ -> composSafeOp codt t
codp p = case p of --- really: composOpPatt
PR rs -> PR [(l,codp p) | (l,p) <- rs]
PString s -> PString (co s)