1 //===----------------------------------------------------------------------===//
2 // Define command classes.
3 //===----------------------------------------------------------------------===//
5 class Command<string name> {
7 string EndCommandName = "";
11 bit IsInlineCommand = 0;
13 bit IsBlockCommand = 0;
14 bit IsBriefCommand = 0;
15 bit IsReturnsCommand = 0;
16 bit IsParamCommand = 0;
17 bit IsTParamCommand = 0;
18 bit IsThrowsCommand = 0;
19 bit IsDeprecatedCommand = 0;
20 bit IsHeaderfileCommand = 0;
22 bit IsEmptyParagraphAllowed = 0;
24 bit IsVerbatimBlockCommand = 0;
25 bit IsVerbatimBlockEndCommand = 0;
26 bit IsVerbatimLineCommand = 0;
27 bit IsDeclarationCommand = 0;
28 bit IsFunctionDeclarationCommand = 0;
29 bit IsRecordLikeDetailCommand = 0;
30 bit IsRecordLikeDeclarationCommand = 0;
33 class InlineCommand<string name> : Command<name> {
34 let IsInlineCommand = 1;
37 class BlockCommand<string name> : Command<name> {
38 let IsBlockCommand = 1;
41 class RecordLikeDetailCommand<string name> : BlockCommand<name> {
42 let IsRecordLikeDetailCommand = 1;
45 class VerbatimBlockCommand<string name> : Command<name> {
46 let EndCommandName = name;
47 let IsVerbatimBlockCommand = 1;
50 multiclass VerbatimBlockCommand<string name, string endCommandName> {
51 def Begin : Command<name> {
52 let EndCommandName = endCommandName;
53 let IsVerbatimBlockCommand = 1;
56 def End : Command<endCommandName> {
57 let IsVerbatimBlockEndCommand = 1;
61 class VerbatimLineCommand<string name> : Command<name> {
62 let IsVerbatimLineCommand = 1;
65 class DeclarationVerbatimLineCommand<string name> :
66 VerbatimLineCommand<name> {
67 let IsDeclarationCommand = 1;
70 class FunctionDeclarationVerbatimLineCommand<string name> :
71 DeclarationVerbatimLineCommand<name> {
72 let IsFunctionDeclarationCommand = 1;
75 class RecordLikeDeclarationVerbatimLineCommand<string name> :
76 DeclarationVerbatimLineCommand<name> {
77 let IsRecordLikeDeclarationCommand = 1;
80 //===----------------------------------------------------------------------===//
82 //===----------------------------------------------------------------------===//
84 def B : InlineCommand<"b">;
85 def C : InlineCommand<"c">;
86 def P : InlineCommand<"p">;
87 def A : InlineCommand<"a">;
88 def E : InlineCommand<"e">;
89 def Em : InlineCommand<"em">;
90 def Ref : InlineCommand<"ref">;
91 def Anchor : InlineCommand<"anchor">;
93 //===----------------------------------------------------------------------===//
95 //===----------------------------------------------------------------------===//
97 def Brief : BlockCommand<"brief"> { let IsBriefCommand = 1; }
98 def Short : BlockCommand<"short"> { let IsBriefCommand = 1; }
100 // Opposite of \brief, it is the default in our implementation.
101 def Details : BlockCommand<"details">;
103 def Returns : BlockCommand<"returns"> { let IsReturnsCommand = 1; }
104 def Return : BlockCommand<"return"> { let IsReturnsCommand = 1; }
105 def Result : BlockCommand<"result"> { let IsReturnsCommand = 1; }
107 def Param : BlockCommand<"param"> { let IsParamCommand = 1; }
109 // Doxygen command for template parameter documentation.
110 def Tparam : BlockCommand<"tparam"> { let IsTParamCommand = 1; }
112 // HeaderDoc command for template parameter documentation.
113 def Templatefield : BlockCommand<"templatefield"> { let IsTParamCommand = 1; }
115 def Throws : BlockCommand<"throws"> { let IsThrowsCommand = 1; }
116 def Throw : BlockCommand<"throw"> { let IsThrowsCommand = 1; }
117 def Exception : BlockCommand<"exception"> { let IsThrowsCommand = 1; }
119 def Deprecated : BlockCommand<"deprecated"> {
120 let IsEmptyParagraphAllowed = 1;
121 let IsDeprecatedCommand = 1;
124 def Headerfile : BlockCommand<"headerfile"> { let IsHeaderfileCommand = 1; }
126 // We don't do any additional semantic analysis for the following
127 // BlockCommands. It might be a good idea to do something extra for them, but
128 // for now we model them as plain BlockCommands.
129 def Arg : BlockCommand<"arg">;
130 def Attention : BlockCommand<"attention">;
131 def Author : BlockCommand<"author">;
132 def Authors : BlockCommand<"authors">;
133 def Bug : BlockCommand<"bug">;
134 def Copyright : BlockCommand<"copyright">;
135 def Date : BlockCommand<"date">;
136 def Invariant : BlockCommand<"invariant">;
137 def Li : BlockCommand<"li">;
138 def Note : BlockCommand<"note">;
139 def Par : BlockCommand<"par">;
140 def Post : BlockCommand<"post">;
141 def Pre : BlockCommand<"pre">;
142 def Remark : BlockCommand<"remark">;
143 def Remarks : BlockCommand<"remarks">;
144 def Retval : BlockCommand<"retval">;
145 def Sa : BlockCommand<"sa">;
146 def See : BlockCommand<"see">;
147 def Since : BlockCommand<"since">;
148 def Todo : BlockCommand<"todo">;
149 def Version : BlockCommand<"version">;
150 def Warning : BlockCommand<"warning">;
151 // HeaderDoc commands
152 def Abstract : BlockCommand<"abstract"> { let IsBriefCommand = 1; }
153 def ClassDesign : RecordLikeDetailCommand<"classdesign">;
154 def CoClass : RecordLikeDetailCommand<"coclass">;
155 def Dependency : RecordLikeDetailCommand<"dependency">;
156 def Discussion : BlockCommand<"discussion">;
157 def Helper : RecordLikeDetailCommand<"helper">;
158 def HelperClass : RecordLikeDetailCommand<"helperclass">;
159 def Helps : RecordLikeDetailCommand<"helps">;
160 def InstanceSize : RecordLikeDetailCommand<"instancesize">;
161 def Ownership : RecordLikeDetailCommand<"ownership">;
162 def Performance : RecordLikeDetailCommand<"performance">;
163 def Security : RecordLikeDetailCommand<"security">;
164 def SeeAlso : BlockCommand<"seealso">;
165 def SuperClass : RecordLikeDetailCommand<"superclass">;
167 //===----------------------------------------------------------------------===//
168 // VerbatimBlockCommand
169 //===----------------------------------------------------------------------===//
171 defm Code : VerbatimBlockCommand<"code", "endcode">;
172 defm Verbatim : VerbatimBlockCommand<"verbatim", "endverbatim">;
173 defm Htmlonly : VerbatimBlockCommand<"htmlonly", "endhtmlonly">;
174 defm Latexonly : VerbatimBlockCommand<"latexonly", "endlatexonly">;
175 defm Xmlonly : VerbatimBlockCommand<"xmlonly", "endxmlonly">;
176 defm Manonly : VerbatimBlockCommand<"manonly", "endmanonly">;
177 defm Rtfonly : VerbatimBlockCommand<"rtfonly", "endrtfonly">;
179 defm Dot : VerbatimBlockCommand<"dot", "enddot">;
180 defm Msc : VerbatimBlockCommand<"msc", "endmsc">;
182 // These three commands have special support in CommentLexer to recognize their
184 def FDollar : VerbatimBlockCommand<"f$">; // Inline LaTeX formula
185 defm FBracket : VerbatimBlockCommand<"f[", "f]">; // Displayed LaTeX formula
186 defm FBrace : VerbatimBlockCommand<"f{", "f}">; // LaTeX environment
188 // HeaderDoc commands
189 defm Textblock : VerbatimBlockCommand<"textblock", "/textblock">;
190 defm Link : VerbatimBlockCommand<"link", "/link">;
192 //===----------------------------------------------------------------------===//
193 // VerbatimLineCommand
194 //===----------------------------------------------------------------------===//
196 def Defgroup : VerbatimLineCommand<"defgroup">;
197 def Ingroup : VerbatimLineCommand<"ingroup">;
198 def Addtogroup : VerbatimLineCommand<"addtogroup">;
199 def Weakgroup : VerbatimLineCommand<"weakgroup">;
200 def Name : VerbatimLineCommand<"name">;
202 def Section : VerbatimLineCommand<"section">;
203 def Subsection : VerbatimLineCommand<"subsection">;
204 def Subsubsection : VerbatimLineCommand<"subsubsection">;
205 def Paragraph : VerbatimLineCommand<"paragraph">;
207 def Mainpage : VerbatimLineCommand<"mainpage">;
208 def Subpage : VerbatimLineCommand<"subpage">;
210 def Relates : VerbatimLineCommand<"relates">;
211 def Related : VerbatimLineCommand<"related">;
212 def RelatesAlso : VerbatimLineCommand<"relatesalso">;
213 def RelatedAlso : VerbatimLineCommand<"relatedalso">;
215 //===----------------------------------------------------------------------===//
216 // DeclarationVerbatimLineCommand
217 //===----------------------------------------------------------------------===//
220 def Def : DeclarationVerbatimLineCommand<"def">;
221 def Fn : DeclarationVerbatimLineCommand<"fn">;
222 def Namespace : DeclarationVerbatimLineCommand<"namespace">;
223 def Overload : DeclarationVerbatimLineCommand<"overload">;
224 def Property : DeclarationVerbatimLineCommand<"property">;
225 def Typedef : DeclarationVerbatimLineCommand<"typedef">;
226 def Var : DeclarationVerbatimLineCommand<"var">;
228 // HeaderDoc commands.
229 def Class : RecordLikeDeclarationVerbatimLineCommand<"class">;
230 def Interface : RecordLikeDeclarationVerbatimLineCommand<"interface">;
231 def Protocol : RecordLikeDeclarationVerbatimLineCommand<"protocol">;
232 def Struct : RecordLikeDeclarationVerbatimLineCommand<"struct">;
233 def Union : RecordLikeDeclarationVerbatimLineCommand<"union">;
234 def Category : DeclarationVerbatimLineCommand<"category">;
235 def Template : DeclarationVerbatimLineCommand<"template">;
236 def Function : FunctionDeclarationVerbatimLineCommand<"function">;
237 def FunctionGroup : FunctionDeclarationVerbatimLineCommand<"functiongroup">;
238 def Method : FunctionDeclarationVerbatimLineCommand<"method">;
239 def MethodGroup : FunctionDeclarationVerbatimLineCommand<"methodgroup">;
240 def Callback : FunctionDeclarationVerbatimLineCommand<"callback">;
241 def Const : DeclarationVerbatimLineCommand<"const">;
242 def Constant : DeclarationVerbatimLineCommand<"constant">;
243 def Enum : DeclarationVerbatimLineCommand<"enum">;