Changeset 14303 for src/Pugs/AST.hs

Show
Ignore:
Timestamp:
10/12/06 23:26:57 (2 years ago)
Author:
audreyt
svk:copy_cache_prev:
21165
Message:

* Pugs.Eval: Allow "/.../" to match against $_ immediately

not only under (Bool $) context, but also (Num $), (Str $)
and () (aka void) contexts.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/AST.hs

    r14138 r14303  
    1818    mergeStmts, isEmptyParams, 
    1919    newPackage, newType, newMetaType, typeMacro, isScalarLValue, 
    20     filterPrim, filterUserDefinedPad, typeOfParam, listVal, 
     20    filterPrim, filterUserDefinedPad, typeOfParam, listVal, isImmediateMatchContext, 
    2121 
    2222    module Pugs.AST.Internals, 
     
    363363listVal x           = [x] 
    364364 
     365isImmediateMatchContext :: Eval Bool 
     366isImmediateMatchContext = do 
     367    env <- ask 
     368    let cls = envClasses env 
     369        cxt = envContext env 
     370        typ = typeOfCxt cxt 
     371    return (cxt == CxtVoid || (any (\x -> isaType cls x typ) ["Bool", "Num", "Str"]))