leaf.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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: '\\(', end: '\\)',
  28. endsParent: true,
  29. contains: [
  30. {
  31. className: 'string',
  32. begin: '"',
  33. end: '"'
  34. },
  35. {
  36. className: 'variable',
  37. begin: '[A-Za-z_][A-Za-z_0-9]*'
  38. }
  39. ]
  40. }
  41. ]
  42. }
  43. ]
  44. };
  45. }
  46. module.exports = leaf;