UNPKG

refractor

Version:

Lightweight, robust, elegant virtual syntax highlighting using Prism

32 lines (30 loc) 729 B
'use strict'; module.exports = graphql; graphql.displayName = 'graphql'; graphql.aliases = []; function graphql(Prism) { Prism.languages.graphql = { comment: /#.*/, string: { pattern: /"(?:\\.|[^\\"\r\n])*"/, greedy: true }, number: /(?:\B-|\b)\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b/, boolean: /\b(?:true|false)\b/, variable: /\$[a-z_]\w*/i, directive: { pattern: /@[a-z_]\w*/i, alias: 'function' }, 'attr-name': /[a-z_]\w*(?=\s*:)/i, keyword: [ { pattern: /(fragment\s+(?!on)[a-z_]\w*\s+|\.{3}\s*)on\b/, lookbehind: true }, /\b(?:query|fragment|mutation)\b/ ], operator: /!|=|\.{3}/, punctuation: /[!(){}\[\]:=,]/ }; }