1 //===----------------------------------------------------------------------===// 2 // Define command classes. 3 //===----------------------------------------------------------------------===// 4 5 class 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 33 class InlineCommand<string name> : Command<name> { 34 let IsInlineCommand = 1; 35 } 36 37 class BlockCommand<string name> : Command<name> { 38 let IsBlockCommand = 1; 39 } 40 41 class RecordLikeDetailCommand<string name> : BlockCommand<name> { 42 let IsRecordLikeDetailCommand = 1; 43 } 44 45 class VerbatimBlockCommand<string name> : Command<name> { 46 let EndCommandName = name; 47 let IsVerbatimBlockCommand = 1; 48 } 49 50 multiclass 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 61 class VerbatimLineCommand<string name> : Command<name> { 62 let IsVerbatimLineCommand = 1; 63 } 64 65 class DeclarationVerbatimLineCommand<string name> : 66 VerbatimLineCommand<name> { 67 let IsDeclarationCommand = 1; 68 } 69 70 class FunctionDeclarationVerbatimLineCommand<string name> : 71 DeclarationVerbatimLineCommand<name> { 72 let IsFunctionDeclarationCommand = 1; 73 } 74 75 class RecordLikeDeclarationVerbatimLineCommand<string name> : 76 DeclarationVerbatimLineCommand<name> { 77 let IsRecordLikeDeclarationCommand = 1; 78 } 79 80 //===----------------------------------------------------------------------===// 81 // InlineCommand 82 //===----------------------------------------------------------------------===// 83 84 def B : InlineCommand<"b">; 85 def C : InlineCommand<"c">; 86 def P : InlineCommand<"p">; 87 def A : InlineCommand<"a">; 88 def E : InlineCommand<"e">; 89 def Em : InlineCommand<"em">; 90 91 //===----------------------------------------------------------------------===// 92 // BlockCommand 93 //===----------------------------------------------------------------------===// 94 95 def Brief : BlockCommand<"brief"> { let IsBriefCommand = 1; } 96 def Short : BlockCommand<"short"> { let IsBriefCommand = 1; } 97 98 // Opposite of \brief, it is the default in our implementation. 99 def Details : BlockCommand<"details">; 100 101 def Returns : BlockCommand<"returns"> { let IsReturnsCommand = 1; } 102 def Return : BlockCommand<"return"> { let IsReturnsCommand = 1; } 103 def Result : BlockCommand<"result"> { let IsReturnsCommand = 1; } 104 105 def Param : BlockCommand<"param"> { let IsParamCommand = 1; } 106 107 // Doxygen command for template parameter documentation. 108 def Tparam : BlockCommand<"tparam"> { let IsTParamCommand = 1; } 109 110 // HeaderDoc command for template parameter documentation. 111 def Templatefield : BlockCommand<"templatefield"> { let IsTParamCommand = 1; } 112 113 def Throws : BlockCommand<"throws"> { let IsThrowsCommand = 1; } 114 def Throw : BlockCommand<"throw"> { let IsThrowsCommand = 1; } 115 def Exception : BlockCommand<"exception"> { let IsThrowsCommand = 1; } 116 117 def Deprecated : BlockCommand<"deprecated"> { 118 let IsEmptyParagraphAllowed = 1; 119 let IsDeprecatedCommand = 1; 120 } 121 122 def Headerfile : BlockCommand<"headerfile"> { let IsHeaderfileCommand = 1; } 123 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. 127 def Arg : BlockCommand<"arg">; 128 def Attention : BlockCommand<"attention">; 129 def Author : BlockCommand<"author">; 130 def Authors : BlockCommand<"authors">; 131 def Bug : BlockCommand<"bug">; 132 def Copyright : BlockCommand<"copyright">; 133 def Date : BlockCommand<"date">; 134 def Invariant : BlockCommand<"invariant">; 135 def Li : BlockCommand<"li">; 136 def Note : BlockCommand<"note">; 137 def Par : BlockCommand<"par">; 138 def Post : BlockCommand<"post">; 139 def Pre : BlockCommand<"pre">; 140 def Remark : BlockCommand<"remark">; 141 def Remarks : BlockCommand<"remarks">; 142 def Sa : BlockCommand<"sa">; 143 def See : BlockCommand<"see">; 144 def Since : BlockCommand<"since">; 145 def Todo : BlockCommand<"todo">; 146 def Version : BlockCommand<"version">; 147 def Warning : BlockCommand<"warning">; 148 // HeaderDoc commands 149 def Abstract : BlockCommand<"abstract"> { let IsBriefCommand = 1; } 150 def ClassDesign : RecordLikeDetailCommand<"classdesign">; 151 def CoClass : RecordLikeDetailCommand<"coclass">; 152 def Dependency : RecordLikeDetailCommand<"dependency">; 153 def Discussion : BlockCommand<"discussion">; 154 def Helper : RecordLikeDetailCommand<"helper">; 155 def HelperClass : RecordLikeDetailCommand<"helperclass">; 156 def Helps : RecordLikeDetailCommand<"helps">; 157 def InstanceSize : RecordLikeDetailCommand<"instancesize">; 158 def Ownership : RecordLikeDetailCommand<"ownership">; 159 def Performance : RecordLikeDetailCommand<"performance">; 160 def Security : RecordLikeDetailCommand<"security">; 161 def SeeAlso : BlockCommand<"seealso">; 162 def SuperClass : RecordLikeDetailCommand<"superclass">; 163 164 //===----------------------------------------------------------------------===// 165 // VerbatimBlockCommand 166 //===----------------------------------------------------------------------===// 167 168 defm Code : VerbatimBlockCommand<"code", "endcode">; 169 defm Verbatim : VerbatimBlockCommand<"verbatim", "endverbatim">; 170 defm Htmlonly : VerbatimBlockCommand<"htmlonly", "endhtmlonly">; 171 defm Latexonly : VerbatimBlockCommand<"latexonly", "endlatexonly">; 172 defm Xmlonly : VerbatimBlockCommand<"xmlonly", "endxmlonly">; 173 defm Manonly : VerbatimBlockCommand<"manonly", "endmanonly">; 174 defm Rtfonly : VerbatimBlockCommand<"rtfonly", "endrtfonly">; 175 176 defm Dot : VerbatimBlockCommand<"dot", "enddot">; 177 defm Msc : VerbatimBlockCommand<"msc", "endmsc">; 178 179 // These three commands have special support in CommentLexer to recognize their 180 // names. 181 def FDollar : VerbatimBlockCommand<"f$">; // Inline LaTeX formula 182 defm FBracket : VerbatimBlockCommand<"f[", "f]">; // Displayed LaTeX formula 183 defm FBrace : VerbatimBlockCommand<"f{", "f}">; // LaTeX environment 184 185 // HeaderDoc commands 186 defm Textblock : VerbatimBlockCommand<"textblock", "/textblock">; 187 defm Link : VerbatimBlockCommand<"link", "/link">; 188 189 //===----------------------------------------------------------------------===// 190 // VerbatimLineCommand 191 //===----------------------------------------------------------------------===// 192 193 def Defgroup : VerbatimLineCommand<"defgroup">; 194 def Ingroup : VerbatimLineCommand<"ingroup">; 195 def Addtogroup : VerbatimLineCommand<"addtogroup">; 196 def Weakgroup : VerbatimLineCommand<"weakgroup">; 197 def Name : VerbatimLineCommand<"name">; 198 199 def Section : VerbatimLineCommand<"section">; 200 def Subsection : VerbatimLineCommand<"subsection">; 201 def Subsubsection : VerbatimLineCommand<"subsubsection">; 202 def Paragraph : VerbatimLineCommand<"paragraph">; 203 204 def Mainpage : VerbatimLineCommand<"mainpage">; 205 def Subpage : VerbatimLineCommand<"subpage">; 206 def Ref : VerbatimLineCommand<"ref">; 207 208 def Relates : VerbatimLineCommand<"relates">; 209 def Related : VerbatimLineCommand<"related">; 210 def RelatesAlso : VerbatimLineCommand<"relatesalso">; 211 def RelatedAlso : VerbatimLineCommand<"relatedalso">; 212 213 //===----------------------------------------------------------------------===// 214 // DeclarationVerbatimLineCommand 215 //===----------------------------------------------------------------------===// 216 217 // Doxygen commands. 218 def Def : DeclarationVerbatimLineCommand<"def">; 219 def Fn : DeclarationVerbatimLineCommand<"fn">; 220 def Namespace : DeclarationVerbatimLineCommand<"namespace">; 221 def Overload : DeclarationVerbatimLineCommand<"overload">; 222 def Property : DeclarationVerbatimLineCommand<"property">; 223 def Typedef : DeclarationVerbatimLineCommand<"typedef">; 224 def Var : DeclarationVerbatimLineCommand<"var">; 225 226 // HeaderDoc commands. 227 def Class : RecordLikeDeclarationVerbatimLineCommand<"class">; 228 def Interface : RecordLikeDeclarationVerbatimLineCommand<"interface">; 229 def Protocol : RecordLikeDeclarationVerbatimLineCommand<"protocol">; 230 def Struct : RecordLikeDeclarationVerbatimLineCommand<"struct">; 231 def Union : RecordLikeDeclarationVerbatimLineCommand<"union">; 232 def Category : DeclarationVerbatimLineCommand<"category">; 233 def Template : DeclarationVerbatimLineCommand<"template">; 234 def Function : FunctionDeclarationVerbatimLineCommand<"function">; 235 def FunctionGroup : FunctionDeclarationVerbatimLineCommand<"functiongroup">; 236 def Method : FunctionDeclarationVerbatimLineCommand<"method">; 237 def MethodGroup : FunctionDeclarationVerbatimLineCommand<"methodgroup">; 238 def Callback : FunctionDeclarationVerbatimLineCommand<"callback">; 239 def Const : DeclarationVerbatimLineCommand<"const">; 240 def Constant : DeclarationVerbatimLineCommand<"constant">; 241 def Enum : DeclarationVerbatimLineCommand<"enum">; 242