UNPKG

679 BJavaScriptView Raw
1Prism.languages.prolog = {
2 // Syntax depends on the implementation
3 'comment': {
4 pattern: /\/\*[\s\S]*?\*\/|%.*/,
5 greedy: true
6 },
7 // Depending on the implementation, strings may allow escaped newlines and quote-escape
8 'string': {
9 pattern: /(["'])(?:\1\1|\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1(?!\1)/,
10 greedy: true
11 },
12 'builtin': /\b(?:fx|fy|xf[xy]?|yfx?)\b/,
13 // FIXME: Should we list all null-ary predicates (not followed by a parenthesis) like halt, trace, etc.?
14 'function': /\b[a-z]\w*(?:(?=\()|\/\d+)/,
15 'number': /\b\d+(?:\.\d*)?/,
16 // Custom operators are allowed
17 'operator': /[:\\=><\-?*@\/;+^|!$.]+|\b(?:is|mod|not|xor)\b/,
18 'punctuation': /[(){}\[\],]/
19};