format .gfm for multiple modules in the same file; includes lines with ;-separated words

This commit is contained in:
aarne
2010-11-30 14:50:24 +00:00
parent 33118ad9d6
commit 3506b313c1
6 changed files with 59 additions and 23 deletions

View File

@@ -407,6 +407,9 @@ allCommands env@(pgf, mos) = Map.fromList [
"If a grammar with the same concrete name is already in the state",
"it is overwritten - but only if compilation succeeds.",
"The grammar parser depends on the file name suffix:",
" .cf context-free (labelled BNF) source",
" .ebnf extended BNF source",
" .gfm multi-module GF source",
" .gf normal GF source",
" .gfo compiled GF source",
" .pgf precompiled grammar in Portable Grammar Format"

View File

@@ -4,6 +4,7 @@ import PGF
import PGF.Data
import GF.Compile
import GF.Compile.Multi (readMulti)
import GF.Grammar (identC, SourceGrammar) -- for cc command
import GF.Grammar.CF
import GF.Grammar.EBNF
@@ -20,8 +21,12 @@ importGrammar :: PGF -> Options -> [FilePath] -> IO PGF
importGrammar pgf0 _ [] = return pgf0
importGrammar pgf0 opts files =
case takeExtensions (last files) of
".cf" -> importCF opts files getCF
".cf" -> importCF opts files getCF
".ebnf" -> importCF opts files getEBNF
".gfm" -> do
ascss <- mapM readMulti files
let cs = concatMap snd ascss
importGrammar pgf0 opts cs
s | elem s [".gf",".gfo"] -> do
res <- appIOE $ compileToPGF opts files
case res of