diff options
| author | martinw | 2000-10-04 15:10:44 +0000 | 
|---|---|---|
| committer | martinw | 2000-10-04 15:10:44 +0000 | 
| commit | d5118da0636c5263a78fdc0f116b0627a302befc (patch) | |
| tree | 9fb5c23d60adbbc65e5294f8bd14e48e9b0fb2aa | |
| parent | -added position information for let bindings for better error messages (diff) | |
added new function to print function names like "c;102;13" as "comprehesion [line 102]"
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@247 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
| -rw-r--r-- | frontend/typesupport.dcl | 4 | ||||
| -rw-r--r-- | frontend/typesupport.icl | 33 | 
2 files changed, 36 insertions, 1 deletions
| diff --git a/frontend/typesupport.dcl b/frontend/typesupport.dcl index 3bdf7ab..0b3c4d1 100644 --- a/frontend/typesupport.dcl +++ b/frontend/typesupport.dcl @@ -86,7 +86,9 @@ addAttrEnvInequalities :: ![AttrInequality] !*Coercions !u:AttrVarHeap  						-> (!.Coercions, !u:AttrVarHeap)  	// assertion: the attribute variables point to (AVI_Attr (TA_TempVar nr)) where  	// nr corresponds to the attribute variable - +optBeautifulizeIdent :: !String -> Optional (!String, !LineNr) +	// convert something like "c;8;2" to Yes ("comprehension", 8) +	  //accCoercionTree :: !.(u:CoercionTree -> (.a,u:CoercionTree)) !Int !*{!u:CoercionTree} -> (!.a,!{!u:CoercionTree})  accCoercionTree f i coercion_trees  	:== acc_coercion_tree i coercion_trees diff --git a/frontend/typesupport.icl b/frontend/typesupport.icl index 11bd794..b9ee9b9 100644 --- a/frontend/typesupport.icl +++ b/frontend/typesupport.icl @@ -1492,3 +1492,36 @@ addAttrEnvInequalities st_attr_env coercions th_attrs  		# (AVI_Attr (TA_TempVar offered), th_attrs) = readPtr ai_offered.av_info_ptr th_attrs  		  (AVI_Attr (TA_TempVar demanded), th_attrs) = readPtr ai_demanded.av_info_ptr th_attrs    		= (newInequality offered demanded coercions, th_attrs) + +optBeautifulizeIdent :: !String -> Optional (!String, !LineNr) +optBeautifulizeIdent id_name +	# fst_semicolon_index = searchlArrElt ((==) ';') id_name 0 +	| fst_semicolon_index < size id_name +		# snd_semicolon_index = searchlArrElt ((==) ';') id_name (fst_semicolon_index+1) +		  prefix = id_name % (0, fst_semicolon_index-1) +		  line = toInt (id_name % (fst_semicolon_index+1, snd_semicolon_index-1)) +		= Yes (prefix_to_readable_name prefix, line) +	= No +  where +	prefix_to_readable_name "_c"	= "case" +	prefix_to_readable_name "_g"	= "guard" +	prefix_to_readable_name "_f"	= "filter" +	prefix_to_readable_name "\\"	= "lambda" +	prefix_to_readable_name prefix +		| prefix.[0] == 'c' +			= "comprehension" +		| prefix.[0] == 'g' +			= "generator" +	prefix_to_readable_name _		= abort "fatal error 21 in type.icl" + +// search for an element in an array +searchlArrElt p s i +	:== searchl s i +  where +	searchl s i +		| i>=size s +			= i +		| p s.[i] +			= i +		= searchl s (i+1) +// ..MW4 | 
