module.exports = function(hljs) { var NUMBERS = { className: 'number', relevance: 0, variants: [ { begin: /([\+\-]+)?[\d]+_[\d_]+/ }, { begin: hljs.NUMBER_RE } ] }; var COMMENTS = hljs.COMMENT(); COMMENTS.variants = [ {begin: /;/, end: /$/}, {begin: /#/, end: /$/}, ]; var VARIABLES = { className: 'variable', variants: [ { begin: /\$[\w\d"][\w\d_]*/ }, { begin: /\$\{(.*?)}/ } ] }; var LITERALS = { className: 'literal', begin: /\bon|off|true|false|yes|no\b/ }; var STRINGS = { className: "string", contains: [hljs.BACKSLASH_ESCAPE], variants: [ { begin: "'''", end: "'''", relevance: 10 }, { begin: '"""', end: '"""', relevance: 10 }, { begin: '"', end: '"' }, { begin: "'", end: "'" } ] }; var ARRAY = { begin: /\[/, end: /\]/, contains: [ COMMENTS, LITERALS, VARIABLES, STRINGS, NUMBERS, 'self' ], relevance:0 }; return { aliases: ['toml'], case_insensitive: true, illegal: /\S/, contains: [ COMMENTS, { className: 'section', begin: /\[+/, end: /\]+/ }, { begin: /^[a-z0-9\[\]_\.-]+(?=\s*=\s*)/, className: 'attr', starts: { end: /$/, contains: [ COMMENTS, ARRAY, LITERALS, VARIABLES, STRINGS, NUMBERS ] } } ] }; };