CommentCommands.td revision d09615fcc03d177a59478d7d6e90a034a4d2a879
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 Post       : BlockCommand<"post">;
133def Pre        : BlockCommand<"pre">;
134def Remark     : BlockCommand<"remark">;
135def Remarks    : BlockCommand<"remarks">;
136def Sa         : BlockCommand<"sa">;
137def See        : BlockCommand<"see">;
138def Since      : BlockCommand<"since">;
139def Todo       : BlockCommand<"todo">;
140def Version    : BlockCommand<"version">;
141def Warning    : BlockCommand<"warning">;
142// HeaderDoc commands
143def Abstract      : BlockCommand<"abstract">;
144def ClassDesign   : RecordLikeDetailCommand<"classdesign">;
145def CoClass       : RecordLikeDetailCommand<"coclass">;
146def Dependency    : RecordLikeDetailCommand<"dependency">;
147def Discussion    : BlockCommand<"discussion">;
148def Helper        : RecordLikeDetailCommand<"helper">;
149def HelperClass   : RecordLikeDetailCommand<"helperclass">;
150def Helps         : RecordLikeDetailCommand<"helps">;
151def InstanceSize  : RecordLikeDetailCommand<"instancesize">;
152def Ownership     : RecordLikeDetailCommand<"ownership">;
153def Performance   : RecordLikeDetailCommand<"performance">;
154def Security      : RecordLikeDetailCommand<"security">;
155def SeeAlso       : BlockCommand<"seealso">;
156def SuperClass    : RecordLikeDetailCommand<"superclass">;
157
158//===----------------------------------------------------------------------===//
159// VerbatimBlockCommand
160//===----------------------------------------------------------------------===//
161
162defm Code      : VerbatimBlockCommand<"code", "endcode">;
163defm Verbatim  : VerbatimBlockCommand<"verbatim", "endverbatim">;
164defm Htmlonly  : VerbatimBlockCommand<"htmlonly", "endhtmlonly">;
165defm Latexonly : VerbatimBlockCommand<"latexonly", "endlatexonly">;
166defm Xmlonly   : VerbatimBlockCommand<"xmlonly", "endxmlonly">;
167defm Manonly   : VerbatimBlockCommand<"manonly", "endmanonly">;
168defm Rtfonly   : VerbatimBlockCommand<"rtfonly", "endrtfonly">;
169
170defm Dot : VerbatimBlockCommand<"dot", "enddot">;
171defm Msc : VerbatimBlockCommand<"msc", "endmsc">;
172
173// These three commands have special support in CommentLexer to recognize their
174// names.
175def  FDollar  : VerbatimBlockCommand<"f$">; // Inline LaTeX formula
176defm FBracket : VerbatimBlockCommand<"f[", "f]">; // Displayed LaTeX formula
177defm FBrace   : VerbatimBlockCommand<"f{", "f}">; // LaTeX environment
178
179// HeaderDoc commands
180defm Textblock    : VerbatimBlockCommand<"textblock", "/textblock">;
181defm Link         : VerbatimBlockCommand<"link", "/link">;
182
183//===----------------------------------------------------------------------===//
184// VerbatimLineCommand
185//===----------------------------------------------------------------------===//
186
187def Defgroup   : VerbatimLineCommand<"defgroup">;
188def Ingroup    : VerbatimLineCommand<"ingroup">;
189def Addtogroup : VerbatimLineCommand<"addtogroup">;
190def Weakgroup  : VerbatimLineCommand<"weakgroup">;
191def Name       : VerbatimLineCommand<"name">;
192
193def Section       : VerbatimLineCommand<"section">;
194def Subsection    : VerbatimLineCommand<"subsection">;
195def Subsubsection : VerbatimLineCommand<"subsubsection">;
196def Paragraph     : VerbatimLineCommand<"paragraph">;
197
198def Mainpage : VerbatimLineCommand<"mainpage">;
199def Subpage  : VerbatimLineCommand<"subpage">;
200def Ref      : VerbatimLineCommand<"ref">;
201
202//===----------------------------------------------------------------------===//
203// DeclarationVerbatimLineCommand
204//===----------------------------------------------------------------------===//
205
206// Doxygen commands.
207def Fn        : DeclarationVerbatimLineCommand<"fn">;
208def Namespace : DeclarationVerbatimLineCommand<"namespace">;
209def Overload  : DeclarationVerbatimLineCommand<"overload">;
210def Property  : DeclarationVerbatimLineCommand<"property">;
211def Typedef   : DeclarationVerbatimLineCommand<"typedef">;
212def Var       : DeclarationVerbatimLineCommand<"var">;
213
214// HeaderDoc commands.
215def Class     : RecordLikeDeclarationVerbatimLineCommand<"class">;
216def Interface : RecordLikeDeclarationVerbatimLineCommand<"interface">;
217def Protocol  : RecordLikeDeclarationVerbatimLineCommand<"protocol">;
218def Struct    : RecordLikeDeclarationVerbatimLineCommand<"struct">;
219def Union     : RecordLikeDeclarationVerbatimLineCommand<"union">;
220def Category  : DeclarationVerbatimLineCommand<"category">;
221def Template  : DeclarationVerbatimLineCommand<"template">;
222def Function  : FunctionDeclarationVerbatimLineCommand<"function">;
223def FunctionGroup  : FunctionDeclarationVerbatimLineCommand<"functiongroup">;
224def Method    : FunctionDeclarationVerbatimLineCommand<"method">;
225def MethodGroup    : FunctionDeclarationVerbatimLineCommand<"methodgroup">;
226def Callback  : FunctionDeclarationVerbatimLineCommand<"callback">;
227def Const     : DeclarationVerbatimLineCommand<"const">;
228def Constant  : DeclarationVerbatimLineCommand<"constant">;
229def Enum      : DeclarationVerbatimLineCommand<"enum">;
230