#749 kill-operator fails to entirely kill prefix, matchfix, nofix

closed
nobody
Lisp Core (471)
5
2005-06-19
2005-06-07
No

kill-operator in src/nparse.lisp doesn't completely
kill prefix, matchfix, and nofix operators. These
operators have a NUD (null left denotation) property,
since there is nothing to the left of the operator.

kill-operator is invoked by kill("op") and remove
("op", op) (the two ways of removing operator
properties). Infix, nary, and postfix operators are not
affected.

The solution is to remove the NUD property along with
the other operator properties. Here is a 1-line patch.

--- nparse.lisp 12 Apr 2005 16:46:15 -0000 1.23
+++ nparse.lisp 7 Jun 2005 04:06:58 -0000
@@ -1842,7 +1842,7 @@
(remprop opr 'opr)
(rempropchk opr)
(mapc #'(lambda (x) (remprop op x))
- '(nud-expr nud-subr ; NUD info
+ '(nud nud-expr nud-subr
; NUD info
led led-expr led-subr
; LED info
lbp rbp ;
Binding power info
lpos rpos pos ;
Part-Of-Speech info

After applying this patch, run_testsuite() succeeds
with all tests passed. This specific test also succeeds:

(%i1) prefix("op1"); infix("op2"); nary("op3");
postfix("op4"); matchfix("op5", "op5b"); nofix("op6");
(%o1) op1
(%o2) op2
(%o3) op3
(%o4) op4
(%o5) op5
(%o6) op6
(%i7) op1 aa;
(%o7) op1 aa
(%i8) aa op2 bb;
(%o8) aa op2 bb
(%i9) aa op3 bb op3 cc;
(%o9) aa op3 bb op3 cc
(%i10) aa op4;
(%o10) aa op4
(%i11) op5 aa, bb op5b;
(%o11) op5aa, bbop5b
(%i12) "op6"() := 8888;
(%o12) op6 := 8888
(%i13) op6;
(%o13) 8888
(%i14) kill ("op1", "op2", "op3", "op4", "op5", "op6");
(%o14) done

------------ OK, now that the operators are killed,
------------ attempting to use them should fail:

(%i15) op1 aa;
Incorrect syntax: aa is not an infix operator
op1 aa;
^
(%i15) aa op2 bb;
Incorrect syntax: op2 is not an infix operator
aa op2
^
(%i15) aa op3 bb op3 cc;
Incorrect syntax: op3 is not an infix operator
aa op3
^
(%i15) aa op4;
Incorrect syntax: op4 is not an infix operator
aa op4;
^
(%i15) op5 aa, bb op5b;
Incorrect syntax: aa is not an infix operator
op5 aa,
^
(%i15) op6;
(%o15) op6

------------ Contrast these with the outputs from
------------ an unpatched system.
------------ Prefix, matchfix, and nofix operators are
------------ recognized as such even though killed:

(%i14) kill ("op1", "op2", "op3", "op4", "op5", "op6");
(%o14) done
(%i15) op1 aa;
(%o15) op1(aa) <---- OOPS
(%i16) aa op2 bb;
Incorrect syntax: OP2 is not an infix operator
aa op2
^
(%i16) aa op3 bb op3 cc;
Incorrect syntax: OP3 is not an infix operator
aa op3
^
(%i16) aa op4;
Incorrect syntax: OP4 is not an infix operator
aa op4;
^
(%i16) op5 aa, bb op5b;
(%o16) op5(aa, bb) <---- OOPS
(%i17) op6;
(%o17) op6() <---- OOPS
(%i18)

Discussion

  • Robert Dodier

    Robert Dodier - 2005-06-19

    Logged In: YES
    user_id=501686

    Patch shown in original comment committed to cvs as version
    1.24 of src/nparse.lisp. Tested with Maxima 5.9.1cvs on
    clisp 2.33.2 and gcl 2.6.6 (both linux). Closing this bug
    report as fixed.

     
  • Robert Dodier

    Robert Dodier - 2005-06-19
    • status: open --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks