doxygen
Public Member Functions | List of all members
ParserInterface Class Referenceabstract

Abstract interface for programming language parsers. More...

#include <parserintf.h>

Inheritance diagram for ParserInterface:
CLanguageScanner FileParser FortranLanguageScanner MarkdownFileParser PythonLanguageScanner SQLScanner TclLanguageScanner VHDLLanguageScanner XMLScanner

Public Member Functions

virtual void startTranslationUnit (const char *fileName)=0
 Starts processing a translation unit (source files + headers). More...
 
virtual void finishTranslationUnit ()=0
 Called after all files in a translation unit have been processed.
 
virtual void parseInput (const char *fileName, const char *fileBuf, const std::unique_ptr< Entry > &root, bool sameTranslationUnit, QStrList &filesInSameTranslationUnit)=0
 Parses a single input file with the goal to build an Entry tree. More...
 
virtual bool needsPreprocessing (const QCString &extension)=0
 Returns TRUE if the language identified by extension needs the C preprocessor to be run before feed the result to the input parser. More...
 
virtual void parseCode (CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, SrcLangExt lang, bool isExampleBlock, const char *exampleName=0, FileDef *fileDef=0, int startLine=-1, int endLine=-1, bool inlineFragment=FALSE, const MemberDef *memberDef=0, bool showLineNumbers=TRUE, const Definition *searchCtx=0, bool collectXRefs=TRUE)=0
 Parses a source file or fragment with the goal to produce highlighted and cross-referenced output. More...
 
virtual void resetCodeParserState ()=0
 Resets the state of the code parser. More...
 
virtual void parsePrototype (const char *text)=0
 Callback function called by the comment block scanner. More...
 

Detailed Description

Abstract interface for programming language parsers.

By implementing the methods of this interface one can add a new language parser to doxygen. The parser can make use of the comment block parser to parse the contents of special comment blocks.

Member Function Documentation

§ needsPreprocessing()

virtual bool ParserInterface::needsPreprocessing ( const QCString extension)
pure virtual

Returns TRUE if the language identified by extension needs the C preprocessor to be run before feed the result to the input parser.

See also
parseInput()

Implemented in VHDLLanguageScanner, PythonLanguageScanner, CLanguageScanner, FortranLanguageScanner, MarkdownFileParser, TclLanguageScanner, SQLScanner, XMLScanner, and FileParser.

§ parseCode()

virtual void ParserInterface::parseCode ( CodeOutputInterface codeOutIntf,
const char *  scopeName,
const QCString input,
SrcLangExt  lang,
bool  isExampleBlock,
const char *  exampleName = 0,
FileDef fileDef = 0,
int  startLine = -1,
int  endLine = -1,
bool  inlineFragment = FALSE,
const MemberDef memberDef = 0,
bool  showLineNumbers = TRUE,
const Definition searchCtx = 0,
bool  collectXRefs = TRUE 
)
pure virtual

Parses a source file or fragment with the goal to produce highlighted and cross-referenced output.

Parameters
[in]codeOutIntfAbstract interface for writing the result.
[in]langThe programming language of the code fragment.
[in]scopeNameName of scope to which the code belongs.
[in]inputActual code in the form of a string
[in]isExampleBlockTRUE iff the code is part of an example.
[in]exampleNameName of the example.
[in]fileDefFile definition to which the code is associated.
[in]startLineStarting line in case of a code fragment.
[in]endLineEnding line of the code fragment.
[in]inlineFragmentCode fragment that is to be shown inline as part of the documentation.
[in]memberDefMember definition to which the code is associated (non null in case of an inline fragment for a member).
[in]showLineNumbersif set to TRUE and also fileDef is not 0, line numbers will be added to the source fragment
[in]searchCtxcontext under which search data has to be stored.
[in]collectXRefscollect cross-reference relations.

Implemented in VHDLLanguageScanner, PythonLanguageScanner, CLanguageScanner, FortranLanguageScanner, MarkdownFileParser, TclLanguageScanner, SQLScanner, XMLScanner, and FileParser.

§ parseInput()

virtual void ParserInterface::parseInput ( const char *  fileName,
const char *  fileBuf,
const std::unique_ptr< Entry > &  root,
bool  sameTranslationUnit,
QStrList filesInSameTranslationUnit 
)
pure virtual

Parses a single input file with the goal to build an Entry tree.

Parameters
[in]fileNameThe full name of the file.
[in]fileBufThe contents of the file (zero terminated).
[in,out]rootThe root of the tree of Entry *nodes representing the information extracted from the file.
[in]sameTranslationUnitTRUE if this file was found in the same translation unit (in the filesInSameTranslationUnit list returned for another file).
[in,out]filesInSameTranslationUnitother files expected to be found in the same translation unit (used for libclang)

Implemented in VHDLLanguageScanner, PythonLanguageScanner, CLanguageScanner, FortranLanguageScanner, MarkdownFileParser, TclLanguageScanner, SQLScanner, XMLScanner, and FileParser.

§ parsePrototype()

virtual void ParserInterface::parsePrototype ( const char *  text)
pure virtual

Callback function called by the comment block scanner.

It provides a string text containing the prototype of a function or variable. The parser should parse this and store the information in the Entry node that corresponds with the node for which the comment block parser was invoked.

Implemented in VHDLLanguageScanner, PythonLanguageScanner, SQLScanner, XMLScanner, CLanguageScanner, FortranLanguageScanner, MarkdownFileParser, TclLanguageScanner, and FileParser.

§ resetCodeParserState()

virtual void ParserInterface::resetCodeParserState ( )
pure virtual

Resets the state of the code parser.

Since multiple code fragments can together form a single example, an explicit function is used to reset the code parser state.

See also
parseCode()

Implemented in VHDLLanguageScanner, PythonLanguageScanner, CLanguageScanner, FortranLanguageScanner, MarkdownFileParser, SQLScanner, TclLanguageScanner, XMLScanner, and FileParser.

§ startTranslationUnit()

virtual void ParserInterface::startTranslationUnit ( const char *  fileName)
pure virtual

Starts processing a translation unit (source files + headers).

After this call parseInput() is called with sameTranslationUnit set to FALSE. If parseInput() returns additional include files, these are also processed using parseInput() with sameTranslationUnit set to TRUE. After that finishTranslationUnit() is called.

Implemented in VHDLLanguageScanner, PythonLanguageScanner, CLanguageScanner, FortranLanguageScanner, MarkdownFileParser, TclLanguageScanner, SQLScanner, XMLScanner, and FileParser.


The documentation for this class was generated from the following file: