Commit 0d6d1318 authored by Martin Wierich's avatar Martin Wierich
Browse files

added new function to print function names like "c;102;13" as "comprehesion [line 102]"

parent d602cd1d
......@@ -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
......
......@@ -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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment