Public Member Functions | List of all members
TclLanguageScanner Class Reference

Tcl language parser using state-based lexical scanning. More...

#include <tclscanner.h>

Inheritance diagram for TclLanguageScanner:
ParserInterface

Public Member Functions

virtual ~TclLanguageScanner ()
 
void startTranslationUnit (const char *)
 
void finishTranslationUnit ()
 
void parseInput (const char *fileName, const char *fileBuf, Entry *root, bool sameTranslationUnit, QStrList &filesInSameTranslationUnit)
 Parse text file and build up entry tree. More...
 
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)
 Parse file and codify. More...
 
void resetCodeParserState ()
 
void parsePrototype (const char *text)
 
- Public Member Functions inherited from ParserInterface
virtual ~ParserInterface ()
 

Detailed Description

Tcl language parser using state-based lexical scanning.

This is the Tcl language parser for doxygen.

Definition at line 28 of file tclscanner.h.

Constructor & Destructor Documentation

virtual TclLanguageScanner::~TclLanguageScanner ( )
inlinevirtual

Definition at line 31 of file tclscanner.h.

31 {}

Member Function Documentation

void TclLanguageScanner::finishTranslationUnit ( )
inlinevirtual

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

Implements ParserInterface.

Definition at line 33 of file tclscanner.h.

33 {}
bool TclLanguageScanner::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 5353 of file tclscanner.cpp.

5354 {
5355  (void)extension;
5356  return FALSE;
5357 }
const bool FALSE
Definition: qglobal.h:370
void TclLanguageScanner::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

Parse file and codify.

Implements ParserInterface.

Definition at line 5250 of file tclscanner.cpp.

5265 {
5266  (void)scopeName;
5267  (void)lang;
5268  (void)exampleName;
5269  (void)fileDef;
5270  (void)endLine;
5271  (void)inlineFragment;
5272  (void)searchCtx;
5273  (void)collectXRefs;
5274 
5275  if (input.length()<1) return;
5276  printlex(tclscannerYY_flex_debug, TRUE, __FILE__, fileDef ? fileDef->fileName().data(): NULL);
5277  tcl.input_string = input;
5278 
5279  QCString myNs="";
5280  QCString myCls="";
5281  if (memberDef)
5282  {
5283  if (memberDef->getClassDef())
5284  {
5285  myCls = memberDef->getClassDef()->displayName();
5286  myNs = myCls;
5287  }
5288  else if (memberDef->getNamespaceDef())
5289  {
5290  myNs = memberDef->getNamespaceDef()->displayName();
5291  }
5292  }
5293 
5294  QString myStr="Codifying..";
5295  if (scopeName)
5296  {
5297  myStr +=" scope=";
5298  myStr+=scopeName;
5299  }
5300  if (exampleName)
5301  {
5302  myStr+=" example=";
5303  myStr+=exampleName;
5304  }
5305  if (memberDef)
5306  {
5307  myStr+=" member=";
5308  myStr+=memberDef->memberTypeName();
5309  myStr+=" ";
5310  myStr+=memberDef->qualifiedName();
5311  }
5312  if (fileDef)
5313  {
5314  myStr+=" file=";
5315  myStr+=fileDef->fileName();
5316  }
5317 tcl_inf("%s (%d,%d) %d %d\n",myStr.ascii(),startLine,endLine,isExampleBlock,inlineFragment);
5318 //tcl_inf("%s\n"input.data());
5319  if (isExampleBlock)
5320  {
5321  tcl_codify(NULL,input);
5322  return;
5323  }
5324  tcl_init();
5325  tcl.collectXRefs = collectXRefs;
5326  tcl.memberdef = memberDef;
5327  tcl.code = &codeOutIntf;
5328  if (startLine<0)
5329  {
5330  startLine=1;
5331  }
5332  tclscannerYYlineno=startLine;
5333  tcl.code_linenumbers = showLineNumbers;
5334  tcl.code_line=tclscannerYYlineno;
5335  tcl.code->startCodeLine(tcl.code_linenumbers);
5336  if (tcl.code_linenumbers)
5337  {
5338  tcl.code->writeLineNumber(0,0,0,tcl.code_line);
5339  }
5340  tcl.file_name = "";
5341  tcl.this_parser = NULL;
5342  tcl.entry_main = tcl_entry_new();
5343  tcl_parse(myNs,myCls);
5344  tcl.code->endCodeLine();
5345  tcl.scan.clear();
5346  tcl.ns.clear();
5347  tcl.cl.clear();
5348  tcl.fn.clear();
5349  tcl.entry.clear();
5350  printlex(tclscannerYY_flex_debug, FALSE, __FILE__, fileDef ? fileDef->fileName().data(): NULL);
5351 }
void printlex(int dbg, bool enter, const char *lexName, const char *fileName)
Definition: message.cpp:242
uint length() const
Definition: qcstring.h:195
QCString displayName(bool=TRUE) const
int tclscannerYYlineno
Definition: tclscanner.cpp:378
#define tcl_inf
Application message.
Definition: tclscanner.cpp:771
const bool FALSE
Definition: qglobal.h:370
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
QCString displayName(bool includeScope=TRUE) const
Definition: classdef.cpp:312
static void tcl_parse(const QCString ns, const QCString cls)
Start parsing.
static int input(void)
Definition: code.cpp:15695
const char * ascii() const
Definition: qstring.cpp:14494
static void tcl_init()
Common initializations.
const char * data() const
Definition: qcstring.h:207
ClassDef * getClassDef() const
Definition: memberdef.cpp:4070
Entry * tcl_entry_new()
Create new entry.
QCString qualifiedName() const
Definition: memberdef.cpp:3968
QCString fileName() const
Definition: filedef.h:81
NamespaceDef * getNamespaceDef() const
Definition: memberdef.cpp:4080
QCString memberTypeName() const
Definition: memberdef.cpp:3188
int tclscannerYY_flex_debug
Definition: tclscanner.cpp:688
static struct @2 tcl
const bool TRUE
Definition: qglobal.h:371
bool collectXRefs
static void tcl_codify(const char *s, const char *str)
Codify &#39;str&#39; with special font class &#39;s&#39;.
void TclLanguageScanner::parseInput ( const char *  fileName,
const char *  fileBuf,
Entry root,
bool  sameTranslationUnit,
QStrList filesInSameTranslationUnit 
)
virtual

