mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-09 03:02:50 -06:00
GF/src is now for 2.9, and the new sources are in src-3.0 - keep it this way until the release of GF 3
This commit is contained in:
53
src-3.0/GF/Text/Hebrew.hs
Normal file
53
src-3.0/GF/Text/Hebrew.hs
Normal file
@@ -0,0 +1,53 @@
|
||||
----------------------------------------------------------------------
|
||||
-- |
|
||||
-- Module : Hebrew
|
||||
-- Maintainer : (Maintainer)
|
||||
-- Stability : (stable)
|
||||
-- Portability : (portable)
|
||||
--
|
||||
-- > CVS $Date: 2005/04/21 16:23:37 $
|
||||
-- > CVS $Author: bringert $
|
||||
-- > CVS $Revision: 1.8 $
|
||||
--
|
||||
-- (Description of the module)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
module GF.Text.Hebrew (mkHebrew) where
|
||||
|
||||
mkHebrew :: String -> String
|
||||
mkHebrew = mkHebrewWord
|
||||
----mkHebrew = reverse . mkHebrewWord
|
||||
--- reverse : assumes everything's on same line
|
||||
|
||||
type HebrewChar = Char
|
||||
|
||||
-- HH 031103 added code for spooling the markup
|
||||
-- removed reverse, words, unwords
|
||||
-- (seemed obsolete and come out wrong on the screen)
|
||||
-- AR 26/1/2004 put reverse back - needed in Fudgets (but not in Java?)
|
||||
|
||||
mkHebrewWord :: String -> [HebrewChar]
|
||||
-- mkHebrewWord = map mkHebrewChar
|
||||
|
||||
mkHebrewWord s = case s of
|
||||
[] -> []
|
||||
'<' : cs -> '<' : spoolMarkup cs
|
||||
' ' : cs -> ' ' : mkHebrewWord cs
|
||||
c1 : cs -> mkHebrewChar c1 : mkHebrewWord cs
|
||||
|
||||
spoolMarkup :: String -> String
|
||||
spoolMarkup s = case s of
|
||||
[] -> [] -- Shouldn't happen
|
||||
'>' : cs -> '>' : mkHebrewWord cs
|
||||
c1 : cs -> c1 : spoolMarkup cs
|
||||
|
||||
mkHebrewChar c = case lookup c cc of Just c' -> c' ; _ -> c
|
||||
where
|
||||
cc = zip allHebrewCodes allHebrew
|
||||
|
||||
allHebrewCodes = "-abgdhwzHTyKklMmNnSoPpCcqrst"
|
||||
|
||||
allHebrew :: String
|
||||
allHebrew = (map toEnum (0x05be : [0x05d0 .. 0x05ea]))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user