Imported Upstream version 1.8.8
[platform/upstream/doxygen.git] / src / doctokenizer.h
1 /******************************************************************************
2  *
3  * $Id: $
4  *
5  *
6  * Copyright (C) 1997-2014 by Dimitri van Heesch.
7  *
8  * Permission to use, copy, modify, and distribute this software and its
9  * documentation under the terms of the GNU General Public License is hereby 
10  * granted. No representations are made about the suitability of this software 
11  * for any purpose. It is provided "as is" without express or implied warranty.
12  * See the GNU General Public License for more details.
13  *
14  * Documents produced by Doxygen are derivative works derived from the
15  * input used in their production; they are not affected by this license.
16  *
17  */
18
19 #ifndef _DOCTOKENIZER_H
20 #define _DOCTOKENIZER_H
21
22 #include <qcstring.h>
23 #include <qlist.h>
24 #include <stdio.h>
25 #include "htmlattrib.h"
26
27 class Definition;
28 class MemberGroup;
29
30 enum Tokens
31 {
32   TK_WORD          = 1,
33   TK_LNKWORD       = 2,
34   TK_WHITESPACE    = 3,
35   TK_LISTITEM      = 4,
36   TK_ENDLIST       = 5,
37   TK_COMMAND       = 6,
38   TK_HTMLTAG       = 7,
39   TK_SYMBOL        = 8,
40   TK_NEWPARA       = 9,
41   TK_RCSTAG        = 10,
42   TK_URL           = 11,
43
44   RetVal_OK             = 0x10000,
45   RetVal_SimpleSec      = 0x10001,
46   RetVal_ListItem       = 0x10002,
47   RetVal_Section        = 0x10003,
48   RetVal_Subsection     = 0x10004,
49   RetVal_Subsubsection  = 0x10005,
50   RetVal_Paragraph      = 0x10006,
51   RetVal_SubParagraph   = 0x10007,
52   RetVal_EndList        = 0x10008,
53   RetVal_EndPre         = 0x10009,
54   RetVal_DescData       = 0x1000A,
55   RetVal_DescTitle      = 0x1000B,
56   RetVal_EndDesc        = 0x1000C,
57   RetVal_TableRow       = 0x1000D,
58   RetVal_TableCell      = 0x1000E,
59   RetVal_TableHCell     = 0x1000F,
60   RetVal_EndTable       = 0x10010,
61   RetVal_Internal       = 0x10011,
62   RetVal_SwitchLang     = 0x10012,
63   RetVal_CloseXml       = 0x10013,
64   RetVal_EndBlockQuote  = 0x10014,
65   RetVal_CopyDoc        = 0x10015,
66   RetVal_EndInternal    = 0x10016,
67   RetVal_EndParBlock    = 0x10017
68 };
69
70 /** @brief Data associated with a token used by the comment block parser. */
71 struct TokenInfo
72 {
73   // unknown token
74   char unknownChar;
75   
76   // command token
77   QCString name;
78
79   // command text (RCS tag)
80   QCString text;
81
82   // comment blocks
83   
84   // list token info
85   bool isEnumList;
86   int indent;
87
88   // sections
89   QCString sectionId;
90
91   // simple section
92   QCString simpleSectName;
93   QCString simpleSectText;
94
95   // verbatim fragment
96   QCString verb;
97
98   // xrefitem
99   int id;
100
101   // html tag
102   HtmlAttribList attribs;
103   bool endTag;
104   bool emptyTag;
105
106   // whitespace
107   QCString chars;
108
109   // url
110   bool isEMailAddr;
111
112   // param attributes
113   enum ParamDir { In=1, Out=2, InOut=3, Unspecified=0 };
114   ParamDir paramDir;
115 };
116
117 // globals
118 extern TokenInfo *g_token;
119 extern int doctokenizerYYlineno;
120 extern FILE *doctokenizerYYin;
121
122 // helper functions
123 const char *tokToString(int token);
124
125 // operations on the scanner
126 void doctokenizerYYFindSections(const char *input,Definition *d,
127                                 MemberGroup *mg,const char *fileName);
128 void doctokenizerYYinit(const char *input,const char *fileName);
129 void doctokenizerYYcleanup();
130 void doctokenizerYYpushContext();
131 bool doctokenizerYYpopContext();
132 int  doctokenizerYYlex();
133 void doctokenizerYYsetStatePara();
134 void doctokenizerYYsetStateTitle();
135 void doctokenizerYYsetStateTitleAttrValue();
136 void doctokenizerYYsetStateCode();
137 void doctokenizerYYsetStateXmlCode();
138 void doctokenizerYYsetStateHtmlOnly();
139 void doctokenizerYYsetStateManOnly();
140 void doctokenizerYYsetStateLatexOnly();
141 void doctokenizerYYsetStateXmlOnly();
142 void doctokenizerYYsetStateDbOnly();
143 void doctokenizerYYsetStateRtfOnly();
144 void doctokenizerYYsetStateVerbatim();
145 void doctokenizerYYsetStateDot();
146 void doctokenizerYYsetStateMsc();
147 void doctokenizerYYsetStateParam();
148 void doctokenizerYYsetStateXRefItem();
149 void doctokenizerYYsetStateFile();
150 void doctokenizerYYsetStatePattern();
151 void doctokenizerYYsetStateLink();
152 void doctokenizerYYsetStateCite();
153 void doctokenizerYYsetStateRef();
154 void doctokenizerYYsetStateInternalRef();
155 void doctokenizerYYsetStateText();
156 void doctokenizerYYsetStateSkipTitle();
157 void doctokenizerYYsetStateAnchor();
158 void doctokenizerYYsetInsidePre(bool b);
159 void doctokenizerYYpushBackHtmlTag(const char *tag);
160 void doctokenizerYYsetStateSnippet();
161 void doctokenizerYYstartAutoList();
162 void doctokenizerYYendAutoList();
163 void doctokenizerYYsetStatePlantUML();
164
165 #endif