aboutsummaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
authorjohnvg2011-08-10 11:32:12 +0000
committerjohnvg2011-08-10 11:32:12 +0000
commitc11b73b8dc11e7460990c61472ca91d8cc6b4f82 (patch)
treea8ff6c290fae05c0abf3ddc885505819a0dc5dec /frontend
parentfix small bug in merging Deps or Lubs (diff)
prevent compiler crash if an uppercase generic identifier is used in a pattern
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@1958 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'frontend')
-rw-r--r--frontend/parse.icl47
1 files changed, 21 insertions, 26 deletions
diff --git a/frontend/parse.icl b/frontend/parse.icl
index 1da098f..72135a4 100644
--- a/frontend/parse.icl
+++ b/frontend/parse.icl
@@ -2895,33 +2895,28 @@ trySimpleExpression is_pattern pState
trySimpleExpressionT :: !Token !Bool !ParseState -> (!Bool, !ParsedExpr, !ParseState)
trySimpleExpressionT (IdentToken name) is_pattern pState
- | isLowerCaseName name
- # (id, pState) = stringToIdent name IC_Expression pState
- | is_pattern
- # (token, pState) = nextToken FunctionContext pState
- | token == DefinesColonToken
- # (succ, expr, pState) = trySimpleExpression is_pattern pState
- | succ
- = (True, PE_Bound { bind_dst = id, bind_src = expr }, pState)
- = (True, PE_Empty, parseError "simple expression" No "expression" pState)
- // token <> DefinesColonToken
- = (True, PE_Ident id, tokenBack pState)
- // not is_pattern
- # (token, pState) = nextToken FunctionContext pState
- | token == GenericOpenToken
- # (kind, pState) = wantKind pState
- = (True, PE_Generic id kind, pState)
- = (True, PE_Ident id, tokenBack pState)
-
-trySimpleExpressionT (IdentToken name) is_pattern pState
-// | isUpperCaseName name || ~ is_pattern
# (id, pState) = stringToIdent name IC_Expression pState
- # (token, pState) = nextToken FunctionContext pState
- | token == GenericOpenToken
- # (kind, pState) = wantKind pState
- = (True, PE_Generic id kind, pState)
- = (True, PE_Ident id, tokenBack pState)
-
+ | isLowerCaseName name
+ | is_pattern
+ # (token, pState) = nextToken FunctionContext pState
+ | token == DefinesColonToken
+ # (succ, expr, pState) = trySimpleExpression is_pattern pState
+ | succ
+ = (True, PE_Bound { bind_dst = id, bind_src = expr }, pState)
+ = (True, PE_Empty, parseError "simple expression" No "expression" pState)
+ = (True, PE_Ident id, tokenBack pState)
+ # (token, pState) = nextToken FunctionContext pState
+ | token == GenericOpenToken
+ # (kind, pState) = wantKind pState
+ = (True, PE_Generic id kind, pState)
+ = (True, PE_Ident id, tokenBack pState)
+ | is_pattern
+ = (True, PE_Ident id, pState)
+ # (token, pState) = nextToken FunctionContext pState
+ | token == GenericOpenToken
+ # (kind, pState) = wantKind pState
+ = (True, PE_Generic id kind, pState)
+ = (True, PE_Ident id, tokenBack pState)
trySimpleExpressionT SquareOpenToken is_pattern pState
# (list_expr, pState) = wantListExp is_pattern pState
= (True, list_expr, pState)