bundles / papyri latest / papyri / ts / TSVisitor / visit_directive
function
papyri.ts:TSVisitor.visit_directive
source: /papyri/ts.py :734
Signature
def visit_directive ( self , node : Node ) → list[Any] Summary
Main entry point for directives.
Extended Summary
Parses directive arguments, options and content into a UnprocessedDirective object.
Parameters
node: NodeThe directive to parse
Returns
: directive: UnprocessedDirective
Notes
The way tree sitter works when parsing directive, we will get a sequence of nodes of various types, thus we must iterate over them and look at their types, which is efficient in term of spaces, but as convenient as term of API, thus will try to disambiguate the various case we encounter to form something a bit more coherent. We want to have structs which all have the same fields, and the fields potentially emtpy if absent.
Note though that some of the directive do allow to now have any arguments, or option and allow the content to start just after the :: marker, and we will need some spacial casing/ workaround for this.
Aliases
-
papyri.ts.TSVisitor.visit_directive