summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Grammar/Analyse.hs
diff options
context:
space:
mode:
authoraarne <aarne@chalmers.se>2011-09-20 16:00:56 +0000
committeraarne <aarne@chalmers.se>2011-09-20 16:00:56 +0000
commit33a42b1c7ca74fd4484fd143b5396d61fa924eb7 (patch)
tree0926903cd3a7feae14ad29167c6faeb96a2ba3df /src/compiler/GF/Grammar/Analyse.hs
parenta2ccf1ce6965e93eff9a3d7bef064cb3cab448f5 (diff)
module for analysing source grammars
Diffstat (limited to 'src/compiler/GF/Grammar/Analyse.hs')
-rw-r--r--src/compiler/GF/Grammar/Analyse.hs29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/compiler/GF/Grammar/Analyse.hs b/src/compiler/GF/Grammar/Analyse.hs
new file mode 100644
index 000000000..ad538de87
--- /dev/null
+++ b/src/compiler/GF/Grammar/Analyse.hs
@@ -0,0 +1,29 @@
+module GF.Grammar.Analyse (
+ stripSourceGrammar
+ ) where
+
+import GF.Grammar.Grammar
+import GF.Infra.Ident
+import GF.Infra.Option ---
+import GF.Infra.Modules
+
+import GF.Data.Operations
+
+import qualified Data.Map as Map
+
+
+stripSourceGrammar :: SourceGrammar -> SourceGrammar
+stripSourceGrammar sgr = mGrammar [(i, m{jments = Map.map stripInfo (jments m)}) | (i,m) <- modules sgr]
+
+stripInfo :: Info -> Info
+stripInfo i = case i of
+ AbsCat _ -> i
+ AbsFun mt mi me mb -> AbsFun mt mi Nothing mb
+ ResParam mp mt -> ResParam mp Nothing
+ ResValue lt -> i ----
+ ResOper mt md -> ResOper mt Nothing
+ ResOverload is fs -> ResOverload is [(lty, L loc (EInt 0)) | (lty,L loc _) <- fs]
+ CncCat mty mte mtf -> CncCat mty Nothing Nothing
+ CncFun mict mte mtf -> CncFun mict Nothing Nothing
+ AnyInd b f -> i
+