basant307/AI_Governance_Project
048
1/*2Language: .properties3Contributors: Valentin Aitken <valentin@nalisbg.com>, Egor Rogov <e.rogov@postgrespro.ru>4Website: https://en.wikipedia.org/wiki/.properties5Category: config6*/7 8/** @type LanguageFn */9function properties(hljs) {10 // whitespaces: space, tab, formfeed11 const WS0 = '[ \\t\\f]*';12 const WS1 = '[ \\t\\f]+';13 // delimiter14 const EQUAL_DELIM = WS0 + '[:=]' + WS0;15 const WS_DELIM = WS1;16 const DELIM = '(' + EQUAL_DELIM + '|' + WS_DELIM + ')';17 const KEY = '([^\\\\:= \\t\\f\\n]|\\\\.)+';18 19 const DELIM_AND_VALUE = {20 // skip DELIM21 end: DELIM,22 relevance: 0,23 starts: {24 // value: everything until end of line (again, taking into account backslashes)25 className: 'string',26 end: /$/,27 relevance: 0,28 contains: [29 { begin: '\\\\\\\\' },30 { begin: '\\\\\\n' }31 ]32 }33 };34 35 return {36 name: '.properties',37 disableAutodetect: true,38 case_insensitive: true,39 illegal: /\S/,40 contains: [41 hljs.COMMENT('^\\s*[!#]', '$'),42 // key: everything until whitespace or = or : (taking into account backslashes)43 // case of a key-value pair44 {45 returnBegin: true,46 variants: [47 { begin: KEY + EQUAL_DELIM },48 { begin: KEY + WS_DELIM }49 ],50 contains: [51 {52 className: 'attr',53 begin: KEY,54 endsParent: true55 }56 ],57 starts: DELIM_AND_VALUE58 },59 // case of an empty key60 {61 className: 'attr',62 begin: KEY + WS0 + '$'63 }64 ]65 };66}67 68export { properties as default };69 