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