eudoxia0 / docparser

Extract documentation from Common Lisp systems
41 stars 18 forks source link

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

Open avodonosov opened 2 years ago

avodonosov commented 2 years ago

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?

eudoxia0 commented 2 years ago

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.