syntax.ts 709 B

12345678910111213141516171819202122232425262728293031
  1. import { Grammar } from 'prismjs';
  2. /* tslint:disable max-line-length */
  3. const tokenizer: Grammar = {
  4. comment: {
  5. pattern: /(^|[^\n])#.*/,
  6. lookbehind: true,
  7. },
  8. 'context-labels': {
  9. pattern: /(^|\s)\{[^}]*(?=})/,
  10. lookbehind: true,
  11. inside: {
  12. 'label-key': {
  13. pattern: /[a-z_]\w*(?=\s*(=|!=|=~|!~))/,
  14. alias: 'attr-name',
  15. },
  16. 'label-value': {
  17. pattern: /"(?:\\.|[^\\"])*"/,
  18. greedy: true,
  19. alias: 'attr-value',
  20. },
  21. punctuation: /[{]/,
  22. },
  23. },
  24. // number: /\b-?\d+((\.\d*)?([eE][+-]?\d+)?)?\b/,
  25. operator: new RegExp(`/&&?|\\|?\\||!=?|<(?:=>?|<|>)?|>[>=]?`, 'i'),
  26. punctuation: /[{}`,.]/,
  27. };
  28. export default tokenizer;