CommentCommands.td revision bca9788dbaf5fcf241efdc82ddcda712cb22214e
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}
29
30class InlineCommand<string name> : Command<name> {
31  let IsInlineCommand = 1;
32}
33
34class BlockCommand<string name> : Command<name> {
35  let IsBlockCommand = 1;
36}
37
38class VerbatimBlockCommand<string name> : Command<name> {
39  let EndCommandName = name;
40  let IsVerbatimBlockCommand = 1;
41}
42
43multiclass VerbatimBlockCommand<string name, string endCommandName> {
44  def Begin : Command<name> {
45    let EndCommandName = endCommandName;
46    let IsVerbatimBlockCommand = 1;
47  }
48
49  def End : Command<endCommandName> {
50    let IsVerbatimBlockEndCommand = 1;
51  }
52}
53
54class VerbatimLineCommand<string name> : Command<name> {
55  let IsVerbatimLineCommand = 1;
56}
57
58class DeclarationVerbatimLineCommand<string name> :
59      VerbatimLineCommand<name> {
60  let IsDeclarationCommand = 1;
61}
62
63class FunctionDeclarationVerbatimLineCommand<string name> :
64      VerbatimLineCommand<name> {
65  let IsDeclarationCommand = 1;
66  let IsFunctionDeclarationCommand = 1;
67}
68
69//===----------------------------------------------------------------------===//
70// InlineCommand
71//===----------------------------------------------------------------------===//
72
73def B  : InlineCommand<"b">;
74def C  : InlineCommand<"c">;
75def P  : InlineCommand<"p">;
76def A  : InlineCommand<"a">;
77def E  : InlineCommand<"e">;
78def Em : InlineCommand<"em">;
79
80//===----------------------------------------------------------------------===//
81// BlockCommand
82//===----------------------------------------------------------------------===//
83
84def Brief : BlockCommand<"brief"> { let IsBriefCommand = 1; }
85def Short : BlockCommand<"short"> { let IsBriefCommand = 1; }
86
87// Opposite of \brief, it is the default in our implementation.
88def Details : BlockCommand<"details">;
89
90def Returns : BlockCommand<"returns"> { let IsReturnsCommand = 1; }
91def Return  : BlockCommand<"return"> { let IsReturnsCommand = 1; }
92def Result  : BlockCommand<"result"> { let IsReturnsCommand = 1; }
93
94def Param : BlockCommand<"param"> { let IsParamCommand = 1; }
95
96// Doxygen command for template parameter documentation.
97def Tparam : BlockCommand<"tparam"> { let IsTParamCommand = 1; }
98
99// HeaderDoc command for template parameter documentation.
100def Templatefield : BlockCommand<"templatefield"> { let IsTParamCommand = 1; }
101
102def Deprecated : BlockCommand<"deprecated"> {
103  let IsEmptyParagraphAllowed = 1;
104  let IsDeprecatedCommand = 1;
105}
106
107def Headerfile : BlockCommand<"headerfile"> { let IsHeaderfileCommand = 1; }
108
109// We don't do any additional semantic analysis for the following
110// BlockCommands.  It might be a good idea to do something extra for them, but
111// for now we model them as plain BlockCommands.
112def Attention  : BlockCommand<"attention">;
113def Author     : BlockCommand<"author">;
114def Authors    : BlockCommand<"authors">;
115def Bug        : BlockCommand<"bug">;
116def Copyright  : BlockCommand<"copyright">;
117def Date       : BlockCommand<"date">;
118def Invariant  : BlockCommand<"invariant">;
119def Note       : BlockCommand<"note">;
120def Post       : BlockCommand<"post">;
121def Pre        : BlockCommand<"pre">;
122def Remark     : BlockCommand<"remark">;
123def Remarks    : BlockCommand<"remarks">;
124def Sa         : BlockCommand<"sa">;
125def See        : BlockCommand<"see">;
126def Since      : BlockCommand<"since">;
127def Todo       : BlockCommand<"todo">;
128def Version    : BlockCommand<"version">;
129def Warning    : BlockCommand<"warning">;
130
131//===----------------------------------------------------------------------===//
132// VerbatimBlockCommand
133//===----------------------------------------------------------------------===//
134
135defm Code      : VerbatimBlockCommand<"code", "endcode">;
136defm Verbatim  : VerbatimBlockCommand<"verbatim", "endverbatim">;
137defm Htmlonly  : VerbatimBlockCommand<"htmlonly", "endhtmlonly">;
138defm Latexonly : VerbatimBlockCommand<"latexonly", "endlatexonly">;
139defm Xmlonly   : VerbatimBlockCommand<"xmlonly", "endxmlonly">;
140defm Manonly   : VerbatimBlockCommand<"manonly", "endmanonly">;
141defm Rtfonly   : VerbatimBlockCommand<"rtfonly", "endrtfonly">;
142
143defm Dot : VerbatimBlockCommand<"dot", "enddot">;
144defm Msc : VerbatimBlockCommand<"msc", "endmsc">;
145
146// These three commands have special support in CommentLexer to recognize their
147// names.
148def  FDollar  : VerbatimBlockCommand<"f$">; // Inline LaTeX formula
149defm FBracket : VerbatimBlockCommand<"f[", "f]">; // Displayed LaTeX formula
150defm FBrace   : VerbatimBlockCommand<"f{", "f}">; // LaTeX environment
151
152//===----------------------------------------------------------------------===//
153// VerbatimLineCommand
154//===----------------------------------------------------------------------===//
155
156def Defgroup   : VerbatimLineCommand<"defgroup">;
157def Ingroup    : VerbatimLineCommand<"ingroup">;
158def Addtogroup : VerbatimLineCommand<"addtogroup">;
159def Weakgroup  : VerbatimLineCommand<"weakgroup">;
160def Name       : VerbatimLineCommand<"name">;
161
162def Section       : VerbatimLineCommand<"section">;
163def Subsection    : VerbatimLineCommand<"subsection">;
164def Subsubsection : VerbatimLineCommand<"subsubsection">;
165def Paragraph     : VerbatimLineCommand<"paragraph">;
166
167def Mainpage : VerbatimLineCommand<"mainpage">;
168def Subpage  : VerbatimLineCommand<"subpage">;
169def Ref      : VerbatimLineCommand<"ref">;
170
171//===----------------------------------------------------------------------===//
172// DeclarationVerbatimLineCommand
173//===----------------------------------------------------------------------===//
174
175// Doxygen commands.
176def Fn        : DeclarationVerbatimLineCommand<"fn">;
177def Namespace : DeclarationVerbatimLineCommand<"namespace">;
178def Overload  : DeclarationVerbatimLineCommand<"overload">;
179def Property  : DeclarationVerbatimLineCommand<"property">;
180def Typedef   : DeclarationVerbatimLineCommand<"typedef">;
181def Var       : DeclarationVerbatimLineCommand<"var">;
182
183// HeaderDoc commands.
184def Class     : DeclarationVerbatimLineCommand<"class">;
185def Interface : DeclarationVerbatimLineCommand<"interface">;
186def Protocol  : DeclarationVerbatimLineCommand<"protocol">;
187def Category  : DeclarationVerbatimLineCommand<"category">;
188def Template  : DeclarationVerbatimLineCommand<"template">;
189def Function  : FunctionDeclarationVerbatimLineCommand<"function">;
190def Method    : FunctionDeclarationVerbatimLineCommand<"method">;
191def Callback  : FunctionDeclarationVerbatimLineCommand<"callback">;
192def Const     : DeclarationVerbatimLineCommand<"const">;
193def Constant  : DeclarationVerbatimLineCommand<"constant">;
194def Struct    : DeclarationVerbatimLineCommand<"struct">;
195def Union     : DeclarationVerbatimLineCommand<"union">;
196def Enum      : DeclarationVerbatimLineCommand<"enum">;
197
198