docparser icon indicating copy to clipboard operation
docparser copied to clipboard

Why are cffi-function's duplicated by other node types?

Open avodonosov opened this issue 3 years ago • 1 comments

For example:

(ql:quickload '#:docparser-test)
(let ((index (docparser:parse '#:docparser-test-system)))
  (map 'list 'type-of (docparser:query index
                                       :package-name '#:docparser-test-system
                                       :symbol-name '#:printf)))

=> (DOCPARSER:CFFI-FUNCTION DOCPARSER:MACRO-NODE)
(ql:quickload '#:cl+ssl)
(let ((index (docparser:parse '#:cl+ssl)))
  (map 'list 'type-of (docparser:query index
                                       :package-name '#:cl+ssl
                                       :symbol-name '#:x509-free)))

=> (DOCPARSER:CFFI-FUNCTION DOCPARSER:FUNCTION-NODE)

Is that intentional that in the first example the cffi-function is duplicated by the macro-node and in the second - by function-node?

BTW, cffi-function and other cffi nodes have nil printed representation - as defined at https://github.com/eudoxia0/docparser/blob/fc35b2a927df22a29141057c156f3902f30ac830/src/print.lisp#L46.

That is confusing when inspecting query results or printing them. For example M-x slime-inspect for this form

(let ((index (docparser:parse '#:docparser-test-system)))
  (docparser:query index
                   :package-name '#:docparser-test-system
                   :symbol-name '#:printf))

Looks like that in SLIME:

#<(SIMPLE-VECTOR 2) #x302001C5D75D>
--------------------
Dimensions: (2)
Element type: T
Total size: 2
Adjustable: NIL
Fill pointer: NIL
Contents:
0: 
1: #<macro printf (CONTROL &REST VARARGS20149)>

Is that also intentional?

avodonosov avatar Sep 02 '22 15:09 avodonosov

Is that intentional that in the first example the cffi-function is duplicated by the macro-node and in the second - by function-node?

This is probably an artifact of how parsing works.

Is that also intentional?

No, I certainly forgot to write the tests.

eudoxia0 avatar Sep 05 '22 09:09 eudoxia0