awk.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. module.exports = function(hljs) {
  2. var VARIABLE = {
  3. className: 'variable',
  4. variants: [
  5. {begin: /\$[\w\d#@][\w\d_]*/},
  6. {begin: /\$\{(.*?)}/}
  7. ]
  8. };
  9. var KEYWORDS = 'BEGIN END if else while do for in break continue delete next nextfile function func exit|10';
  10. var STRING = {
  11. className: 'string',
  12. contains: [hljs.BACKSLASH_ESCAPE],
  13. variants: [
  14. {
  15. begin: /(u|b)?r?'''/, end: /'''/,
  16. relevance: 10
  17. },
  18. {
  19. begin: /(u|b)?r?"""/, end: /"""/,
  20. relevance: 10
  21. },
  22. {
  23. begin: /(u|r|ur)'/, end: /'/,
  24. relevance: 10
  25. },
  26. {
  27. begin: /(u|r|ur)"/, end: /"/,
  28. relevance: 10
  29. },
  30. {
  31. begin: /(b|br)'/, end: /'/
  32. },
  33. {
  34. begin: /(b|br)"/, end: /"/
  35. },
  36. hljs.APOS_STRING_MODE,
  37. hljs.QUOTE_STRING_MODE
  38. ]
  39. };
  40. return {
  41. keywords: {
  42. keyword: KEYWORDS
  43. },
  44. contains: [
  45. VARIABLE,
  46. STRING,
  47. hljs.REGEXP_MODE,
  48. hljs.HASH_COMMENT_MODE,
  49. hljs.NUMBER_MODE
  50. ]
  51. }
  52. };