From 677d849840e3a5b8f69044ef43151908b0f6737b Mon Sep 17 00:00:00 2001 From: hallgren Date: Wed, 9 Apr 2014 17:26:23 +0000 Subject: [PATCH] Unlexers: move capitalization of first word from GF.Text.Lexing to PGF.Lexing The capitalization of the first word was done in GF.Text.Lexing.stringOp, but is now done in the functions unlexText and unlexMixed in PGF.Lexing. These functions are only used in stringOp and in PGFService (where the change is needed), so the subtle change in behaviour should not cause any bugs. --- src/compiler/GF/Text/Lexing.hs | 4 ++-- src/runtime/haskell/PGF/Lexing.hs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/GF/Text/Lexing.hs b/src/compiler/GF/Text/Lexing.hs index 29647a786..4e07c2126 100644 --- a/src/compiler/GF/Text/Lexing.hs +++ b/src/compiler/GF/Text/Lexing.hs @@ -16,9 +16,9 @@ stringOp name = case name of "words" -> Just $ appLexer words "bind" -> Just $ appUnlexer bindTok "unchars" -> Just $ appUnlexer concat - "unlextext" -> Just $ capitInit . appUnlexer (unlexText . unquote) + "unlextext" -> Just $ appUnlexer (unlexText . unquote) "unlexcode" -> Just $ appUnlexer unlexCode - "unlexmixed" -> Just $ capitInit . appUnlexer (unlexMixed . unquote) + "unlexmixed" -> Just $ appUnlexer (unlexMixed . unquote) "unwords" -> Just $ appUnlexer unwords "to_html" -> Just wrapHTML _ -> transliterate name diff --git a/src/runtime/haskell/PGF/Lexing.hs b/src/runtime/haskell/PGF/Lexing.hs index 10d8332f7..a49328826 100644 --- a/src/runtime/haskell/PGF/Lexing.hs +++ b/src/runtime/haskell/PGF/Lexing.hs @@ -20,7 +20,7 @@ lexText' uncap1 = uncap . lext where _ -> s unlexText :: [String] -> String -unlexText = unlext where +unlexText = capitInit . unlext where unlext s = case s of w:[] -> w w:[c]:[] | isPunct c -> w ++ [c] @@ -67,7 +67,7 @@ lexMixed = concat . alternate False where lex env = if env then lexCode else lexText unlexMixed :: [String] -> String -unlexMixed = concat . alternate False where +unlexMixed = capitInit . concat . alternate False where alternate env s = case s of _:_ -> case break (=="$") s of (t,[]) -> unlex env t : []