parser3.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. Language: Parser3
  3. Requires: xml.js
  4. Author: Oleg Volchkov <oleg@volchkov.net>
  5. Website: https://www.parser.ru/en/
  6. Category: template
  7. */
  8. function parser3(hljs) {
  9. const CURLY_SUBCOMMENT = hljs.COMMENT(
  10. /\{/,
  11. /\}/,
  12. {
  13. contains: [ 'self' ]
  14. }
  15. );
  16. return {
  17. name: 'Parser3',
  18. subLanguage: 'xml',
  19. relevance: 0,
  20. contains: [
  21. hljs.COMMENT('^#', '$'),
  22. hljs.COMMENT(
  23. /\^rem\{/,
  24. /\}/,
  25. {
  26. relevance: 10,
  27. contains: [ CURLY_SUBCOMMENT ]
  28. }
  29. ),
  30. {
  31. className: 'meta',
  32. begin: '^@(?:BASE|USE|CLASS|OPTIONS)$',
  33. relevance: 10
  34. },
  35. {
  36. className: 'title',
  37. begin: '@[\\w\\-]+\\[[\\w^;\\-]*\\](?:\\[[\\w^;\\-]*\\])?(?:.*)$'
  38. },
  39. {
  40. className: 'variable',
  41. begin: /\$\{?[\w\-.:]+\}?/
  42. },
  43. {
  44. className: 'keyword',
  45. begin: /\^[\w\-.:]+/
  46. },
  47. {
  48. className: 'number',
  49. begin: '\\^#[0-9a-fA-F]+'
  50. },
  51. hljs.C_NUMBER_MODE
  52. ]
  53. };
  54. }
  55. module.exports = parser3;