summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Hallgren <th-github@altocumulus.org>2019-11-18 13:20:41 +0100
committerThomas Hallgren <th-github@altocumulus.org>2019-11-18 13:20:41 +0100
commit28f53e801aaf0d47b22f64467c2c760dff8fd6a9 (patch)
tree1268d270d36b8fb3df944780c553dfbdaf0683ec /src
parent6f2b1a83b7a6b2593a0c484abed84a6faaef4a93 (diff)
PGFService: revert unlexing change in PGFService to restore &+ behaviour
Diffstat (limited to 'src')
-rw-r--r--src/compiler/GF/Text/Lexing.hs2
-rw-r--r--src/server/PGFService.hs15
2 files changed, 12 insertions, 5 deletions
diff --git a/src/compiler/GF/Text/Lexing.hs b/src/compiler/GF/Text/Lexing.hs
index 7195daacd..16d53d0f8 100644
--- a/src/compiler/GF/Text/Lexing.hs
+++ b/src/compiler/GF/Text/Lexing.hs
@@ -1,5 +1,5 @@
-- | Lexers and unlexers - they work on space-separated word strings
-module GF.Text.Lexing (stringOp,opInEnv) where
+module GF.Text.Lexing (stringOp,opInEnv,bindTok) where
import GF.Text.Transliterations
diff --git a/src/server/PGFService.hs b/src/server/PGFService.hs
index 8b5c4855d..8a2857289 100644
--- a/src/server/PGFService.hs
+++ b/src/server/PGFService.hs
@@ -304,7 +304,7 @@ cpgfMain qsem command (t,(pgf,pc)) =
from1 = maybe (missing "from") return =<< from'
from' = getLang "from"
- to = (,) # getLangs "to" % unlexer (const False)
+ to = (,) # getLangs "to" % unlexerC (const False)
getLangs = getLangs' readLang
getLang = getLang' readLang
@@ -360,8 +360,15 @@ lexer good = maybe (return id) lexerfun =<< getInput "lexer"
type Unlexer = String->String
-- | Unlexing for the C runtime system, &+ is already applied
-unlexer :: (String -> Bool) -> CGI Unlexer
-unlexer good = maybe (return id) unlexerfun =<< getInput "unlexer"
+unlexerC :: (String -> Bool) -> CGI Unlexer
+unlexerC = unlexer' id
+
+-- | Unlexing for the Haskell runtime system, the default is to just apply &+
+unlexerH :: CGI Unlexer
+unlexerH = unlexer' (unwords . bindTok . words) (const False)
+
+unlexer' defaultUnlexer good =
+ maybe (return defaultUnlexer) unlexerfun =<< getInput "unlexer"
where
unlexerfun name =
case stringOp good ("unlex"++name) of
@@ -466,7 +473,7 @@ pgfMain lcs@(alc,clc) path command tpgf@(t,pgf) =
from = getLang "from"
to1 = maybe (missing "to") return =<< getLang "to"
- to = (,) # getLangs "to" % unlexer (const False)
+ to = (,) # getLangs "to" % unlexerH
getLangs = getLangs' readLang
getLang = getLang' readLang