CommentCommands.td revision 9db0fe97f533513f88e7141f0b2a405ebe86fa67
18bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)//===----------------------------------------------------------------------===//
28bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// Define command classes.
38bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)//===----------------------------------------------------------------------===//
48bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
58bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)class Command<string name> {
68bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  string Name = name;
78bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  string EndCommandName = "";
88bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
98bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  int NumArgs = 0;
108bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
118bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  bit IsInlineCommand = 0;
128bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
138bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  bit IsBlockCommand = 0;
148bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  bit IsBriefCommand = 0;
158bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  bit IsReturnsCommand = 0;
168bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  bit IsParamCommand = 0;
178bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  bit IsTParamCommand = 0;
188bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  bit IsDeprecatedCommand = 0;
198bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  bit IsHeaderfileCommand = 0;
208bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
218bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  bit IsEmptyParagraphAllowed = 0;
228bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
238bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  bit IsVerbatimBlockCommand = 0;
248bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  bit IsVerbatimBlockEndCommand = 0;
258bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  bit IsVerbatimLineCommand = 0;
268bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  bit IsDeclarationCommand = 0;
278bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)}
288bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
298bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)class InlineCommand<string name> : Command<name> {
308bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  let IsInlineCommand = 1;
318bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)}
328bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
338bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)class BlockCommand<string name> : Command<name> {
348bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  let IsBlockCommand = 1;
358bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)}
368bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
378bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)class VerbatimBlockCommand<string name> : Command<name> {
388bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  let EndCommandName = name;
398bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  let IsVerbatimBlockCommand = 1;
408bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)}
418bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
428bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)multiclass VerbatimBlockCommand<string name, string endCommandName> {
438bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  def Begin : Command<name> {
448bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)    let EndCommandName = endCommandName;
458bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)    let IsVerbatimBlockCommand = 1;
468bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  }
478bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
488bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  def End : Command<endCommandName> {
498bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)    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 Attention  : BlockCommand<"attention">;
106def Author     : BlockCommand<"author">;
107def Authors    : BlockCommand<"authors">;
108def Bug        : BlockCommand<"bug">;
109def Copyright  : BlockCommand<"copyright">;
110def Date       : BlockCommand<"date">;
111def Invariant  : BlockCommand<"invariant">;
112def Note       : BlockCommand<"note">;
113def Post       : BlockCommand<"post">;
114def Pre        : BlockCommand<"pre">;
115def Remark     : BlockCommand<"remark">;
116def Remarks    : BlockCommand<"remarks">;
117def Sa         : BlockCommand<"sa">;
118def See        : BlockCommand<"see">;
119def Since      : BlockCommand<"since">;
120def Todo       : BlockCommand<"todo">;
121def Version    : BlockCommand<"version">;
122def Warning    : BlockCommand<"warning">;
123
124//===----------------------------------------------------------------------===//
125// VerbatimBlockCommand
126//===----------------------------------------------------------------------===//
127
128defm Code      : VerbatimBlockCommand<"code", "endcode">;
129defm Verbatim  : VerbatimBlockCommand<"verbatim", "endverbatim">;
130defm Htmlonly  : VerbatimBlockCommand<"htmlonly", "endhtmlonly">;
131defm Latexonly : VerbatimBlockCommand<"latexonly", "endlatexonly">;
132defm Xmlonly   : VerbatimBlockCommand<"xmlonly", "endxmlonly">;
133defm Manonly   : VerbatimBlockCommand<"manonly", "endmanonly">;
134defm Rtfonly   : VerbatimBlockCommand<"rtfonly", "endrtfonly">;
135
136defm Dot : VerbatimBlockCommand<"dot", "enddot">;
137defm Msc : VerbatimBlockCommand<"msc", "endmsc">;
138
139// These three commands have special support in CommentLexer to recognize their
140// names.
141def  FDollar  : VerbatimBlockCommand<"f$">; // Inline LaTeX formula
142defm FBracket : VerbatimBlockCommand<"f[", "f]">; // Displayed LaTeX formula
143defm FBrace   : VerbatimBlockCommand<"f{", "f}">; // LaTeX environment
144
145//===----------------------------------------------------------------------===//
146// VerbatimLineCommand
147//===----------------------------------------------------------------------===//
148
149def Defgroup   : VerbatimLineCommand<"defgroup">;
150def Ingroup    : VerbatimLineCommand<"ingroup">;
151def Addtogroup : VerbatimLineCommand<"addtogroup">;
152def Weakgroup  : VerbatimLineCommand<"weakgroup">;
153def Name       : VerbatimLineCommand<"name">;
154
155def Section       : VerbatimLineCommand<"section">;
156def Subsection    : VerbatimLineCommand<"subsection">;
157def Subsubsection : VerbatimLineCommand<"subsubsection">;
158def Paragraph     : VerbatimLineCommand<"paragraph">;
159
160def Mainpage : VerbatimLineCommand<"mainpage">;
161def Subpage  : VerbatimLineCommand<"subpage">;
162def Ref      : VerbatimLineCommand<"ref">;
163
164//===----------------------------------------------------------------------===//
165// DeclarationVerbatimLineCommand
166//===----------------------------------------------------------------------===//
167
168// Doxygen commands.
169def Fn        : DeclarationVerbatimLineCommand<"fn">;
170def Namespace : DeclarationVerbatimLineCommand<"namespace">;
171def Overload  : DeclarationVerbatimLineCommand<"overload">;
172def Property  : DeclarationVerbatimLineCommand<"property">;
173def Typedef   : DeclarationVerbatimLineCommand<"typedef">;
174def Var       : DeclarationVerbatimLineCommand<"var">;
175
176// HeaderDoc commands.
177def Class     : DeclarationVerbatimLineCommand<"class">;
178def Interface : DeclarationVerbatimLineCommand<"interface">;
179def Protocol  : DeclarationVerbatimLineCommand<"protocol">;
180def Category  : DeclarationVerbatimLineCommand<"category">;
181def Template  : DeclarationVerbatimLineCommand<"template">;
182def Function  : DeclarationVerbatimLineCommand<"function">;
183def Method    : DeclarationVerbatimLineCommand<"method">;
184def Callback  : DeclarationVerbatimLineCommand<"callback">;
185def Const     : DeclarationVerbatimLineCommand<"const">;
186def Constant  : DeclarationVerbatimLineCommand<"constant">;
187def Struct    : DeclarationVerbatimLineCommand<"struct">;
188def Union     : DeclarationVerbatimLineCommand<"union">;
189def Enum      : DeclarationVerbatimLineCommand<"enum">;
190
191