prism-aql.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. Prism.languages.aql = {
  2. 'comment': /\/\/.*|\/\*[\s\S]*?\*\//,
  3. 'property': {
  4. pattern: /([{,]\s*)(?:(?!\d)\w+|(["'´`])(?:(?!\2)[^\\\r\n]|\\.)*\2)(?=\s*:)/,
  5. lookbehind: true,
  6. greedy: true
  7. },
  8. 'string': {
  9. pattern: /(["'])(?:(?!\1)[^\\\r\n]|\\.)*\1/,
  10. greedy: true
  11. },
  12. 'identifier': {
  13. pattern: /([´`])(?:(?!\1)[^\\\r\n]|\\.)*\1/,
  14. greedy: true
  15. },
  16. 'variable': /@@?\w+/,
  17. 'keyword': [
  18. {
  19. pattern: /(\bWITH\s+)COUNT(?=\s+INTO\b)/i,
  20. lookbehind: true
  21. },
  22. /\b(?:AGGREGATE|ALL|AND|ANY|ASC|COLLECT|DESC|DISTINCT|FILTER|FOR|GRAPH|IN|INBOUND|INSERT|INTO|K_PATHS|K_SHORTEST_PATHS|LET|LIKE|LIMIT|NONE|NOT|NULL|OR|OUTBOUND|REMOVE|REPLACE|RETURN|SHORTEST_PATH|SORT|UPDATE|UPSERT|WINDOW|WITH)\b/i,
  23. // pseudo keywords get a lookbehind to avoid false positives
  24. {
  25. pattern: /(^|[^\w.[])(?:KEEP|PRUNE|SEARCH|TO)\b/i,
  26. lookbehind: true
  27. },
  28. {
  29. pattern: /(^|[^\w.[])(?:CURRENT|NEW|OLD)\b/,
  30. lookbehind: true
  31. },
  32. {
  33. pattern: /\bOPTIONS(?=\s*\{)/i
  34. }
  35. ],
  36. 'function': /\b(?!\d)\w+(?=\s*\()/,
  37. 'boolean': /\b(?:false|true)\b/i,
  38. 'range': {
  39. pattern: /\.\./,
  40. alias: 'operator'
  41. },
  42. 'number': [
  43. /\b0b[01]+/i,
  44. /\b0x[0-9a-f]+/i,
  45. /(?:\B\.\d+|\b(?:0|[1-9]\d*)(?:\.\d+)?)(?:e[+-]?\d+)?/i
  46. ],
  47. 'operator': /\*{2,}|[=!]~|[!=<>]=?|&&|\|\||[-+*/%]/,
  48. 'punctuation': /::|[?.:,;()[\]{}]/
  49. };