X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=utils%2Fext-core%2FParser.y;fp=utils%2Fext-core%2FParser.y;h=ac186e399af0d7ed0eefb5d1a80542c93140bfba;hb=276585028d51a2516a31b91a91a1f4bba5c9f8ba;hp=1e1c6a3592aa215727896901cfe36884a77e09ae;hpb=e415eeaf6c7771488af24758ca5b9c22c42be3a6;p=ghc-hetmet.git diff --git a/utils/ext-core/Parser.y b/utils/ext-core/Parser.y index 1e1c6a3..ac186e3 100644 --- a/utils/ext-core/Parser.y +++ b/utils/ext-core/Parser.y @@ -20,7 +20,7 @@ import Lex '%in' { TKin } '%case' { TKcase } '%of' { TKof } - '%coerce' { TKcoerce } + '%cast' { TKcast } '%note' { TKnote } '%external' { TKexternal } '%_' { TKwild } @@ -36,6 +36,7 @@ import Lex '\\' { TKlambda} '@' { TKat } '.' { TKdot } + ':' { TKcolon } '?' { TKquestion} ';' { TKsemicolon } NAME { TKname $$ } @@ -172,10 +173,10 @@ exp :: { Exp } { foldr Lam $4 $2 } | '%let' vdefg '%in' exp { Let $2 $4 } - | '%case' aexp '%of' vbind '{' alts1 '}' - { Case $2 $4 $6 } - | '%coerce' aty exp - { Coerce $2 $3 } + | '%case' ty aexp '%of' vbind '{' alts1 '}' + { Case $3 $5 $2 $7 } + | '%cast' exp aty + { Cast $2 $3 } | '%note' STRING exp { Note $2 $3 } | '%external' STRING aty @@ -209,17 +210,29 @@ name :: { Id } cname :: { Id } : CNAME { $1 } -mname :: { Id } - : CNAME { $1 } +mname :: { AnMname } + : pkgName ':' mnames '.' name + { ($1, $3, $5) } + +pkgName :: { Id } + : NAME { $1 } + +mnames :: { [Id] } + : {- empty -} {[]} + | name '.' mnames {$1:$3} + +-- it sucks to have to repeat the Maybe-checking twice, +-- but otherwise we get reduce/reduce conflicts -qname :: { (Id,Id) } - : name { ("",$1) } +qname :: { (Mname,Id) } + : name { (Nothing, $1) } | mname '.' name - { ($1,$3) } + { (Just $1,$3) } -qcname :: { (Id,Id) } - : mname '.' cname - { ($1,$3) } +qcname :: { (Mname,Id) } + : cname { (Nothing, $1) } + | mname '.' cname + { (Just $1,$3) } {