mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-20 16:42:51 -06:00
Fixed several things, e.g. tokenizer.
This commit is contained in:
@@ -63,6 +63,9 @@ updateModule (Module mt ms fs me ops js) i t =
|
||||
replaceJudgements :: Module i f t -> BinTree (i,t) -> Module i f t
|
||||
replaceJudgements (Module mt ms fs me ops _) js = Module mt ms fs me ops js
|
||||
|
||||
allFlags :: MGrammar i f a -> [f]
|
||||
allFlags gr = concat $ map flags $ reverse [m | (_, ModMod m) <- modules gr]
|
||||
|
||||
data MainGrammar i = MainGrammar {
|
||||
mainAbstract :: i ,
|
||||
mainConcretes :: [MainConcreteSpec i]
|
||||
|
||||
@@ -59,6 +59,9 @@ addOption o (Opts os) = iOpts (o:os)
|
||||
|
||||
addOptions (Opts os) os0 = foldr addOption os0 os
|
||||
|
||||
concatOptions :: [Options] -> Options
|
||||
concatOptions = foldr addOptions noOptions
|
||||
|
||||
removeOption :: Option -> Options -> Options
|
||||
removeOption o (Opts os) = iOpts (filter (/=o) os)
|
||||
|
||||
@@ -152,6 +155,8 @@ doTrace = iOpt "tr"
|
||||
noCPU = iOpt "nocpu"
|
||||
doCompute = iOpt "c"
|
||||
optimizeCanon = iOpt "opt"
|
||||
stripQualif = iOpt "strip"
|
||||
nostripQualif = iOpt "nostrip"
|
||||
|
||||
-- mainly for stand-alone
|
||||
useUnicode = iOpt "unicode"
|
||||
|
||||
@@ -2,11 +2,13 @@ module ReadFiles where
|
||||
|
||||
import Arch (selectLater, modifiedFiles, ModTime)
|
||||
|
||||
import Option
|
||||
import Operations
|
||||
import UseIO
|
||||
import System
|
||||
import Char
|
||||
import Monad
|
||||
import List
|
||||
|
||||
-- make analysis for GF grammar modules. AR 11/6/2003
|
||||
|
||||
@@ -122,6 +124,14 @@ lexs s = x:xs where
|
||||
(x,y) = head $ lex s
|
||||
xs = if null y then [] else lexs y
|
||||
|
||||
-- options can be passed to the compiler by comments in --#, in the main file
|
||||
|
||||
getOptionsFromFile :: FilePath -> IO Options
|
||||
getOptionsFromFile file = do
|
||||
s <- readFileIf file
|
||||
let ls = filter (isPrefixOf "--#") $ lines s
|
||||
return $ fst $ getOptions "-" $ map (unwords . words . drop 3) ls
|
||||
|
||||
-- old GF tolerated newlines in quotes. No more supported!
|
||||
fixNewlines s = case s of
|
||||
'"':cs -> '"':mk cs
|
||||
|
||||
Reference in New Issue
Block a user