Skip to content

Commit

Permalink
Merge branch 'development' of https://github.com/Macaulay2/M2 into va…
Browse files Browse the repository at this point in the history
…nilla
  • Loading branch information
pzinn committed Oct 3, 2024
2 parents 0e7e0e0 + c11077b commit 805025b
Show file tree
Hide file tree
Showing 46 changed files with 1,125 additions and 826 deletions.
2 changes: 1 addition & 1 deletion M2/Macaulay2/d/actors.d
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ export notFun(rhs:Code):Expr := (
else if a == True then False
else if a == False then True
else unarymethod(a,notS));
setup(notS,notFun);
setupop(notS,notFun);
EqualEqualEqualfun(lhs:Code,rhs:Code):Expr := (
-- # typical value: symbol ===, Thing, Thing, Boolean
x := eval(lhs);
Expand Down
102 changes: 51 additions & 51 deletions M2/Macaulay2/d/actors3.d

Large diffs are not rendered by default.

15 changes: 8 additions & 7 deletions M2/Macaulay2/d/binding.d
Original file line number Diff line number Diff line change
Expand Up @@ -747,10 +747,10 @@ bindassignment(assn:Binary,dictionary:Dictionary,colon:bool):void := (
)
is n:New do (
if colon then (
bind(n.newclass,dictionary);
bind(n.newparent,dictionary);
bind(n.newinitializer,dictionary);
bind(body,dictionary))
bind(n.newClass, dictionary);
bind(n.newParent, dictionary);
bind(n.newInitializer, dictionary);
bind(body, dictionary))
else makeErrorTree(assn.Operator,
"left hand side of assignment inappropriate"))
else makeErrorTree(assn.Operator,
Expand Down Expand Up @@ -874,9 +874,10 @@ export bind(e:ParseTree,dictionary:Dictionary):void := (
bind(w.doClause,dictionary);
)
is n:New do (
bind(n.newclass,dictionary);
bind(n.newparent,dictionary);
bind(n.newinitializer,dictionary);)
bind(n.newClass, dictionary);
bind(n.newParent, dictionary);
bind(n.newInitializer, dictionary);
)
is i:TryElse do (
-- i.primary = bindnewdictionary(i.primary,dictionary);
bind(i.primary,dictionary);
Expand Down
132 changes: 43 additions & 89 deletions M2/Macaulay2/d/common.d
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,46 @@ use binding;
use stdiop0;

export codePosition(c:Code):Position := ( -- TODO retire
when c
is f:adjacentCode do f.position
is f:augmentedAssignmentCode do f.position
is f:arrayCode do f.position
is f:angleBarListCode do f.position
is f:binaryCode do f.position
is f:catchCode do f.position
is f:Error do f.position
is f:evaluatedCode do f.position
is f:forCode do f.position
is f:functionCode do f.position
is f:globalAssignmentCode do f.position
is f:globalMemoryReferenceCode do f.position
is f:globalSymbolClosureCode do f.position
is f:ifCode do f.position
is f:integerCode do f.position
is f:listCode do f.position
is f:localAssignmentCode do f.position
is f:localMemoryReferenceCode do f.position
is f:localSymbolClosureCode do f.position
is f:multaryCode do f.position
is f:newCode do f.position
is f:newFromCode do f.position
is f:newOfCode do f.position
is f:newOfFromCode do f.position
is f:nullCode do dummyPosition
is f:parallelAssignmentCode do f.position
is f:realCode do f.position
is f:semiCode do f.position
is f:sequenceCode do f.position
is f:stringCode do f.position
is f:ternaryCode do f.position
is f:threadMemoryReferenceCode do f.position
is f:threadSymbolClosureCode do f.position
is f:tryCode do f.position
is f:unaryCode do f.position
is f:whileDoCode do f.position
is f:whileListCode do f.position
is f:whileListDoCode do f.position
);

export pos(c:Code):void := ( -- for use in the debugger
stdIO << codePosition(c) << endl;
);
when c
is f:nullCode do dummyPosition
is f:realCode do f.position
is f:stringCode do f.position
is f:integerCode do f.position
is f:globalMemoryReferenceCode do f.position
is f:threadMemoryReferenceCode do f.position
is f:localMemoryReferenceCode do f.position
is f:globalAssignmentCode do f.position
is f:localAssignmentCode do f.position
is f:parallelAssignmentCode do f.position
is f:augmentedAssignmentCode do f.position
is f:evaluatedCode do f.position
is f:globalSymbolClosureCode do f.position
is f:threadSymbolClosureCode do f.position
is f:localSymbolClosureCode do f.position
is f:unaryCode do f.position
is f:binaryCode do f.position
is f:ternaryCode do f.position
is f:multaryCode do f.position
is f:sequenceCode do f.position
is f:listCode do f.position
is f:arrayCode do f.position
is f:angleBarListCode do f.position
is f:semiCode do f.position
is f:newCode do f.position
is f:newFromCode do f.position
is f:newOfCode do f.position
is f:newOfFromCode do f.position
is f:forCode do f.position
is f:whileDoCode do f.position
is f:whileListCode do f.position
is f:whileListDoCode do f.position
is f:ifCode do f.position
is f:tryCode do f.position
is f:adjacentCode do f.position
is f:functionCode do f.position
is f:catchCode do f.position
is f:Error do f.position
);

