⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scanner.l

📁 doxygen(一个自动从源代码生成文档的工具)的源代码
💻 L
📖 第 1 页 / 共 5 页
字号:
  					  startGroup();					  tmpDocType=-1;					  if (current_root->section & Entry::SCOPE_MASK)                                          {					      current->inside = current_root->name+"::";                                              if (current->mGrpId!=NOGROUP)                                              {                                                memberGroupInside = current->inside.copy();                                              }                                          }					  if (yytext[1]=='/') // C++ style comment					  {  					    current->brief.resize(0);					    lastDocContext = YY_START;					    BEGIN( LineDoc );					  }					  else // C style comment 					  {					    current->doc.resize(0);					    lastDocContext = YY_START;					    removeSlashes=FALSE;					    BEGIN( Doc );					  }  					}<FindMembers,FindFields,ReadInitializer>"//"([!/]?){B}*{CMD}"}"|"/*"([!*]?){B}*{CMD}"}"{B}*"*/"	{  					  endGroup();  					}<FindMembers>"="			{  					  current->bodyLine = yyLineNr;					  lastInitializerContext = YY_START;					  initializerSharpCount=0;					  BEGIN(ReadInitializer);  					}  /* Read initializer rules */<ReadInitializer>"("			{  					  lastRoundContext=YY_START;  					  pCopyRoundString=&current->initializer;					  roundCount=0;  					  current->initializer+=*yytext;   					  BEGIN(CopyRound);  					}<ReadInitializer>"{"			{  					  lastCurlyContext=YY_START;  					  pCopyCurlyString=&current->initializer;					  curlyCount=0;  					  current->initializer+=*yytext;   					  BEGIN(CopyCurly);  					}<ReadInitializer>[;,]			{  					  //printf(">> initializer `%s' <<\n",current->initializer.data());  					  if (initializerSharpCount==0)					  {  					    unput(*yytext);  					    BEGIN(lastInitializerContext);					  }					  else					  {  					    current->initializer+=*yytext; 					  }  					}<ReadInitializer>\"			{					  if (insideIDL && insideCppQuote)  					  {					    BEGIN(EndCppQuote);					  }					  else					  {                                            lastStringContext=YY_START;  					    current->initializer+=*yytext;   					    pCopyQuotedString=&current->initializer;					    BEGIN(CopyString);					  }					}<ReadInitializer>"<<"			{  					  current->initializer+=yytext; 					}<ReadInitializer>">>"			{  					  current->initializer+=yytext;   					}<ReadInitializer>\<			{  					  initializerSharpCount++;  					  current->initializer+=*yytext;   					}<ReadInitializer>\>			{  					  initializerSharpCount--;  					  current->initializer+=*yytext;   					}<ReadInitializer>{CHARLIT}              { current->initializer+=yytext; } <ReadInitializer>\n			{  					  current->initializer+=*yytext;					  yyLineNr++;  					}<ReadInitializer>.			{   					  current->initializer+=*yytext; 					}  /* generic quoted string copy rules */<CopyString>\\.				{  					  *pCopyQuotedString+=yytext;  					}<CopyString>\"				{   					  *pCopyQuotedString+=*yytext;  					  BEGIN( lastStringContext ); 					}<CopyString>"/*"|"*/"|"//"		{  					  *pCopyQuotedString+=yytext;  					}<CopyString>\n				{  					  *pCopyQuotedString+=*yytext;  					  yyLineNr++;  					}<CopyString>.				{  					  *pCopyQuotedString+=*yytext;  					}  /* generic round bracket list copy rules */<CopyRound>\"				{					  *pCopyRoundString+=*yytext;  					  pCopyQuotedString=pCopyRoundString;					  lastStringContext=YY_START;					  BEGIN(CopyString);					}<CopyRound>"("				{  					  *pCopyRoundString+=*yytext;  					  roundCount++;  					}<CopyRound>")"				{  					  *pCopyRoundString+=*yytext;					  if (--roundCount<0)					    BEGIN(lastRoundContext);  					}<CopyRound>\n				{  					  yyLineNr++;  					  *pCopyRoundString+=*yytext;  					}<CopyRound>{CHARLIT}		        { *pCopyRoundString+=yytext; }<CopyRound>[^"'()\n]+			{  					  *pCopyRoundString+=yytext;  					}  /* generic curly bracket list copy rules */<CopyCurly>\"				{					  *pCopyCurlyString+=*yytext;  					  pCopyQuotedString=pCopyCurlyString;					  lastStringContext=YY_START;					  BEGIN(CopyString);					}<CopyCurly>"{"				{  					  *pCopyCurlyString+=*yytext;					  curlyCount++;  					}<CopyCurly>"}"				{					  *pCopyCurlyString+=*yytext;					  if (--curlyCount<0)					    BEGIN(lastCurlyContext);   					}<CopyCurly>{CHARLIT}                    { *pCopyCurlyString+=yytext; }<CopyCurly>[^"'{}\/\n]+			{  					  *pCopyCurlyString+=yytext;  					}<CopyCurly>\n				{  					  yyLineNr++;					  *pCopyCurlyString+=*yytext;  					}<FindMembers>":"			{  					  if (current->type.isEmpty()) // bit pad field					  {					    addType(current);					    current->name.sprintf("__pad%d__",padCount++);					  }  					  BEGIN(BitFields);					  current->bitfields+=":";  					}<BitFields>.				{  					  current->bitfields+=*yytext;  					}<FindMembers>[;,]			{   					  QCString oldType = current->type.copy();					  if (current->bodyLine==-1)					  {					    current->bodyLine = yyLineNr;					  }					  current->type=current->type.simplifyWhiteSpace();					  current->args=current->args.simplifyWhiteSpace();					  current->name=current->name.stripWhiteSpace();					  //if (!current->name.isEmpty() && current->type.left(8)=="typedef ")					  //{					  //  // add typedef to dictionary					  //  QCString dest = extractName(current->type.right(current->type.length()-8));					  //  if (Doxygen::typedefDict[current->name]==0 && !dest.isEmpty())					  //  {							  //    //printf("1>>>>>>>>>> adding %s->%s\n",current->name.data(),dest.data());					  //    QCString scope;					  //    if (current_root->section & Entry::SCOPE_MASK) scope=current_root->name;                                          //    Doxygen::typedefDict.insert(current->name, new TypedefInfo(dest,scope));					  //  }					  //}					  current->section = Entry::VARIABLE_SEC ;					  current->fileName = yyFileName;					  current->startLine = yyLineNr;					  //printf("New variable type=`%s' name=`%s' groupId=%d\n",current->type.data(),current->name.data(),current->mGrpId);					  current_root->addSubEntry( current ) ;					  if ( *yytext == ',')					  {					    current = new Entry(*current);					    current->name.resize(0);					    current->args.resize(0);					    current->initializer.resize(0);					    current->bitfields.resize(0);					    int i=oldType.length(); 					    while (i>0 && (oldType[i-1]=='*' || oldType[i-1]=='&' || oldType[i-1]==' ')) i--;					    current->type = oldType.left(i);					  }					  else					  {					    current = new Entry ;					    initEntry();					  }					  BEGIN( FindMembers ) ;					}<FindMembers>"["			{ 					  if (current->name.isEmpty() || current->name=="typedef") // IDL function property					  {					    squareCount=1;					    lastSquareContext = YY_START;					    BEGIN(SkipSquare);					  }					  else					  {  					    current->args += yytext ;					    squareCount=1;					    BEGIN( Array ) ;					  }					}<Array>"]"				{ current->args += *yytext ;					  if (--squareCount<=0)	                                     BEGIN( FindMembers ) ;					}<Array>"["				{ current->args += *yytext ;					  squareCount++;						}<Array>.				{ current->args += *yytext ; }<SkipSquare>"["				{ squareCount++; }<SkipSquare>"]"				{  					  if (--squareCount<=0)					    BEGIN( lastSquareContext );  					}<SkipSquare>\"				{  					  lastStringContext=YY_START;  				          BEGIN( SkipString ); 					}<SkipSquare>[^\n\[\]\"]+<FindMembers>"<"			{ addType( current ) ;					  current->type += yytext ;					  BEGIN( Sharp ) ;					}<Sharp>">"				{ current->type += *yytext ;					  if (--sharpCount<=0)	                                     BEGIN( FindMembers ) ;					}<Sharp>"<"				{ current->type += *yytext ;					  sharpCount++;						}<Sharp>{BN}+				{  					  lineCount();					}<Sharp>.				{ current->type += *yytext ; }<FindFields>{ID}			{  					  current->name = yytext;					}<FindFields>"="				{  					  lastInitializerContext = YY_START;					  initializerSharpCount=0;  					  BEGIN(ReadInitializer);  					}<FindFields>","				{					  //printf("adding `%s' `%s' `%s' to enum `%s' (mGrpId=%d)\n",					  //     current->type.data(), current->name.data(),					  //     current->args.data(), current_root->name.data(),current->mGrpId);  					  if (!current->name.isEmpty())					  {					    current->fileName   = yyFileName;					    current->startLine  = yyLineNr;					    current->type       = "@"; // enum marker  					    current->args       = current->args.simplifyWhiteSpace();  					    current->name       = current->name.stripWhiteSpace();					    current->section    = Entry::VARIABLE_SEC;					    // add to the scope of the enum					    current_root->addSubEntry(current);					    current             = new Entry(*current);					    // add to the scope surrounding the enum (copy!)					    current_root->parent->addSubEntry(current);					    current             = new Entry ;					    initEntry();					  }					  else // probably a redundant , 					  {				     	    current->reset();					  }  					}  /*<FindFieldArg>","			{ unput(*yytext); BEGIN(FindFields); }  */<ReadBody>[^\r\n{}"'/]*			{ current->program += yytext ; }<ReadBody>"//".*			{ current->program += yytext ; }<ReadBody>\"				{ current->program += yytext ;                                           pCopyQuotedString = &current->program;                                          lastStringContext=YY_START;                                          BEGIN( CopyString );					}<ReadBody>"/*"{B}*			{ current->program += yytext ;					  lastContext = ReadBody ;					  BEGIN( Comment ) ;					}<ReadBody>"/*"{BL}				{ current->program += yytext ;					  ++yyLineNr ;					  lastContext = ReadBody ;					  BEGIN( Comment ) ;					}<ReadBody>{CHARLIT}                     { current->program += yytext; }<ReadBody>"{"				{ current->program += yytext ;					  ++curlyCount ;					}<ReadBody>"}"				{ //err("ReadBody count=%d\n",curlyCount);  					  if ( curlyCount>0 )					  {					    current->program += yytext ;					    --curlyCount ;					  }					  else					  {					    current->endBodyLine = yyLineNr;					    QCString &cn = current->name;					    QCString rn = current_root->name.copy();					    //printf("cn=`%s' rn=`%s'\n",cn.data(),rn.data());					    if (!cn.isEmpty() && !rn.isEmpty())					    {					      prependScope();					      //cn.prepend(rn+"::");					    }					    if (isTypedef && cn.isEmpty())					    {					      //printf("Typedef Name\n");					      BEGIN( TypedefName );					    }					    else					    {					      if (current->section == Entry::ENUM_SEC)					      {					        current->program+=','; // add field terminator					      }					      // add compound definition to the tree  					      current->args = current->args.simplifyWhiteSpace();  					      current->type = current->type.simplifyWhiteSpace();  					      current->name = current->name.stripWhiteSpace();					      //printf("adding `%s' `%s' `%s' brief=%s\n",current->type.data(),current->name.data(),current->args.data(),current->brief.data());					      current_root->addSubEntry( current ) ;					      current = new Entry(*current);					      if (current->section==Entry::NAMESPACE_SEC || 						  current->section==Entry::INTERFACE_SEC ||						  insideJava						 )					      { // namespaces and interfaces and java classes ends with a closing bracket without semicolon						current->reset();						initEntry();						BEGIN( FindMembers ) ;					      }					      else					      {						BEGIN( MemberSpec ) ;					      }					    }					  }					}<ReadBody>"}"{BN}+"typedef"{BN}+	{ //err("ReadBody count=%d\n",curlyCount);  					  if ( curlyCount>0 )					  {					    current->program += yytext ;					    --curlyCount ;					  }					  else					  {					    lineCount();					    isTypedef = TRUE;					    current->endBodyLine = yyLineNr;					    QCString &cn = current->name;					    QCString rn = current_root->name.copy();					    if (!cn.isEmpty() && !rn.isEmpty())					    {					      prependScope();					    }					    BEGIN( TypedefName );					  }					}<TypedefName>{ID}			{  					  if (current->section == Entry::ENUM_SEC)					  {					    current->program+=","; // add field terminator					  }  				          current->name=yytext;					  prependScope();  					  current->args = current->args.simplifyWhiteSpace();  					  current->type = current->type.simplifyWhiteSpace();					  //printf("Adding compound %s %s %s\n",current->type.data(),current->name.data(),current->args.data());					  current_root->addSubEntry( current ) ;					  current = new Entry;					  initEntry();  					  BEGIN(MemberSpecSkip);   					}<MemberSpec>([*&]*{BN}*)*{ID}("["[a-z_A-Z0-9]*"]")* { // the [] part could be improved.  					  lineCount();  					  int i=0,l=yyleng,j;					  while (i<l && (!isId(yytext[i]))) i++;					  msName = yytext; 					  msName = msName.right(msName.length()-i);					  j=msName.find("[");					  if (j!=-1) 					  {					    msArgs=msName.right(msName.length()-j);					    msName=msName.left(j);					  }					  msType = yytext; msType=msType.left(i);					}<MemberSpec>[,;]			{  					  if (msName.isEmpty() && !current->name.isEmpty())					   /* && (current->section & Entry::COMPOUND_MASK)) */					  { 					    // see if the compound does not have a name or is inside another					    // annonymous compound. If so we insert a 					    // special `annonymous' variable.					    Entry *p=current_root;					    while (p)					    {					      // only look for class scopes, not namespace scopes					      if ((p->section & Entry::COMPOUND_MASK) && !p->name.isEmpty())					      {						//printf("Trying scope `%s'\n",p->name.data());						int i=p->name.findRev("::");						int pi = (i==-1) ? 0 : i+2;						if (p->name.at(pi)=='@')						{

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -