From bf74f50733840b0bcec81ac265c824ae2bc3f675 Mon Sep 17 00:00:00 2001 From: krasimir Date: Mon, 22 Mar 2010 21:15:29 +0000 Subject: store and propagate the exact source location for all judgements in the grammar. It may not be used accurately in the error messages yet --- src/compiler/GF/Compile/Coding.hs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/compiler/GF/Compile/Coding.hs') diff --git a/src/compiler/GF/Compile/Coding.hs b/src/compiler/GF/Compile/Coding.hs index 49538bd35..b909aac7d 100644 --- a/src/compiler/GF/Compile/Coding.hs +++ b/src/compiler/GF/Compile/Coding.hs @@ -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 +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,codeTerm co v) | (p,v) <- cs] + T ty cs -> T ty [(codp p,codt v) | (p,v) <- cs] EPatt p -> EPatt (codp p) - _ -> composSafeOp (codeTerm co) t - where + _ -> composSafeOp codt t + codp p = case p of --- really: composOpPatt PR rs -> PR [(l,codp p) | (l,p) <- rs] PString s -> PString (co s) -- cgit v1.2.3