00001 /****************************************************************************** 00002 * 00003 * $Id: $ 00004 * 00005 * 00006 * Copyright (C) 1997-2008 by Dimitri van Heesch. 00007 * 00008 * Permission to use, copy, modify, and distribute this software and its 00009 * documentation under the terms of the GNU General Public License is hereby 00010 * granted. No representations are made about the suitability of this software 00011 * for any purpose. It is provided "as is" without express or implied warranty. 00012 * See the GNU General Public License for more details. 00013 * 00014 * Documents produced by Doxygen are derivative works derived from the 00015 * input used in their production; they are not affected by this license. 00016 * 00017 */ 00018 00019 #ifndef _DOCTOKENIZER_H 00020 #define _DOCTOKENIZER_H 00021 00022 #include <qstring.h> 00023 #include <qlist.h> 00024 #include "htmlattrib.h" 00025 00026 class Definition; 00027 class MemberGroup; 00028 00029 enum Tokens 00030 { 00031 TK_WORD = 1, 00032 TK_LNKWORD = 2, 00033 TK_WHITESPACE = 3, 00034 TK_LISTITEM = 4, 00035 TK_ENDLIST = 5, 00036 TK_COMMAND = 6, 00037 TK_HTMLTAG = 7, 00038 TK_SYMBOL = 8, 00039 TK_NEWPARA = 9, 00040 TK_RCSTAG = 10, 00041 TK_URL = 11, 00042 00043 RetVal_OK = 0x10000, 00044 RetVal_SimpleSec = 0x10001, 00045 RetVal_ListItem = 0x10002, 00046 RetVal_Section = 0x10003, 00047 RetVal_Subsection = 0x10004, 00048 RetVal_Subsubsection = 0x10005, 00049 RetVal_Paragraph = 0x10006, 00050 RetVal_EndList = 0x10007, 00051 RetVal_EndPre = 0x10008, 00052 RetVal_DescData = 0x10009, 00053 RetVal_DescTitle = 0x1000A, 00054 RetVal_EndDesc = 0x1000B, 00055 RetVal_TableRow = 0x1000C, 00056 RetVal_TableCell = 0x1000D, 00057 RetVal_TableHCell = 0x1000E, 00058 RetVal_EndTable = 0x1000F, 00059 RetVal_Internal = 0x10010, 00060 RetVal_SwitchLang = 0x10011, 00061 RetVal_CloseXml = 0x10012 00062 }; 00063 00064 struct TokenInfo 00065 { 00066 // unknown token 00067 char unknownChar; 00068 00069 // command token 00070 QString name; 00071 00072 // command text (RCS tag) 00073 QString text; 00074 00075 // comment blocks 00076 00077 // list token info 00078 bool isEnumList; 00079 int indent; 00080 00081 // sections 00082 QString sectionId; 00083 00084 // simple section 00085 QString simpleSectName; 00086 QString simpleSectText; 00087 00088 // verbatim fragment 00089 QString verb; 00090 00091 // xrefitem 00092 int id; 00093 00094 // html tag 00095 HtmlAttribList attribs; 00096 bool endTag; 00097 bool emptyTag; 00098 00099 // whitespace 00100 QString chars; 00101 00102 // url 00103 bool isEMailAddr; 00104 00105 // param attributes 00106 enum ParamDir { In=1, Out=2, InOut=3, Unspecified=0 }; 00107 ParamDir paramDir; 00108 }; 00109 00110 // globals 00111 extern TokenInfo *g_token; 00112 extern int doctokenizerYYlineno; 00113 extern FILE *doctokenizerYYin; 00114 00115 // helper functions 00116 const char *tokToString(int token); 00117 00118 // operations on the scanner 00119 void doctokenizerYYFindSections(const char *input,Definition *d, 00120 MemberGroup *mg,const char *fileName); 00121 void doctokenizerYYinit(const char *input,const char *fileName); 00122 void doctokenizerYYcleanup(); 00123 void doctokenizerYYpushContext(); 00124 bool doctokenizerYYpopContext(); 00125 int doctokenizerYYlex(); 00126 void doctokenizerYYsetStatePara(); 00127 void doctokenizerYYsetStateTitle(); 00128 void doctokenizerYYsetStateTitleAttrValue(); 00129 void doctokenizerYYsetStateCode(); 00130 void doctokenizerYYsetStateXmlCode(); 00131 void doctokenizerYYsetStateHtmlOnly(); 00132 void doctokenizerYYsetStateManOnly(); 00133 void doctokenizerYYsetStateLatexOnly(); 00134 void doctokenizerYYsetStateXmlOnly(); 00135 void doctokenizerYYsetStateVerbatim(); 00136 void doctokenizerYYsetStateDot(); 00137 void doctokenizerYYsetStateMsc(); 00138 void doctokenizerYYsetStateParam(); 00139 void doctokenizerYYsetStateXRefItem(); 00140 void doctokenizerYYsetStateFile(); 00141 void doctokenizerYYsetStatePattern(); 00142 void doctokenizerYYsetStateLink(); 00143 void doctokenizerYYsetStateRef(); 00144 void doctokenizerYYsetStateInternalRef(); 00145 void doctokenizerYYsetStateText(); 00146 void doctokenizerYYsetStateSkipTitle(); 00147 void doctokenizerYYsetInsidePre(bool b); 00148 void doctokenizerYYpushBackHtmlTag(const char *tag); 00149 00150 #endif