From b91436e16c46bb3c8b0fa22d4f81eb8743f6cbd7 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Sat, 26 Nov 2011 20:11:59 +0000 Subject: * algebra/indexedp.spad.pamphlet: Avoid direct use or RPLACD. * algebra/poly.spad.pamphlet: Likewise. * interp/define.boot (spadCompileOrSetq): Tidy replacement info. * interp/i-output.boot ($BinaryOperators): New. (binaryInfix?): Tidy. --- src/interp/define.boot | 6 ++++-- src/interp/format.boot | 2 +- src/interp/i-output.boot | 13 +++++++++++-- 3 files changed, 16 insertions(+), 5 deletions(-) (limited to 'src/interp') diff --git a/src/interp/define.boot b/src/interp/define.boot index abc12e16..8204957c 100644 --- a/src/interp/define.boot +++ b/src/interp/define.boot @@ -2004,8 +2004,10 @@ spadCompileOrSetq(db,form is [nam,[lam,vl,body]]) == registerFunctionReplacement(nam,nam') sayBrightly ['" ",:bright nam,'"is replaced by",:bright nam'] else if macform := expandableDefinition?(vl,body) then - registerFunctionReplacement(nam,macform) - sayBrightly ['" ",:bright nam,'"is replaced by",:bright body] + registerFunctionReplacement(nam,macform) + [:vl',.] := vl + sayBrightly ['" ",:bright prefix2String [nam,:vl'], + '"is replaced by",:bright prefix2String body] form := getFunctionReplacement nam => diff --git a/src/interp/format.boot b/src/interp/format.boot index 0d4f3d4b..41033b90 100644 --- a/src/interp/format.boot +++ b/src/interp/format.boot @@ -446,7 +446,7 @@ form2String1 u == argl := rest argl (null argl) or null (first argl) => [lo, '".."] [lo, '"..", form2String1 first argl] - isBinaryInfix op => formatAsFortranExpression [op,:argl] + binaryInfix? op => formatAsFortranExpression [op,:argl] application2String(op,[form2String1 x for x in argl], u1) formWrapId id == diff --git a/src/interp/i-output.boot b/src/interp/i-output.boot index af86f29e..d734fbc1 100644 --- a/src/interp/i-output.boot +++ b/src/interp/i-output.boot @@ -469,8 +469,17 @@ rbrkSch() == symbolName specialChar 'rbrk lbrkSch() == symbolName specialChar 'lbrk quadSch() == symbolName specialChar 'quad -isBinaryInfix x == - member(x, '(_= _+ _- _* _/ _*_* _^ "=" "+" "-" "*" "/" "**" "^")) +++ List of binary operators +$BinaryOperators == + ["**", "^", "*", "/", "//", "\", "\\", "rem", "quo", "exquo", "+", "-", + "/\", "\/", "=", "~=", "<", "<=", ">", ">=", "and", "or", ">>", "<<", + "by", "has", "case", "->", "..", "|"] + + +binaryInfix? x == + ident? x => symbolMember?(x,$BinaryOperators) + string? x => symbolMember?(makeSymbol x,$BinaryOperators) + false stringApp([.,u],x,y,d) == appChar(strconc($DoubleQuote,atom2String u,$DoubleQuote),x,y,d) -- cgit v1.2.3