Commit aee6f194 authored by Martin Wierich's avatar Martin Wierich
Browse files

readableizing error messages

parent a18be23e
...@@ -2642,7 +2642,7 @@ checkModule {mod_type,mod_name,mod_imports,mod_imported_objects,mod_defs = cdefs ...@@ -2642,7 +2642,7 @@ checkModule {mod_type,mod_name,mod_imports,mod_imported_objects,mod_defs = cdefs
(icl_functions, e_info, heaps, cs) = checkMacros cIclModIndex cdefs.def_macros icl_functions e_info heaps cs (icl_functions, e_info, heaps, cs) = checkMacros cIclModIndex cdefs.def_macros icl_functions e_info heaps cs
(icl_functions, e_info, heaps, cs) = checkFunctions cIclModIndex cGlobalScope icl_global_function_range.ir_from icl_global_function_range.ir_to icl_functions e_info heaps cs (icl_functions, e_info, heaps, cs) = checkFunctions cIclModIndex cGlobalScope icl_global_function_range.ir_from icl_global_function_range.ir_to icl_functions e_info heaps cs
cs = check_start_rule mod_type icl_global_function_range cs cs = check_start_rule mod_type mod_name icl_global_function_range cs
cs = check_needed_modules_are_imported mod_name ".icl" cs cs = check_needed_modules_are_imported mod_name ".icl" cs
(icl_functions, e_info, heaps, {cs_symbol_table, cs_predef_symbols, cs_error}) (icl_functions, e_info, heaps, {cs_symbol_table, cs_predef_symbols, cs_error})
...@@ -2686,7 +2686,7 @@ checkModule {mod_type,mod_name,mod_imports,mod_imported_objects,mod_defs = cdefs ...@@ -2686,7 +2686,7 @@ checkModule {mod_type,mod_name,mod_imports,mod_imported_objects,mod_defs = cdefs
icl_declared = {dcls_local = local_defs, dcls_import = icl_imported, dcls_explicit = dcls_explicit} } icl_declared = {dcls_local = local_defs, dcls_import = icl_imported, dcls_explicit = dcls_explicit} }
= (False, icl_mod, dcl_modules, {}, No, heaps, cs_predef_symbols, cs_symbol_table, cs_error.ea_file) = (False, icl_mod, dcl_modules, {}, No, heaps, cs_predef_symbols, cs_symbol_table, cs_error.ea_file)
where where
check_start_rule mod_kind {ir_from, ir_to} cs=:{cs_predef_symbols,cs_symbol_table} check_start_rule mod_kind mod_name {ir_from, ir_to} cs=:{cs_predef_symbols,cs_symbol_table}
# (pre_symb, cs_predef_symbols) = cs_predef_symbols![PD_Start] # (pre_symb, cs_predef_symbols) = cs_predef_symbols![PD_Start]
({ste_kind, ste_index}, cs_symbol_table) = readPtr pre_symb.pds_ident.id_info cs_symbol_table ({ste_kind, ste_index}, cs_symbol_table) = readPtr pre_symb.pds_ident.id_info cs_symbol_table
cs = { cs & cs_predef_symbols = cs_predef_symbols, cs_symbol_table = cs_symbol_table } cs = { cs & cs_predef_symbols = cs_predef_symbols, cs_symbol_table = cs_symbol_table }
...@@ -2699,7 +2699,8 @@ checkModule {mod_type,mod_name,mod_imports,mod_imported_objects,mod_defs = cdefs ...@@ -2699,7 +2699,8 @@ checkModule {mod_type,mod_name,mod_imports,mod_imported_objects,mod_defs = cdefs
_ _
-> case mod_kind of -> case mod_kind of
MK_Main MK_Main
-> { cs & cs_error = checkError "Start" " function not defined" cs.cs_error } # pos = newPosition pre_symb.pds_ident (LinePos (mod_name.id_name+++".icl") 1)
-> { cs & cs_error = checkErrorWithIdentPos pos " has not been declared" cs.cs_error }
_ _
-> cs -> cs
......
...@@ -159,10 +159,8 @@ checkWarning id mess error=:{ea_file,ea_loc} ...@@ -159,10 +159,8 @@ checkWarning id mess error=:{ea_file,ea_loc}
= { error & ea_file = ea_file <<< "Check Warning " <<< hd ea_loc <<< ":\"" <<< id <<< "\" " <<< mess <<< '\n' } = { error & ea_file = ea_file <<< "Check Warning " <<< hd ea_loc <<< ":\"" <<< id <<< "\" " <<< mess <<< '\n' }
checkErrorWithIdentPos :: !IdentPos !a !*ErrorAdmin -> .ErrorAdmin | <<< a; checkErrorWithIdentPos :: !IdentPos !a !*ErrorAdmin -> .ErrorAdmin | <<< a;
checkErrorWithIdentPos ident_pos mess error_admin checkErrorWithIdentPos ident_pos mess error=:{ea_file}
# error_admin = pushErrorAdmin ident_pos error_admin = { error & ea_file = ea_file <<< "Check Error " <<< ident_pos <<< ":" <<< mess <<< '\n', ea_ok = False }
error_admin = checkError ident_pos.ip_ident mess error_admin
= popErrorAdmin error_admin
class envLookUp a :: !a !(Env Ident .b) -> (!Bool,.b) class envLookUp a :: !a !(Env Ident .b) -> (!Bool,.b)
......
...@@ -1944,7 +1944,13 @@ trySimpleNonLhsExpressionT BackSlashToken pState ...@@ -1944,7 +1944,13 @@ trySimpleNonLhsExpressionT BackSlashToken pState
(lam_args, pState) = wantList "arguments" trySimpleLhsExpression pState (lam_args, pState) = wantList "arguments" trySimpleLhsExpression pState
pState = want_lambda_sep pState pState = want_lambda_sep pState
(exp, pState) = wantExpression cIsNotAPattern pState (exp, pState) = wantExpression cIsNotAPattern pState
= (True, PE_Lambda lam_ident lam_args exp, pState) // MW9..
(file_name, line_nr, pState)
= getFileAndLineNr pState
position = FunPos file_name line_nr lam_ident.id_name
// ..MW9
// MW9 was = (True, PE_Lambda lam_ident lam_args exp, pState)
= (True, PE_Lambda lam_ident lam_args exp position, pState)
where where
want_lambda_sep pState want_lambda_sep pState
# (token, pState) = nextToken FunctionContext pState # (token, pState) = nextToken FunctionContext pState
......
...@@ -129,9 +129,11 @@ where ...@@ -129,9 +129,11 @@ where
collectFunctions (PE_Bound bound_expr) ca collectFunctions (PE_Bound bound_expr) ca
# (bound_expr, ca) = collectFunctions bound_expr ca # (bound_expr, ca) = collectFunctions bound_expr ca
= (PE_Bound bound_expr, ca) = (PE_Bound bound_expr, ca)
collectFunctions (PE_Lambda lam_ident args res) ca // MW was: collectFunctions (PE_Lambda lam_ident args res) ca
collectFunctions (PE_Lambda lam_ident args res pos) ca
# ((args,res), ca) = collectFunctions (args,res) ca # ((args,res), ca) = collectFunctions (args,res) ca
# (range, ca) = addFunctionsRange [transformLambda lam_ident args res] ca // MW was: # (range, ca) = addFunctionsRange [transformLambda lam_ident args res] ca
# (range, ca) = addFunctionsRange [transformLambda lam_ident args res pos] ca
= (PE_Let cIsStrict (CollectedLocalDefs { loc_functions = range, loc_nodes = [] }) = (PE_Let cIsStrict (CollectedLocalDefs { loc_functions = range, loc_nodes = [] })
(PE_Ident lam_ident), ca) (PE_Ident lam_ident), ca)
collectFunctions (PE_Record rec_expr type_name fields) ca collectFunctions (PE_Record rec_expr type_name fields) ca
...@@ -297,12 +299,15 @@ where ...@@ -297,12 +299,15 @@ where
NoCollectedLocalDefs :== CollectedLocalDefs { loc_functions = { ir_from = 0, ir_to = 0 }, loc_nodes = [] } NoCollectedLocalDefs :== CollectedLocalDefs { loc_functions = { ir_from = 0, ir_to = 0 }, loc_nodes = [] }
transformLambda :: Ident [ParsedExpr] ParsedExpr -> FunDef // MW was:transformLambda :: Ident [ParsedExpr] ParsedExpr -> FunDef
transformLambda lam_ident args result transformLambda :: Ident [ParsedExpr] ParsedExpr Position -> FunDef
// MW was:transformLambda lam_ident args result
transformLambda lam_ident args result pos
# lam_rhs = { rhs_alts = UnGuardedExpr { ewl_nodes = [], ewl_expr = result, ewl_locals = NoCollectedLocalDefs }, # lam_rhs = { rhs_alts = UnGuardedExpr { ewl_nodes = [], ewl_expr = result, ewl_locals = NoCollectedLocalDefs },
rhs_locals = NoCollectedLocalDefs } rhs_locals = NoCollectedLocalDefs }
lam_body = [{pb_args = args, pb_rhs = lam_rhs }] lam_body = [{pb_args = args, pb_rhs = lam_rhs }]
fun_def = MakeNewFunction lam_ident (length args) lam_body (FK_Function cNameLocationDependent) NoPrio No NoPos // MW was: fun_def = MakeNewFunction lam_ident (length args) lam_body (FK_Function cNameLocationDependent) NoPrio No NoPos
fun_def = MakeNewFunction lam_ident (length args) lam_body (FK_Function cNameLocationDependent) NoPrio No pos
= fun_def = fun_def
makeNilExpression :: *CollectAdmin -> (ParsedExpr,*CollectAdmin) makeNilExpression :: *CollectAdmin -> (ParsedExpr,*CollectAdmin)
......
...@@ -894,7 +894,7 @@ cNonUniqueSelection :== False ...@@ -894,7 +894,7 @@ cNonUniqueSelection :== False
| PE_Ident !Ident | PE_Ident !Ident
| PE_Basic !BasicValue | PE_Basic !BasicValue
| PE_Bound !BoundExpr | PE_Bound !BoundExpr
| PE_Lambda !Ident ![ParsedExpr] !ParsedExpr | PE_Lambda !Ident ![ParsedExpr] !ParsedExpr !Position
| PE_Tuple ![ParsedExpr] | PE_Tuple ![ParsedExpr]
| PE_Record !ParsedExpr !(Optional Ident) ![FieldAssignment] | PE_Record !ParsedExpr !(Optional Ident) ![FieldAssignment]
| PE_ArrayPattern ![ElemAssignment] | PE_ArrayPattern ![ElemAssignment]
......
...@@ -516,10 +516,10 @@ cNotVarNumber :== -1 ...@@ -516,10 +516,10 @@ cNotVarNumber :== -1
:: FunctionInfo = FI_Empty | FI_Function !GeneratedFunction :: FunctionInfo = FI_Empty | FI_Function !GeneratedFunction
:: Producer = PR_Empty :: Producer = PR_Empty
| PR_Function !SymbIdent !Index !Int // Int: number of actual arguments in application | PR_Function !SymbIdent !Index !Int // Int: number of actual arguments in application (XXX possibly superfluous (already contained in SymbIdent))
| PR_Class !App ![BoundVar] !Type | PR_Class !App ![BoundVar] !Type
// | PR_Constructor !SymbIdent ![Expression] // | PR_Constructor !SymbIdent ![Expression]
| PR_GeneratedFunction !SymbIdent !Index !Int // Int: number of actual arguments in application | PR_GeneratedFunction !SymbIdent !Index !Int // Int: number of actual arguments in application (XXX possibly superfluous (already contained in SymbIdent))
:: InstanceInfo = II_Empty | II_Node !{! Producer} !FunctionInfoPtr !InstanceInfo !InstanceInfo :: InstanceInfo = II_Empty | II_Node !{! Producer} !FunctionInfoPtr !InstanceInfo !InstanceInfo
...@@ -859,7 +859,7 @@ cNonUniqueSelection :== False ...@@ -859,7 +859,7 @@ cNonUniqueSelection :== False
| PE_Ident !Ident | PE_Ident !Ident
| PE_Basic !BasicValue | PE_Basic !BasicValue
| PE_Bound !BoundExpr | PE_Bound !BoundExpr
| PE_Lambda !Ident ![ParsedExpr] !ParsedExpr | PE_Lambda !Ident ![ParsedExpr] !ParsedExpr !Position
| PE_Tuple ![ParsedExpr] | PE_Tuple ![ParsedExpr]
| PE_Record !ParsedExpr !(Optional Ident) ![FieldAssignment] | PE_Record !ParsedExpr !(Optional Ident) ![FieldAssignment]
| PE_ArrayPattern ![ElemAssignment] | PE_ArrayPattern ![ElemAssignment]
...@@ -1455,7 +1455,7 @@ where ...@@ -1455,7 +1455,7 @@ where
(<<<) file PE_Empty = file <<< "** E **" (<<<) file PE_Empty = file <<< "** E **"
(<<<) file (PE_Ident symb) = file <<< symb (<<<) file (PE_Ident symb) = file <<< symb
(<<<) file PE_WildCard = file <<< '_' (<<<) file PE_WildCard = file <<< '_'
(<<<) file (PE_Lambda _ exprs expr) = file <<< '\\' <<< exprs <<< " -> " <<< expr (<<<) file (PE_Lambda _ exprs expr _) = file <<< '\\' <<< exprs <<< " -> " <<< expr
(<<<) file (PE_Bound bind) = file <<< bind (<<<) file (PE_Bound bind) = file <<< bind
(<<<) file (PE_Case _ expr alts) = file <<< "case " <<< expr <<< " of\n" <<< alts (<<<) file (PE_Case _ expr alts) = file <<< "case " <<< expr <<< " of\n" <<< alts
(<<<) file (PE_Let _ defs expr) = file <<< "let " <<< defs <<< " in\n" <<< expr (<<<) file (PE_Let _ defs expr) = file <<< "let " <<< defs <<< " in\n" <<< expr
......
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