]> luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/properties.js
Initial commit.
[flow-web.git] / static / highlight / es / languages / properties.js
1 /*! `properties` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar = (function () {
3 'use strict';
4
5 /*
6 Language: .properties
7 Contributors: Valentin Aitken <valentin@nalisbg.com>, Egor Rogov <e.rogov@postgrespro.ru>
8 Website: https://en.wikipedia.org/wiki/.properties
9 Category: config
10 */
11
12 /** @type LanguageFn */
13 function properties(hljs) {
14 // whitespaces: space, tab, formfeed
15 const WS0 = '[ \\t\\f]*';
16 const WS1 = '[ \\t\\f]+';
17 // delimiter
18 const EQUAL_DELIM = WS0 + '[:=]' + WS0;
19 const WS_DELIM = WS1;
20 const DELIM = '(' + EQUAL_DELIM + '|' + WS_DELIM + ')';
21 const KEY = '([^\\\\:= \\t\\f\\n]|\\\\.)+';
22
23 const DELIM_AND_VALUE = {
24 // skip DELIM
25 end: DELIM,
26 relevance: 0,
27 starts: {
28 // value: everything until end of line (again, taking into account backslashes)
29 className: 'string',
30 end: /$/,
31 relevance: 0,
32 contains: [
33 { begin: '\\\\\\\\' },
34 { begin: '\\\\\\n' }
35 ]
36 }
37 };
38
39 return {
40 name: '.properties',
41 disableAutodetect: true,
42 case_insensitive: true,
43 illegal: /\S/,
44 contains: [
45 hljs.COMMENT('^\\s*[!#]', '$'),
46 // key: everything until whitespace or = or : (taking into account backslashes)
47 // case of a key-value pair
48 {
49 returnBegin: true,
50 variants: [
51 { begin: KEY + EQUAL_DELIM },
52 { begin: KEY + WS_DELIM }
53 ],
54 contains: [
55 {
56 className: 'attr',
57 begin: KEY,
58 endsParent: true
59 }
60 ],
61 starts: DELIM_AND_VALUE
62 },
63 // case of an empty key
64 {
65 className: 'attr',
66 begin: KEY + WS0 + '$'
67 }
68 ]
69 };
70 }
71
72 return properties;
73
74 })();
75 ;
76 export default hljsGrammar;