From ecc2d455e4f66755fb4a82de63b08373ae351dd0 Mon Sep 17 00:00:00 2001 From: johnvg Date: Mon, 4 Nov 2013 16:22:41 +0000 Subject: fix comprehensions with a non lower case identifier as pattern, for example: [0 \\ [] <- [[]]] git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@2317 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d --- frontend/postparse.icl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'frontend/postparse.icl') diff --git a/frontend/postparse.icl b/frontend/postparse.icl index 3f09591..f1dd0ed 100644 --- a/frontend/postparse.icl +++ b/frontend/postparse.icl @@ -948,8 +948,9 @@ makeComprehensions [{tq_generators,tq_let_defs,tq_filter, tq_end, tq_call, tq_lh case_with_default :: Ident ParsedExpr Bool ParsedExpr Rhs ParsedExpr -> Rhs case_with_default case_ident expr expr_is_uselect pattern=:(PE_Ident ident) rhs=:{rhs_alts=UnGuardedExpr ung_exp=:{ewl_nodes,ewl_expr,ewl_locals=LocalParsedDefs [],ewl_position},rhs_locals=LocalParsedDefs []} default_rhs - # new_node={ndwl_strict=False,ndwl_def={bind_src=expr,bind_dst=pattern},ndwl_locals=LocalParsedDefs [],ndwl_position=ewl_position} - = {rhs & rhs_alts=UnGuardedExpr {ung_exp & ewl_nodes=[new_node:ewl_nodes]}} + | isLowerCaseName ident.id_name + # new_node={ndwl_strict=False,ndwl_def={bind_src=expr,bind_dst=pattern},ndwl_locals=LocalParsedDefs [],ndwl_position=ewl_position} + = {rhs & rhs_alts=UnGuardedExpr {ung_exp & ewl_nodes=[new_node:ewl_nodes]}} case_with_default case_ident expr True pattern=:(PE_Tuple [PE_Ident ident1,ident2_exp=:PE_Ident ident2]) rhs=:{rhs_alts=UnGuardedExpr ung_exp=:{ewl_nodes,ewl_expr,ewl_locals=LocalParsedDefs [],ewl_position},rhs_locals=LocalParsedDefs []} default_rhs # new_node1={ndwl_strict=False,ndwl_def={bind_src=expr,bind_dst=pattern},ndwl_locals=LocalParsedDefs [],ndwl_position=ewl_position} # new_node2={ndwl_strict=True,ndwl_def={bind_src=ident2_exp,bind_dst=ident2_exp},ndwl_locals=LocalParsedDefs [],ndwl_position=ewl_position} -- cgit v1.2.3