Imported Upstream version 1.8.15
[platform/upstream/doxygen.git] / src / doctokenizer.h
1 /******************************************************************************
2  *
3  * $Id: $
4  *
5  *
6  * Copyright (C) 1997-2015 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_AT    = 6, //! Command starting with `@`
38   TK_HTMLTAG       = 7,
39   TK_SYMBOL        = 8,
40   TK_NEWPARA       = 9,
41   TK_RCSTAG        = 10,
42   TK_URL           = 11,
43   TK_COMMAND_BS    = 12, //! Command starting with `\`
44
45   RetVal_OK             = 0x10000,
46   RetVal_SimpleSec      = 0x10001,
47   RetVal_ListItem       = 0x10002,
48   RetVal_Section        = 0x10003,
49   RetVal_Subsection     = 0x10004,
50   RetVal_Subsubsection  = 0x10005,
51   RetVal_Paragraph      = 0x10006,
52   RetVal_SubParagraph   = 0x10007,
53   RetVal_EndList        = 0x10008,
54   RetVal_EndPre         = 0x10009,
55   RetVal_DescData       = 0x1000A,
56   RetVal_DescTitle      = 0x1000B,
57   RetVal_EndDesc        = 0x1000C,
58   RetVal_TableRow       = 0x1000D,
59   RetVal_TableCell      = 0x1000E,
60   RetVal_TableHCell     = 0x1000F,
61   RetVal_EndTable       = 0x10010,
62   RetVal_Internal       = 0x10011,
63   RetVal_SwitchLang     = 0x10012,
64   RetVal_CloseXml       = 0x10013,
65   RetVal_EndBlockQuote  = 0x10014,
66   RetVal_CopyDoc        = 0x10015,
67   RetVal_EndInternal    = 0x10016,
68   RetVal_EndParBlock    = 0x10017
69 };
70
71 /** @brief Data associated with a token used by the comment block parser. */
72 struct TokenInfo
73 {
74   // unknown token
75   char unknownChar;
76   
77   // command token
78   QCString name;
79
80   // command text (RCS tag)
81   QCString text;
82
83   // comment blocks
84   
85   // list token info
86   bool isEnumList;
87   int indent;
88
89   // sections
90   QCString sectionId;
91
92   // simple section
93   QCString simpleSectName;
94   QCString simpleSectText;
95
96   // verbatim fragment
97   QCString verb;
98
99   // xrefitem
100   int id;
101
102   // html tag
103   HtmlAttribList attribs;
104   bool endTag;
105   bool emptyTag;
106
107   // whitespace
108   QCString chars;
109
110   // url
111   bool isEMailAddr;
112
113   // param attributes
114   enum ParamDir { In=1, Out=2, InOut=3, Unspecified=0 };
115   ParamDir paramDir;
116 };
117
118 // globals
119 extern TokenInfo *g_token;
120 extern int doctokenizerYYlineno;
121 extern FILE *doctokenizerYYin;
122
123 // helper functions
124 const char *tokToString(int token);
125
126 // operations on the scanner
127 void doctokenizerYYFindSections(const char *input,Definition *d,
128                                 MemberGroup *mg,const char *fileName);
129 void doctokenizerYYinit(const char *input,const char *fileName);
130 void doctokenizerYYcleanup();
131 void doctokenizerYYpushContext();
132 bool doctokenizerYYpopContext();
133 int  doctokenizerYYlex();
134 void doctokenizerYYsetStatePara();
135 void doctokenizerYYsetStateTitle();
136 void doctokenizerYYsetStateTitleAttrValue();
137 void doctokenizerYYsetStateCode();
138 void doctokenizerYYsetStateXmlCode();
139 void doctokenizerYYsetStateHtmlOnly();
140 void doctokenizerYYsetStateManOnly();
141 void doctokenizerYYsetStateLatexOnly();
142 void doctokenizerYYsetStateXmlOnly();
143 void doctokenizerYYsetStateDbOnly();
144 void doctokenizerYYsetStateRtfOnly();
145 void doctokenizerYYsetStateVerbatim();
146 void doctokenizerYYsetStateDot();
147 void doctokenizerYYsetStateMsc();
148 void doctokenizerYYsetStateParam();
149 void doctokenizerYYsetStateXRefItem();
150 void doctokenizerYYsetStateFile();
151 void doctokenizerYYsetStatePattern();
152 void doctokenizerYYsetStateLink();
153 void doctokenizerYYsetStateCite();
154 void doctokenizerYYsetStateRef();
155 void doctokenizerYYsetStateInternalRef();
156 void doctokenizerYYsetStateText();
157 void doctokenizerYYsetStateSkipTitle();
158 void doctokenizerYYsetStateAnchor();
159 void doctokenizerYYsetInsidePre(bool b);
160 void doctokenizerYYpushBackHtmlTag(const char *tag);
161 void doctokenizerYYsetStateSnippet();
162 void doctokenizerYYstartAutoList();
163 void doctokenizerYYendAutoList();
164 void doctokenizerYYsetStatePlantUML();
165 void doctokenizerYYsetStateSetScope();
166 void doctokenizerYYsetStatePlantUMLOpt();
167 void doctokenizerYYsetStateOptions();
168 void doctokenizerYYsetStateBlock();
169 void doctokenizerYYsetStateEmoji();
170
171 #endif