Parse text file and build up entry tree.

Implements ParserInterface.

Definition at line 5218 of file tclscanner.cpp.

5223 {
5224  QFile myFile;
5225 tcl_inf("%s\n",fileName);
5226  myFile.setName(fileName);
5227  if (!myFile.open(IO_ReadOnly)) return;
5228  if (strlen(input)<1) return;
5229 
5230  tcl.input_string = input;
5231  if (tcl.input_string.length()<1) return;
5233 
5234  msg("Parsing %s...\n",fileName);
5236 
5237  tcl_init();
5238  tcl.code = NULL;
5239  tcl.file_name = fileName;
5240  tcl.this_parser = this;
5241  tcl.entry_main = root; /* toplevel entry */
5242  tcl_parse("","");
5244  root->program.resize(0);
5245  myFile.close();
5247 }
QGString program
the program text
Definition: entry.h:256
void msg(const char *fmt,...)
Definition: message.cpp:107
void printlex(int dbg, bool enter, const char *lexName, const char *fileName)
Definition: message.cpp:242
int tclscannerYYlineno
Definition: tclscanner.cpp:378
#define tcl_inf
Application message.
Definition: tclscanner.cpp:771
const bool FALSE
Definition: qglobal.h:370
bool resize(uint newlen)
Definition: qgstring.cpp:96
void setName(const QString &name)
Definition: qfile.cpp:167
#define IO_ReadOnly
Definition: qiodevice.h:61
static void tcl_parse(const QCString ns, const QCString cls)
Start parsing.
void groupEnterFile(const char *fileName, int)
static int input(void)
Definition: code.cpp:15695
fileName
Definition: dumpTree.py:9
static void tcl_init()
Common initializations.
bool open(int)
Definition: qfile_unix.cpp:134
The QFile class is an I/O device that operates on files.
Definition: qfile.h:50
void groupLeaveFile(const char *fileName, int line)
void close()
Definition: qfile_unix.cpp:614
int tclscannerYY_flex_debug
Definition: tclscanner.cpp:688
static struct @2 tcl
const bool TRUE
Definition: qglobal.h:371
void TclLanguageScanner::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 5363 of file tclscanner.cpp.

5364 {
5365  (void)text;
5366 }
void TclLanguageScanner::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 5359 of file tclscanner.cpp.

5360 {
5361 }
void TclLanguageScanner::startTranslationUnit ( const char *  fileName)
inlinevirtual

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 32 of file tclscanner.h.

32 {}

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