Changeset 14716 for src/Pugs/Eval.hs

Show
Ignore:
Timestamp:
11/10/06 20:02:03 (2 years ago)
Author:
audreyt
Message:

* Pugs.Eval: Binding for array and hash elements.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Eval.hs

    r14639 r14716  
    670670            [v] -> v 
    671671            vs  -> VList vs 
     672 
     673reduceSyn ":=" [Syn "{}" [conExp, keyExp], valExp] = enterLValue $ do 
     674    ref     <- fromVal =<< enterEvalContext cxtItemAny valExp 
     675    con     <- enterEvalContext (cxtItem "Hash") conExp 
     676    key     <- fromVal =<< enterEvalContext (cxtItem "Str") keyExp 
     677    doBind  <- doHash con hash_storeElem 
     678    doBind key ref 
     679    return (castV ref) 
     680 
     681reduceSyn ":=" [Syn "[]" [conExp, keyExp], valExp] = enterLValue $ do 
     682    ref     <- fromVal =<< enterEvalContext cxtItemAny valExp 
     683    con     <- enterEvalContext (cxtItem "Array") conExp 
     684    key     <- fromVal =<< enterEvalContext (cxtItem "Int") keyExp 
     685    doBind  <- doArray con array_storeElem 
     686    doBind key ref 
     687    return (castV ref) 
    672688 
    673689reduceSyn ":=" [var, vexp] = do