summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2007-11-09 10:08:07 +0000
committeraarne <aarne@cs.chalmers.se>2007-11-09 10:08:07 +0000
commite66aab0978dc4652ee9df3160dcd1f5fbe3bdb79 (patch)
treec786de97c582c9782107ab4507cb780e6d4bc590 /src
parent1ad7527f657c9b268773d674e0bad1789f96fa8a (diff)
changed js and hs file names in gfcc output to expected ones
Diffstat (limited to 'src')
-rw-r--r--src/GF/Command/PPrTree.hs5
-rw-r--r--src/GF/Devel/GFC.hs14
2 files changed, 14 insertions, 5 deletions
diff --git a/src/GF/Command/PPrTree.hs b/src/GF/Command/PPrTree.hs
index aa383b18b..7e1755bbc 100644
--- a/src/GF/Command/PPrTree.hs
+++ b/src/GF/Command/PPrTree.hs
@@ -18,7 +18,7 @@ tree2exp t = case t of
TId c -> tree (AC (i2i c)) []
TInt i -> tree (AI i) []
TStr s -> tree (AS s) []
--- TFloat d ->
+ TFloat d -> tree (AF d) []
where
i2i (Ident s) = CId s
@@ -32,4 +32,7 @@ exp2tree (DTr xs at ts) = tabs (map i4i xs) (tapp at (map exp2tree ts))
tapp (AC f) [] = TId (i4i f)
tapp (AC f) vs = TApp (i4i f) vs
tapp (AI i) [] = TInt i
+ tapp (AS i) [] = TStr i
+ tapp (AF i) [] = TFloat i
+ tapp (AM i) [] = TId (Ident "?") ----
i4i (CId s) = Ident s
diff --git a/src/GF/Devel/GFC.hs b/src/GF/Devel/GFC.hs
index 0c352bbb7..1e66d29a5 100644
--- a/src/GF/Devel/GFC.hs
+++ b/src/GF/Devel/GFC.hs
@@ -16,7 +16,7 @@ main = do
xx <- getArgs
let (opts,fs) = getOptions "-" xx
case opts of
- _ | oElem (iOpt "help") opts -> putStrLn "usage: gfc (--make) FILES"
+ _ | oElem (iOpt "help") opts -> putStrLn usageMsg
_ | oElem (iOpt "-make") opts -> do
gr <- batchCompile opts fs
let name = justModuleName (last fs)
@@ -50,14 +50,20 @@ file2gfcc f =
---- TODO: nicer and richer print options
-alsoPrint opts abs gr (opt,suff) =
+alsoPrint opts abs gr (opt,name) =
if oElem (iOpt opt) opts
then do
- let outfile = abs ++ "." ++ suff
+ let outfile = name
let output = prGFCC opt gr
writeFile outfile output
putStrLn $ "wrote file " ++ outfile
else return ()
-printOptions = [("haskell","hs"),("haskell_gadt","hs"),("js","js")]
+printOptions = [
+ ("haskell","GSyntax.hs"),
+ ("haskell_gadt","GSyntax.hs"),
+ ("js","grammar.js")
+ ]
+usageMsg =
+ "usage: gfc (-h | --make (-noopt) (-js | -haskell | -haskell_gadt)) (-src) FILES"