mirror of
https://github.com/zeek/zeek.git
synced 2025-10-16 05:28:20 +00:00
Bro script documentation framework checkpoint
* New bro runtime options: -Z or --doc-scripts enables documentation mode * New BroDoc, BroBifDoc, and BroDocObj interfaces to support script documentation * Modifications to the bro scanner (scan.l) to get it to keep track of which script is being scanned/parsed and which document is being generated * Modifications to scan.l and the bro parser (parse.y) to produce/consume script comments denoted with "##" * Documentation is currently generated for the following ** Script author ** Script summary ** @load's ** capture_filters ** modules (namespaces) Most of the remaining framework/infrastructure work should be in extracting the interesting BroObj objects as the parser sees them and better formatting the reST documents.
This commit is contained in:
parent
4b77164e04
commit
30209b56bb
10 changed files with 644 additions and 3 deletions
35
src/BroDocObj.cc
Normal file
35
src/BroDocObj.cc
Normal file
|
@ -0,0 +1,35 @@
|
|||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include "Obj.h"
|
||||
#include "BroDocObj.h"
|
||||
|
||||
BroDocObj::BroDocObj(const BroObj* obj,
|
||||
std::list<std::string>*& reST,
|
||||
bool exported)
|
||||
{
|
||||
broObj = obj;
|
||||
isExported = exported;
|
||||
reST_doc_strings = reST;
|
||||
reST = 0;
|
||||
}
|
||||
|
||||
BroDocObj::~BroDocObj()
|
||||
{
|
||||
delete reST_doc_strings;
|
||||
}
|
||||
|
||||
void BroDocObj::WriteReST(FILE* file) const
|
||||
{
|
||||
if ( reST_doc_strings )
|
||||
{
|
||||
std::list<std::string>::const_iterator it;
|
||||
for ( it = reST_doc_strings->begin();
|
||||
it != reST_doc_strings->end(); ++it)
|
||||
fprintf(file, "%s\n", it->c_str());
|
||||
}
|
||||
|
||||
ODesc desc;
|
||||
broObj->Describe(&desc);
|
||||
fprintf(file, "%s\n", desc.Description());
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue