aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjohnvg2001-10-12 10:39:33 +0000
committerjohnvg2001-10-12 10:39:33 +0000
commitb0e1dad1bde865061d9790693377f931a4efed1b (patch)
tree5ae8d17455e016fea80cef5aa4a30b8e4157db92
parentbind special idents (such as abort, undef from StdMisc) to the correct identi... (diff)
add <|- generator for overloaded lists again
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@846 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
-rw-r--r--frontend/parse.icl6
-rw-r--r--frontend/syntax.dcl5
-rw-r--r--frontend/syntax.icl12
3 files changed, 9 insertions, 14 deletions
diff --git a/frontend/parse.icl b/frontend/parse.icl
index 157512b..6e401c6 100644
--- a/frontend/parse.icl
+++ b/frontend/parse.icl
@@ -2665,16 +2665,14 @@ where
(lhs_expr, pState) = wantExpression cIsAPattern pState
(token, pState) = nextToken FunctionContext pState
| token == LeftArrowToken
-//MW3 was: = want_generators IsListGenerator (toLineAndColumn qual_position) lhs_expr pState
= want_generators IsListGenerator (toLineAndColumn qual_position) qual_filename lhs_expr pState
| token == LeftArrowColonToken
-//MW3 was: = want_generators IsArrayGenerator (toLineAndColumn qual_position) lhs_expr pState
= want_generators IsArrayGenerator (toLineAndColumn qual_position) qual_filename lhs_expr pState
+ | token == LeftArrowWithBarToken
+ = want_generators IsOverloadedListGenerator (toLineAndColumn qual_position) qual_filename lhs_expr pState
= ({qual_generators = [], qual_filter = No, qual_position = {lc_line = 0, lc_column = 0}, qual_filename = "" },
parseError "comprehension: qualifier" (Yes token) "qualifier(s)" pState)
-//MW3 was: want_generators :: !GeneratorKind !LineAndColumn !ParsedExpr !ParseState -> (!Qualifier, !ParseState)
-//MW3 was: want_generators gen_kind qual_position pattern_exp pState
want_generators :: !GeneratorKind !LineAndColumn !FileName !ParsedExpr !ParseState -> (!Qualifier, !ParseState)
want_generators gen_kind qual_position qual_filename pattern_exp pState
# (gen_position, pState) = getPosition pState
diff --git a/frontend/syntax.dcl b/frontend/syntax.dcl
index 5437bfb..5de820b 100644
--- a/frontend/syntax.dcl
+++ b/frontend/syntax.dcl
@@ -1055,10 +1055,7 @@ cNonUniqueSelection :== False
| PS_Array !ParsedExpr
| PS_Erroneous
-:: GeneratorKind :== Bool
-
-IsListGenerator :== True
-IsArrayGenerator :== False
+:: GeneratorKind = IsListGenerator | IsOverloadedListGenerator | IsArrayGenerator
:: LineAndColumn = {lc_line :: !Int, lc_column :: !Int}
diff --git a/frontend/syntax.icl b/frontend/syntax.icl
index 63d0a91..1e9ad0b 100644
--- a/frontend/syntax.icl
+++ b/frontend/syntax.icl
@@ -1050,11 +1050,7 @@ cNonUniqueSelection :== False
| PS_Array !ParsedExpr
| PS_Erroneous
-
-:: GeneratorKind :== Bool
-
-IsListGenerator :== True
-IsArrayGenerator :== False
+:: GeneratorKind = IsListGenerator | IsOverloadedListGenerator | IsArrayGenerator
:: LineAndColumn = {lc_line :: !Int, lc_column :: !Int}
@@ -1524,7 +1520,11 @@ where
instance <<< Generator
where
(<<<) file {gen_kind,gen_pattern,gen_expr}
- = file <<< gen_pattern <<< (if gen_kind "<-" "<-:") <<< gen_expr
+ = file <<< gen_pattern <<< (gen_kind_to_string gen_kind) <<< gen_expr
+ where
+ gen_kind_to_string IsListGenerator = "<-"
+ gen_kind_to_string IsOverloadedListGenerator = "<|-"
+ gen_kind_to_string IsArrayGenerator = "<-:"
instance <<< BasicValue
where