Commit 6f88b920 authored by Martin Wierich's avatar Martin Wierich
Browse files

added error messages

"first argument of infix operator missing" and
"second argument of infix operator missing"
parent 2467f5ca
......@@ -1187,6 +1187,11 @@ where
check_expressions free_vars [] e_input e_state e_info cs
= ([], free_vars, e_state, e_info, cs)
first_argument_of_infix_operator_missing
= "first argument of infix operator missing"
build_expression [Constant symb _ (Prio _ _) _ , _: _] e_state cs_error
= (EE, e_state, checkError symb.symb_name first_argument_of_infix_operator_missing cs_error)
build_expression [Constant symb arity _ is_fun] e_state cs_error
= buildApplication symb arity 0 is_fun [] e_state cs_error
build_expression [expr] e_state cs_error
......@@ -1196,13 +1201,19 @@ where
(left_expr, e_state, cs_error) = combine_expressions left [] 0 e_state cs_error
= case opt_opr of
Yes (symb, prio, is_fun, right)
-> build_operator_expression [] left_expr (symb, prio, is_fun) right e_state cs_error
-> case right of
[Constant symb _ (Prio _ _) _:_]
-> (EE, e_state, checkError symb.symb_name first_argument_of_infix_operator_missing cs_error)
_
-> build_operator_expression [] left_expr (symb, prio, is_fun) right e_state cs_error
No
-> (left_expr, e_state, cs_error)
where
split_at_operator left [Constant symb arity NoPrio is_fun : exprs] e_state cs_error
# (appl_exp, e_state, cs_error) = buildApplication symb arity 0 is_fun [] e_state cs_error
= split_at_operator [appl_exp : left] exprs e_state cs_error
split_at_operator left [Constant symb arity (Prio _ _) is_fun] e_state cs_error
= (No, left, e_state, checkError symb.symb_name "second argument of infix operator missing" cs_error)
split_at_operator left [Constant symb arity prio is_fun] e_state cs_error
# (appl_exp, e_state, cs_error) = buildApplication symb arity 0 is_fun [] e_state cs_error
= (No, [appl_exp : left], e_state, cs_error)
......
......@@ -384,7 +384,8 @@ transformGenerator {gen_kind, gen_expr, gen_pattern, gen_position} ca
transformed_generator
= { tg_expr = PE_Tuple [PE_Basic (BVI "0"), PE_List [PE_Ident usize, gen_expr]]
, tg_lhs_arg = PE_Tuple [i, PE_Tuple [n, array]]
, tg_case_end_expr = PE_List [PE_Ident smaller, i, n]
// MW50 , tg_case_end_expr = PE_List [PE_Ident smaller, i, n]
, tg_case_end_expr = PE_List [PE_List [PE_Ident smaller], i, n]
, tg_case_end_pattern = PE_Basic (BVB True)
, tg_element = PE_List [PE_Ident uselect, array, i]
, tg_case1 = gen_var_case1
......
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