CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
reasonml.js143 linesDownload Raw Back to languages
1/*2Language: ReasonML3Description: Reason lets you write simple, fast and quality type safe code while leveraging both the JavaScript & OCaml ecosystems.4Website: https://reasonml.github.io5Author: Gidi Meir Morris <oss@gidi.io>6Category: functional7*/8function reasonml(hljs) {9  const BUILT_IN_TYPES = [10    "array",11    "bool",12    "bytes",13    "char",14    "exn|5",15    "float",16    "int",17    "int32",18    "int64",19    "list",20    "lazy_t|5",21    "nativeint|5",22    "ref",23    "string",24    "unit",25  ];26  return {27    name: 'ReasonML',28    aliases: [ 're' ],29    keywords: {30      $pattern:  /[a-z_]\w*!?/,31      keyword: [32        "and",33        "as",34        "asr",35        "assert",36        "begin",37        "class",38        "constraint",39        "do",40        "done",41        "downto",42        "else",43        "end",44        "esfun",45        "exception",46        "external",47        "for",48        "fun",49        "function",50        "functor",51        "if",52        "in",53        "include",54        "inherit",55        "initializer",56        "land",57        "lazy",58        "let",59        "lor",60        "lsl",61        "lsr",62        "lxor",63        "mod",64        "module",65        "mutable",66        "new",67        "nonrec",68        "object",69        "of",70        "open",71        "or",72        "pri",73        "pub",74        "rec",75        "sig",76        "struct",77        "switch",78        "then",79        "to",80        "try",81        "type",82        "val",83        "virtual",84        "when",85        "while",86        "with",87      ],88      built_in: BUILT_IN_TYPES,89      literal: ["true", "false"],90    },91    illegal: /(:-|:=|\$\{|\+=)/,92    contains: [93      {94        scope: 'literal',95        match: /\[(\|\|)?\]|\(\)/,96        relevance: 097      },98      hljs.C_LINE_COMMENT_MODE,99      hljs.COMMENT(/\/\*/, /\*\//, { illegal: /^(#,\/\/)/ }),100      { /* type variable */101        scope: 'symbol',102        match: /\'[A-Za-z_](?!\')[\w\']*/103        /* the grammar is ambiguous on how 'a'b should be interpreted but not the compiler */104      },105      { /* polymorphic variant */106        scope: 'type',107        match: /`[A-Z][\w\']*/108      },109      { /* module or constructor */110        scope: 'type',111        match: /\b[A-Z][\w\']*/,112        relevance: 0113      },114      { /* don't color identifiers, but safely catch all identifiers with ' */115      match: /[a-z_]\w*\'[\w\']*/,116        relevance: 0117      },118      {119        scope: 'operator',120        match: /\s+(\|\||\+[\+\.]?|\*[\*\/\.]?|\/[\.]?|\.\.\.|\|>|&&|===?)\s+/,121        relevance: 0122      },      123      hljs.inherit(hljs.APOS_STRING_MODE, {124        scope: 'string',125        relevance: 0126      }),127      hljs.inherit(hljs.QUOTE_STRING_MODE, { illegal: null }),128      {129        scope: 'number',130        variants: [131          { match: /\b0[xX][a-fA-F0-9_]+[Lln]?/ },132          { match: /\b0[oO][0-7_]+[Lln]?/ },133          { match: /\b0[bB][01_]+[Lln]?/ },134          { match: /\b[0-9][0-9_]*([Lln]|(\.[0-9_]*)?([eE][-+]?[0-9_]+)?)/ },135        ],136        relevance: 0137      },138    ]139  };140}141 142export { reasonml as default };143