CommentCommands.td revision 360784
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 IsThrowsCommand = 0; 19 bit IsDeprecatedCommand = 0; 20 bit IsHeaderfileCommand = 0; 21 22 bit IsEmptyParagraphAllowed = 0; 23 24 bit IsVerbatimBlockCommand = 0; 25 bit IsVerbatimBlockEndCommand = 0; 26 bit IsVerbatimLineCommand = 0; 27 bit IsDeclarationCommand = 0; 28 bit IsFunctionDeclarationCommand = 0; 29 bit IsRecordLikeDetailCommand = 0; 30 bit IsRecordLikeDeclarationCommand = 0; 31} 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 41class RecordLikeDetailCommand<string name> : BlockCommand<name> { 42 let IsRecordLikeDetailCommand = 1; 43} 44 45class 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 70class FunctionDeclarationVerbatimLineCommand<string name> : 71 DeclarationVerbatimLineCommand<name> { 72 let IsFunctionDeclarationCommand = 1; 73} 74 75class RecordLikeDeclarationVerbatimLineCommand<string name> : 76 DeclarationVerbatimLineCommand<name> { 77 let IsRecordLikeDeclarationCommand = 1; 78} 79 80//===----------------------------------------------------------------------===// 81// InlineCommand 82//===----------------------------------------------------------------------===// 83 84def B : InlineCommand<"b">; 85def C : InlineCommand<"c">; 86def P : InlineCommand<"p">; 87def A : InlineCommand<"a">; 88def E : InlineCommand<"e">; 89def Em : InlineCommand<"em">; 90def Anchor : InlineCommand<"anchor">; 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 Throws : BlockCommand<"throws"> { let IsThrowsCommand = 1; } 115def Throw : BlockCommand<"throw"> { let IsThrowsCommand = 1; } 116def Exception : BlockCommand<"exception"> { let IsThrowsCommand = 1; } 117 118def Deprecated : BlockCommand<"deprecated"> { 119 let IsEmptyParagraphAllowed = 1; 120 let IsDeprecatedCommand = 1; 121} 122 123def Headerfile : BlockCommand<"headerfile"> { let IsHeaderfileCommand = 1; } 124 125// We don't do any additional semantic analysis for the following 126// BlockCommands. It might be a good idea to do something extra for them, but 127// for now we model them as plain BlockCommands. 128def Arg : BlockCommand<"arg">; 129def Attention : BlockCommand<"attention">; 130def Author : BlockCommand<"author">; 131def Authors : BlockCommand<"authors">; 132def Bug : BlockCommand<"bug">; 133def Copyright : BlockCommand<"copyright">; 134def Date : BlockCommand<"date">; 135def Invariant : BlockCommand<"invariant">; 136def Li : BlockCommand<"li">; 137def Note : BlockCommand<"note">; 138def Par : BlockCommand<"par">; 139def Post : BlockCommand<"post">; 140def Pre : BlockCommand<"pre">; 141def Remark : BlockCommand<"remark">; 142def Remarks : BlockCommand<"remarks">; 143def Retval : BlockCommand<"retval">; 144def Sa : BlockCommand<"sa">; 145def See : BlockCommand<"see">; 146def Since : BlockCommand<"since">; 147def Todo : BlockCommand<"todo">; 148def Version : BlockCommand<"version">; 149def Warning : BlockCommand<"warning">; 150// HeaderDoc commands 151def Abstract : BlockCommand<"abstract"> { let IsBriefCommand = 1; } 152def ClassDesign : RecordLikeDetailCommand<"classdesign">; 153def CoClass : RecordLikeDetailCommand<"coclass">; 154def Dependency : RecordLikeDetailCommand<"dependency">; 155def Discussion : BlockCommand<"discussion">; 156def Helper : RecordLikeDetailCommand<"helper">; 157def HelperClass : RecordLikeDetailCommand<"helperclass">; 158def Helps : RecordLikeDetailCommand<"helps">; 159def InstanceSize : RecordLikeDetailCommand<"instancesize">; 160def Ownership : RecordLikeDetailCommand<"ownership">; 161def Performance : RecordLikeDetailCommand<"performance">; 162def Security : RecordLikeDetailCommand<"security">; 163def SeeAlso : BlockCommand<"seealso">; 164def SuperClass : RecordLikeDetailCommand<"superclass">; 165 166//===----------------------------------------------------------------------===// 167// VerbatimBlockCommand 168//===----------------------------------------------------------------------===// 169 170defm Code : VerbatimBlockCommand<"code", "endcode">; 171defm Verbatim : VerbatimBlockCommand<"verbatim", "endverbatim">; 172defm Htmlonly : VerbatimBlockCommand<"htmlonly", "endhtmlonly">; 173defm Latexonly : VerbatimBlockCommand<"latexonly", "endlatexonly">; 174defm Xmlonly : VerbatimBlockCommand<"xmlonly", "endxmlonly">; 175defm Manonly : VerbatimBlockCommand<"manonly", "endmanonly">; 176defm Rtfonly : VerbatimBlockCommand<"rtfonly", "endrtfonly">; 177 178defm Dot : VerbatimBlockCommand<"dot", "enddot">; 179defm Msc : VerbatimBlockCommand<"msc", "endmsc">; 180 181// These three commands have special support in CommentLexer to recognize their 182// names. 183def FDollar : VerbatimBlockCommand<"f$">; // Inline LaTeX formula 184defm FBracket : VerbatimBlockCommand<"f[", "f]">; // Displayed LaTeX formula 185defm FBrace : VerbatimBlockCommand<"f{", "f}">; // LaTeX environment 186 187// HeaderDoc commands 188defm Textblock : VerbatimBlockCommand<"textblock", "/textblock">; 189defm Link : VerbatimBlockCommand<"link", "/link">; 190 191//===----------------------------------------------------------------------===// 192// VerbatimLineCommand 193//===----------------------------------------------------------------------===// 194 195def Defgroup : VerbatimLineCommand<"defgroup">; 196def Ingroup : VerbatimLineCommand<"ingroup">; 197def Addtogroup : VerbatimLineCommand<"addtogroup">; 198def Weakgroup : VerbatimLineCommand<"weakgroup">; 199def Name : VerbatimLineCommand<"name">; 200 201def Section : VerbatimLineCommand<"section">; 202def Subsection : VerbatimLineCommand<"subsection">; 203def Subsubsection : VerbatimLineCommand<"subsubsection">; 204def Paragraph : VerbatimLineCommand<"paragraph">; 205 206def Mainpage : VerbatimLineCommand<"mainpage">; 207def Subpage : VerbatimLineCommand<"subpage">; 208def Ref : VerbatimLineCommand<"ref">; 209 210def Relates : VerbatimLineCommand<"relates">; 211def Related : VerbatimLineCommand<"related">; 212def RelatesAlso : VerbatimLineCommand<"relatesalso">; 213def RelatedAlso : VerbatimLineCommand<"relatedalso">; 214 215//===----------------------------------------------------------------------===// 216// DeclarationVerbatimLineCommand 217//===----------------------------------------------------------------------===// 218 219// Doxygen commands. 220def Def : DeclarationVerbatimLineCommand<"def">; 221def Fn : DeclarationVerbatimLineCommand<"fn">; 222def Namespace : DeclarationVerbatimLineCommand<"namespace">; 223def Overload : DeclarationVerbatimLineCommand<"overload">; 224def Property : DeclarationVerbatimLineCommand<"property">; 225def Typedef : DeclarationVerbatimLineCommand<"typedef">; 226def Var : DeclarationVerbatimLineCommand<"var">; 227 228// HeaderDoc commands. 229def Class : RecordLikeDeclarationVerbatimLineCommand<"class">; 230def Interface : RecordLikeDeclarationVerbatimLineCommand<"interface">; 231def Protocol : RecordLikeDeclarationVerbatimLineCommand<"protocol">; 232def Struct : RecordLikeDeclarationVerbatimLineCommand<"struct">; 233def Union : RecordLikeDeclarationVerbatimLineCommand<"union">; 234def Category : DeclarationVerbatimLineCommand<"category">; 235def Template : DeclarationVerbatimLineCommand<"template">; 236def Function : FunctionDeclarationVerbatimLineCommand<"function">; 237def FunctionGroup : FunctionDeclarationVerbatimLineCommand<"functiongroup">; 238def Method : FunctionDeclarationVerbatimLineCommand<"method">; 239def MethodGroup : FunctionDeclarationVerbatimLineCommand<"methodgroup">; 240def Callback : FunctionDeclarationVerbatimLineCommand<"callback">; 241def Const : DeclarationVerbatimLineCommand<"const">; 242def Constant : DeclarationVerbatimLineCommand<"constant">; 243def Enum : DeclarationVerbatimLineCommand<"enum">; 244