mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-24 18:28:55 -06:00
PGFService: revert unlexing change in PGFService to restore &+ behaviour
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
-- | Lexers and unlexers - they work on space-separated word strings
|
-- | 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
|
import GF.Text.Transliterations
|
||||||
|
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ cpgfMain qsem command (t,(pgf,pc)) =
|
|||||||
from1 = maybe (missing "from") return =<< from'
|
from1 = maybe (missing "from") return =<< from'
|
||||||
from' = getLang "from"
|
from' = getLang "from"
|
||||||
|
|
||||||
to = (,) # getLangs "to" % unlexer (const False)
|
to = (,) # getLangs "to" % unlexerC (const False)
|
||||||
|
|
||||||
getLangs = getLangs' readLang
|
getLangs = getLangs' readLang
|
||||||
getLang = getLang' readLang
|
getLang = getLang' readLang
|
||||||
@@ -360,8 +360,15 @@ lexer good = maybe (return id) lexerfun =<< getInput "lexer"
|
|||||||
type Unlexer = String->String
|
type Unlexer = String->String
|
||||||
|
|
||||||
-- | Unlexing for the C runtime system, &+ is already applied
|
-- | Unlexing for the C runtime system, &+ is already applied
|
||||||
unlexer :: (String -> Bool) -> CGI Unlexer
|
unlexerC :: (String -> Bool) -> CGI Unlexer
|
||||||
unlexer good = maybe (return id) unlexerfun =<< getInput "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
|
where
|
||||||
unlexerfun name =
|
unlexerfun name =
|
||||||
case stringOp good ("unlex"++name) of
|
case stringOp good ("unlex"++name) of
|
||||||
@@ -466,7 +473,7 @@ pgfMain lcs@(alc,clc) path command tpgf@(t,pgf) =
|
|||||||
from = getLang "from"
|
from = getLang "from"
|
||||||
|
|
||||||
to1 = maybe (missing "to") return =<< getLang "to"
|
to1 = maybe (missing "to") return =<< getLang "to"
|
||||||
to = (,) # getLangs "to" % unlexer (const False)
|
to = (,) # getLangs "to" % unlexerH
|
||||||
|
|
||||||
getLangs = getLangs' readLang
|
getLangs = getLangs' readLang
|
||||||
getLang = getLang' readLang
|
getLang = getLang' readLang
|
||||||
|
|||||||
Reference in New Issue
Block a user