export tostringerror(e:Expr):string := (
when e
Expand All @@ -58,37 +54,6 @@ export tostringerror(e:Expr):string := (
else ""
);

export setup(word:Word):void := (
makeSymbol(word,dummyPosition,globalDictionary);
);
export setup(word:Word,fn:unop):void := (
e := makeSymbol(word,dummyPosition,globalDictionary);
unopNameList = unopNameListCell(fn,e,unopNameList);
e.unary = fn;
);
export setup(word:Word,fn:binop):void := (
e := makeSymbol(word,dummyPosition,globalDictionary);
binopNameList = binopNameListCell(fn,e,binopNameList);
e.binary = fn;
);
export setup(word:Word,fun1:unop,fun2:binop):void := (
e := makeSymbol(word,dummyPosition,globalDictionary);
unopNameList = unopNameListCell(fun1,e,unopNameList);
binopNameList = binopNameListCell(fun2,e,binopNameList);
e.unary = fun1;
e.binary = fun2;
);
export setup(word:Word,fun1:unop,fun2:unop):void := (
e := makeSymbol(word,dummyPosition,globalDictionary);
unopNameList = unopNameListCell(fun2,e,unopNameList);
unopNameList = unopNameListCell(fun1,e,unopNameList);
e.unary = fun1;
e.postfix = fun2;
);
export setup(e:SymbolClosure,fn:unop):void := (
unopNameList = unopNameListCell(fn,e.symbol,unopNameList);
e.symbol.unary = fn;
);
export setuppostfix(e:SymbolClosure,fn:unop):void := (
unopNameList = unopNameListCell(fn,e.symbol,unopNameList);
e.symbol.postfix = fn;
Expand All @@ -103,12 +68,6 @@ export setup(e:SymbolClosure,fun1:unop,fun2:binop):void := (
e.symbol.unary = fun1;
e.symbol.binary = fun2;
);
export setup(e:SymbolClosure,fun1:unop,fun2:unop):void := (
unopNameList = unopNameListCell(fun1,e.symbol,unopNameList);
unopNameList = unopNameListCell(fun2,e.symbol,unopNameList);
e.symbol.unary = fun1;
e.symbol.postfix = fun2;
);
export setupop(s:SymbolClosure,fun:unop):void := (
unopNameList = unopNameListCell(fun,s.symbol,unopNameList);
s.symbol.unary = fun;
Expand All @@ -119,14 +78,6 @@ export setup(e:SymbolClosure,fn:ternop):void := (
export setup(e:SymbolClosure,fn:multop):void := (
multopNameList = multopNameListCell(fn,e.symbol,multopNameList);
);
export setupfun(name:string,fun:unop):Symbol := (
word := makeUniqueWord(name,
parseinfo(precSpace,precSpace,precSpace,parsefuns(unaryop, defaultbinary)));
entry := makeSymbol(word,dummyPosition,globalDictionary);
unopNameList = unopNameListCell(fun,entry,unopNameList);
entry.unary = fun;
entry.Protected = true;
entry);
export setupfun(name:string, value:function(Expr):Expr):Symbol := (
word := makeUniqueWord(name,parseWORD);
entry := makeSymbol(word,dummyPosition,globalDictionary);
Expand Down Expand Up @@ -155,6 +106,9 @@ setup(commaS,dummyBinaryFun);

threadLocal export errorDepth := ushort(0);

-- for use in the debugger
export printPosition(c:Code):void := ( stdIO << codePosition(c) << endl; );

export returnFromFunction(z:Expr):Expr := when z is err:Error do if err.message == returnMessage then err.value else z else z;
export returnFromLoop(z:Expr):Expr := when z is err:Error do if err.message == breakMessage then if err.value == dummyExpr then nullE else err.value else z else z;

Expand Down
Loading

0 comments on commit 805025b

Please sign in to comment.