From 6d2b43121e3d0762fc0895f97c704a504ae26b56 Mon Sep 17 00:00:00 2001 From: Mahrud Sayrafi Date: Wed, 21 Aug 2024 03:07:49 +0200 Subject: [PATCH] uncommented missing operator method errors e.g. A+B (where A and B are undefined symbols) --- M2/Macaulay2/m2/robust.m2 | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/M2/Macaulay2/m2/robust.m2 b/M2/Macaulay2/m2/robust.m2 index c5dee5cc33..ee6720e872 100644 --- a/M2/Macaulay2/m2/robust.m2 +++ b/M2/Macaulay2/m2/robust.m2 @@ -63,12 +63,6 @@ Thing.RobustPrintMethod = (msg, obj) -> toString stack { msg | ":", horizontalJoin("\t", silentRobustNetWithClass(60, 5, 3, obj)) } hush := false -commentGuardString := "--" -commentGuardNet := raise(horizontalJoin commentGuardString,-1) -commentGuardWidth := #commentGuardString -commentGuard := n -> if class n === String then concatenate(commentGuard,n) else ( - (stack((height n + depth n):commentGuardNet))^(height n) | n - ) scan(flexibleBinaryOperators, op -> ( opstring := toString op; ht := 8; @@ -83,13 +77,13 @@ scan(flexibleBinaryOperators, op -> ( ); if hush then error(line1, " not displayed"); wid := max(printWidth,80); -- error might occur while printWidth is narrowed - wid = wid - commentGuardWidth - width preX; + wid = wid - width preX; hush = true; -- prevent error message recursion line2 := preX | silentRobustNetWithClass(wid,ht,errorPrintingTimeLimit,x); line3 := preY | silentRobustNetWithClass(wid,ht,errorPrintingTimeLimit,y); -* line4 := preZ | silentRobustNetWithClass(wid,ht,errorPrintingTimeLimit,z); *- hush = false; - error toString stack(line1,commentGuard line2,commentGuard line3 -*,commentGuard line4 *-)))); + error toString stack(line1, line2, line3 -*, line4 *-)))); if not Thing#?(op,Thing,Thing) then ( undocumented' (op,Thing,Thing); installMethod(op, Thing, Thing, (x,y) -> ( @@ -99,12 +93,12 @@ scan(flexibleBinaryOperators, op -> ( if hush then error(line1, " not displayed"); preY := centerString(#preX, opstring); wid := max(printWidth,80); -- error might occur while printWidth is narrowed - wid = wid - commentGuardWidth - width preX; + wid = wid - width preX; hush = true; -- prevent error message recursion line2 := preX | silentRobustNetWithClass(wid,ht,errorPrintingTimeLimit,x); line3 := preY | silentRobustNetWithClass(wid,ht,errorPrintingTimeLimit,y); hush = false; - error toString stack(line1,commentGuard line2,commentGuard line3)))))); + error toString stack(line1, line2, line3)))))); scan( {(flexiblePrefixOperators,"prefix"), (flexiblePostfixOperators,"postfix")}, (ops,type) -> scan(ops, op -> ( ht := 8; @@ -117,23 +111,23 @@ scan( {(flexiblePrefixOperators,"prefix"), (flexiblePostfixOperators,"postfix")} line1 := concatenate("no method for assignment to ", concatenate(type," operator ",op), " applied to objects:"); if hush then error(line1, " not displayed"); wid := max(printWidth,80); -- error might occur while printWidth is narrowed - wid = wid - commentGuardWidth - width preX; + wid = wid - width preX; hush = true; -- prevent error message recursion line2 := preY | silentRobustNetWithClass(wid,ht,errorPrintingTimeLimit,y); -* line3 := preZ | silentRobustNetWithClass(wid,ht,errorPrintingTimeLimit,z); *- hush = false; - error toString stack(line1,commentGuard line2 -*,commentGuard line3 *- )))); + error toString stack(line1, line2 -*, line3 *- )))); if not Thing#?op and op =!= symbol ?? then ( undocumented' (op, Thing); installMethod(op, Thing, (x) -> ( line1 := concatenate("no method for ", concatenate(type," operator ",op), " applied to object:"); if hush then error(line1, " not displayed"); wid := max(printWidth,80); -- error might occur while printWidth is narrowed - wid = wid - commentGuardWidth - width preX; + wid = wid - width preX; hush = true; -- prevent error message recursion line2 := preX | silentRobustNetWithClass(wid,ht,errorPrintingTimeLimit,x); hush = false; - error toString stack(line1,commentGuard line2))); + error toString stack(line1, line2))); )))) Thing#{Standard,Print} = x -> (