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">;
91 //===----------------------------------------------------------------------===//
93 //===----------------------------------------------------------------------===//
95 def Brief : BlockCommand<"brief"> { let IsBriefCommand = 1; }
96 def Short : BlockCommand<"short"> { let IsBriefCommand = 1; }
98 // Opposite of \brief, it is the default in our implementation.
99 def Details : BlockCommand<"details">;
101 def Returns : BlockCommand<"returns"> { let IsReturnsCommand = 1; }
102 def Return : BlockCommand<"return"> { let IsReturnsCommand = 1; }
103 def Result : BlockCommand<"result"> { let IsReturnsCommand = 1; }
105 def Param : BlockCommand<"param"> { let IsParamCommand = 1; }
107 // Doxygen command for template parameter documentation.
108 def Tparam : BlockCommand<"tparam"> { let IsTParamCommand = 1; }
110 // HeaderDoc command for template parameter documentation.
111 def Templatefield : BlockCommand<"templatefield"> { let IsTParamCommand = 1; }
113 def Throws : BlockCommand<"throws"> { let IsThrowsCommand = 1; }
114 def Throw : BlockCommand<"throw"> { let IsThrowsCommand = 1; }
115 def Exception : BlockCommand<"exception"> { let IsThrowsCommand = 1; }
117 def Deprecated : BlockCommand<"deprecated"> {
118 let IsEmptyParagraphAllowed = 1;
119 let IsDeprecatedCommand = 1;
122 def Headerfile : BlockCommand<"headerfile"> { let IsHeaderfileCommand = 1; }
124 // We don't do any additional semantic analysis for the following
125 // BlockCommands. It might be a good idea to do something extra for them, but
126 // for now we model them as plain BlockCommands.
127 def Arg : BlockCommand<"arg">;
128 def Attention : BlockCommand<"attention">;
129 def Author : BlockCommand<"author">;
130 def Authors : BlockCommand<"authors">;
131 def Bug : BlockCommand<"bug">;
132 def Copyright : BlockCommand<"copyright">;
133 def Date : BlockCommand<"date">;
134 def Invariant : BlockCommand<"invariant">;
135 def Li : BlockCommand<"li">;
136 def Note : BlockCommand<"note">;
137 def Par : BlockCommand<"par">;
138 def Post : BlockCommand<"post">;
139 def Pre : BlockCommand<"pre">;
140 def Remark : BlockCommand<"remark">;
141 def Remarks : BlockCommand<"remarks">;
142 def Sa : BlockCommand<"sa">;
143 def See : BlockCommand<"see">;
144 def Since : BlockCommand<"since">;
145 def Todo : BlockCommand<"todo">;
146 def Version : BlockCommand<"version">;
147 def Warning : BlockCommand<"warning">;
148 // HeaderDoc commands
149 def Abstract : BlockCommand<"abstract">;
150 def ClassDesign : RecordLikeDetailCommand<"classdesign">;
151 def CoClass : RecordLikeDetailCommand<"coclass">;
152 def Dependency : RecordLikeDetailCommand<"dependency">;
153 def Discussion : BlockCommand<"discussion">;
154 def Helper : RecordLikeDetailCommand<"helper">;
155 def HelperClass : RecordLikeDetailCommand<"helperclass">;
156 def Helps : RecordLikeDetailCommand<"helps">;
157 def InstanceSize : RecordLikeDetailCommand<"instancesize">;
158 def Ownership : RecordLikeDetailCommand<"ownership">;
159 def Performance : RecordLikeDetailCommand<"performance">;
160 def Security : RecordLikeDetailCommand<"security">;
161 def SeeAlso : BlockCommand<"seealso">;
162 def SuperClass : RecordLikeDetailCommand<"superclass">;
164 //===----------------------------------------------------------------------===//
165 // VerbatimBlockCommand
166 //===----------------------------------------------------------------------===//
168 defm Code : VerbatimBlockCommand<"code", "endcode">;
169 defm Verbatim : VerbatimBlockCommand<"verbatim", "endverbatim">;
170 defm Htmlonly : VerbatimBlockCommand<"htmlonly", "endhtmlonly">;
171 defm Latexonly : VerbatimBlockCommand<"latexonly", "endlatexonly">;
172 defm Xmlonly : VerbatimBlockCommand<"xmlonly", "endxmlonly">;
173 defm Manonly : VerbatimBlockCommand<"manonly", "endmanonly">;
174 defm Rtfonly : VerbatimBlockCommand<"rtfonly", "endrtfonly">;
176 defm Dot : VerbatimBlockCommand<"dot", "enddot">;
177 defm Msc : VerbatimBlockCommand<"msc", "endmsc">;
179 // These three commands have special support in CommentLexer to recognize their
181 def FDollar : VerbatimBlockCommand<"f$">; // Inline LaTeX formula
182 defm FBracket : VerbatimBlockCommand<"f[", "f]">; // Displayed LaTeX formula
183 defm FBrace : VerbatimBlockCommand<"f{", "f}">; // LaTeX environment
185 // HeaderDoc commands
186 defm Textblock : VerbatimBlockCommand<"textblock", "/textblock">;
187 defm Link : VerbatimBlockCommand<"link", "/link">;
189 //===----------------------------------------------------------------------===//
190 // VerbatimLineCommand
191 //===----------------------------------------------------------------------===//
193 def Defgroup : VerbatimLineCommand<"defgroup">;
194 def Ingroup : VerbatimLineCommand<"ingroup">;
195 def Addtogroup : VerbatimLineCommand<"addtogroup">;
196 def Weakgroup : VerbatimLineCommand<"weakgroup">;
197 def Name : VerbatimLineCommand<"name">;
199 def Section : VerbatimLineCommand<"section">;
200 def Subsection : VerbatimLineCommand<"subsection">;
201 def Subsubsection : VerbatimLineCommand<"subsubsection">;
202 def Paragraph : VerbatimLineCommand<"paragraph">;
204 def Mainpage : VerbatimLineCommand<"mainpage">;
205 def Subpage : VerbatimLineCommand<"subpage">;
206 def Ref : VerbatimLineCommand<"ref">;
208 def Relates : VerbatimLineCommand<"relates">;
209 def Related : VerbatimLineCommand<"related">;
210 def RelatesAlso : VerbatimLineCommand<"relatesalso">;
211 def RelatedAlso : VerbatimLineCommand<"relatedalso">;
213 //===----------------------------------------------------------------------===//
214 // DeclarationVerbatimLineCommand
215 //===----------------------------------------------------------------------===//
218 def Def : DeclarationVerbatimLineCommand<"def">;
219 def Fn : DeclarationVerbatimLineCommand<"fn">;
220 def Namespace : DeclarationVerbatimLineCommand<"namespace">;
221 def Overload : DeclarationVerbatimLineCommand<"overload">;
222 def Property : DeclarationVerbatimLineCommand<"property">;
223 def Typedef : DeclarationVerbatimLineCommand<"typedef">;
224 def Var : DeclarationVerbatimLineCommand<"var">;
226 // HeaderDoc commands.
227 def Class : RecordLikeDeclarationVerbatimLineCommand<"class">;
228 def Interface : RecordLikeDeclarationVerbatimLineCommand<"interface">;
229 def Protocol : RecordLikeDeclarationVerbatimLineCommand<"protocol">;
230 def Struct : RecordLikeDeclarationVerbatimLineCommand<"struct">;
231 def Union : RecordLikeDeclarationVerbatimLineCommand<"union">;
232 def Category : DeclarationVerbatimLineCommand<"category">;
233 def Template : DeclarationVerbatimLineCommand<"template">;
234 def Function : FunctionDeclarationVerbatimLineCommand<"function">;
235 def FunctionGroup : FunctionDeclarationVerbatimLineCommand<"functiongroup">;
236 def Method : FunctionDeclarationVerbatimLineCommand<"method">;
237 def MethodGroup : FunctionDeclarationVerbatimLineCommand<"methodgroup">;
238 def Callback : FunctionDeclarationVerbatimLineCommand<"callback">;
239 def Const : DeclarationVerbatimLineCommand<"const">;
240 def Constant : DeclarationVerbatimLineCommand<"constant">;
241 def Enum : DeclarationVerbatimLineCommand<"enum">;