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