1
0
forked from GitHub/gf-core

When producing PGF, do UTF-8 encoding of the whole file after pretty printing instead of walking through the PGF structure before pretty-printing.

The old code was brittle, and only converted strings in the lins and opers, not in printnames and parsers. The old code also double encoded some grammars when using gfc to combine PGF files.
This commit is contained in:
bjorn
2008-08-18 12:34:56 +00:00
parent ae90af3211
commit 4925580877
3 changed files with 2 additions and 31 deletions

View File

@@ -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)],