basant307/AI_Governance_Project
048
1/*2Language: Delphi3Website: https://www.embarcadero.com/products/delphi4Category: system5*/6 7/** @type LanguageFn */8function delphi(hljs) {9 const KEYWORDS = [10 "exports",11 "register",12 "file",13 "shl",14 "array",15 "record",16 "property",17 "for",18 "mod",19 "while",20 "set",21 "ally",22 "label",23 "uses",24 "raise",25 "not",26 "stored",27 "class",28 "safecall",29 "var",30 "interface",31 "or",32 "private",33 "static",34 "exit",35 "index",36 "inherited",37 "to",38 "else",39 "stdcall",40 "override",41 "shr",42 "asm",43 "far",44 "resourcestring",45 "finalization",46 "packed",47 "virtual",48 "out",49 "and",50 "protected",51 "library",52 "do",53 "xorwrite",54 "goto",55 "near",56 "function",57 "end",58 "div",59 "overload",60 "object",61 "unit",62 "begin",63 "string",64 "on",65 "inline",66 "repeat",67 "until",68 "destructor",69 "write",70 "message",71 "program",72 "with",73 "read",74 "initialization",75 "except",76 "default",77 "nil",78 "if",79 "case",80 "cdecl",81 "in",82 "downto",83 "threadvar",84 "of",85 "try",86 "pascal",87 "const",88 "external",89 "constructor",90 "type",91 "public",92 "then",93 "implementation",94 "finally",95 "published",96 "procedure",97 "absolute",98 "reintroduce",99 "operator",100 "as",101 "is",102 "abstract",103 "alias",104 "assembler",105 "bitpacked",106 "break",107 "continue",108 "cppdecl",109 "cvar",110 "enumerator",111 "experimental",112 "platform",113 "deprecated",114 "unimplemented",115 "dynamic",116 "export",117 "far16",118 "forward",119 "generic",120 "helper",121 "implements",122 "interrupt",123 "iochecks",124 "local",125 "name",126 "nodefault",127 "noreturn",128 "nostackframe",129 "oldfpccall",130 "otherwise",131 "saveregisters",132 "softfloat",133 "specialize",134 "strict",135 "unaligned",136 "varargs"137 ];138 const COMMENT_MODES = [139 hljs.C_LINE_COMMENT_MODE,140 hljs.COMMENT(/\{/, /\}/, { relevance: 0 }),141 hljs.COMMENT(/\(\*/, /\*\)/, { relevance: 10 })142 ];143 const DIRECTIVE = {144 className: 'meta',145 variants: [146 {147 begin: /\{\$/,148 end: /\}/149 },150 {151 begin: /\(\*\$/,152 end: /\*\)/153 }154 ]155 };156 const STRING = {157 className: 'string',158 begin: /'/,159 end: /'/,160 contains: [ { begin: /''/ } ]161 };162 const NUMBER = {163 className: 'number',164 relevance: 0,165 // Source: https://www.freepascal.org/docs-html/ref/refse6.html166 variants: [167 {168 // Regular numbers, e.g., 123, 123.456.169 match: /\b\d[\d_]*(\.\d[\d_]*)?/ },170 {171 // Hexadecimal notation, e.g., $7F.172 match: /\$[\dA-Fa-f_]+/ },173 {174 // Hexadecimal literal with no digits175 match: /\$/,176 relevance: 0 },177 {178 // Octal notation, e.g., &42.179 match: /&[0-7][0-7_]*/ },180 {181 // Binary notation, e.g., %1010.182 match: /%[01_]+/ },183 {184 // Binary literal with no digits185 match: /%/,186 relevance: 0 }187 ]188 };189 const CHAR_STRING = {190 className: 'string',191 variants: [192 { match: /#\d[\d_]*/ },193 { match: /#\$[\dA-Fa-f][\dA-Fa-f_]*/ },194 { match: /#&[0-7][0-7_]*/ },195 { match: /#%[01][01_]*/ }196 ]197 };198 const CLASS = {199 begin: hljs.IDENT_RE + '\\s*=\\s*class\\s*\\(',200 returnBegin: true,201 contains: [ hljs.TITLE_MODE ]202 };203 const FUNCTION = {204 className: 'function',205 beginKeywords: 'function constructor destructor procedure',206 end: /[:;]/,207 keywords: 'function constructor|10 destructor|10 procedure|10',208 contains: [209 hljs.TITLE_MODE,210 {211 className: 'params',212 begin: /\(/,213 end: /\)/,214 keywords: KEYWORDS,215 contains: [216 STRING,217 CHAR_STRING,218 DIRECTIVE219 ].concat(COMMENT_MODES)220 },221 DIRECTIVE222 ].concat(COMMENT_MODES)223 };224 return {225 name: 'Delphi',226 aliases: [227 'dpr',228 'dfm',229 'pas',230 'pascal'231 ],232 case_insensitive: true,233 keywords: KEYWORDS,234 illegal: /"|\$[G-Zg-z]|\/\*|<\/|\|/,235 contains: [236 STRING,237 CHAR_STRING,238 NUMBER,239 CLASS,240 FUNCTION,241 DIRECTIVE242 ].concat(COMMENT_MODES)243 };244}245 246export { delphi as default };247 