CommentCommands.td revision 5238e40f6ea6346b6bc1505e4975c2c4ab7fde09
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      VerbatimLineCommand<name> {
71  let IsDeclarationCommand = 1;
72  let IsFunctionDeclarationCommand = 1;
73}
74
75class RecordLikeDeclarationVerbatimLineCommand<string name> :
76      VerbatimLineCommand<name> {
77  let IsDeclarationCommand = 1;
78  let IsRecordLikeDeclarationCommand = 1;
79}
80
81//===----------------------------------------------------------------------===//
82// InlineCommand
83//===----------------------------------------------------------------------===//
84
85def B  : InlineCommand<"b">;
86def C  : InlineCommand<"c">;
87def P  : InlineCommand<"p">;
88def A  : InlineCommand<"a">;
89def E  : InlineCommand<"e">;
90def Em : InlineCommand<"em">;
91
92//===----------------------------------------------------------------------===//
93// BlockCommand
94//===----------------------------------------------------------------------===//
95
96def Brief : BlockCommand<"brief"> { let IsBriefCommand = 1; }
97def Short : BlockCommand<"short"> { let IsBriefCommand = 1; }
98
99// Opposite of \brief, it is the default in our implementation.
100def Details : BlockCommand<"details">;
101
102def Returns : BlockCommand<"returns"> { let IsReturnsCommand = 1; }
103def Return  : BlockCommand<"return"> { let IsReturnsCommand = 1; }
104def Result  : BlockCommand<"result"> { let IsReturnsCommand = 1; }
105
106def Param : BlockCommand<"param"> { let IsParamCommand = 1; }
107
108// Doxygen command for template parameter documentation.
109def Tparam : BlockCommand<"tparam"> { let IsTParamCommand = 1; }
110
111// HeaderDoc command for template parameter documentation.
112def Templatefield : BlockCommand<"templatefield"> { let IsTParamCommand = 1; }
113
114def Deprecated : BlockCommand<"deprecated"> {
115  let IsEmptyParagraphAllowed = 1;
116  let IsDeprecatedCommand = 1;
117}
118
119def Headerfile : BlockCommand<"headerfile"> { let IsHeaderfileCommand = 1; }
120
121// We don't do any additional semantic analysis for the following
122// BlockCommands.  It might be a good idea to do something extra for them, but
123// for now we model them as plain BlockCommands.
124def Attention  : BlockCommand<"attention">;
125def Author     : BlockCommand<"author">;
126def Authors    : BlockCommand<"authors">;
127def Bug        : BlockCommand<"bug">;
128def Copyright  : BlockCommand<"copyright">;
129def Date       : BlockCommand<"date">;
130def Invariant  : BlockCommand<"invariant">;
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 SuperClass    : RecordLikeDetailCommand<"superclass">;
156
157//===----------------------------------------------------------------------===//
158// VerbatimBlockCommand
159//===----------------------------------------------------------------------===//
160
161defm Code      : VerbatimBlockCommand<"code", "endcode">;
162defm Verbatim  : VerbatimBlockCommand<"verbatim", "endverbatim">;
163defm Htmlonly  : VerbatimBlockCommand<"htmlonly", "endhtmlonly">;
164defm Latexonly : VerbatimBlockCommand<"latexonly", "endlatexonly">;
165defm Xmlonly   : VerbatimBlockCommand<"xmlonly", "endxmlonly">;
166defm Manonly   : VerbatimBlockCommand<"manonly", "endmanonly">;
167defm Rtfonly   : VerbatimBlockCommand<"rtfonly", "endrtfonly">;
168
169defm Dot : VerbatimBlockCommand<"dot", "enddot">;
170defm Msc : VerbatimBlockCommand<"msc", "endmsc">;
171
172// These three commands have special support in CommentLexer to recognize their
173// names.
174def  FDollar  : VerbatimBlockCommand<"f$">; // Inline LaTeX formula
175defm FBracket : VerbatimBlockCommand<"f[", "f]">; // Displayed LaTeX formula
176defm FBrace   : VerbatimBlockCommand<"f{", "f}">; // LaTeX environment
177
178// HeaderDoc commands
179defm Textblock    : VerbatimBlockCommand<"textblock", "/textblock">;
180
181//===----------------------------------------------------------------------===//
182// VerbatimLineCommand
183//===----------------------------------------------------------------------===//
184
185def Defgroup   : VerbatimLineCommand<"defgroup">;
186def Ingroup    : VerbatimLineCommand<"ingroup">;
187def Addtogroup : VerbatimLineCommand<"addtogroup">;
188def Weakgroup  : VerbatimLineCommand<"weakgroup">;
189def Name       : VerbatimLineCommand<"name">;
190
191def Section       : VerbatimLineCommand<"section">;
192def Subsection    : VerbatimLineCommand<"subsection">;
193def Subsubsection : VerbatimLineCommand<"subsubsection">;
194def Paragraph     : VerbatimLineCommand<"paragraph">;
195
196def Mainpage : VerbatimLineCommand<"mainpage">;
197def Subpage  : VerbatimLineCommand<"subpage">;
198def Ref      : VerbatimLineCommand<"ref">;
199
200//===----------------------------------------------------------------------===//
201// DeclarationVerbatimLineCommand
202//===----------------------------------------------------------------------===//
203
204// Doxygen commands.
205def Fn        : DeclarationVerbatimLineCommand<"fn">;
206def Namespace : DeclarationVerbatimLineCommand<"namespace">;
207def Overload  : DeclarationVerbatimLineCommand<"overload">;
208def Property  : DeclarationVerbatimLineCommand<"property">;
209def Typedef   : DeclarationVerbatimLineCommand<"typedef">;
210def Var       : DeclarationVerbatimLineCommand<"var">;
211
212// HeaderDoc commands.
213def Class     : RecordLikeDeclarationVerbatimLineCommand<"class">;
214def Interface : RecordLikeDeclarationVerbatimLineCommand<"interface">;
215def Protocol  : RecordLikeDeclarationVerbatimLineCommand<"protocol">;
216def Struct    : RecordLikeDeclarationVerbatimLineCommand<"struct">;
217def Union     : RecordLikeDeclarationVerbatimLineCommand<"union">;
218def Category  : DeclarationVerbatimLineCommand<"category">;
219def Template  : DeclarationVerbatimLineCommand<"template">;
220def Function  : FunctionDeclarationVerbatimLineCommand<"function">;
221def FunctionGroup  : FunctionDeclarationVerbatimLineCommand<"functiongroup">;
222def Method    : FunctionDeclarationVerbatimLineCommand<"method">;
223def MethodGroup    : FunctionDeclarationVerbatimLineCommand<"methodgroup">;
224def Callback  : FunctionDeclarationVerbatimLineCommand<"callback">;
225def Const     : DeclarationVerbatimLineCommand<"const">;
226def Constant  : DeclarationVerbatimLineCommand<"constant">;
227def Enum      : DeclarationVerbatimLineCommand<"enum">;
228