summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2012-02-24 17:12:38 +0000
committerhallgren <hallgren@chalmers.se>2012-02-24 17:12:38 +0000
commit03f3baeba3e4921446846828a2974e81e766f934 (patch)
treebe14419a0a3d2e27f6a2f707ed57d603f065397e /src
parent92aa961205b84d89184a954b1050d4bc31f2f568 (diff)
gfse: text mode editing: accept grammars with printname judgements
But printname judgements are ignored for now. Also fixed an UTF-8 encoding bug when parsing uploaded grammars in gf -server mode.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/GFServer.hs7
-rw-r--r--src/compiler/SimpleEditor/Convert.hs7
-rw-r--r--src/www/gfse/editor.js2
3 files changed, 10 insertions, 6 deletions
diff --git a/src/compiler/GFServer.hs b/src/compiler/GFServer.hs
index cb66137b2..65ed6a315 100644
--- a/src/compiler/GFServer.hs
+++ b/src/compiler/GFServer.hs
@@ -27,7 +27,7 @@ import Text.JSON(encode,showJSON,makeObj)
import System.IO.Silently(hCapture)
import System.Process(readProcessWithExitCode)
import System.Exit(ExitCode(..))
-import Codec.Binary.UTF8.String(encodeString)
+import Codec.Binary.UTF8.String(decodeString,encodeString)
import GF.Infra.UseIO(readBinaryFile,writeBinaryFile)
import qualified PGFService as PS
import qualified ExampleService as ES
@@ -158,7 +158,8 @@ handle state0 cache execute1
let state' = maybe state (flip (M.insert dir) state) st'
return (state',ok200 output)
- parse qs = return (state,json200 (makeObj (map parseModule qs)))
+ parse qs =
+ return (state,json200 (makeObj(map(parseModule.apBoth decodeString) qs)))
cloud dir cmd qs =
case cmd of
@@ -382,6 +383,7 @@ removeDir dir =
toHeader "Content-Type" = FCGI.HttpContentType -- to avoid duplicate headers
toHeader s = FCGI.HttpExtensionHeader s -- cheating a bit
-}
+
-- * misc utils
@@ -392,5 +394,6 @@ inputs = queryToArguments . fixplus
decode c = [c]
mapFst f xys = [(f x,y)|(x,y)<-xys]
+apBoth f (x,y) = (f x,f y)
prop n v = (n,showJSON v)
diff --git a/src/compiler/SimpleEditor/Convert.hs b/src/compiler/SimpleEditor/Convert.hs
index 037b04986..4a2e0daa9 100644
--- a/src/compiler/SimpleEditor/Convert.hs
+++ b/src/compiler/SimpleEditor/Convert.hs
@@ -103,7 +103,7 @@ convOpen o =
_ -> fail "unsupported module open"
-data CncJment = Pa S.Param | LC Lincat | Op Oper | Li Lin
+data CncJment = Pa S.Param | LC Lincat | Op Oper | Li Lin | Ignored
convCncJments = mapM convCncJment . Map.toList
@@ -111,13 +111,14 @@ convCncJment (name,jment) =
case jment of
ResParam ops _ ->
return $ Pa $ Param i (maybe "" (render . ppParams q . unLoc) ops)
- CncCat (Just (L _ typ)) Nothing Nothing _ ->
+ ResValue _ -> return Ignored
+ CncCat (Just (L _ typ)) Nothing pprn _ -> -- ignores printname !!
return $ LC $ Lincat i (render $ ppTerm q 0 typ)
ResOper oltyp (Just lterm) -> return $ Op $ Oper lhs rhs
where
lhs = i++maybe "" ((" : "++) . render . ppTerm q 0 . unLoc) oltyp
rhs = " = "++render (ppTerm q 0 (unLoc lterm))
- CncFun _ (Just ldef) Nothing _ ->
+ CncFun _ (Just ldef) pprn _ -> -- ignores printname !!
do let (xs,e') = getAbs (unLoc ldef)
lin = render $ ppTerm q 0 e'
args <- mapM convBind xs
diff --git a/src/www/gfse/editor.js b/src/www/gfse/editor.js
index 64b44e36c..72999ce72 100644
--- a/src/www/gfse/editor.js
+++ b/src/www/gfse/editor.js
@@ -536,7 +536,7 @@ function text_mode(g,file,ix) {
var mode_button=div_class("right",[button("Guided mode",switch_to_guided_mode)])
clear(file)
appendChildren(file,[mode_button,ta])
- ta.style.height=ta.scrollHeight+"px";
+ //ta.style.height=ta.scrollHeight+"px";
ta.focus();
}
var mode_button=div_class("right",[button("Text mode",switch_to_text_mode)])