summaryrefslogtreecommitdiffstats
path: root/src/tclscanner.l
diff options
context:
space:
mode:
Diffstat (limited to 'src/tclscanner.l')
-rw-r--r--src/tclscanner.l167
1 files changed, 92 insertions, 75 deletions
diff --git a/src/tclscanner.l b/src/tclscanner.l
index e763575..a4709ce 100644
--- a/src/tclscanner.l
+++ b/src/tclscanner.l
@@ -429,7 +429,7 @@ static struct
QCString input_string; // file contents
int input_position; // position in file
QCString file_name; // name of used file
- ParserInterface *this_parser; // myself
+ OutlineParserInterface *this_parser; // myself
int command; // true if command was found
int comment; // set true if comment was scanned
int brace_level; // bookkeeping of braces
@@ -486,6 +486,8 @@ Entry* tcl_entry_new()
// myEntry->mtype = Method;
// myEntry->virt = Normal;
// myEntry->stat = FALSE;
+ myEntry->docFile = tcl.file_name;
+ myEntry->inbodyFile = tcl.file_name;
myEntry->fileName = tcl.file_name;
myEntry->lang = SrcLangExt_Tcl;
Doxygen::docGroup.initGroupInfo(myEntry);
@@ -535,6 +537,13 @@ static void tcl_name(const QCString &ns0, const QCString &name0, QCString &ns, Q
ns = "";
name = myNm;
}
+ else if (myNm.length()-myStart == 2)
+ {
+ // ending with :: so get name equal to last component
+ ns = myNm.mid(0,myStart);
+ myStart = ns.findRev("::");
+ name = myNm.mid(myStart+2);
+ }
else
{
ns = myNm.mid(0,myStart);
@@ -578,7 +587,7 @@ Entry* tcl_entry_namespace(const QCString ns)
myEntry = tcl_entry_new();
myEntry->section = Entry::NAMESPACE_SEC;
myEntry->name = ns;
- tcl.entry_main->addSubEntry(myEntry);
+ tcl.entry_main->moveToSubEntryAndKeep(myEntry);
tcl.ns.insert(ns,myEntry);
}
return myEntry;
@@ -597,7 +606,7 @@ Entry* tcl_entry_class(const QCString cl)
myEntry = tcl_entry_new();
myEntry->section = Entry::CLASS_SEC;
myEntry->name = cl;
- tcl.entry_main->addSubEntry(myEntry);
+ tcl.entry_main->moveToSubEntryAndKeep(myEntry);
tcl.cl.insert(cl,myEntry);
}
return myEntry;
@@ -1494,7 +1503,7 @@ tcl_inf("-> %s\n",(const char *)tcl.string_comment);
{
tcl_inf("-> %s\n",(const char *)tcl.string_comment);
int myPos=0;
- bool myNew=0;
+ bool myNew=false;
int myLine=tcl.line_comment;
BufStr myI(1024);
BufStr myO(1024);
@@ -1540,7 +1549,7 @@ tcl_inf("-> %s\n",(const char *)tcl.string_comment);
processedDoc = preprocessCommentBlock(myDoc,tcl.file_name,myLine0);
parseCommentBlock(tcl.this_parser, myEntry, processedDoc, tcl.file_name,
myLine0, FALSE, tcl.config_autobrief, FALSE, myProt, myPos0, myNew);
- tcl.entry_inside->addSubEntry(myEntry);
+ tcl.entry_inside->moveToSubEntryAndRefresh(myEntry);
}
else
{ // we can add to current entry in this case
@@ -1562,7 +1571,7 @@ tcl_inf("-> %s\n",(const char *)tcl.string_comment);
processedDoc = preprocessCommentBlock(myDoc,tcl.file_name,myLine0);
parseCommentBlock(tcl.this_parser, myEntry, processedDoc, tcl.file_name,
myLine0, FALSE, tcl.config_autobrief, FALSE, myProt, myPos0, myNew);
- tcl.entry_inside->addSubEntry(myEntry);
+ tcl.entry_inside->moveToSubEntryAndKeep(myEntry);
}
else
{ // we can add to current entry
@@ -1585,7 +1594,7 @@ tcl_inf("-> %s\n",(const char *)tcl.string_comment);
{
if (myNew)
{
- tcl.entry_inside->addSubEntry(tcl.entry_current);
+ tcl.entry_inside->moveToSubEntryAndKeep(tcl.entry_current);
tcl.entry_current = tcl_entry_new();
}
else
@@ -1596,7 +1605,7 @@ tcl_inf("-> %s\n",(const char *)tcl.string_comment);
}
if (myNew)
{
- tcl.entry_inside->addSubEntry(tcl.entry_current);
+ tcl.entry_inside->moveToSubEntryAndKeep(tcl.entry_current);
tcl.entry_current = tcl_entry_new();
}
else
@@ -1622,37 +1631,32 @@ tcl_inf("-> %s\n",(const char *)tcl.string_comment);
static void tcl_command_ARGLIST(QCString &arglist)
{
D
- Argument *myArg;
QCStringList myArgs;
QCString myArglist="";
- if (!tcl.entry_current->argList)
- {
- tcl.entry_current->argList=new ArgumentList;
- }
tcl_split_list(arglist,myArgs);
for (uint i=0;i<myArgs.count();i++)
{
QCStringList myArgs1;
- myArg=new Argument;
+ Argument myArg;
tcl_split_list(*myArgs.at(i),myArgs1);
if (myArgs1.count()==2)
{
- myArg->name= (*myArgs1.at(0));
- myArg->defval= (*myArgs1.at(1));
- if (myArg->defval.isEmpty())
+ myArg.name= (*myArgs1.at(0));
+ myArg.defval= (*myArgs1.at(1));
+ if (myArg.defval.isEmpty())
{
- myArg->defval = " ";
+ myArg.defval = " ";
}
- myArglist += "?" + QCString(myArg->name) + "? ";
+ myArglist += "?" + QCString(myArg.name) + "? ";
}
else
{
- myArg->name= (*myArgs.at(i));
- myArglist += myArg->name + " ";
+ myArg.name= (*myArgs.at(i));
+ myArglist += myArg.name + " ";
}
- tcl.entry_current->argList->append(myArg);
+ tcl.entry_current->argList.push_back(myArg);
}
arglist = myArglist;
tcl.entry_current->args = arglist;
@@ -2151,11 +2155,13 @@ D
tcl.entry_current->mtype = Method;
tcl.entry_current->name = myName;
tcl.entry_current->startLine = tcl.line_command;
+ tcl.entry_current->docLine = tcl.line_comment;
+ tcl.entry_current->inbodyLine = tcl.line_comment;
tcl.entry_current->bodyLine = tcl.line_body0;
tcl.entry_current->endBodyLine = tcl.line_body1;
tcl_protection(tcl.entry_current);
tcl_command_ARGLIST(*tcl.list_commandwords.at(4));
- myEntryNs->addSubEntry(tcl.entry_current);
+ myEntryNs->moveToSubEntryAndKeep(tcl.entry_current);
myEntry = tcl.entry_current;
tcl.fn.insert(myName,myEntry);
myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(6),
@@ -2193,11 +2199,13 @@ D
tcl.entry_current->mtype = Method;
tcl.entry_current->name = myName;
tcl.entry_current->startLine = tcl.line_command;
+ tcl.entry_current->docLine = tcl.line_comment;
+ tcl.entry_current->inbodyLine = tcl.line_comment;
tcl.entry_current->bodyLine = tcl.line_body0;
tcl.entry_current->endBodyLine = tcl.line_body1;
tcl_protection(tcl.entry_current);
tcl_command_ARGLIST(*tcl.list_commandwords.at(4));
- myEntryCl->addSubEntry(tcl.entry_current);
+ myEntryCl->moveToSubEntryAndKeep(tcl.entry_current);
tcl.fn.insert(myName,tcl.entry_current);
myEntry = tcl.entry_current;
myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(6),
@@ -2230,11 +2238,13 @@ D
tcl.entry_current->mtype = Method;
tcl.entry_current->name = myName;
tcl.entry_current->startLine = tcl.line_command;
+ tcl.entry_current->docLine = tcl.line_comment;
+ tcl.entry_current->inbodyLine = tcl.line_comment;
tcl.entry_current->bodyLine = tcl.line_body0;
tcl.entry_current->endBodyLine = tcl.line_body1;
tcl_protection(tcl.entry_current);
tcl_command_ARGLIST(*tcl.list_commandwords.at(2));
- if (myEntryCl) myEntryCl->addSubEntry(tcl.entry_current);
+ if (myEntryCl) myEntryCl->moveToSubEntryAndKeep(tcl.entry_current);
myEntry = tcl.entry_current;
tcl.fn.insert(myName,myEntry);
myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(4),
@@ -2265,10 +2275,12 @@ D
tcl.entry_current->mtype = Method;
tcl.entry_current->name = myName;
tcl.entry_current->startLine = tcl.line_command;
+ tcl.entry_current->docLine = tcl.line_comment;
+ tcl.entry_current->inbodyLine = tcl.line_comment;
tcl.entry_current->bodyLine = tcl.line_body0;
tcl.entry_current->endBodyLine = tcl.line_body1;
tcl_protection(tcl.entry_current);
- myEntryCl->addSubEntry(tcl.entry_current);
+ myEntryCl->moveToSubEntryAndKeep(tcl.entry_current);
myEntry = tcl.entry_current;
tcl.fn.insert(myName,myEntry);
myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(2),
@@ -2298,9 +2310,11 @@ D
tcl.entry_current->section = Entry::NAMESPACE_SEC;
tcl.entry_current->name = myName;
tcl.entry_current->startLine = tcl.line_command;
+ tcl.entry_current->docLine = tcl.line_comment;
+ tcl.entry_current->inbodyLine = tcl.line_comment;
tcl.entry_current->bodyLine = tcl.line_body0;
tcl.entry_current->endBodyLine = tcl.line_body1;
- tcl.entry_main->addSubEntry(tcl.entry_current);
+ tcl.entry_main->moveToSubEntryAndKeep(tcl.entry_current);
tcl.ns.insert(myName,tcl.entry_current);
//myEntryNs = tcl.entry_current;
myStr = (*tcl.list_commandwords.at(6));
@@ -2336,9 +2350,11 @@ D
tcl.entry_current->section = Entry::CLASS_SEC;
tcl.entry_current->name = myName;
tcl.entry_current->startLine = tcl.line_command;
+ tcl.entry_current->docLine = tcl.line_comment;
+ tcl.entry_current->inbodyLine = tcl.line_comment;
tcl.entry_current->bodyLine = tcl.line_body0;
tcl.entry_current->endBodyLine = tcl.line_body1;
- tcl.entry_main->addSubEntry(tcl.entry_current);
+ tcl.entry_main->moveToSubEntryAndKeep(tcl.entry_current);
tcl.cl.insert(myName,tcl.entry_current);
myEntryCl = tcl.entry_current;
myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(4),
@@ -2368,9 +2384,11 @@ D
tcl.entry_current->section = Entry::CLASS_SEC;
tcl.entry_current->name = myName;
tcl.entry_current->startLine = tcl.line_command;
+ tcl.entry_current->docLine = tcl.line_comment;
+ tcl.entry_current->inbodyLine = tcl.line_comment;
tcl.entry_current->bodyLine = tcl.line_body0;
tcl.entry_current->endBodyLine = tcl.line_body1;
- tcl.entry_main->addSubEntry(tcl.entry_current);
+ tcl.entry_main->moveToSubEntryAndKeep(tcl.entry_current);
//myEntryNs = tcl_entry_namespace(myName);
tcl.cl.insert(myName,tcl.entry_current);
myEntryCl = tcl.entry_current;
@@ -2420,6 +2438,8 @@ D
tcl.entry_current->mtype = Method;
tcl.entry_current->name = myMethod;
tcl.entry_current->startLine = tcl.line_command;
+ tcl.entry_current->docLine = tcl.line_comment;
+ tcl.entry_current->inbodyLine = tcl.line_comment;
tcl.entry_current->bodyLine = tcl.line_body0;
tcl.entry_current->endBodyLine = tcl.line_body1;
tcl_protection(tcl.entry_current);
@@ -2431,7 +2451,7 @@ D
{
tcl_command_ARGLIST(*tcl.list_commandwords.at(6));
}
- if (myEntryCl) myEntryCl->addSubEntry(tcl.entry_current);
+ if (myEntryCl) myEntryCl->moveToSubEntryAndKeep(tcl.entry_current);
tcl.fn.insert(myMethod,tcl.entry_current);
myEntry = tcl.entry_current;
myScan = tcl_scan_start('?',*tcl.list_commandwords.at(n-1),
@@ -2490,10 +2510,12 @@ D
tcl.entry_current->section = Entry::VARIABLE_SEC;
tcl.entry_current->name = myName;
tcl.entry_current->startLine = tcl.line_command;
+ tcl.entry_current->docLine = tcl.line_comment;
+ tcl.entry_current->inbodyLine = tcl.line_comment;
tcl.entry_current->bodyLine = tcl.line_body0;
tcl.entry_current->endBodyLine = tcl.line_body1;
tcl_protection(tcl.entry_current);
- myEntry->addSubEntry(tcl.entry_current);
+ myEntry->moveToSubEntryAndKeep(tcl.entry_current);
tcl.entry_current = tcl_entry_new();
}
@@ -2705,7 +2727,7 @@ tcl_inf("->\n");
{
for (unsigned int i = 2; i < tcl.list_commandwords.count(); i = i + 2)
{
- tcl.scan.at(0)->entry_cl->extends->append(new BaseInfo((*tcl.list_commandwords.at(i)),Public,Normal));
+ tcl.scan.at(0)->entry_cl->extends.push_back(BaseInfo((*tcl.list_commandwords.at(i)),Public,Normal));
}
}
goto command_end;
@@ -2911,10 +2933,10 @@ static void tcl_parse(const QCString ns, const QCString cls)
tcl.entry_file->name = tcl.file_name;
tcl.entry_file->section = Entry::SOURCE_SEC;
tcl.entry_file->protection = Public;
- tcl.entry_main->addSubEntry(tcl.entry_file);
+ tcl.entry_main->moveToSubEntryAndKeep(tcl.entry_file);
Entry *myEntry=tcl_entry_new();
myEntry->name="";
- tcl.entry_main->addSubEntry(myEntry);
+ tcl.entry_main->moveToSubEntryAndKeep(myEntry);
tcl.ns.insert("::",myEntry);
tcl.entry_current = tcl_entry_new();
@@ -2942,9 +2964,9 @@ static void tcl_parse(const QCString ns, const QCString cls)
}
//! Parse text file and build up entry tree.
-void TclLanguageScanner::parseInput(const char *fileName,
+void TclOutlineParser::parseInput(const char *fileName,
const char *input,
- Entry *root,
+ const std::shared_ptr<Entry> &root,
bool /*sameTranslationUnit*/,
QStrList & /*filesInSameTranslationUnit*/)
{
@@ -2965,7 +2987,7 @@ tcl_inf("%s\n",fileName);
tcl.code = NULL;
tcl.file_name = fileName;
tcl.this_parser = this;
- tcl.entry_main = root; /* toplevel entry */
+ tcl.entry_main = root.get(); /* toplevel entry */
tcl_parse("","");
Doxygen::docGroup.leaveFile(tcl.file_name,yylineno);
root->program.resize(0);
@@ -2973,8 +2995,40 @@ tcl_inf("%s\n",fileName);
printlex(yy_flex_debug, FALSE, __FILE__, fileName);
}
+
+bool TclOutlineParser::needsPreprocessing(const QCString &extension) const
+{
+ (void)extension;
+ return FALSE;
+}
+
+void TclOutlineParser::parsePrototype(const char *text)
+{
+ (void)text;
+}
+
+static int yyread(char *buf,int max_size)
+{
+ int c=0;
+
+ *buf = '\0';
+ while ( c < max_size && tcl.input_string.at(tcl.input_position) )
+ {
+ *buf = tcl.input_string.at(tcl.input_position++) ;
+ c++; buf++;
+ }
+ //printf("Read from=%d size=%d max=%d c=%d\n",tcl.input_position,strlen(&tcl.input_string[tcl.input_position]),max_size,c);
+ return c;
+}
+
+//----------------------------------------------------------------------------
+
+void TclCodeParser::resetCodeParserState()
+{
+}
+
//! Parse file and codify.
-void TclLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf,
+void TclCodeParser::parseCode(CodeOutputInterface & codeOutIntf,
const char * scopeName,
const QCString & input,
SrcLangExt lang,
@@ -3078,36 +3132,6 @@ tcl_inf("%s (%d,%d) %d %d\n",myStr.data(),startLine,endLine,isExampleBlock,inlin
tcl.entry.clear();
printlex(yy_flex_debug, FALSE, __FILE__, fileDef ? fileDef->fileName().data(): NULL);
}
-
-bool TclLanguageScanner::needsPreprocessing(const QCString &extension)
-{
- (void)extension;
- return FALSE;
-}
-
-void TclLanguageScanner::resetCodeParserState()
-{
-}
-
-void TclLanguageScanner::parsePrototype(const char *text)
-{
- (void)text;
-}
-
-static int yyread(char *buf,int max_size)
-{
- int c=0;
-
- *buf = '\0';
- while ( c < max_size && tcl.input_string.at(tcl.input_position) )
- {
- *buf = tcl.input_string.at(tcl.input_position++) ;
- c++; buf++;
- }
- //printf("Read from=%d size=%d max=%d c=%d\n",tcl.input_position,strlen(&tcl.input_string[tcl.input_position]),max_size,c);
- return c;
-}
-
//----------------------------------------------------------------------------
// to avoid a warning
@@ -3116,11 +3140,4 @@ void tclDummy()
yy_top_state();
}
-#if !defined(YY_FLEX_SUBMINOR_VERSION)
-//----------------------------------------------------------------------------
-extern "C" { // some bogus code to keep the compiler happy
- void tclscannerYYdummy() { yy_flex_realloc(0,0); }
-}
-#endif
-
#include "tclscanner.l.h"