diff --git a/src/core/parser/Melder.re b/src/core/parser/Melder.re index 9ae75d08..d697674f 100644 --- a/src/core/parser/Melder.re +++ b/src/core/parser/Melder.re @@ -228,7 +228,7 @@ let push_bound = (~repair=false, t: Token.t, ~fill=Cell.empty, bound, ~onto) => let push = (~repair=false, t: Token.t, ~fill=Cell.empty, slope, ~bound, ~onto) : option(Melded.t) => - switch (Slope.merge_hd(t, ~caret=?Cell.is_caret(fill), slope, ~onto)) { + switch (Slope.merge_hd(t, slope, ~onto)) { | Some(slope) => Some(Neq(slope)) | None => switch (t.mtrl) { diff --git a/src/core/structure/Cell.re b/src/core/structure/Cell.re index 7989d10e..1f03cfdc 100644 --- a/src/core/structure/Cell.re +++ b/src/core/structure/Cell.re @@ -83,7 +83,7 @@ let get_spc = (c: t) => }; // raises Invalid_argument if inputs are not space cells let merge_spc = (l: t, r: t) => { - let get = Options.get_exn(Invalid_argument("Cell.merge")); + let get = Options.get_exn(Invalid_argument("Cell.merge_spc")); let spc_l = get(get_spc(l)); let spc_r = get(get_spc(r)); let marks_l = diff --git a/src/core/structure/Slope.re b/src/core/structure/Slope.re index 45994e8b..29e63791 100644 --- a/src/core/structure/Slope.re +++ b/src/core/structure/Slope.re @@ -99,11 +99,11 @@ let pull = (~from: Dir.t, slope: t): option((Token.t, t)) => Some((tok, slope)); }; -let merge_hd = (~onto: Dir.t, t: Token.t, ~caret=?, slope: t): option(t) => +let merge_hd = (~onto: Dir.t, t: Token.t, slope: t): option(t) => switch (slope) { | [] => None | [hd, ...tl] => - Terr.merge_hd(~onto, t, ~caret?, hd) |> Option.map(hd => [hd, ...tl]) + Terr.merge_hd(~onto, t, hd) |> Option.map(hd => [hd, ...tl]) }; // Dn and Up slopes named based on left-to-right order of terraces diff --git a/src/core/structure/Terr.re b/src/core/structure/Terr.re index 19d97c1c..d9a8e341 100644 --- a/src/core/structure/Terr.re +++ b/src/core/structure/Terr.re @@ -45,11 +45,11 @@ let unlink = (terr: t) => | Error(tok) => (tok, terr.cell, None) }; -let merge_hd = (~onto: Dir.t, t: Token.t, ~caret=?, terr: t) => { +let merge_hd = (~onto: Dir.t, t: Token.t, terr: t) => { open Options.Syntax; let (l, r) = Dir.order(onto, (hd(terr), t)); - let+ zipped = Token.merge(~save_cursor=Dir.toggle(onto), l, ~caret?, r); - put_hd(zipped, terr); + let+ merged = Token.merge(~save_cursor=Dir.toggle(onto), l, r); + put_hd(merged, terr); }; // module Tl = { // // a terrace minus its hd token diff --git a/src/core/structure/Token.re b/src/core/structure/Token.re index 9a3d549c..c936bf06 100644 --- a/src/core/structure/Token.re +++ b/src/core/structure/Token.re @@ -112,20 +112,12 @@ module Molded = { ); }; - let merge = (~save_cursor=?, l: t, ~caret=?, r: t) => + let merge = (~save_cursor=?, l: t, r: t) => if (l.id == r.id) { switch (save_cursor) { | None => Some(clear_marks(l)) | Some(d) => Some(Dir.pick(d, (l, r))) }; - } else if (l.mtrl == Space() && r.mtrl == Space()) { - let (l, r) = - switch (save_cursor) { - | None => (clear_marks(l), clear_marks(r)) - | Some(L) => (l, clear_marks(r)) - | Some(R) => (clear_marks(l), r) - }; - Some(cat(l, ~caret?, r)); } else { None; };