diff options
| author | aarne <unknown> | 2004-06-24 14:06:09 +0000 |
|---|---|---|
| committer | aarne <unknown> | 2004-06-24 14:06:09 +0000 |
| commit | 3b39607bbac8e6ab99198ab608f14e1f84c2f60e (patch) | |
| tree | 35b823c38ef0ed7439f1a057d939fbdfa96bc719 /src/GF/Compile/GetGrammar.hs | |
| parent | d3db78ad31fe8b27c7ebb4e05b92d4c3986cb119 (diff) | |
last-minute bug fixes
Diffstat (limited to 'src/GF/Compile/GetGrammar.hs')
| -rw-r--r-- | src/GF/Compile/GetGrammar.hs | 11 |
1 files changed, 6 insertions, 5 deletions
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 |
