summaryrefslogtreecommitdiff
path: root/src/GF/Compile/GetGrammar.hs
diff options
context:
space:
mode:
authoraarne <unknown>2003-11-07 14:54:44 +0000
committeraarne <unknown>2003-11-07 14:54:44 +0000
commit4c99687f217ce258f821d55e68f5403233f6dea7 (patch)
tree04e2d94654dd4ceb4c5e988f18f979594876c730 /src/GF/Compile/GetGrammar.hs
parent6ae3322b373c52e59fb34360345d1c1e35049c5f (diff)
Fixed treatment of predefined types (Int, String).
Fixed treatment of predefined types (Int, String). Added treatment of new reserved words to reading old grammars.
Diffstat (limited to 'src/GF/Compile/GetGrammar.hs')
-rw-r--r--src/GF/Compile/GetGrammar.hs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/GF/Compile/GetGrammar.hs b/src/GF/Compile/GetGrammar.hs
index fb3fbf5ad..a9a40ee06 100644
--- a/src/GF/Compile/GetGrammar.hs
+++ b/src/GF/Compile/GetGrammar.hs
@@ -14,6 +14,7 @@ import SourceToGrammar
import Option
--- import Custom
import ParGF
+import qualified LexGF as L
import ReadFiles ----
@@ -57,7 +58,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 $ myLexer $ fixNewlines s
+ A.OldGr incl topdefs <- ioeErr $ err2err $ pOldGrammar $ oldLexer $ fixNewlines s
includes <- ioeErr $ transInclude incl
return (includes, topdefs)
@@ -69,3 +70,13 @@ err2err (E.Bad s) = Bad s
ioeEErr = ioeErr . err2err
+-- To resolve the new reserved words: change them by turning the final letter to Z.
+--- 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")))
+ _ -> t
+ new = words $ "abstract concrete interface incomplete " ++
+ "instance out open resource reuse transfer with"