sterzycom/assets/js/components/prism-graphql.js
2019-01-25 13:45:36 +01:00

24 lines
No EOL
538 B
JavaScript
Executable file

Prism.languages.graphql = {
'comment': /#.*/,
'string': {
pattern: /"(?:\\.|[^\\"])*"/,
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+|\.\.\.\s*)on\b/,
lookbehind: true
},
/\b(?:query|fragment|mutation)\b/
],
'operator': /!|=|\.{3}/,
'punctuation': /[!(){}\[\]:=,]/
};