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