prism-ini.js 929 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. Prism.languages.ini = {
  2. /**
  3. * The component mimics the behavior of the Win32 API parser.
  4. *
  5. * @see {@link https://github.com/PrismJS/prism/issues/2775#issuecomment-787477723}
  6. */
  7. 'comment': {
  8. pattern: /(^[ \f\t\v]*)[#;][^\n\r]*/m,
  9. lookbehind: true
  10. },
  11. 'section': {
  12. pattern: /(^[ \f\t\v]*)\[[^\n\r\]]*\]?/m,
  13. lookbehind: true,
  14. inside: {
  15. 'section-name': {
  16. pattern: /(^\[[ \f\t\v]*)[^ \f\t\v\]]+(?:[ \f\t\v]+[^ \f\t\v\]]+)*/,
  17. lookbehind: true,
  18. alias: 'selector'
  19. },
  20. 'punctuation': /\[|\]/
  21. }
  22. },
  23. 'key': {
  24. pattern: /(^[ \f\t\v]*)[^ \f\n\r\t\v=]+(?:[ \f\t\v]+[^ \f\n\r\t\v=]+)*(?=[ \f\t\v]*=)/m,
  25. lookbehind: true,
  26. alias: 'attr-name'
  27. },
  28. 'value': {
  29. pattern: /(=[ \f\t\v]*)[^ \f\n\r\t\v]+(?:[ \f\t\v]+[^ \f\n\r\t\v]+)*/,
  30. lookbehind: true,
  31. alias: 'attr-value',
  32. inside: {
  33. 'inner-value': {
  34. pattern: /^("|').+(?=\1$)/,
  35. lookbehind: true
  36. }
  37. }
  38. },
  39. 'punctuation': /=/
  40. };