mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 03:32:51 -06:00
Removed on-demand parser generation from the PGF interpreter.
This commit is contained in:
4
GF.cabal
4
GF.cabal
@@ -587,10 +587,6 @@ library
|
|||||||
GF.Data.Assoc
|
GF.Data.Assoc
|
||||||
GF.Data.ErrM
|
GF.Data.ErrM
|
||||||
GF.Text.UTF8
|
GF.Text.UTF8
|
||||||
-- needed only for the on demand generation of PMCFG
|
|
||||||
GF.Data.BacktrackM
|
|
||||||
GF.Compile.GenerateFCFG
|
|
||||||
GF.Compile.GeneratePMCFG
|
|
||||||
|
|
||||||
executable gf
|
executable gf
|
||||||
build-depends: base,
|
build-depends: base,
|
||||||
|
|||||||
10
src/PGF.hs
10
src/PGF.hs
@@ -69,7 +69,6 @@ import PGF.Raw.Parse
|
|||||||
import PGF.Raw.Print (printTree)
|
import PGF.Raw.Print (printTree)
|
||||||
import PGF.Parsing.FCFG
|
import PGF.Parsing.FCFG
|
||||||
import qualified PGF.Parsing.FCFG.Incremental as Incremental
|
import qualified PGF.Parsing.FCFG.Incremental as Incremental
|
||||||
import qualified GF.Compile.GeneratePMCFG as PMCFG
|
|
||||||
import GF.Text.UTF8
|
import GF.Text.UTF8
|
||||||
|
|
||||||
import GF.Data.ErrM
|
import GF.Data.ErrM
|
||||||
@@ -205,14 +204,7 @@ complete :: PGF -> Language -> Category -> String
|
|||||||
readPGF f = do
|
readPGF f = do
|
||||||
s <- readFile f >>= return . decodeUTF8 -- pgf is in UTF8, internal in unicode
|
s <- readFile f >>= return . decodeUTF8 -- pgf is in UTF8, internal in unicode
|
||||||
g <- parseGrammar s
|
g <- parseGrammar s
|
||||||
return $! addParsers $ toPGF g
|
return $! toPGF g
|
||||||
|
|
||||||
-- Adds parsers for all concretes that don't have a parser.
|
|
||||||
addParsers :: PGF -> PGF
|
|
||||||
addParsers pgf = pgf { concretes = Map.map conv (concretes pgf) }
|
|
||||||
where
|
|
||||||
conv cnc | isJust (parser cnc) = cnc
|
|
||||||
| otherwise = cnc { parser = Just (PMCFG.convertConcrete (abstract pgf) cnc) }
|
|
||||||
|
|
||||||
linearize pgf lang = concat . take 1 . PGF.Linearize.linearizes pgf (mkCId lang)
|
linearize pgf lang = concat . take 1 . PGF.Linearize.linearizes pgf (mkCId lang)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user