From 3b39607bbac8e6ab99198ab608f14e1f84c2f60e Mon Sep 17 00:00:00 2001 From: aarne Date: Thu, 24 Jun 2004 14:06:09 +0000 Subject: last-minute bug fixes --- src/GF/Compile/GetGrammar.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/GF/Compile/GetGrammar.hs') diff --git a/src/GF/Compile/GetGrammar.hs b/src/GF/Compile/GetGrammar.hs index 4e641dc3d..7907a817b 100644 --- a/src/GF/Compile/GetGrammar.hs +++ b/src/GF/Compile/GetGrammar.hs @@ -22,6 +22,7 @@ import EBNF import ReadFiles ---- +import Char (toUpper) import List (nub) import Monad (foldM) @@ -62,7 +63,7 @@ parseOldGrammar :: FilePath -> IOE ([FilePath],[A.TopDef]) parseOldGrammar file = do putStrE $ "reading old file" +++ file s <- ioeIO $ readFileIf file - A.OldGr incl topdefs <- ioeErr $ {- err2err $ -} pOldGrammar $ oldLexer $ fixNewlines s + A.OldGr incl topdefs <- ioeErr $ pOldGrammar $ oldLexer $ fixNewlines s includes <- ioeErr $ transInclude incl return (includes, topdefs) @@ -74,16 +75,16 @@ err2err (E.Bad s) = Bad s ioeEErr = ioeErr . err2err --- To resolve the new reserved words: change them by turning the final letter to Z. +-- To resolve the new reserved words: +-- change them by turning the final letter to upper case. --- There is a risk of clash. oldLexer :: String -> [L.Token] oldLexer = map change . L.tokens where change t = case t of - (L.PT p (L.TS s)) | elem s new -> (L.PT p (L.TV (init s ++ "Z"))) + (L.PT p (L.TS s)) | elem s newReservedWords -> + (L.PT p (L.TV (init s ++ [toUpper (last s)]))) _ -> t - new = words $ "abstract concrete interface incomplete " ++ - "instance out open resource reuse transfer union with where" getCFGrammar :: Options -> FilePath -> IOE SourceGrammar getCFGrammar opts file = do -- cgit v1.2.3