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