-
-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathsource.mermaid.quad-chart.js
More file actions
117 lines (115 loc) · 3.61 KB
/
source.mermaid.quad-chart.js
File metadata and controls
117 lines (115 loc) · 3.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is developed at
// <https://github.com/Alhadis/language-mermaid>
// and licensed `isc`.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
dependencies: ['source.mermaid'],
extensions: [],
names: [],
patterns: [{include: '#main'}],
repository: {
axes: {
begin: '(?i)^\\s*([xy]-axis)(?=$|\\s)',
beginCaptures: {1: {name: 'keyword.operator.axis.mermaid'}},
end: '(?=\\s*(?:$|%%))',
name: 'meta.${1:/downcase}.statement.mermaid',
patterns: [
{
captures: {1: {name: 'string.unquoted.axis-label.first.mermaid'}},
match: '\\G\\s*(\\S.+?)(?=\\s+--+>\\s|\\s*(?:$|%%))'
},
{
begin: '(?!\\G)[ \\t]+((--+>))(?:[ \\t]+|$)',
beginCaptures: {
1: {name: 'keyword.operator.label-separator.mermaid'},
2: {name: 'punctuation.definition.separator.mermaid'}
},
contentName: 'string.unquoted.axis-label.second.mermaid',
end: '(?=\\s*(?:$|%%))'
}
]
},
class: {
begin: '(?i)^\\s*(classDef)(?:\\s+(\\w+))?(?=\\s|$)',
beginCaptures: {
1: {name: 'storage.type.style-definition.mermaid'},
2: {name: 'entity.name.class.mermaid'}
},
end: '(?=\\s*(?:$|%%))',
name: 'meta.class-definition.statement.mermaid',
patterns: [{include: 'source.mermaid#inline-css'}]
},
coordinates: {
begin: '(\\[)',
beginCaptures: {
0: {name: 'punctuation.definition.array.begin.mermaid'},
1: {name: 'brackethighlighter.square'}
},
end: '(\\])',
endCaptures: {
0: {name: 'punctuation.definition.array.end.mermaid'},
1: {name: 'brackethighlighter.square'}
},
name: 'meta.array.coordinates.mermaid',
patterns: [
{
match: '[-+]?\\d+(?:\\.\\d+)?',
name: 'constant.numeric.decimal.ordinate.mermaid'
},
{include: 'source.mermaid#comma'}
]
},
main: {
patterns: [
{include: 'source.mermaid#a11y'},
{include: 'source.mermaid#directive'},
{include: 'source.mermaid#comment'},
{include: 'source.mermaid#title'},
{include: '#axes'},
{include: '#quads'},
{include: '#class'},
{include: '#points'}
]
},
points: {
applyEndPatternLast: true,
begin:
'^\\s*((?!\\s)(?:[-\\s\\w,!?.\'"*/\\\\&#`+=$]|%(?!%))++(?<!\\s))(?:(:::)(\\w+))?(:)',
beginCaptures: {
1: {name: 'entity.name.tag.point.mermaid'},
2: {name: 'keyword.operator.css-class.mermaid'},
3: {name: 'constant.language.css-class.mermaid'},
4: {name: 'keyword.operator.assignment.mermaid'}
},
end: '(?!\\G)',
name: 'meta.data-point.mermaid',
patterns: [
{
begin: '\\G',
end: '\\s*(?=\\[)|^\\s*([^\\s\\[])',
endCaptures: {1: {name: 'invalid.illegal.syntax.mermaid'}}
},
{include: '#coordinates'},
{
begin: '(?<=\\])\\s*(?=[^%\\s])',
end: '(?=\\s*(?:$|%%))',
patterns: [{include: 'source.mermaid#inline-css'}]
}
]
},
quads: {
begin: '(?i)^\\s*(quadrant-([1-4]))(?=$|\\s)',
beginCaptures: {1: {name: 'keyword.operator.quadrant.mermaid'}},
contentName: 'string.unquoted.quadrant-label.mermaid',
end: '(?=\\s*(?:$|%%))',
name: 'meta.quadrant.$2.mermaid'
}
},
scopeName: 'source.mermaid.quad-chart'
}
export default grammar