blob: 3b0d1603d407c045da3df8c619dc08a5de5bf5a4 [file] [log] [blame]
Dmitri Gribenkoe1ebedf2013-01-31 23:31:14 +00001//===----------------------------------------------------------------------===//
2// Define command classes.
3//===----------------------------------------------------------------------===//
4
Dmitri Gribenkoe4330a32012-09-10 20:32:42 +00005class 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;
Dmitri Gribenkof6785e32013-11-12 22:16:08 +000018 bit IsThrowsCommand = 0;
Dmitri Gribenko0bd98382012-09-22 21:47:50 +000019 bit IsDeprecatedCommand = 0;
Fariborz Jahanianf843a582013-01-31 23:12:39 +000020 bit IsHeaderfileCommand = 0;
Dmitri Gribenkoe4330a32012-09-10 20:32:42 +000021
Dmitri Gribenkoabcf0dc2012-09-13 20:36:01 +000022 bit IsEmptyParagraphAllowed = 0;
23
Dmitri Gribenkoe4330a32012-09-10 20:32:42 +000024 bit IsVerbatimBlockCommand = 0;
25 bit IsVerbatimBlockEndCommand = 0;
26 bit IsVerbatimLineCommand = 0;
27 bit IsDeclarationCommand = 0;
Fariborz Jahanian2a268f22013-03-05 01:05:07 +000028 bit IsFunctionDeclarationCommand = 0;
Fariborz Jahanianb421b562013-03-08 23:59:23 +000029 bit IsRecordLikeDetailCommand = 0;
30 bit IsRecordLikeDeclarationCommand = 0;
Dmitri Gribenkoe4330a32012-09-10 20:32:42 +000031}
32
33class InlineCommand<string name> : Command<name> {
34 let IsInlineCommand = 1;
35}
36
37class BlockCommand<string name> : Command<name> {
38 let IsBlockCommand = 1;
39}
40
Fariborz Jahanianb421b562013-03-08 23:59:23 +000041class RecordLikeDetailCommand<string name> : BlockCommand<name> {
42 let IsRecordLikeDetailCommand = 1;
43}
44
Dmitri Gribenkoe4330a32012-09-10 20:32:42 +000045class VerbatimBlockCommand<string name> : Command<name> {
46 let EndCommandName = name;
47 let IsVerbatimBlockCommand = 1;
48}
49
50multiclass VerbatimBlockCommand<string name, string endCommandName> {
51 def Begin : Command<name> {
52 let EndCommandName = endCommandName;
53 let IsVerbatimBlockCommand = 1;
54 }
55
56 def End : Command<endCommandName> {
57 let IsVerbatimBlockEndCommand = 1;
58 }
59}
60
61class VerbatimLineCommand<string name> : Command<name> {
62 let IsVerbatimLineCommand = 1;
63}
64
65class DeclarationVerbatimLineCommand<string name> :
66 VerbatimLineCommand<name> {
67 let IsDeclarationCommand = 1;
68}
69
Fariborz Jahanian2a268f22013-03-05 01:05:07 +000070class FunctionDeclarationVerbatimLineCommand<string name> :
Dmitri Gribenkod09615f2013-04-15 02:31:50 +000071 DeclarationVerbatimLineCommand<name> {
Fariborz Jahanian2a268f22013-03-05 01:05:07 +000072 let IsFunctionDeclarationCommand = 1;
73}
74
Fariborz Jahanianb421b562013-03-08 23:59:23 +000075class RecordLikeDeclarationVerbatimLineCommand<string name> :
Dmitri Gribenkod09615f2013-04-15 02:31:50 +000076 DeclarationVerbatimLineCommand<name> {
Fariborz Jahanianb421b562013-03-08 23:59:23 +000077 let IsRecordLikeDeclarationCommand = 1;
Fariborz Jahanian28c1cd22013-03-07 23:33:11 +000078}
79
Dmitri Gribenkoe1ebedf2013-01-31 23:31:14 +000080//===----------------------------------------------------------------------===//
81// InlineCommand
82//===----------------------------------------------------------------------===//
83
Dmitri Gribenkoe4330a32012-09-10 20:32:42 +000084def B : InlineCommand<"b">;
85def C : InlineCommand<"c">;
86def P : InlineCommand<"p">;
87def A : InlineCommand<"a">;
88def E : InlineCommand<"e">;
89def Em : InlineCommand<"em">;
90
Dmitri Gribenkoe1ebedf2013-01-31 23:31:14 +000091//===----------------------------------------------------------------------===//
92// BlockCommand
93//===----------------------------------------------------------------------===//
94
Dmitri Gribenkoe4330a32012-09-10 20:32:42 +000095def Brief : BlockCommand<"brief"> { let IsBriefCommand = 1; }
96def Short : BlockCommand<"short"> { let IsBriefCommand = 1; }
97
Dmitri Gribenkoaf01bed2013-02-01 20:23:57 +000098// Opposite of \brief, it is the default in our implementation.
99def Details : BlockCommand<"details">;
100
Dmitri Gribenkoe4330a32012-09-10 20:32:42 +0000101def Returns : BlockCommand<"returns"> { let IsReturnsCommand = 1; }
102def Return : BlockCommand<"return"> { let IsReturnsCommand = 1; }
103def Result : BlockCommand<"result"> { let IsReturnsCommand = 1; }
104
105def Param : BlockCommand<"param"> { let IsParamCommand = 1; }
106
Dmitri Gribenkoe1ebedf2013-01-31 23:31:14 +0000107// Doxygen command for template parameter documentation.
Dmitri Gribenkoe4330a32012-09-10 20:32:42 +0000108def Tparam : BlockCommand<"tparam"> { let IsTParamCommand = 1; }
109
Dmitri Gribenkoe1ebedf2013-01-31 23:31:14 +0000110// HeaderDoc command for template parameter documentation.
Dmitri Gribenkoe4330a32012-09-10 20:32:42 +0000111def Templatefield : BlockCommand<"templatefield"> { let IsTParamCommand = 1; }
112
Dmitri Gribenkof6785e32013-11-12 22:16:08 +0000113def Throws : BlockCommand<"throws"> { let IsThrowsCommand = 1; }
114def Throw : BlockCommand<"throw"> { let IsThrowsCommand = 1; }
115def Exception : BlockCommand<"exception"> { let IsThrowsCommand = 1; }
116
Dmitri Gribenko0bd98382012-09-22 21:47:50 +0000117def Deprecated : BlockCommand<"deprecated"> {
118 let IsEmptyParagraphAllowed = 1;
119 let IsDeprecatedCommand = 1;
120}
Dmitri Gribenkoe1ebedf2013-01-31 23:31:14 +0000121
Fariborz Jahanianf843a582013-01-31 23:12:39 +0000122def Headerfile : BlockCommand<"headerfile"> { let IsHeaderfileCommand = 1; }
Dmitri Gribenkoe1ebedf2013-01-31 23:31:14 +0000123
124// We don't do any additional semantic analysis for the following
125// BlockCommands. It might be a good idea to do something extra for them, but
126// for now we model them as plain BlockCommands.
Fariborz Jahanian75dbdfa2013-04-10 23:10:42 +0000127def Arg : BlockCommand<"arg">;
Fariborz Jahanian9db0fe92013-02-26 22:12:16 +0000128def Attention : BlockCommand<"attention">;
Dmitri Gribenko0841a072012-09-12 17:02:40 +0000129def Author : BlockCommand<"author">;
130def Authors : BlockCommand<"authors">;
131def Bug : BlockCommand<"bug">;
132def Copyright : BlockCommand<"copyright">;
133def Date : BlockCommand<"date">;
Dmitri Gribenko388a5942012-09-14 15:37:29 +0000134def Invariant : BlockCommand<"invariant">;
Fariborz Jahanian75dbdfa2013-04-10 23:10:42 +0000135def Li : BlockCommand<"li">;
Dmitri Gribenko0841a072012-09-12 17:02:40 +0000136def Note : BlockCommand<"note">;
Fariborz Jahanian4d6bc182013-04-18 16:45:57 +0000137def Par : BlockCommand<"par">;
Dmitri Gribenko0841a072012-09-12 17:02:40 +0000138def Post : BlockCommand<"post">;
139def Pre : BlockCommand<"pre">;
140def Remark : BlockCommand<"remark">;
141def Remarks : BlockCommand<"remarks">;
Stephan Bergmann3c19a892019-08-20 08:36:21 +0000142def Retval : BlockCommand<"retval">;
Dmitri Gribenko0841a072012-09-12 17:02:40 +0000143def Sa : BlockCommand<"sa">;
144def See : BlockCommand<"see">;
145def Since : BlockCommand<"since">;
146def Todo : BlockCommand<"todo">;
147def Version : BlockCommand<"version">;
148def Warning : BlockCommand<"warning">;
Fariborz Jahanianb421b562013-03-08 23:59:23 +0000149// HeaderDoc commands
Dmitri Gribenko122064b2013-11-19 19:18:54 +0000150def Abstract : BlockCommand<"abstract"> { let IsBriefCommand = 1; }
Fariborz Jahanianb421b562013-03-08 23:59:23 +0000151def ClassDesign : RecordLikeDetailCommand<"classdesign">;
152def CoClass : RecordLikeDetailCommand<"coclass">;
153def Dependency : RecordLikeDetailCommand<"dependency">;
Fariborz Jahanian5238e402013-04-05 19:40:53 +0000154def Discussion : BlockCommand<"discussion">;
Fariborz Jahanianb421b562013-03-08 23:59:23 +0000155def Helper : RecordLikeDetailCommand<"helper">;
156def HelperClass : RecordLikeDetailCommand<"helperclass">;
157def Helps : RecordLikeDetailCommand<"helps">;
158def InstanceSize : RecordLikeDetailCommand<"instancesize">;
159def Ownership : RecordLikeDetailCommand<"ownership">;
160def Performance : RecordLikeDetailCommand<"performance">;
161def Security : RecordLikeDetailCommand<"security">;
Fariborz Jahanian1bd077b2013-04-08 19:14:15 +0000162def SeeAlso : BlockCommand<"seealso">;
Fariborz Jahanianb421b562013-03-08 23:59:23 +0000163def SuperClass : RecordLikeDetailCommand<"superclass">;
Dmitri Gribenkoe4330a32012-09-10 20:32:42 +0000164
Dmitri Gribenkoe1ebedf2013-01-31 23:31:14 +0000165//===----------------------------------------------------------------------===//
166// VerbatimBlockCommand
167//===----------------------------------------------------------------------===//
168
Dmitri Gribenkoe4330a32012-09-10 20:32:42 +0000169defm Code : VerbatimBlockCommand<"code", "endcode">;
170defm Verbatim : VerbatimBlockCommand<"verbatim", "endverbatim">;
171defm Htmlonly : VerbatimBlockCommand<"htmlonly", "endhtmlonly">;
172defm Latexonly : VerbatimBlockCommand<"latexonly", "endlatexonly">;
173defm Xmlonly : VerbatimBlockCommand<"xmlonly", "endxmlonly">;
174defm Manonly : VerbatimBlockCommand<"manonly", "endmanonly">;
175defm Rtfonly : VerbatimBlockCommand<"rtfonly", "endrtfonly">;
176
177defm Dot : VerbatimBlockCommand<"dot", "enddot">;
178defm Msc : VerbatimBlockCommand<"msc", "endmsc">;
179
Dmitri Gribenkoe1ebedf2013-01-31 23:31:14 +0000180// These three commands have special support in CommentLexer to recognize their
181// names.
Dmitri Gribenkoe4330a32012-09-10 20:32:42 +0000182def FDollar : VerbatimBlockCommand<"f$">; // Inline LaTeX formula
183defm FBracket : VerbatimBlockCommand<"f[", "f]">; // Displayed LaTeX formula
184defm FBrace : VerbatimBlockCommand<"f{", "f}">; // LaTeX environment
185
Fariborz Jahanian5238e402013-04-05 19:40:53 +0000186// HeaderDoc commands
187defm Textblock : VerbatimBlockCommand<"textblock", "/textblock">;
Fariborz Jahaniancac9ee02013-04-08 18:53:25 +0000188defm Link : VerbatimBlockCommand<"link", "/link">;
Fariborz Jahanian5238e402013-04-05 19:40:53 +0000189
Dmitri Gribenkoe1ebedf2013-01-31 23:31:14 +0000190//===----------------------------------------------------------------------===//
191// VerbatimLineCommand
192//===----------------------------------------------------------------------===//
193
Dmitri Gribenkoe4330a32012-09-10 20:32:42 +0000194def Defgroup : VerbatimLineCommand<"defgroup">;
195def Ingroup : VerbatimLineCommand<"ingroup">;
196def Addtogroup : VerbatimLineCommand<"addtogroup">;
197def Weakgroup : VerbatimLineCommand<"weakgroup">;
198def Name : VerbatimLineCommand<"name">;
199
200def Section : VerbatimLineCommand<"section">;
201def Subsection : VerbatimLineCommand<"subsection">;
202def Subsubsection : VerbatimLineCommand<"subsubsection">;
203def Paragraph : VerbatimLineCommand<"paragraph">;
204
205def Mainpage : VerbatimLineCommand<"mainpage">;
206def Subpage : VerbatimLineCommand<"subpage">;
207def Ref : VerbatimLineCommand<"ref">;
208
Dmitri Gribenko6969e432013-06-23 23:33:14 +0000209def Relates : VerbatimLineCommand<"relates">;
210def Related : VerbatimLineCommand<"related">;
211def RelatesAlso : VerbatimLineCommand<"relatesalso">;
212def RelatedAlso : VerbatimLineCommand<"relatedalso">;
213
Dmitri Gribenkoe1ebedf2013-01-31 23:31:14 +0000214//===----------------------------------------------------------------------===//
215// DeclarationVerbatimLineCommand
216//===----------------------------------------------------------------------===//
217
Dmitri Gribenkoe4330a32012-09-10 20:32:42 +0000218// Doxygen commands.
Dmitri Gribenkoc31fbe32013-11-09 03:50:37 +0000219def Def : DeclarationVerbatimLineCommand<"def">;
Dmitri Gribenko19ec9622012-09-15 21:33:50 +0000220def Fn : DeclarationVerbatimLineCommand<"fn">;
221def Namespace : DeclarationVerbatimLineCommand<"namespace">;
222def Overload : DeclarationVerbatimLineCommand<"overload">;
223def Property : DeclarationVerbatimLineCommand<"property">;
224def Typedef : DeclarationVerbatimLineCommand<"typedef">;
225def Var : DeclarationVerbatimLineCommand<"var">;
Dmitri Gribenkoe4330a32012-09-10 20:32:42 +0000226
227// HeaderDoc commands.
Fariborz Jahanianb421b562013-03-08 23:59:23 +0000228def Class : RecordLikeDeclarationVerbatimLineCommand<"class">;
229def Interface : RecordLikeDeclarationVerbatimLineCommand<"interface">;
230def Protocol : RecordLikeDeclarationVerbatimLineCommand<"protocol">;
231def Struct : RecordLikeDeclarationVerbatimLineCommand<"struct">;
232def Union : RecordLikeDeclarationVerbatimLineCommand<"union">;
Dmitri Gribenkoe4330a32012-09-10 20:32:42 +0000233def Category : DeclarationVerbatimLineCommand<"category">;
234def Template : DeclarationVerbatimLineCommand<"template">;
Fariborz Jahanian2a268f22013-03-05 01:05:07 +0000235def Function : FunctionDeclarationVerbatimLineCommand<"function">;
Fariborz Jahanian2aa5cf42013-03-18 23:45:52 +0000236def FunctionGroup : FunctionDeclarationVerbatimLineCommand<"functiongroup">;
Fariborz Jahanianbca97882013-03-05 19:40:47 +0000237def Method : FunctionDeclarationVerbatimLineCommand<"method">;
Fariborz Jahanian2aa5cf42013-03-18 23:45:52 +0000238def MethodGroup : FunctionDeclarationVerbatimLineCommand<"methodgroup">;
Fariborz Jahanianbca97882013-03-05 19:40:47 +0000239def Callback : FunctionDeclarationVerbatimLineCommand<"callback">;
Dmitri Gribenkoe4330a32012-09-10 20:32:42 +0000240def Const : DeclarationVerbatimLineCommand<"const">;
241def Constant : DeclarationVerbatimLineCommand<"constant">;
Dmitri Gribenkoe4330a32012-09-10 20:32:42 +0000242def Enum : DeclarationVerbatimLineCommand<"enum">;