leaf.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. Language: Leaf
  3. Author: Hale Chan <halechan@qq.com>
  4. Description: Based on the Leaf reference from https://vapor.github.io/documentation/guide/leaf.html.
  5. */
  6. function leaf(hljs) {
  7. return {
  8. name: 'Leaf',
  9. contains: [
  10. {
  11. className: 'function',
  12. begin: '#+' + '[A-Za-z_0-9]*' + '\\(',
  13. end: / \{/,
  14. returnBegin: true,
  15. excludeEnd: true,
  16. contains: [
  17. {
  18. className: 'keyword',
  19. begin: '#+'
  20. },
  21. {
  22. className: 'title',
  23. begin: '[A-Za-z_][A-Za-z_0-9]*'
  24. },
  25. {
  26. className: 'params',
  27. begin: '\\(',
  28. end: '\\)',
  29. endsParent: true,
  30. contains: [
  31. {
  32. className: 'string',
  33. begin: '"',
  34. end: '"'
  35. },
  36. {
  37. className: 'variable',
  38. begin: '[A-Za-z_][A-Za-z_0-9]*'
  39. }
  40. ]
  41. }
  42. ]
  43. }
  44. ]
  45. };
  46. }
  47. module.exports = leaf;