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