diff --git a/src/haz3lweb/view/LangDoc.re b/src/haz3lweb/view/LangDoc.re index 57111446e0..b79097ef14 100644 --- a/src/haz3lweb/view/LangDoc.re +++ b/src/haz3lweb/view/LangDoc.re @@ -1855,584 +1855,8 @@ let get_doc = | Parens(_) => default // Shouldn't get hit? | TypeAnn(_) => default // Shouldn't get hit? }; - | Module(pat, def, body) => - let basic = (doc: LangDocMessages.form, group_id, options) => { - let pat_id = List.nth(pat.ids, 0); - let def_id = List.nth(def.ids, 0); - get_message( - doc, - options, - group_id, - Printf.sprintf( - Scanf.format_from_string(doc.explanation.message, "%i%i"), - def_id, - pat_id, - ), - LangDocMessages.let_base_exp_coloring_ids(~pat_id, ~def_id), - ); - }; - let pat = bypass_parens_and_annot_pat(pat); - switch (pat.term) { - | EmptyHole => - let (doc, options) = - LangDocMessages.get_form_and_options( - LangDocMessages.let_empty_hole_exp_group, - docs, - ); - if (LangDocMessages.let_empty_hole_exp.id == doc.id) { - let pat_id = List.nth(pat.ids, 0); - let def_id = List.nth(def.ids, 0); - get_message( - doc, - options, - LangDocMessages.let_empty_hole_exp_group, - Printf.sprintf( - Scanf.format_from_string(doc.explanation.message, "%i%i%i"), - pat_id, - def_id, - pat_id, - ), - LangDocMessages.let_empty_hole_exp_coloring_ids( - ~pat_id, - ~def_id, - ), - ); - } else { - basic(doc, LangDocMessages.let_empty_hole_exp_group, options); - }; - | MultiHole(_) => - let (doc, options) = - LangDocMessages.get_form_and_options( - LangDocMessages.let_multi_hole_exp_group, - docs, - ); - if (LangDocMessages.let_multi_hole_exp.id == doc.id) { - let pat_id = List.nth(pat.ids, 0); - let def_id = List.nth(def.ids, 0); - get_message( - doc, - options, - LangDocMessages.let_multi_hole_exp_group, - Printf.sprintf( - Scanf.format_from_string(doc.explanation.message, "%i%i%i"), - pat_id, - def_id, - pat_id, - ), - LangDocMessages.let_multi_hole_exp_coloring_ids( - ~pat_id, - ~def_id, - ), - ); - } else { - basic(doc, LangDocMessages.let_multi_hole_exp_group, options); - }; - | Wild => - let (doc, options) = - LangDocMessages.get_form_and_options( - LangDocMessages.let_wild_exp_group, - docs, - ); - if (LangDocMessages.let_wild_exp.id == doc.id) { - let def_id = List.nth(def.ids, 0); - let body_id = List.nth(body.ids, 0); - get_message( - doc, - options, - LangDocMessages.let_wild_exp_group, - Printf.sprintf( - Scanf.format_from_string(doc.explanation.message, "%i%i%i"), - def_id, - def_id, - body_id, - ), - LangDocMessages.let_wild_exp_coloring_ids(~def_id, ~body_id), - ); - } else { - basic(doc, LangDocMessages.let_wild_exp_group, options); - }; - | Int(i) => - let (doc, options) = - LangDocMessages.get_form_and_options( - LangDocMessages.let_int_exp_group, - docs, - ); - if (LangDocMessages.let_int_exp.id == doc.id) { - let pat_id = List.nth(pat.ids, 0); - let def_id = List.nth(def.ids, 0); - let body_id = List.nth(body.ids, 0); - get_message( - doc, - options, - LangDocMessages.let_int_exp_group, - Printf.sprintf( - Scanf.format_from_string( - doc.explanation.message, - "%i%i%i%i%i", - ), - def_id, - pat_id, - i, - def_id, - body_id, - ), - LangDocMessages.let_int_exp_coloring_ids( - ~pat_id, - ~def_id, - ~body_id, - ), - ); - } else { - /* TODO The coloring for the syntactic form is sometimes wrong here and some other places when switching between forms and specificity levels... maybe a Safari issue... */ - basic( - doc, - LangDocMessages.let_int_exp_group, - options, - ); - }; - | Float(f) => - let (doc, options) = - LangDocMessages.get_form_and_options( - LangDocMessages.let_float_exp_group, - docs, - ); - if (LangDocMessages.let_float_exp.id == doc.id) { - let pat_id = List.nth(pat.ids, 0); - let def_id = List.nth(def.ids, 0); - let body_id = List.nth(body.ids, 0); - // TODO Make sure everywhere printing the float literal print it prettier - get_message( - doc, - options, - LangDocMessages.let_float_exp_group, - Printf.sprintf( - Scanf.format_from_string( - doc.explanation.message, - "%i%i%f%i%i", - ), - def_id, - pat_id, - f, - def_id, - body_id, - ), - LangDocMessages.let_float_exp_coloring_ids( - ~pat_id, - ~def_id, - ~body_id, - ), - ); - } else { - /* TODO The coloring for the syntactic form is sometimes wrong here... */ - basic( - doc, - LangDocMessages.let_float_exp_group, - options, - ); - }; - | Bool(b) => - let (doc, options) = - LangDocMessages.get_form_and_options( - LangDocMessages.let_bool_exp_group, - docs, - ); - if (LangDocMessages.let_bool_exp.id == doc.id) { - let pat_id = List.nth(pat.ids, 0); - let def_id = List.nth(def.ids, 0); - let body_id = List.nth(body.ids, 0); - get_message( - doc, - options, - LangDocMessages.let_bool_exp_group, - Printf.sprintf( - Scanf.format_from_string( - doc.explanation.message, - "%i%i%b%i%i", - ), - def_id, - pat_id, - b, - def_id, - body_id, - ), - LangDocMessages.let_bool_exp_coloring_ids( - ~pat_id, - ~def_id, - ~body_id, - ), - ); - } else { - /* TODO The coloring for the syntactic form is sometimes wrong here... */ - basic( - doc, - LangDocMessages.let_bool_exp_group, - options, - ); - }; - | String(s) => - let (doc, options) = - LangDocMessages.get_form_and_options( - LangDocMessages.let_str_exp_group, - docs, - ); - if (LangDocMessages.let_str_exp.id == doc.id) { - let pat_id = List.nth(pat.ids, 0); - let def_id = List.nth(def.ids, 0); - let body_id = List.nth(body.ids, 0); - get_message( - doc, - options, - LangDocMessages.let_str_exp_group, - Printf.sprintf( - Scanf.format_from_string( - doc.explanation.message, - "%i%i%s%i%i", - ), - def_id, - pat_id, - s, - def_id, - body_id, - ), - LangDocMessages.let_str_exp_coloring_ids( - ~pat_id, - ~def_id, - ~body_id, - ), - ); - } else { - /* TODO The coloring for the syntactic form is sometimes wrong here... */ - basic( - doc, - LangDocMessages.let_str_exp_group, - options, - ); - }; - | Triv => - let (doc, options) = - LangDocMessages.get_form_and_options( - LangDocMessages.let_triv_exp_group, - docs, - ); - if (LangDocMessages.let_triv_exp.id == doc.id) { - let pat_id = List.nth(pat.ids, 0); - let def_id = List.nth(def.ids, 0); - let body_id = List.nth(body.ids, 0); - get_message( - doc, - options, - LangDocMessages.let_triv_exp_group, - Printf.sprintf( - Scanf.format_from_string(doc.explanation.message, "%i%i%i%i"), - def_id, - pat_id, - def_id, - body_id, - ), - LangDocMessages.let_triv_exp_coloring_ids( - ~pat_id, - ~def_id, - ~body_id, - ), - ); - } else { - /* TODO The coloring for the syntactic form is sometimes wrong here and other places when switching syntactic specificities... seems like might be Safari issue... */ - basic( - doc, - LangDocMessages.let_triv_exp_group, - options, - ); - }; - | ListLit(elements) => - if (List.length(elements) == 0) { - let (doc, options) = - LangDocMessages.get_form_and_options( - LangDocMessages.let_listnil_exp_group, - docs, - ); - if (LangDocMessages.let_listnil_exp.id == doc.id) { - let pat_id = List.nth(pat.ids, 0); - let def_id = List.nth(def.ids, 0); - let body_id = List.nth(body.ids, 0); - get_message( - doc, - options, - LangDocMessages.let_listnil_exp_group, - Printf.sprintf( - Scanf.format_from_string( - doc.explanation.message, - "%i%i%i%i", - ), - def_id, - pat_id, - def_id, - body_id, - ), - LangDocMessages.let_listnil_exp_coloring_ids( - ~pat_id, - ~def_id, - ~body_id, - ), - ); - } else { - basic(doc, LangDocMessages.let_listnil_exp_group, options); - }; - } else { - let (doc, options) = - LangDocMessages.get_form_and_options( - LangDocMessages.let_listlit_exp_group, - docs, - ); - if (LangDocMessages.let_listlit_exp.id == doc.id) { - let pat_id = List.nth(pat.ids, 0); - let def_id = List.nth(def.ids, 0); - get_message( - doc, - options, - LangDocMessages.let_listlit_exp_group, - Printf.sprintf( - Scanf.format_from_string(doc.explanation.message, "%i%i%i"), - def_id, - pat_id, - List.length(elements), - ), - LangDocMessages.let_listlit_exp_coloring_ids( - ~pat_id, - ~def_id, - ), - ); - } else { - basic(doc, LangDocMessages.let_listlit_exp_group, options); - }; - } - | Cons(hd, tl) => - let (doc, options) = - LangDocMessages.get_form_and_options( - LangDocMessages.let_cons_exp_group, - docs, - ); - if (LangDocMessages.let_cons_exp.id == doc.id) { - let hd_id = List.nth(hd.ids, 0); - let tl_id = List.nth(tl.ids, 0); - let def_id = List.nth(def.ids, 0); - get_message( - doc, - options, - LangDocMessages.let_cons_exp_group, - Printf.sprintf( - Scanf.format_from_string(doc.explanation.message, "%i%i%i"), - def_id, - hd_id, - tl_id, - ), - LangDocMessages.let_cons_exp_coloring_ids( - ~hd_id, - ~tl_id, - ~def_id, - ), - ); - } else { - basic(doc, LangDocMessages.let_cons_exp_group, options); - }; - | Var(var) => - let (doc, options) = - LangDocMessages.get_form_and_options( - LangDocMessages.let_var_exp_group, - docs, - ); - if (LangDocMessages.let_var_exp.id == doc.id) { - let pat_id = List.nth(pat.ids, 0); - let def_id = List.nth(def.ids, 0); - let body_id = List.nth(body.ids, 0); - get_message( - doc, - options, - LangDocMessages.let_var_exp_group, - Printf.sprintf( - Scanf.format_from_string(doc.explanation.message, "%i%i%s%i"), - def_id, - pat_id, - var, - body_id, - ), - LangDocMessages.let_var_exp_coloring_ids( - ~pat_id, - ~def_id, - ~body_id, - ), - ); - } else { - basic(doc, LangDocMessages.let_var_exp_group, options); - }; - | Tuple(elements) => - let pat_id = List.nth(pat.ids, 0); - let def_id = List.nth(def.ids, 0); - let basic_tuple = (doc: LangDocMessages.form, group_id, options) => { - get_message( - doc, - options, - group_id, - Printf.sprintf( - Scanf.format_from_string(doc.explanation.message, "%i%i%i"), - def_id, - pat_id, - List.length(elements), - ), - LangDocMessages.let_tuple_exp_coloring_ids(~pat_id, ~def_id), - ); - }; - - switch (List.length(elements)) { - | 2 => - let (doc, options) = - LangDocMessages.get_form_and_options( - LangDocMessages.let_tuple2_exp_group, - docs, - ); - if (LangDocMessages.let_tuple2_exp.id == doc.id) { - let pat1_id = List.nth(List.nth(elements, 0).ids, 0); - let pat2_id = List.nth(List.nth(elements, 1).ids, 0); - get_message( - doc, - options, - LangDocMessages.let_tuple2_exp_group, - Printf.sprintf( - Scanf.format_from_string(doc.explanation.message, "%i%i%i"), - def_id, - pat1_id, - pat2_id, - ), - LangDocMessages.let_tuple2_exp_coloring_ids( - ~pat1_id, - ~pat2_id, - ~def_id, - ), - ); - } else if (LangDocMessages.let_tuple_exp.id == doc.id) { - basic_tuple(doc, LangDocMessages.let_tuple2_exp_group, options); - } else { - basic(doc, LangDocMessages.let_tuple2_exp_group, options); - }; - | 3 => - let (doc, options) = - LangDocMessages.get_form_and_options( - LangDocMessages.let_tuple3_exp_group, - docs, - ); - // TODO Syntactic form can go off page - so can examples - but can scroll, just can't see bottom scroll bar - if (LangDocMessages.let_tuple3_exp.id == doc.id) { - let pat1_id = List.nth(List.nth(elements, 0).ids, 0); - let pat2_id = List.nth(List.nth(elements, 1).ids, 0); - let pat3_id = List.nth(List.nth(elements, 2).ids, 0); - get_message( - doc, - options, - LangDocMessages.let_tuple3_exp_group, - Printf.sprintf( - Scanf.format_from_string( - doc.explanation.message, - "%i%i%i%i", - ), - def_id, - pat1_id, - pat2_id, - pat3_id, - ), - LangDocMessages.let_tuple3_exp_coloring_ids( - ~pat1_id, - ~pat2_id, - ~pat3_id, - ~def_id, - ), - ); - } else if (LangDocMessages.let_tuple_exp.id == doc.id) { - basic_tuple(doc, LangDocMessages.let_tuple3_exp_group, options); - } else { - basic(doc, LangDocMessages.let_tuple3_exp_group, options); - }; - | _ => - let (doc, options) = - LangDocMessages.get_form_and_options( - LangDocMessages.let_tuple_base_exp_group, - docs, - ); - if (LangDocMessages.let_tuple_exp.id == doc.id) { - basic_tuple( - doc, - LangDocMessages.let_tuple_base_exp_group, - options, - ); - } else { - basic(doc, LangDocMessages.let_tuple_base_exp_group, options); - }; - }; - | Ap(con, arg) => - let (doc, options) = - LangDocMessages.get_form_and_options( - LangDocMessages.let_ap_exp_group, - docs, - ); - if (LangDocMessages.let_ap_exp.id == doc.id) { - let con_id = List.nth(con.ids, 0); - let arg_id = List.nth(arg.ids, 0); - let def_id = List.nth(def.ids, 0); - get_message( - doc, - options, - LangDocMessages.let_ap_exp_group, - Printf.sprintf( - Scanf.format_from_string(doc.explanation.message, "%i%i%i"), - def_id, - con_id, - arg_id, - ), - LangDocMessages.let_ap_exp_coloring_ids( - ~con_id, - ~arg_id, - ~def_id, - ), - ); - } else { - basic(doc, LangDocMessages.let_ap_exp_group, options); - }; - | Tag(v) => - let (doc, options) = - LangDocMessages.get_form_and_options( - LangDocMessages.let_tag_exp_group, - docs, - ); - if (LangDocMessages.let_tag_exp.id == doc.id) { - let pat_id = List.nth(pat.ids, 0); - let def_id = List.nth(def.ids, 0); - let body_id = List.nth(body.ids, 0); - get_message( - doc, - options, - LangDocMessages.let_tag_exp_group, - Printf.sprintf( - Scanf.format_from_string( - doc.explanation.message, - "%i%i%s%i%i", - ), - def_id, - pat_id, - v, - def_id, - body_id, - ), - LangDocMessages.let_tag_exp_coloring_ids( - ~pat_id, - ~def_id, - ~body_id, - ), - ); - } else { - basic(doc, LangDocMessages.let_tag_exp_group, options); - }; - | Invalid(_) => default // Shouldn't get hit - | Parens(_) => default // Shouldn't get hit? - | TypeAnn(_) => default // Shouldn't get hit? - }; + // TODO + | Module(_) => default | Ap(x, arg) => let x_id = List.nth(x.ids, 0); let arg_id = List.nth(arg.ids, 0); diff --git a/src/haz3lweb/view/dhcode/layout/DHDoc_Exp.re b/src/haz3lweb/view/dhcode/layout/DHDoc_Exp.re index b747aab87b..dc1fe7fa19 100644 --- a/src/haz3lweb/view/dhcode/layout/DHDoc_Exp.re +++ b/src/haz3lweb/view/dhcode/layout/DHDoc_Exp.re @@ -231,7 +231,7 @@ let rec mk = | IntLit(n) => DHDoc_common.mk_IntLit(n) | FloatLit(f) => DHDoc_common.mk_FloatLit(f) | StringLit(s) => DHDoc_common.mk_StringLit(s) - | ModuleVal(c) => DHDoc_common.mk_StringLit("Module") + | ModuleVal(_) => DHDoc_common.mk_StringLit("Module") | TestLit(_) => Doc.text(ExpandingKeyword.to_string(Test)) | Sequence(d1, d2) => let (doc1, doc2) = (go'(d1), go'(d2));