summaryrefslogtreecommitdiffstats
path: root/public/prism/prism-ocaml.min.js
blob: 3c434252f6b7618e0ee6f2b1a866da97568d8aed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Prism.languages.ocaml = {
  comment: { pattern: /\(\*[\s\S]*?\*\)/, greedy: !0 },
  char: { pattern: /'(?:[^\\\r\n']|\\(?:.|[ox]?[0-9a-f]{1,3}))'/i, greedy: !0 },
  string: [
    { pattern: /"(?:\\(?:[\s\S]|\r\n)|[^\\\r\n"])*"/, greedy: !0 },
    { pattern: /\{([a-z_]*)\|[\s\S]*?\|\1\}/, greedy: !0 },
  ],
  number: [
    /\b(?:0b[01][01_]*|0o[0-7][0-7_]*)\b/i,
    /\b0x[a-f0-9][a-f0-9_]*(?:\.[a-f0-9_]*)?(?:p[+-]?\d[\d_]*)?(?!\w)/i,
    /\b\d[\d_]*(?:\.[\d_]*)?(?:e[+-]?\d[\d_]*)?(?!\w)/i,
  ],
  directive: { pattern: /\B#\w+/, alias: 'property' },
  label: { pattern: /\B~\w+/, alias: 'property' },
  'type-variable': { pattern: /\B'\w+/, alias: 'function' },
  variant: { pattern: /`\w+/, alias: 'symbol' },
  keyword:
    /\b(?:as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|match|method|module|mutable|new|nonrec|object|of|open|private|rec|sig|struct|then|to|try|type|val|value|virtual|when|where|while|with)\b/,
  boolean: /\b(?:false|true)\b/,
  'operator-like-punctuation': {
    pattern: /\[[<>|]|[>|]\]|\{<|>\}/,
    alias: 'punctuation',
  },
  operator:
    /\.[.~]|:[=>]|[=<>@^|&+\-*\/$%!?~][!$%&*+\-.\/:<=>?@^|~]*|\b(?:and|asr|land|lor|lsl|lsr|lxor|mod|or)\b/,
  punctuation: /;;|::|[(){}\[\].,:;#]|\b_\b/,
};
#39;Options', defaultValue: { summary: false }, }, type: { name: 'boolean', required: false, }, }, lang: { control: { type: 'text', }, table: { category: 'Options', }, description: 'The target language as code language.', type: { name: 'string', required: false, }, }, }, } as ComponentMeta<typeof Link>; const Template: ComponentStory<typeof Link> = (args) => <Link {...args} />; /** * Links Stories - Default */ export const Default = Template.bind({}); Default.args = { children: 'A link', href: '#', }; /** * Links Stories - Download */ export const DownloadLink = Template.bind({}); DownloadLink.args = { children: 'A link to a file', href: '#', isDownload: true, isExternal: false, }; /** * Links Stories - Download link with lang */ export const DownloadLinkWithLang = Template.bind({}); DownloadLinkWithLang.args = { children: 'A link to a file', href: '#', isDownload: true, isExternal: false, lang: 'en', }; /** * Links Stories - External */ export const ExternalLink = Template.bind({}); ExternalLink.args = { children: 'A link', href: '#', isDownload: false, isExternal: true, }; /** * Links Stories - External download link */ export const ExternalDownload = Template.bind({}); ExternalDownload.args = { children: 'A link', href: '#', isDownload: true, isExternal: true, }; /** * Links Stories - External link with Lang */ export const ExternalLinkWithLang = Template.bind({}); ExternalLinkWithLang.args = { children: 'A link', href: '#', isDownload: false, isExternal: true, lang: 'en', }; /** * Links Stories - External download with lang */ export const ExternalDownloadWithLang = Template.bind({}); ExternalDownloadWithLang.args = { children: 'A link', href: '#', isDownload: true, isExternal: true, lang: 'en', }; /** * Links Stories - With Lang */ export const LinkLang = Template.bind({}); LinkLang.args = { children: 'A link', href: '#', isDownload: false, isExternal: false, lang: 'en', };