From 576c69d9b807d31b4883639bc22b0c941bba0bc6 Mon Sep 17 00:00:00 2001 From: Mahrud Sayrafi Date: Sat, 24 Aug 2024 19:11:25 +0200 Subject: [PATCH] Revert "updated convertr.d" This reverts commit bf16db96963cbc7a439157a351cd6e5f94e3fa1f. --- M2/Macaulay2/d/CMakeLists.txt | 2 +- M2/Macaulay2/d/Makefile.files.in | 2 +- M2/Macaulay2/d/convertr.d | 290 +++++++++++++------------------ 3 files changed, 124 insertions(+), 170 deletions(-) diff --git a/M2/Macaulay2/d/CMakeLists.txt b/M2/Macaulay2/d/CMakeLists.txt index 9114704d79..4474c9cdca 100644 --- a/M2/Macaulay2/d/CMakeLists.txt +++ b/M2/Macaulay2/d/CMakeLists.txt @@ -61,9 +61,9 @@ set(DLIST parser.d binding.d basic.d + convertr.d common.d util.d - convertr.d struct.d classes.dd buckets.dd diff --git a/M2/Macaulay2/d/Makefile.files.in b/M2/Macaulay2/d/Makefile.files.in index 7202f2a757..efbfa0ae82 100644 --- a/M2/Macaulay2/d/Makefile.files.in +++ b/M2/Macaulay2/d/Makefile.files.in @@ -55,9 +55,9 @@ M2_DFILES += lex.d M2_DFILES += parser.d M2_DFILES += binding.d M2_DFILES += basic.d +M2_DFILES += convertr.d M2_DFILES += common.d M2_DFILES += util.d -M2_DFILES += convertr.d M2_DFILES += struct.d M2_DFILES += classes.dd M2_DFILES += buckets.dd diff --git a/M2/Macaulay2/d/convertr.d b/M2/Macaulay2/d/convertr.d index 499f3d37d7..3428d02ce0 100644 --- a/M2/Macaulay2/d/convertr.d +++ b/M2/Macaulay2/d/convertr.d @@ -1,7 +1,5 @@ -- Copyright 1994 by Daniel R. Grayson use binding; -use common; -use util; dummyMultaryFun(c:CodeSequence):Expr := ( error("dummy multary function called"); @@ -25,14 +23,7 @@ export UnaryInstallMethodFun := dummyTernaryFun; export InstallValueFun := dummyMultaryFun; export UnaryInstallValueFun := dummyTernaryFun; -combinePosition(a:Position,b:Position):Position := Position(a.filename,b.line,b.column,a.line1,a.column1,b.line2,b.column2,a.loadDepth); -- combine with emphasis on right -combinePositionLeft(a:Position,b:Position):Position := Position(a.filename,a.line,a.column,a.line1,a.column1,b.line2,b.column2,a.loadDepth); -- combine with emphasis on left -combinePosition(a:Position,b:Position,c:Position):Position := Position(a.filename,c.line,c.column,a.line1,a.column1,b.line2,b.column2,a.loadDepth); -- left, right, center -combinePositionAdjacent(a:Position,b:Position):Position := Position(a.filename,a.line2,a.column2,a.line1,a.column1,b.line2,b.column2,a.loadDepth); -- special for Adjacent - -convert0(e:ParseTree):Code; convert(e:ParseTree):Code; -unseq(c:Code):Code; CodeSequenceLength(e:ParseTree,separator:Word):int := ( i := 0; while true do ( @@ -119,69 +110,50 @@ nestingDepth(frameID:int,d:Dictionary):int := ( ); n); -tokenAssignment(t:Token,p:ParseTree):Code := ( - c:=convert0(p); - l:=combinePosition(t.position,codePosition(c)); - c=unseq(c); +tokenAssignment(e:ParseTree,b:Binary,t:Token):Code := ( if t.entry.frameID == 0 - then Code(globalAssignmentCode(t.entry,c,l)) - else Code(localAssignmentCode(nestingDepth(t.entry.frameID,t.dictionary),t.entry.frameindex,c,l)) + then Code(globalAssignmentCode(t.entry,convert(b.rhs),treePosition(e))) + else Code(localAssignmentCode(nestingDepth(t.entry.frameID,t.dictionary),t.entry.frameindex,convert(b.rhs),treePosition(e))) ); -parallelAssignment(par:Parentheses,rhs:ParseTree,d:Dictionary):Code := ( - symbols := makeSymbolSequence(ParseTree(par)); -- silly -- rethink +parallelAssignment(e:ParseTree,b:Binary,p:Parentheses):Code := ( + symbols := makeSymbolSequence(b.lhs); n := length(symbols); - nd := new array(int) len n do foreach x in symbols do provide nestingDepth(x.frameID,d); -- rethink dictionary + nd := new array(int) len n do foreach x in symbols do provide nestingDepth(x.frameID,b.Operator.dictionary); fr := new array(int) len n do foreach x in symbols do provide x.frameindex; foreach x in symbols do if x.frameID != 0 then x = dummySymbol; Code(parallelAssignmentCode( nd, fr, symbols, - unseq(c:=convert0(rhs)), - combinePosition(par.left.position,codePosition(c)) + convert(b.rhs), + treePosition(e) )) ); -export unseq(c:Code):Code := ( - when c - is s:sequenceCode do ( - if length(s.x)==1 then s.x.0 else c - ) - else c - ); - -export convert0(e:ParseTree):Code := ( +export convert(e:ParseTree):Code := ( when e - is w:For do ( - c:=convert0(w.doClause); - cc:=convert0(w.listClause); - loc:=codePosition(c); - when c is - nullCode do loc=codePosition(cc) - else nothing; - Code( + is w:For do Code( forCode( convert(w.inClause), convert(w.fromClause), convert(w.toClause), - convert(w.whenClause), unseq(cc), - unseq(c), + convert(w.whenClause), convert(w.listClause), + convert(w.doClause), w.dictionary.frameID, w.dictionary.framesize, - combinePosition(w.forToken.position,loc) - ))) - is w:WhileDo do Code(whileDoCode(convert(w.predicate),unseq(c:=convert0(w.doClause)),combinePosition(w.whileToken.position,codePosition(c)))) - is w:WhileList do Code(whileListCode(convert(w.predicate),unseq(c:=convert0(w.listClause)),combinePosition(w.whileToken.position,codePosition(c)))) - is w:WhileListDo do Code(whileListDoCode(convert(w.predicate),convert(w.listClause),unseq(c:=convert0(w.doClause)),combinePosition(w.whileToken.position,codePosition(c)))) + treePosition(e))) + is w:WhileDo do Code(whileDoCode(convert(w.predicate),convert(w.doClause),treePosition(e))) + is w:WhileList do Code(whileListCode(convert(w.predicate),convert(w.listClause),treePosition(e))) + is w:WhileListDo do Code(whileListDoCode(convert(w.predicate),convert(w.listClause),convert(w.doClause),treePosition(e))) is n:New do ( if n.newparent == dummyTree then if n.newinitializer == dummyTree - then Code(newCode(unseq(c:=convert0(n.newclass)),combinePosition(n.newtoken.position,codePosition(c)))) - else Code(newFromCode(convert(n.newclass),unseq(c:=convert0(n.newinitializer)),combinePosition(n.newtoken.position,codePosition(c)))) + then Code(newCode(convert(n.newclass),treePosition(e))) + else Code(newFromCode(convert(n.newclass),convert(n.newinitializer),treePosition(e))) else if n.newinitializer == dummyTree - then Code(newOfCode(convert(n.newclass),unseq(c:=convert0(n.newparent)),combinePosition(n.newtoken.position,codePosition(c)))) - else Code(newOfFromCode(convert(n.newclass),convert(n.newparent),unseq(c:=convert0(n.newinitializer)),combinePosition(n.newtoken.position,codePosition(c))))) - is i:IfThen do Code(ifCode(convert(i.predicate),unseq(c:=convert0(i.thenClause)),NullCode,combinePosition(i.ifToken.position,codePosition(c)))) - is i:IfThenElse do Code(ifCode(convert(i.predicate),convert(i.thenClause),unseq(c:=convert0(i.elseClause)),combinePosition(i.ifToken.position,codePosition(c)))) + then Code(newOfCode(convert(n.newclass),convert(n.newparent),treePosition(e))) + else Code(newOfFromCode(convert(n.newclass),convert(n.newparent),convert(n.newinitializer),treePosition(e)))) + is i:IfThen do Code(ifCode(convert(i.predicate),convert(i.thenClause),NullCode,treePosition(e))) + is i:IfThenElse do Code(ifCode(convert(i.predicate),convert(i.thenClause),convert(i.elseClause),treePosition(e))) is token:Token do ( var := token.entry; wrd := token.word; @@ -210,27 +182,24 @@ export convert0(e:ParseTree):Code := ( else Code(localMemoryReferenceCode(nestingDepth(var.frameID,token.dictionary),var.frameindex,token.position)) ) ) - is a:Adjacent do Code(adjacentCode(unseq(c:=convert0(a.lhs)),unseq(cc:=convert0(a.rhs)),combinePositionAdjacent(codePosition(c),codePosition(cc)))) + is a:Adjacent do Code(adjacentCode(convert(a.lhs),convert(a.rhs),treePosition(e))) is p:EmptyParentheses do ( - pp:=combinePositionLeft(p.left.position,p.right.position); - if p.left.word == leftparen then Code(sequenceCode(CodeSequence(),pp)) - else if p.left.word == leftbrace then Code(listCode(CodeSequence(),pp)) - else if p.left.word == leftbracket then Code(arrayCode(CodeSequence(),pp)) - else if p.left.word == leftAngleBar then Code(angleBarListCode(CodeSequence(),pp)) + if p.left.word == leftparen then Code(sequenceCode(CodeSequence(),treePosition(e))) + else if p.left.word == leftbrace then Code(listCode(CodeSequence(),treePosition(e))) + else if p.left.word == leftbracket then Code(arrayCode(CodeSequence(),treePosition(e))) + else if p.left.word == leftAngleBar then Code(angleBarListCode(CodeSequence(),treePosition(e))) else dummyCode -- should not happen ) is p:Parentheses do ( - pp:=combinePositionLeft(p.left.position,p.right.position); - if p.left.word == leftparen - then Code(sequenceCode(makeCodeSequence(p.contents,CommaW),pp)) + if p.left.word == leftparen then convert(p.contents) else if p.left.word == leftbrace - then Code(listCode(makeCodeSequence(p.contents,CommaW),pp)) + then Code(listCode(makeCodeSequence(p.contents,CommaW),treePosition(e))) else if p.left.word == leftbracket - then Code(arrayCode(makeCodeSequence(p.contents,CommaW),pp)) + then Code(arrayCode(makeCodeSequence(p.contents,CommaW),treePosition(e))) else if p.left.word == leftAngleBar - then Code(angleBarListCode(makeCodeSequence(p.contents,CommaW),pp)) + then Code(angleBarListCode(makeCodeSequence(p.contents,CommaW),treePosition(e))) else dummyCode -- should not happen ) @@ -242,14 +211,13 @@ export convert0(e:ParseTree):Code := ( is token:Token do ( wrd := token.word; var := token.entry; - p := token.position; if wrd.typecode == TCid then ( Code(binaryCode( b.Operator.entry.binary, - unseq(c:=convert0(b.lhs)), - Code(globalSymbolClosureCode(var,p)), - combinePosition(codePosition(c),p,b.Operator.position) + convert(b.lhs), + Code(globalSymbolClosureCode(var,treePosition(b.rhs))), + treePosition(e) ) ) ) @@ -258,9 +226,9 @@ export convert0(e:ParseTree):Code := ( else dummyCode -- should not occur ) else if b.Operator.word == CommaW - then Code(sequenceCode(s:=makeCodeSequence(e,CommaW),combinePositionLeft(codePosition(s.0),codePosition(s.(length(s)-1))))) + then Code(sequenceCode(makeCodeSequence(e,CommaW),treePosition(e))) else if b.Operator.word == SemicolonW - then Code(semiCode(s:=makeCodeSequence(e,SemicolonW),combinePositionLeft(codePosition(s.0),codePosition(s.(length(s)-1))))) + then Code(semiCode(makeCodeSequence(e,SemicolonW),treePosition(e))) else if b.Operator.word == EqualW then ( when b.lhs @@ -270,50 +238,50 @@ export convert0(e:ParseTree):Code := ( InstallValueFun, CodeSequence( Code(globalSymbolClosureCode(AdjacentS.symbol,dummyPosition)), - unseq(c:=convert0(a.lhs)), + convert(a.lhs), convert(a.rhs), - unseq(cc:=convert0(b.rhs))), - combinePosition(codePosition(c),codePosition(cc),b.Operator.position)))) + convert(b.rhs)), + treePosition(e)))) is u:Unary do Code( ternaryCode( UnaryInstallValueFun, - Code(globalSymbolClosureCode(u.Operator.entry,p:=u.Operator.position)), + Code(globalSymbolClosureCode(u.Operator.entry,u.Operator.position)), convert(u.rhs), - unseq(cc:=convert0(b.rhs)), - combinePosition(p,codePosition(cc),b.Operator.position))) + convert(b.rhs), + treePosition(e))) is u:Postfix do Code( ternaryCode( UnaryInstallValueFun, Code(globalSymbolClosureCode(u.Operator.entry,u.Operator.position)), - unseq(c:=convert0(u.lhs)), - unseq(cc:=convert0(b.rhs)), - combinePosition(codePosition(c),codePosition(cc),b.Operator.position))) + convert(u.lhs), + convert(b.rhs), + treePosition(e))) is c:Binary do ( if c.Operator.entry == SharpS.symbol - then Code(ternaryCode( AssignElemFun, c1:=convert(c.lhs), - convert(c.rhs), unseq(c2:=convert0(b.rhs)), combinePosition(codePosition(c1),codePosition(c2),b.Operator.position))) + then Code(ternaryCode( AssignElemFun, convert(c.lhs), + convert(c.rhs), convert(b.rhs), treePosition(e))) else if c.Operator.entry == DotS.symbol then ( when c.rhs is crhs:Token do Code(ternaryCode( AssignElemFun, - c1:=convert(c.lhs), - Code(globalSymbolClosureCode(crhs.entry,crhs.position)), - unseq(c2:=convert0(b.rhs)), - combinePosition(codePosition(c1),codePosition(c2),b.Operator.position))) + convert(c.lhs), + Code(globalSymbolClosureCode(crhs.entry,crhs.position)), + convert(b.rhs), + treePosition(e))) else dummyCode --should not happen ) else Code(multaryCode( InstallValueFun, CodeSequence( - Code(globalSymbolClosureCode(c.Operator.entry,c.Operator.position)), - c1:=convert(c.lhs), + Code(globalSymbolClosureCode(c.Operator.entry,c.Operator.position)), + convert(c.lhs), convert(c.rhs), - unseq(c2:=convert0(b.rhs))), - combinePosition(codePosition(c1),codePosition(c2),b.Operator.position)))) - is t:Token do tokenAssignment(t,b.rhs) - is p:Parentheses do parallelAssignment(p,b.rhs,b.Operator.dictionary) + convert(b.rhs)), + treePosition(e)))) + is t:Token do tokenAssignment(e,b,t) + is p:Parentheses do parallelAssignment(e,b,p) else dummyCode -- should not happen ) else if b.Operator.word == ColonEqualW @@ -325,167 +293,153 @@ export convert0(e:ParseTree):Code := ( then Code(binaryCode( AssignNewFun, convert(n.newclass), - unseq(c:=convert0(b.rhs)), - combinePosition(n.newtoken.position,codePosition(c),b.Operator.position))) + convert(b.rhs), + treePosition(e))) else Code(ternaryCode( AssignNewFromFun, convert(n.newclass), convert(n.newinitializer), - unseq(c:=convert0(b.rhs)), - combinePosition(n.newtoken.position,codePosition(c),b.Operator.position))) + convert(b.rhs), + treePosition(e))) else if n.newinitializer == dummyTree then Code(ternaryCode( AssignNewOfFun, convert(n.newclass), convert(n.newparent), - unseq(c:=convert0(b.rhs)), - combinePosition(n.newtoken.position,codePosition(c),b.Operator.position))) + convert(b.rhs), + treePosition(e))) else Code(multaryCode( AssignNewOfFromFun, CodeSequence( convert(n.newclass), convert(n.newparent), convert(n.newinitializer), - unseq(c:=convert0(b.rhs))), - combinePosition(n.newtoken.position,codePosition(c),b.Operator.position)))) + convert(b.rhs)), + treePosition(e)))) is a:Adjacent do ( Code(multaryCode( InstallMethodFun, CodeSequence( Code(globalSymbolClosureCode(AdjacentS.symbol,dummyPosition)), - unseq(c:=convert0(a.lhs)), + convert(a.lhs), convert(a.rhs), - unseq(cc:=convert0(b.rhs))), - combinePosition(codePosition(c),codePosition(cc),b.Operator.position)))) + convert(b.rhs)), + treePosition(e)))) is u:Unary do Code(ternaryCode( UnaryInstallMethodFun, - Code(globalSymbolClosureCode(u.Operator.entry,p:=u.Operator.position)), - convert(u.rhs), unseq(c:=convert0(b.rhs)), combinePosition(p,codePosition(c),b.Operator.position))) + Code(globalSymbolClosureCode(u.Operator.entry,u.Operator.position)), + convert(u.rhs), convert(b.rhs), treePosition(e))) is u:Postfix do Code(ternaryCode( UnaryInstallMethodFun, Code(globalSymbolClosureCode(u.Operator.entry,u.Operator.position)), - unseq(c:=convert0(u.lhs)), unseq(cc:=convert0(b.rhs)), combinePosition(codePosition(c),codePosition(cc),b.Operator.position))) + convert(u.lhs), convert(b.rhs), treePosition(e))) is c:Binary do ( if c.Operator.entry == SharpS.symbol - then Code(ternaryCode( AssignElemFun, c1:=convert(c.lhs), - convert(c.rhs), unseq(c2:=convert0(b.rhs)), combinePosition(codePosition(c1),codePosition(c2),b.Operator.position))) + then Code(ternaryCode( AssignElemFun, convert(c.lhs), + convert(c.rhs), convert(b.rhs), treePosition(e))) else if c.Operator.entry == UnderscoreS.symbol then Code(multaryCode( InstallMethodFun, CodeSequence( Code(globalSymbolClosureCode(UnderscoreS.symbol,dummyPosition)), - unseq(c1:=convert0(c.lhs)), + convert(c.lhs), convert(c.rhs), - unseq(c2:=convert0(b.rhs))), - combinePosition(codePosition(c1),codePosition(c2),b.Operator.position))) + convert(b.rhs)), + treePosition(e))) else if c.Operator.entry == DotS.symbol then ( when c.rhs is crhs:Token do Code(ternaryCode( AssignElemFun, - unseq(c1:=convert0(c.lhs)), - Code(globalSymbolClosureCode(crhs.entry,crhs.position)), - unseq(c2:=convert0(b.rhs)), - combinePosition(codePosition(c1),codePosition(c2),b.Operator.position))) + convert(c.lhs), + Code(globalSymbolClosureCode(crhs.entry,crhs.position)), + convert(b.rhs), + treePosition(e))) else dummyCode --should not happen ) else Code(multaryCode( InstallMethodFun, CodeSequence( - Code(globalSymbolClosureCode(c.Operator.entry,c.Operator.position)), - unseq(c1:=convert0(c.lhs)), + Code(globalSymbolClosureCode(c.Operator.entry,c.Operator.position)), + convert(c.lhs), convert(c.rhs), - unseq(c2:=convert0(b.rhs))), - combinePosition(codePosition(c1),codePosition(c2),b.Operator.position))) - ) - is t:Token do tokenAssignment(t,b.rhs) - is p:Parentheses do parallelAssignment(p,b.rhs,b.Operator.dictionary) + convert(b.rhs)), + treePosition(e)))) + is t:Token do tokenAssignment(e,b,t) + is p:Parentheses do parallelAssignment(e,b,p) else dummyCode -- should not happen ) else if isAugmentedAssignmentOperatorWord(b.Operator.word) then ( when b.lhs is a:Adjacent - do Code(augmentedAssignmentCode(b.Operator.entry, unseq(c1:=convert0(b.lhs)), - unseq(c2:=convert0(b.rhs)), AdjacentS.symbol, combinePosition(codePosition(c1),codePosition(c2),b.Operator.position))) + do Code(augmentedAssignmentCode(b.Operator.entry, convert(b.lhs), + convert(b.rhs), AdjacentS.symbol, treePosition(e))) is u:Unary - do Code(augmentedAssignmentCode(b.Operator.entry, unseq(c1:=convert0(b.lhs)), - unseq(c2:=convert0(b.rhs)), u.Operator.entry, combinePosition(codePosition(c1),codePosition(c2),b.Operator.position))) + do Code(augmentedAssignmentCode(b.Operator.entry, convert(b.lhs), + convert(b.rhs), u.Operator.entry, treePosition(e))) is u:Postfix - do Code(augmentedAssignmentCode(b.Operator.entry, unseq(c1:=convert0(b.lhs)), - unseq(c2:=convert0(b.rhs)), u.Operator.entry, combinePosition(codePosition(c1),codePosition(c2),b.Operator.position))) + do Code(augmentedAssignmentCode(b.Operator.entry, convert(b.lhs), + convert(b.rhs), u.Operator.entry, treePosition(e))) is c:Binary - do Code(augmentedAssignmentCode(b.Operator.entry, unseq(c1:=convert0(b.lhs)), - unseq(c2:=convert0(b.rhs)), c.Operator.entry, combinePosition(codePosition(c1),codePosition(c2),b.Operator.position))) + do Code(augmentedAssignmentCode(b.Operator.entry, convert(b.lhs), + convert(b.rhs), c.Operator.entry, treePosition(e))) is t:Token - do Code(augmentedAssignmentCode(b.Operator.entry, unseq(c1:=convert0(b.lhs)), - unseq(c2:=convert0(b.rhs)), t.entry, combinePosition(codePosition(c1),codePosition(c2),b.Operator.position))) + do Code(augmentedAssignmentCode(b.Operator.entry, convert(b.lhs), + convert(b.rhs), t.entry, treePosition(e))) else Code(augmentedAssignmentCode(b.Operator.entry, dummyCode, - dummyCode, dummySymbol, dummyPosition)) -- CHECK - ) - else Code(binaryCode(b.Operator.entry.binary,unseq(c1:=convert0(b.lhs)), - unseq(c2:=convert0(b.rhs)),combinePosition(codePosition(c1),codePosition(c2),b.Operator.position))) + dummyCode, dummySymbol, treePosition(e)))) + else Code(binaryCode(b.Operator.entry.binary,convert(b.lhs), + convert(b.rhs),treePosition(e))) ) is a:Arrow do ( - p:=treePosition(a.lhs); - fc:=functionCode( - unseq(c:=convert0(a.rhs)),a.desc,hash_t(0), - combinePosition(p,codePosition(c),a.Operator.position)); - fc.hash = hashFromAddress(Expr(fc)); - Code(fc)) + fc := functionCode( + convert(a.rhs),a.desc,hash_t(0),a.Operator.position); + fc.hash = hashFromAddress(Expr(fc)); + Code(fc)) is u:Unary do ( if u.Operator.word == CommaW - then Code(sequenceCode(s:=makeCodeSequence(e,CommaW),combinePositionLeft(u.Operator.position,codePosition(s.(length(s)-1))))) + then Code(sequenceCode(makeCodeSequence(e,CommaW),treePosition(e))) else if u.Operator.word == SemicolonW - then Code(semiCode(s:=makeCodeSequence(e,SemicolonW),combinePositionLeft(u.Operator.position,codePosition(s.(length(s)-1))))) - else ( - c:=convert0(u.rhs); - loc:=codePosition(c); - loc2:=u.Operator.position; - when c is - nullCode do nothing - else loc2=combinePositionLeft(loc2,loc); - Code(unaryCode(u.Operator.entry.unary,unseq(c),loc2)))) + then Code(semiCode(makeCodeSequence(e,SemicolonW),treePosition(e))) + else Code(unaryCode(u.Operator.entry.unary,convert(u.rhs),treePosition(e)))) is q:Quote do ( token := q.rhs; sym := token.entry; - p := combinePosition(q.Operator.position,token.position); + pos := treePosition(e); if sym.frameID == 0 then ( if sym.thread - then Code(threadSymbolClosureCode(sym,p)) - else Code(globalSymbolClosureCode(sym,p)) + then Code(threadSymbolClosureCode(sym,pos)) + else Code(globalSymbolClosureCode(sym,pos)) ) - else Code(localSymbolClosureCode(nestingDepth(sym.frameID,token.dictionary),sym,p))) + else Code(localSymbolClosureCode(nestingDepth(sym.frameID,token.dictionary),sym,pos))) is q:GlobalQuote do ( token := q.rhs; sym := token.entry; - p := combinePosition(q.Operator.position,token.position); - Code(globalSymbolClosureCode(sym,p))) + pos := treePosition(e); + Code(globalSymbolClosureCode(sym,pos))) is q:ThreadQuote do ( token := q.rhs; sym := token.entry; - p := combinePosition(q.Operator.position,token.position); - Code(threadSymbolClosureCode(sym,p))) + pos := treePosition(e); + Code(threadSymbolClosureCode(sym,pos))) is q:LocalQuote do ( token := q.rhs; sym := token.entry; - p := combinePosition(q.Operator.position,token.position); + pos := treePosition(e); nd := nestingDepth(sym.frameID,token.dictionary); - Code(localSymbolClosureCode(nd,sym,p))) - is i:TryThenElse do Code(tryCode(convert(i.primary), convert(i.sequel), unseq(c:=convert0(i.alternate)), combinePosition(i.tryToken.position,codePosition(c)))) - is i:TryThen do Code(tryCode(convert(i.primary), unseq(c:=convert0(i.sequel)), NullCode, combinePosition(i.tryToken.position,codePosition(c)))) - is i:TryElse do Code(tryCode(convert(i.primary), NullCode, unseq(c:=convert0(i.alternate)), combinePosition(i.tryToken.position,codePosition(c)))) - is i:Try do Code(tryCode(unseq(c:=convert0(i.primary)), NullCode, NullCode, combinePosition(i.tryToken.position,codePosition(c)))) - is i:Catch do Code(catchCode(unseq(c:=convert0(i.primary)),combinePosition(i.catchToken.position,codePosition(c)))) - is u:Postfix do Code(unaryCode(u.Operator.entry.postfix,unseq(c:=convert0(u.lhs)),combinePosition(codePosition(c),u.Operator.position))) + Code(localSymbolClosureCode(nd,sym,pos))) + is i:TryThenElse do Code(tryCode(convert(i.primary), convert(i.sequel), convert(i.alternate), treePosition(e))) + is i:TryThen do Code(tryCode(convert(i.primary), convert(i.sequel), NullCode, treePosition(e))) + is i:TryElse do Code(tryCode(convert(i.primary), NullCode, convert(i.alternate), treePosition(e))) + is i:Try do Code(tryCode(convert(i.primary), NullCode, NullCode, treePosition(e))) + is i:Catch do Code(catchCode(convert(i.primary),treePosition(e))) + is u:Postfix do Code(unaryCode(u.Operator.entry.postfix,convert(u.lhs),treePosition(e))) is d:dummy do dummyCode ); -export convert(e:ParseTree):Code := unseq(convert0(e)); - - -- Local Variables: -- compile-command: "echo \"make: Entering directory \\`$M2BUILDDIR/Macaulay2/d'\" && make -C $M2BUILDDIR/Macaulay2/d convertr.o " -- End: