Show
Ignore:
Timestamp:
10/05/06 06:25:21 (2 years ago)
Author:
audreyt
Message:

* Add support for transliteration:

tr///
y///
$x tr///
$x
y///

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Prim/Match.hs

    r13744 r13903  
    136136    op2Match x (VType (mkType name)) 
    137137 
    138 op2Match x (VSubst (rx, subst)) | rxGlobal rx = do 
     138-- $x ~~ tr/x/y/ ==> $x = ~$x.trans('x' => 'y') 
     139op2Match x (VSubst (MkTrans from to)) = do 
     140    str <- fromVal x 
     141    evalExp $ Syn "=" 
     142        [ Val x 
     143        , App (_Var "&trans") (Just (Val (VStr str))) 
     144            [ App (_Var "&infix:=>") Nothing 
     145                [ Val (VStr from) 
     146                , Val (VStr to) 
     147                ] 
     148            ] 
     149        ] 
     150 
     151op2Match x (VSubst (MkSubst rx subst)) | rxGlobal rx = do 
    139152    str         <- fromVal x 
    140153    (str', cnt) <- doReplace str 0 
     
    162175                return (concat [genericTake from str, str', after'], ok') 
    163176 
    164 op2Match x (VSubst (rx, subst)) = do 
     177op2Match x (VSubst (MkSubst rx subst)) = do 
    165178    str     <- fromVal x 
    166179    ref     <- fromVal x