prism-awk.js 826 B

1234567891011121314151617181920212223242526272829303132
  1. Prism.languages.awk = {
  2. 'hashbang': {
  3. pattern: /^#!.*/,
  4. greedy: true,
  5. alias: 'comment'
  6. },
  7. 'comment': {
  8. pattern: /#.*/,
  9. greedy: true
  10. },
  11. 'string': {
  12. pattern: /(^|[^\\])"(?:[^\\"\r\n]|\\.)*"/,
  13. lookbehind: true,
  14. greedy: true
  15. },
  16. 'regex': {
  17. pattern: /((?:^|[^\w\s)])\s*)\/(?:[^\/\\\r\n]|\\.)*\//,
  18. lookbehind: true,
  19. greedy: true
  20. },
  21. 'variable': /\$\w+/,
  22. 'keyword': /\b(?:BEGIN|BEGINFILE|END|ENDFILE|break|case|continue|default|delete|do|else|exit|for|function|getline|if|in|next|nextfile|printf?|return|switch|while)\b|@(?:include|load)\b/,
  23. 'function': /\b[a-z_]\w*(?=\s*\()/i,
  24. 'number': /\b(?:\d+(?:\.\d+)?(?:e[+-]?\d+)?|0x[a-fA-F0-9]+)\b/,
  25. 'operator': /--|\+\+|!?~|>&|>>|<<|(?:\*\*|[<>!=+\-*/%^])=?|&&|\|[|&]|[?:]/,
  26. 'punctuation': /[()[\]{},;]/
  27. };
  28. Prism.languages.gawk = Prism.languages.awk;