main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[d24f17c] | 1 | 'use strict'
|
---|
| 2 |
|
---|
| 3 | module.exports = ini
|
---|
| 4 | ini.displayName = 'ini'
|
---|
| 5 | ini.aliases = []
|
---|
| 6 | function ini(Prism) {
|
---|
| 7 | Prism.languages.ini = {
|
---|
| 8 | /**
|
---|
| 9 | * The component mimics the behavior of the Win32 API parser.
|
---|
| 10 | *
|
---|
| 11 | * @see {@link https://github.com/PrismJS/prism/issues/2775#issuecomment-787477723}
|
---|
| 12 | */
|
---|
| 13 | comment: {
|
---|
| 14 | pattern: /(^[ \f\t\v]*)[#;][^\n\r]*/m,
|
---|
| 15 | lookbehind: true
|
---|
| 16 | },
|
---|
| 17 | section: {
|
---|
| 18 | pattern: /(^[ \f\t\v]*)\[[^\n\r\]]*\]?/m,
|
---|
| 19 | lookbehind: true,
|
---|
| 20 | inside: {
|
---|
| 21 | 'section-name': {
|
---|
| 22 | pattern: /(^\[[ \f\t\v]*)[^ \f\t\v\]]+(?:[ \f\t\v]+[^ \f\t\v\]]+)*/,
|
---|
| 23 | lookbehind: true,
|
---|
| 24 | alias: 'selector'
|
---|
| 25 | },
|
---|
| 26 | punctuation: /\[|\]/
|
---|
| 27 | }
|
---|
| 28 | },
|
---|
| 29 | key: {
|
---|
| 30 | pattern:
|
---|
| 31 | /(^[ \f\t\v]*)[^ \f\n\r\t\v=]+(?:[ \f\t\v]+[^ \f\n\r\t\v=]+)*(?=[ \f\t\v]*=)/m,
|
---|
| 32 | lookbehind: true,
|
---|
| 33 | alias: 'attr-name'
|
---|
| 34 | },
|
---|
| 35 | value: {
|
---|
| 36 | pattern: /(=[ \f\t\v]*)[^ \f\n\r\t\v]+(?:[ \f\t\v]+[^ \f\n\r\t\v]+)*/,
|
---|
| 37 | lookbehind: true,
|
---|
| 38 | alias: 'attr-value',
|
---|
| 39 | inside: {
|
---|
| 40 | 'inner-value': {
|
---|
| 41 | pattern: /^("|').+(?=\1$)/,
|
---|
| 42 | lookbehind: true
|
---|
| 43 | }
|
---|
| 44 | }
|
---|
| 45 | },
|
---|
| 46 | punctuation: /=/
|
---|
| 47 | }
|
---|
| 48 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.