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 IsDeprecatedCommand = 0;
19 bit IsHeaderfileCommand = 0;
21 bit IsEmptyParagraphAllowed = 0;
23 bit IsVerbatimBlockCommand = 0;
24 bit IsVerbatimBlockEndCommand = 0;
25 bit IsVerbatimLineCommand = 0;
26 bit IsDeclarationCommand = 0;
27 bit IsFunctionDeclarationCommand = 0;
28 bit IsRecordLikeDetailCommand = 0;
29 bit IsRecordLikeDeclarationCommand = 0;
32 class InlineCommand<string name> : Command<name> {
33 let IsInlineCommand = 1;
36 class BlockCommand<string name> : Command<name> {
37 let IsBlockCommand = 1;
40 class RecordLikeDetailCommand<string name> : BlockCommand<name> {
41 let IsRecordLikeDetailCommand = 1;
44 class VerbatimBlockCommand<string name> : Command<name> {
45 let EndCommandName = name;
46 let IsVerbatimBlockCommand = 1;
49 multiclass VerbatimBlockCommand<string name, string endCommandName> {
50 def Begin : Command<name> {
51 let EndCommandName = endCommandName;
52 let IsVerbatimBlockCommand = 1;
55 def End : Command<endCommandName> {
56 let IsVerbatimBlockEndCommand = 1;
60 class VerbatimLineCommand<string name> : Command<name> {
61 let IsVerbatimLineCommand = 1;
64 class DeclarationVerbatimLineCommand<string name> :
65 VerbatimLineCommand<name> {
66 let IsDeclarationCommand = 1;
69 class FunctionDeclarationVerbatimLineCommand<string name> :
70 DeclarationVerbatimLineCommand<name> {
71 let IsFunctionDeclarationCommand = 1;
74 class RecordLikeDeclarationVerbatimLineCommand<string name> :
75 DeclarationVerbatimLineCommand<name> {
76 let IsRecordLikeDeclarationCommand = 1;
79 //===----------------------------------------------------------------------===//
81 //===----------------------------------------------------------------------===//
83 def B : InlineCommand<"b">;
84 def C : InlineCommand<"c">;
85 def P : InlineCommand<"p">;
86 def A : InlineCommand<"a">;
87 def E : InlineCommand<"e">;
88 def Em : InlineCommand<"em">;
90 //===----------------------------------------------------------------------===//
92 //===----------------------------------------------------------------------===//
94 def Brief : BlockCommand<"brief"> { let IsBriefCommand = 1; }
95 def Short : BlockCommand<"short"> { let IsBriefCommand = 1; }
97 // Opposite of \brief, it is the default in our implementation.
98 def Details : BlockCommand<"details">;
100 def Returns : BlockCommand<"returns"> { let IsReturnsCommand = 1; }
101 def Return : BlockCommand<"return"> { let IsReturnsCommand = 1; }
102 def Result : BlockCommand<"result"> { let IsReturnsCommand = 1; }
104 def Param : BlockCommand<"param"> { let IsParamCommand = 1; }
106 // Doxygen command for template parameter documentation.
107 def Tparam : BlockCommand<"tparam"> { let IsTParamCommand = 1; }
109 // HeaderDoc command for template parameter documentation.
110 def Templatefield : BlockCommand<"templatefield"> { let IsTParamCommand = 1; }
112 def Deprecated : BlockCommand<"deprecated"> {
113 let IsEmptyParagraphAllowed = 1;
114 let IsDeprecatedCommand = 1;
117 def Headerfile : BlockCommand<"headerfile"> { let IsHeaderfileCommand = 1; }
119 // We don't do any additional semantic analysis for the following
120 // BlockCommands. It might be a good idea to do something extra for them, but
121 // for now we model them as plain BlockCommands.
122 def Arg : BlockCommand<"arg">;
123 def Attention : BlockCommand<"attention">;
124 def Author : BlockCommand<"author">;
125 def Authors : BlockCommand<"authors">;
126 def Bug : BlockCommand<"bug">;
127 def Copyright : BlockCommand<"copyright">;
128 def Date : BlockCommand<"date">;
129 def Invariant : BlockCommand<"invariant">;
130 def Li : BlockCommand<"li">;
131 def Note : BlockCommand<"note">;
132 def Par : BlockCommand<"par">;
133 def Post : BlockCommand<"post">;
134 def Pre : BlockCommand<"pre">;
135 def Remark : BlockCommand<"remark">;
136 def Remarks : BlockCommand<"remarks">;
137 def Sa : BlockCommand<"sa">;
138 def See : BlockCommand<"see">;
139 def Since : BlockCommand<"since">;
140 def Todo : BlockCommand<"todo">;
141 def Version : BlockCommand<"version">;
142 def Warning : BlockCommand<"warning">;
143 // HeaderDoc commands
144 def Abstract : BlockCommand<"abstract">;
145 def ClassDesign : RecordLikeDetailCommand<"classdesign">;
146 def CoClass : RecordLikeDetailCommand<"coclass">;
147 def Dependency : RecordLikeDetailCommand<"dependency">;
148 def Discussion : BlockCommand<"discussion">;
149 def Helper : RecordLikeDetailCommand<"helper">;
150 def HelperClass : RecordLikeDetailCommand<"helperclass">;
151 def Helps : RecordLikeDetailCommand<"helps">;
152 def InstanceSize : RecordLikeDetailCommand<"instancesize">;
153 def Ownership : RecordLikeDetailCommand<"ownership">;
154 def Performance : RecordLikeDetailCommand<"performance">;
155 def Security : RecordLikeDetailCommand<"security">;
156 def SeeAlso : BlockCommand<"seealso">;
157 def SuperClass : RecordLikeDetailCommand<"superclass">;
159 //===----------------------------------------------------------------------===//
160 // VerbatimBlockCommand
161 //===----------------------------------------------------------------------===//
163 defm Code : VerbatimBlockCommand<"code", "endcode">;
164 defm Verbatim : VerbatimBlockCommand<"verbatim", "endverbatim">;
165 defm Htmlonly : VerbatimBlockCommand<"htmlonly", "endhtmlonly">;
166 defm Latexonly : VerbatimBlockCommand<"latexonly", "endlatexonly">;
167 defm Xmlonly : VerbatimBlockCommand<"xmlonly", "endxmlonly">;
168 defm Manonly : VerbatimBlockCommand<"manonly", "endmanonly">;
169 defm Rtfonly : VerbatimBlockCommand<"rtfonly", "endrtfonly">;
171 defm Dot : VerbatimBlockCommand<"dot", "enddot">;
172 defm Msc : VerbatimBlockCommand<"msc", "endmsc">;
174 // These three commands have special support in CommentLexer to recognize their
176 def FDollar : VerbatimBlockCommand<"f$">; // Inline LaTeX formula
177 defm FBracket : VerbatimBlockCommand<"f[", "f]">; // Displayed LaTeX formula
178 defm FBrace : VerbatimBlockCommand<"f{", "f}">; // LaTeX environment
180 // HeaderDoc commands
181 defm Textblock : VerbatimBlockCommand<"textblock", "/textblock">;
182 defm Link : VerbatimBlockCommand<"link", "/link">;
184 //===----------------------------------------------------------------------===//
185 // VerbatimLineCommand
186 //===----------------------------------------------------------------------===//
188 def Defgroup : VerbatimLineCommand<"defgroup">;
189 def Ingroup : VerbatimLineCommand<"ingroup">;
190 def Addtogroup : VerbatimLineCommand<"addtogroup">;
191 def Weakgroup : VerbatimLineCommand<"weakgroup">;
192 def Name : VerbatimLineCommand<"name">;
194 def Section : VerbatimLineCommand<"section">;
195 def Subsection : VerbatimLineCommand<"subsection">;
196 def Subsubsection : VerbatimLineCommand<"subsubsection">;
197 def Paragraph : VerbatimLineCommand<"paragraph">;
199 def Mainpage : VerbatimLineCommand<"mainpage">;
200 def Subpage : VerbatimLineCommand<"subpage">;
201 def Ref : VerbatimLineCommand<"ref">;
203 //===----------------------------------------------------------------------===//
204 // DeclarationVerbatimLineCommand
205 //===----------------------------------------------------------------------===//
208 def Fn : DeclarationVerbatimLineCommand<"fn">;
209 def Namespace : DeclarationVerbatimLineCommand<"namespace">;
210 def Overload : DeclarationVerbatimLineCommand<"overload">;
211 def Property : DeclarationVerbatimLineCommand<"property">;
212 def Typedef : DeclarationVerbatimLineCommand<"typedef">;
213 def Var : DeclarationVerbatimLineCommand<"var">;
215 // HeaderDoc commands.
216 def Class : RecordLikeDeclarationVerbatimLineCommand<"class">;
217 def Interface : RecordLikeDeclarationVerbatimLineCommand<"interface">;
218 def Protocol : RecordLikeDeclarationVerbatimLineCommand<"protocol">;
219 def Struct : RecordLikeDeclarationVerbatimLineCommand<"struct">;
220 def Union : RecordLikeDeclarationVerbatimLineCommand<"union">;
221 def Category : DeclarationVerbatimLineCommand<"category">;
222 def Template : DeclarationVerbatimLineCommand<"template">;
223 def Function : FunctionDeclarationVerbatimLineCommand<"function">;
224 def FunctionGroup : FunctionDeclarationVerbatimLineCommand<"functiongroup">;
225 def Method : FunctionDeclarationVerbatimLineCommand<"method">;
226 def MethodGroup : FunctionDeclarationVerbatimLineCommand<"methodgroup">;
227 def Callback : FunctionDeclarationVerbatimLineCommand<"callback">;
228 def Const : DeclarationVerbatimLineCommand<"const">;
229 def Constant : DeclarationVerbatimLineCommand<"constant">;
230 def Enum : DeclarationVerbatimLineCommand<"enum">;