CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
json.js55 linesDownload Raw Back to languages
1/*2Language: JSON3Description: JSON (JavaScript Object Notation) is a lightweight data-interchange format.4Author: Ivan Sagalaev <maniac@softwaremaniacs.org>5Website: http://www.json.org6Category: common, protocols, web7*/8 9function json(hljs) {10  const ATTRIBUTE = {11    className: 'attr',12    begin: /"(\\.|[^\\"\r\n])*"(?=\s*:)/,13    relevance: 1.0114  };15  const PUNCTUATION = {16    match: /[{}[\],:]/,17    className: "punctuation",18    relevance: 019  };20  const LITERALS = [21    "true",22    "false",23    "null"24  ];25  // NOTE: normally we would rely on `keywords` for this but using a mode here allows us26  // - to use the very tight `illegal: \S` rule later to flag any other character27  // - as illegal indicating that despite looking like JSON we do not truly have28  // - JSON and thus improve false-positively greatly since JSON will try and claim29  // - all sorts of JSON looking stuff30  const LITERALS_MODE = {31    scope: "literal",32    beginKeywords: LITERALS.join(" "),33  };34 35  return {36    name: 'JSON',37    aliases: ['jsonc'],38    keywords:{39      literal: LITERALS,40    },41    contains: [42      ATTRIBUTE,43      PUNCTUATION,44      hljs.QUOTE_STRING_MODE,45      LITERALS_MODE,46      hljs.C_NUMBER_MODE,47      hljs.C_LINE_COMMENT_MODE,48      hljs.C_BLOCK_COMMENT_MODE49    ],50    illegal: '\\S'51  };52}53 54export { json as default };55 
basant307/AI_Governance_Project · CoolFace