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 Anchor : InlineCommand<"anchor">;
92 //===----------------------------------------------------------------------===//
94 //===----------------------------------------------------------------------===//
96 def Brief : BlockCommand<"brief"> { let IsBriefCommand = 1; }
97 def Short : BlockCommand<"short"> { let IsBriefCommand = 1; }
99 // Opposite of \brief, it is the default in our implementation.
100 def Details : BlockCommand<"details">;
102 def Returns : BlockCommand<"returns"> { let IsReturnsCommand = 1; }
103 def Return : BlockCommand<"return"> { let IsReturnsCommand = 1; }
104 def Result : BlockCommand<"result"> { let IsReturnsCommand = 1; }
106 def Param : BlockCommand<"param"> { let IsParamCommand = 1; }
108 // Doxygen command for template parameter documentation.
109 def Tparam : BlockCommand<"tparam"> { let IsTParamCommand = 1; }
111 // HeaderDoc command for template parameter documentation.
112 def Templatefield : BlockCommand<"templatefield"> { let IsTParamCommand = 1; }
114 def Throws : BlockCommand<"throws"> { let IsThrowsCommand = 1; }
115 def Throw : BlockCommand<"throw"> { let IsThrowsCommand = 1; }
116 def Exception : BlockCommand<"exception"> { let IsThrowsCommand = 1; }
118 def Deprecated : BlockCommand<"deprecated"> {
119 let IsEmptyParagraphAllowed = 1;
120 let IsDeprecatedCommand = 1;
123 def Headerfile : BlockCommand<"headerfile"> { let IsHeaderfileCommand = 1; }
125 // We don't do any additional semantic analysis for the following
126 // BlockCommands. It might be a good idea to do something extra for them, but
127 // for now we model them as plain BlockCommands.
128 def Arg : BlockCommand<"arg">;
129 def Attention : BlockCommand<"attention">;
130 def Author : BlockCommand<"author">;
131 def Authors : BlockCommand<"authors">;
132 def Bug : BlockCommand<"bug">;
133 def Copyright : BlockCommand<"copyright">;
134 def Date : BlockCommand<"date">;
135 def Invariant : BlockCommand<"invariant">;
136 def Li : BlockCommand<"li">;
137 def Note : BlockCommand<"note">;
138 def Par : BlockCommand<"par">;
139 def Post : BlockCommand<"post">;
140 def Pre : BlockCommand<"pre">;
141 def Remark : BlockCommand<"remark">;
142 def Remarks : BlockCommand<"remarks">;
143 def Retval : BlockCommand<"retval">;
144 def Sa : BlockCommand<"sa">;
145 def See : BlockCommand<"see">;
146 def Since : BlockCommand<"since">;
147 def Todo : BlockCommand<"todo">;
148 def Version : BlockCommand<"version">;
149 def Warning : BlockCommand<"warning">;
150 // HeaderDoc commands
151 def Abstract : BlockCommand<"abstract"> { let IsBriefCommand = 1; }
152 def ClassDesign : RecordLikeDetailCommand<"classdesign">;
153 def CoClass : RecordLikeDetailCommand<"coclass">;
154 def Dependency : RecordLikeDetailCommand<"dependency">;
155 def Discussion : BlockCommand<"discussion">;
156 def Helper : RecordLikeDetailCommand<"helper">;
157 def HelperClass : RecordLikeDetailCommand<"helperclass">;
158 def Helps : RecordLikeDetailCommand<"helps">;
159 def InstanceSize : RecordLikeDetailCommand<"instancesize">;
160 def Ownership : RecordLikeDetailCommand<"ownership">;
161 def Performance : RecordLikeDetailCommand<"performance">;
162 def Security : RecordLikeDetailCommand<"security">;
163 def SeeAlso : BlockCommand<"seealso">;
164 def SuperClass : RecordLikeDetailCommand<"superclass">;
166 //===----------------------------------------------------------------------===//
167 // VerbatimBlockCommand
168 //===----------------------------------------------------------------------===//
170 defm Code : VerbatimBlockCommand<"code", "endcode">;
171 defm Verbatim : VerbatimBlockCommand<"verbatim", "endverbatim">;
172 defm Htmlonly : VerbatimBlockCommand<"htmlonly", "endhtmlonly">;
173 defm Latexonly : VerbatimBlockCommand<"latexonly", "endlatexonly">;
174 defm Xmlonly : VerbatimBlockCommand<"xmlonly", "endxmlonly">;
175 defm Manonly : VerbatimBlockCommand<"manonly", "endmanonly">;
176 defm Rtfonly : VerbatimBlockCommand<"rtfonly", "endrtfonly">;
178 defm Dot : VerbatimBlockCommand<"dot", "enddot">;
179 defm Msc : VerbatimBlockCommand<"msc", "endmsc">;
181 // These three commands have special support in CommentLexer to recognize their
183 def FDollar : VerbatimBlockCommand<"f$">; // Inline LaTeX formula
184 defm FBracket : VerbatimBlockCommand<"f[", "f]">; // Displayed LaTeX formula
185 defm FBrace : VerbatimBlockCommand<"f{", "f}">; // LaTeX environment
187 // HeaderDoc commands
188 defm Textblock : VerbatimBlockCommand<"textblock", "/textblock">;
189 defm Link : VerbatimBlockCommand<"link", "/link">;
191 //===----------------------------------------------------------------------===//
192 // VerbatimLineCommand
193 //===----------------------------------------------------------------------===//
195 def Defgroup : VerbatimLineCommand<"defgroup">;
196 def Ingroup : VerbatimLineCommand<"ingroup">;
197 def Addtogroup : VerbatimLineCommand<"addtogroup">;
198 def Weakgroup : VerbatimLineCommand<"weakgroup">;
199 def Name : VerbatimLineCommand<"name">;
201 def Section : VerbatimLineCommand<"section">;
202 def Subsection : VerbatimLineCommand<"subsection">;
203 def Subsubsection : VerbatimLineCommand<"subsubsection">;
204 def Paragraph : VerbatimLineCommand<"paragraph">;
206 def Mainpage : VerbatimLineCommand<"mainpage">;
207 def Subpage : VerbatimLineCommand<"subpage">;
208 def Ref : VerbatimLineCommand<"ref">;
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">;