summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/GF/Compile/Export.hs3
-rw-r--r--src/PGF/Data.hs27
-rw-r--r--src/PGF/Raw/Convert.hs3
3 files changed, 2 insertions, 31 deletions
diff --git a/src/GF/Compile/Export.hs b/src/GF/Compile/Export.hs
index 21ecb3d15..9e9a99e99 100644
--- a/src/GF/Compile/Export.hs
+++ b/src/GF/Compile/Export.hs
@@ -58,5 +58,4 @@ outputConcr pgf = case cncnames pgf of
cnc:_ -> cnc
printPGF :: PGF -> String
-printPGF = -- encodeUTF8 . -- fromPGF does UTF8 encoding
- printTree . fromPGF
+printPGF = encodeUTF8 . printTree . fromPGF
diff --git a/src/PGF/Data.hs b/src/PGF/Data.hs
index 3f9aaa6ab..761097d7f 100644
--- a/src/PGF/Data.hs
+++ b/src/PGF/Data.hs
@@ -172,30 +172,3 @@ emptyPGF = PGF {
abstract = error "empty grammar, no abstract",
concretes = Map.empty
}
-
--- encode idenfifiers and strings in UTF8
-
-utf8GFCC :: PGF -> PGF
-utf8GFCC pgf = pgf {
- concretes = Map.map u8concr (concretes pgf)
- }
- where
- u8concr cnc = cnc {
- lins = Map.map u8term (lins cnc),
- opers = Map.map u8term (opers cnc)
- }
- u8term = convertStringsInTerm encodeUTF8
-
----- TODO: convert identifiers and flags
-
-convertStringsInTerm conv t = case t of
- K (KS s) -> K (KS (conv s))
- W s r -> W (conv s) (convs r)
- R ts -> R $ map convs ts
- S ts -> S $ map convs ts
- FV ts -> FV $ map convs ts
- P u v -> P (convs u) (convs v)
- _ -> t
- where
- convs = convertStringsInTerm conv
-
diff --git a/src/PGF/Raw/Convert.hs b/src/PGF/Raw/Convert.hs
index af3708eb5..8e429660a 100644
--- a/src/PGF/Raw/Convert.hs
+++ b/src/PGF/Raw/Convert.hs
@@ -136,7 +136,7 @@ toTerm e = case e of
------------------------------
fromPGF :: PGF -> Grammar
-fromPGF pgf0 = Grm [
+fromPGF pgf = Grm [
App "pgf" (AInt pgfMajorVersion:AInt pgfMinorVersion
: App (prCId (absname pgf)) [] : map (flip App [] . prCId) (cncnames pgf)),
App "flags" [App (prCId f) [AStr v] | (f,v) <- Map.toList (gflags pgf `Map.union` aflags apgf)],
@@ -147,7 +147,6 @@ fromPGF pgf0 = Grm [
App "concrete" [App (prCId lang) (fromConcrete c) | (lang,c) <- Map.toList (concretes pgf)]
]
where
- pgf = utf8GFCC pgf0
apgf = abstract pgf
fromConcrete cnc = [
App "flags" [App (prCId f) [AStr v] | (f,v) <- Map.toList (cflags cnc)],