Public Member Functions | List of all members
CLanguageScanner Class Reference

C-like language parser using state-based lexical scanning. More...

#include <scanner.h>

Inheritance diagram for CLanguageScanner:
ParserInterface

Public Member Functions

virtual ~CLanguageScanner ()
 
void startTranslationUnit (const char *fileName)
 
void finishTranslationUnit ()
 
void parseInput (const char *fileName, const char *fileBuf, Entry *root, bool sameTranslationUnit, QStrList &filesInSameTranslationUnit)
 
bool needsPreprocessing (const QCString &extension)
 
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, MemberDef *memberDef=0, bool showLineNumbers=TRUE, Definition *searchCtx=0, bool collectXRefs=TRUE)
 
void resetCodeParserState ()
 
void parsePrototype (const char *text)
 
- Public Member Functions inherited from ParserInterface
virtual ~ParserInterface ()
 

Detailed Description

C-like language parser using state-based lexical scanning.

This is the language parser for doxygen. It is somewhat fuzzy and supports C++ and various languages that are closely related to C++, such as C, C#, Objective-C, Java, PHP, and IDL.

Definition at line 29 of file scanner.h.

Constructor & Destructor Documentation

virtual CLanguageScanner::~CLanguageScanner ( )
inlinevirtual

Definition at line 32 of file scanner.h.

32 {}

Member Function Documentation

void CLanguageScanner::finishTranslationUnit ( )
virtual

Called after all files in a translation unit have been processed.

Implements ParserInterface.

Definition at line 22538 of file scanner.cpp.

22539 {
22540  bool processWithClang = insideCpp || insideObjC;
22541  if (processWithClang)
22542  {
22544  }
22545 }
static bool insideObjC
processing Objective C code?
Definition: scanner.cpp:10901
static ClangParser * instance()
Definition: clangparser.cpp:30
static bool insideCpp
processing C/C++ code
Definition: scanner.cpp:10904
bool CLanguageScanner::needsPreprocessing ( const QCString extension)
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()

Implements ParserInterface.

Definition at line 22584 of file scanner.cpp.

22585 {
22586  QCString fe=extension.lower();
22587  SrcLangExt lang = getLanguageFromFileName(extension);
22588  return (SrcLangExt_Cpp == lang) ||
22589  !( fe==".java" || fe==".as" || fe==".d" || fe==".php" ||
22590  fe==".php4" || fe==".inc" || fe==".phtml"
22591  );
22592 }
SrcLangExt
Definition: types.h:41
SrcLangExt getLanguageFromFileName(const QCString fileName)
Definition: util.cpp:7061
QCString lower() const
Definition: qcstring.cpp:263
void CLanguageScanner::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,
MemberDef memberDef = 0,
bool  showLineNumbers = TRUE,
Definition searchCtx = 0,
bool  collectXRefs = TRUE 
)
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 fragement
[in]searchCtxcontext under which search data has to be stored.
[in]collectXRefscollect cross-reference relations.

Implements ParserInterface.

Definition at line 22563 of file scanner.cpp.

22578 {
22579  ::parseCCode(codeOutIntf,scopeName,input,lang,isExampleBlock,exampleName,
22580  fileDef,startLine,endLine,inlineFragment,memberDef,
22581  showLineNumbers,searchCtx,collectXRefs);
22582 }
void parseCCode(CodeOutputInterface &od, const char *className, const QCString &s, SrcLangExt lang, bool exBlock, const char *exName, FileDef *fd, int startLine, int endLine, bool inlineFragment, MemberDef *memberDef, bool showLineNumbers, Definition *searchCtx, bool collectXRefs)
Definition: code.cpp:16397
bool collectXRefs
void CLanguageScanner::parseInput ( const char *  fileName,
const char *  fileBuf,
Entry root,
bool  sameTranslationUnit,
QStrList filesInSameTranslationUnit 
)
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)

Implements ParserInterface.

Definition at line 22547 of file scanner.cpp.

22552 {
22553  g_thisParser = this;
22554 
22556 
22557  ::parseMain(fileName,fileBuf,root,
22558  sameTranslationUnit,filesInSameTranslationUnit);
22559 
22561 }
int scannerYY_flex_debug
Definition: scanner.cpp:10753
void printlex(int dbg, bool enter, const char *lexName, const char *fileName)
Definition: message.cpp:242
static ParserInterface * g_thisParser
Definition: scanner.cpp:10831
const bool FALSE
Definition: qglobal.h:370
static void parseMain(const char *fileName, const char *fileBuf, Entry *rt, bool sameTranslationUnit, QStrList &filesInSameTranslationUnit)
Definition: scanner.cpp:22363
fileName
Definition: dumpTree.py:9
const bool TRUE
Definition: qglobal.h:371
void CLanguageScanner::parsePrototype ( const char *  text)
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.

Implements ParserInterface.

Definition at line 22599 of file scanner.cpp.

22600 {
22601  ::parsePrototype(text);
22602 }
void parsePrototype(const char *text)
Definition: scanner.cpp:22599
void CLanguageScanner::resetCodeParserState ( )
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()

Implements ParserInterface.

Definition at line 22594 of file scanner.cpp.

22595 {
22597 }
void resetCCodeParserState()
Definition: code.cpp:16382
void CLanguageScanner::startTranslationUnit ( const char *  fileName)
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.

Implements ParserInterface.

Definition at line 22534 of file scanner.cpp.

22535 {
22536 }

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