prism-prolog.js 676 B

1234567891011121314151617181920
  1. Prism.languages.prolog = {
  2. // Syntax depends on the implementation
  3. 'comment': [
  4. /%.+/,
  5. /\/\*[\s\S]*?\*\//
  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/,
  10. greedy: true
  11. },
  12. 'builtin': /\b(?:fx|fy|xf[xy]?|yfx?)\b/,
  13. 'variable': /\b[A-Z_]\w*/,
  14. // FIXME: Should we list all null-ary predicates (not followed by a parenthesis) like halt, trace, etc.?
  15. 'function': /\b[a-z]\w*(?:(?=\()|\/\d+)/,
  16. 'number': /\b\d+\.?\d*/,
  17. // Custom operators are allowed
  18. 'operator': /[:\\=><\-?*@\/;+^|!$.]+|\b(?:is|mod|not|xor)\b/,
  19. 'punctuation': /[(){}\[\],]/
  20. };