mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-24 03:52:50 -06:00
format .gfm for multiple modules in the same file; includes lines with ;-separated words
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user