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