aboutsummaryrefslogtreecommitdiff
path: root/frontend/parse.icl
diff options
context:
space:
mode:
authorsjakie2001-10-05 12:51:55 +0000
committersjakie2001-10-05 12:51:55 +0000
commit2193df68d22256fc01aa82bc902fbb683b681642 (patch)
tree31d4504ec8ab1116c965a97c9c0346e4aa113796 /frontend/parse.icl
parentbind special idents (such as abort, undef from StdMisc) to the correct identi... (diff)
Added existential attribute variables to type definitions
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@829 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'frontend/parse.icl')
-rw-r--r--frontend/parse.icl44
1 files changed, 23 insertions, 21 deletions
diff --git a/frontend/parse.icl b/frontend/parse.icl
index 76e28b1..157512b 100644
--- a/frontend/parse.icl
+++ b/frontend/parse.icl
@@ -2034,9 +2034,11 @@ optionalExistentialQuantifiedVariables pState
# (token, pState) = nextToken TypeContext pState
= case token of
ExistsToken
- # (vars, pState) = wantList "existential quantified variable(s)" try_existential_type_var pState
+ # (vars, pState) = wantList "existential quantified variable(s)" tryQuantifiedTypeVar pState
-> (vars, wantToken TypeContext "Existential Quantified Variables" ColonToken pState)
_ -> ([], tokenBack pState)
+
+/* Sjaak 041001
where
try_existential_type_var :: !ParseState -> (Bool,ATypeVar,ParseState)
try_existential_type_var pState
@@ -2053,34 +2055,34 @@ where
# atypevar = {atv_attribute = TA_None, atv_annotation = AN_None, atv_variable = typevar}
-> (True,atypevar,pState)
-> (False,abort "no ATypeVar",pState)
-
-// Sjaak 210801 ....
+*/
+// Sjaak 041001 ....
optionalUniversalQuantifiedVariables :: !*ParseState -> *(![ATypeVar],!*ParseState)
optionalUniversalQuantifiedVariables pState
# (token, pState) = nextToken TypeContext pState
= case token of
ForAllToken
- # (vars, pState) = wantList "universal quantified variable(s)" try_universal_type_var pState
+ # (vars, pState) = wantList "universal quantified variable(s)" tryQuantifiedTypeVar pState
-> (vars, wantToken TypeContext "Universal Quantified Variables" ColonToken pState)
_ -> ([], tokenBack pState)
-where
- try_universal_type_var :: !ParseState -> (Bool, ATypeVar, ParseState)
- try_universal_type_var pState
- # (token, pState) = nextToken TypeContext pState
- (succ, attr, pState) = try_universal_attribute token pState
- | succ
- # (typevar, pState) = wantTypeVar pState
- (attr, pState) = adjustAttributeOfTypeVariable attr typevar.tv_name pState
- = (True, {atv_attribute = attr, atv_annotation = AN_None, atv_variable = typevar}, pState)
- # (succ, typevar, pState) = tryTypeVarT token pState
- | succ
- = (True, {atv_attribute = TA_None, atv_annotation = AN_None, atv_variable = typevar}, pState)
- = (False, abort "no ATypeVar", pState)
-
- try_universal_attribute DotToken pState = (True, TA_Anonymous, pState)
- try_universal_attribute AsteriskToken pState = (True, TA_Unique, pState)
- try_universal_attribute token pState = (False, TA_None, pState)
+
+tryQuantifiedTypeVar :: !ParseState -> (Bool, ATypeVar, ParseState)
+tryQuantifiedTypeVar pState
+ # (token, pState) = nextToken TypeContext pState
+ (succ, attr, pState) = try_attribute token pState
+ | succ
+ # (typevar, pState) = wantTypeVar pState
+ (attr, pState) = adjustAttributeOfTypeVariable attr typevar.tv_name pState
+ = (True, {atv_attribute = attr, atv_annotation = AN_None, atv_variable = typevar}, pState)
+ # (succ, typevar, pState) = tryTypeVarT token pState
+ | succ
+ = (True, {atv_attribute = TA_None, atv_annotation = AN_None, atv_variable = typevar}, pState)
+ = (False, abort "no ATypeVar", pState)
+where
+ try_attribute DotToken pState = (True, TA_Anonymous, pState)
+ try_attribute AsteriskToken pState = (True, TA_Unique, pState)
+ try_attribute token pState = (False, TA_None, pState)
// ... Sjaak