[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Axiom-developer] Nud and Led properties
From: |
Gabriel Dos Reis |
Subject: |
[Axiom-developer] Nud and Led properties |
Date: |
04 May 2007 17:34:52 -0500 |
Hi,
The old parser (and unparser) encodes operator precedence as Nud and
Led properties. Those properties are set only for symbols.
The Nud and Led properties are queried through GET. There is a
snag: depsys (but not bootsys) renames GET to GETL (which supposedly
works only on list). In the preparation to conversion to bootsys,
I systematically made appearant the renaming by manually turn all GET
to GETL. That manual renaming implies no semantics change.
Now, while investigating some runtime error (that manifests itself
when checking is enabled), it appears that Axiom is querying Nud and
Led properties for things that are lists, in getUserIdentifiersIn.
That is wrong. Fixed thusly. In addition, this patch uses GET for Nud
and Led queries -- they might bogusly get rewritten by depsys, but
eventually that will go away when we convert to bootsys.
-- Gaby
2007-05-04 Gabriel Dos Reis <address@hidden>
* c-doc.boot.pamphlet (checkRecordHash): Use GET instead of GETL.
(checkTransformFirsts): Likewise.
* format.boot.pamphlet (formatOpSymbol): Likewise.
* i-output.boot.pamphlet (exptNeedsPren): Likewise.
(charyTrouble1): Likewise.
* postpar.boot.pamphlet (postForm): Likewise.
* pspad1.boot.pamphlet (format, getOp, formatSelectionOp,
formatPrefixOp): Likewise.
* pspad2.boot.pamphlet (isNewspadOperator): Likewise.
* i-map.boot.pamphlet (getUserIdentifiersIn): Likewise.
Non-atomic objects don't have Nud or Led properties.
*** c-doc.boot.pamphlet (revision 19762)
--- c-doc.boot.pamphlet (local)
*************** checkRecordHash u ==
*** 395,401 ****
checkDocError ['"Wrong number of arguments: ",form2HtString key]
else if member(x,'("\spadop" "\keyword")) and (u :=
checkLookForLeftBrace IFCDR u) and (u := IFCDR u) then
x := intern checkGetStringBeforeRightBrace u
! not (GETL(x,'Led) or GETL(x,'Nud)) =>
checkDocError ['"Unknown \spadop: ",x]
u := rest u
'done
--- 395,401 ----
checkDocError ['"Wrong number of arguments: ",form2HtString key]
else if member(x,'("\spadop" "\keyword")) and (u :=
checkLookForLeftBrace IFCDR u) and (u := IFCDR u) then
x := intern checkGetStringBeforeRightBrace u
! not (GET(x,'Led) or GET(x,'Nud)) =>
checkDocError ['"Unknown \spadop: ",x]
u := rest u
'done
*************** checkTransformFirsts(opname,u,margin) ==
*** 1125,1131 ****
STRCONC('"\spad{",SUBSTRING(u,0,k + 1),'"}",SUBSTRING(u,k + 1,nil))
k := checkSkipToken(u,j,m) or return u
infixOp := INTERN SUBSTRING(u,j,k - j)
! not GETL(infixOp,'Led) => --case 3
namestring ^= (firstWord := SUBSTRING(u,0,i)) =>
checkDocError ['"Improper first word in comments: ",firstWord]
u
--- 1125,1131 ----
STRCONC('"\spad{",SUBSTRING(u,0,k + 1),'"}",SUBSTRING(u,k + 1,nil))
k := checkSkipToken(u,j,m) or return u
infixOp := INTERN SUBSTRING(u,j,k - j)
! not GET(infixOp,'Led) => --case 3
namestring ^= (firstWord := SUBSTRING(u,0,i)) =>
checkDocError ['"Improper first word in comments: ",firstWord]
u
*************** checkTransformFirsts(opname,u,margin) ==
*** 1147,1153 ****
checkDocError ['"Improper first word in comments: ",firstWord]
u
prefixOp := INTERN SUBSTRING(u,0,i)
! not GETL(prefixOp,'Nud) =>
u ---what could this be?
j := checkSkipBlanks(u,i,m) or return u
u.j = char '_( => --case 4
--- 1147,1153 ----
checkDocError ['"Improper first word in comments: ",firstWord]
u
prefixOp := INTERN SUBSTRING(u,0,i)
! not GET(prefixOp,'Nud) =>
u ---what could this be?
j := checkSkipBlanks(u,i,m) or return u
u.j = char '_( => --case 4
*** format.boot.pamphlet (revision 19762)
--- format.boot.pamphlet (local)
*************** formatOpSymbol(op,sig) ==
*** 252,258 ****
[quad,".",sel]
[quad,".",quad]
op
! STRINGP op or GETL(op,"Led") or GETL(op,"Nud") =>
n = 3 =>
if op = 'SEGMENT then op := '".."
op = 'in => [quad,'" ",op,'" ",quad]
--- 252,258 ----
[quad,".",sel]
[quad,".",quad]
op
! STRINGP op or GET(op,"Led") or GET(op,"Nud") =>
n = 3 =>
if op = 'SEGMENT then op := '".."
op = 'in => [quad,'" ",op,'" ",quad]
*************** formatOpSymbol(op,sig) ==
*** 261,267 ****
op = 'exquo => op
[quad,op,quad]
n = 2 =>
! not GETL(op,"Nud") => [quad,op]
[op,quad]
op
op
--- 261,267 ----
op = 'exquo => op
[quad,op,quad]
n = 2 =>
! not GET(op,"Nud") => [quad,op]
[op,quad]
op
op
*** i-map.boot.pamphlet (revision 19762)
--- i-map.boot.pamphlet (local)
*************** getUserIdentifiersIn body ==
*** 244,250 ****
body is [op,:l] =>
argIdList:= "append"/[getUserIdentifiersIn y for y in l]
bodyIdList :=
! not (GETL(op,'Nud) or GETL(op,'Led) or GETL(op,'up))=>
NCONC(getUserIdentifiersIn op, argIdList)
argIdList
REMDUP bodyIdList
--- 244,250 ----
body is [op,:l] =>
argIdList:= "append"/[getUserIdentifiersIn y for y in l]
bodyIdList :=
! CONSP op or not (GET(op,'Nud) or GET(op,'Led) or GET(op,'up))=>
NCONC(getUserIdentifiersIn op, argIdList)
argIdList
REMDUP bodyIdList
*** i-output.boot.pamphlet (revision 19762)
--- i-output.boot.pamphlet (local)
*************** exptNeedsPren a ==
*** 710,716 ****
atom a and null (INTEGERP a and a < 0) => false
key:= keyp a
key = "OVER" => true -- added JHD 2/Aug/90
! (key="SUB") or (null GETL(key,"Nud") and null GETL(key,"Led")) => false
true
exptSub u == subspan CADR u
--- 710,716 ----
atom a and null (INTEGERP a and a < 0) => false
key:= keyp a
key = "OVER" => true -- added JHD 2/Aug/90
! (key="SUB") or (null GET(key,"Nud") and null GET(key,"Led")) => false
true
exptSub u == subspan CADR u
*************** charyTrouble1(u,v,start,linelength) ==
*** 1578,1585 ****
d := GETL(x,'INFIXOP) => charyBinary(d,u,v,start,linelength)
x = 'OVER =>
charyBinary(GETL("/",'INFIXOP),u,v,start,linelength)
! EQ(3,LENGTH u) and GETL(x,'Led) =>
! d:= PNAME first GETL(x,'Led)
charyBinary(d,u,v,start,linelength)
EQ(x,'CONCAT) =>
concatTrouble(rest v,d,start,linelength,nil)
--- 1578,1585 ----
d := GETL(x,'INFIXOP) => charyBinary(d,u,v,start,linelength)
x = 'OVER =>
charyBinary(GETL("/",'INFIXOP),u,v,start,linelength)
! EQ(3,LENGTH u) and GET(x,'Led) =>
! d:= PNAME first GET(x,'Led)
charyBinary(d,u,v,start,linelength)
EQ(x,'CONCAT) =>
concatTrouble(rest v,d,start,linelength,nil)
*** postpar.boot.pamphlet (revision 19762)
--- postpar.boot.pamphlet (local)
*************** postForm (u is [op,:argl]) ==
*** 266,272 ****
op':=
true=> op
$BOOT => op
! GETL(op,'Led) or GETL(op,'Nud) or op = 'IN => op
numOfArgs:= (argl' is [["Tuple",:l]] => #l; 1)
INTERNL("*",STRINGIMAGE numOfArgs,PNAME op)
[op',:argl']
--- 266,272 ----
op':=
true=> op
$BOOT => op
! GET(op,'Led) or GET(op,'Nud) or op = 'IN => op
numOfArgs:= (argl' is [["Tuple",:l]] => #l; 1)
INTERNL("*",STRINGIMAGE numOfArgs,PNAME op)
[op',:argl']
*** pspad1.boot.pamphlet (revision 19762)
--- pspad1.boot.pamphlet (local)
*************** format(x,:options) ==
*** 298,305 ****
getOp(op,kind) ==
kind = 'Led =>
MEMQ(op,'(_div _exquo)) => nil
! GETL(op,'Led)
! GETL(op,'Nud)
formatDollar(name,p,argl) ==
name := markMacroTran name
--- 298,305 ----
getOp(op,kind) ==
kind = 'Led =>
MEMQ(op,'(_div _exquo)) => nil
! GET(op,'Led)
! GET(op,'Nud)
formatDollar(name,p,argl) ==
name := markMacroTran name
*************** formatSelection1 [f,x] == formatSelectio
*** 460,466 ****
formatPren x
formatSelectionOp op ==
! op is [f,.] and not GETL(f,'Nud) or
1000 < pspadBindingPowerOf("right",op) => formatSelectionOp1 op
formatPren1("formatSelectionOp1",op)
--- 460,466 ----
formatPren x
formatSelectionOp op ==
! op is [f,.] and not GET(f,'Nud) or
1000 < pspadBindingPowerOf("right",op) => formatSelectionOp1 op
formatPren1("formatSelectionOp1",op)
*************** formatPrefix(op,arg,lbp,rbp,:options) ==
*** 512,518 ****
formatPrefixOp(op,:options) ==
qualification := IFCAR options
op=char '" " => format " ="
! qualification or GETL(op,"Nud") and ^MEMQ(op,$spadTightList) =>
formatQual(op,qualification) and format " "
format op
--- 512,518 ----
formatPrefixOp(op,:options) ==
qualification := IFCAR options
op=char '" " => format " ="
! qualification or GET(op,"Nud") and ^MEMQ(op,$spadTightList) =>
formatQual(op,qualification) and format " "
format op
*** pspad2.boot.pamphlet (revision 19762)
--- pspad2.boot.pamphlet (local)
*************** formatPileLine($m,x,newLineIfTrue) ==
*** 561,567 ****
--======================================================================
nBlanks m == "STRCONC"/[char('_ ) for i in 1..m]
! isNewspadOperator op == GETL(op,"Led") or GETL(op,"Nud")
isTrue x == x="true" or x is '(QUOTE T)
--- 561,567 ----
--======================================================================
nBlanks m == "STRCONC"/[char('_ ) for i in 1..m]
! isNewspadOperator op == GET(op,"Led") or GET(op,"Nud")
isTrue x == x="true" or x is '(QUOTE T)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Axiom-developer] Nud and Led properties,
Gabriel Dos Reis <=