aboutsummaryrefslogtreecommitdiff
path: root/frontend/parse.icl
diff options
context:
space:
mode:
authoralimarin2001-10-19 12:02:05 +0000
committeralimarin2001-10-19 12:02:05 +0000
commit3cb66d21e43dd48c61baec3ef24ca197c22cdef0 (patch)
tree9212b29bc345c24e83c9a7316d259c59beccddca /frontend/parse.icl
parentfix bug in renumbering of specials (diff)
higher-order kinded types in generics
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@871 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'frontend/parse.icl')
-rw-r--r--frontend/parse.icl13
1 files changed, 9 insertions, 4 deletions
diff --git a/frontend/parse.icl b/frontend/parse.icl
index 6e401c6..4236e72 100644
--- a/frontend/parse.icl
+++ b/frontend/parse.icl
@@ -1328,8 +1328,10 @@ optionalCoercions pState
wantGenericDefinition :: !ParseContext !Position !ParseState -> (!ParsedDefinition, !ParseState)
wantGenericDefinition parseContext pos pState
+ | SwitchGenerics False True
+ = (PD_Erroneous, parseError "generic definition" No "generics are not supported" pState)
| not pState.ps_support_generics
- = (PD_Erroneous, parseError "generic definition" No "support for generics is disabled in the compiler. " pState)
+ = (PD_Erroneous, parseError "generic definition" No "to enable generics use the command line flag -generics" pState)
# (name, pState) = want_name pState
| name == ""
= (PD_Erroneous, pState)
@@ -3357,8 +3359,10 @@ wantBeginGroup msg pState
// AA..
wantKind :: !ParseState -> !(!TypeKind, !ParseState)
wantKind pState
+ | SwitchGenerics False True
+ = (KindConst, parseError "kind" No "generics are not supported" pState)
| not pState.ps_support_generics
- = (KindConst, parseError "kind" No "support for generics is disabled in the compiler. " pState)
+ = (KindConst, parseError "kind" No "to enable generics use -generics command line flag" pState)
# (token, pState) = nextToken TypeContext pState
# (kind, pState) = want_simple_kind token pState
# (token, pState) = nextToken TypeContext pState
@@ -3368,7 +3372,7 @@ wantKind pState
want_simple_kind (IntToken str) pState
# n = toInt str
| n == 0 = (KindConst, pState)
- | n > 0 = (KindArrow (repeatn (n+1) KindConst), pState)
+ | n > 0 = (KindArrow (repeatn n KindConst), pState)
| otherwise = (KindConst, parseError "invalid kind" No "positive integer expected" pState)
want_simple_kind OpenToken pState = wantKind pState
want_simple_kind GenericOpenToken pState = wantKind pState
@@ -3379,7 +3383,8 @@ wantKind pState
# (rhs, pState) = wantKind pState
= case rhs of
(KindArrow ks) -> (KindArrow [kind : ks], pState)
- _ -> (KindArrow [kind, rhs], pState)
+ KindConst -> (KindArrow [kind], pState)
+ //_ -> (KindArrow [kind, rhs], pState)
want_kind kind CloseToken pState = (kind, pState)
want_kind kind GenericCloseToken pState = (kind, pState)
want_kind kind token pState