-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
source.mermaid.gitgraph.js
132 lines (130 loc) · 4.03 KB
/
source.mermaid.gitgraph.js
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// 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.json', 'source.mermaid'],
extensions: [],
names: [],
patterns: [{include: '#main'}],
repository: {
command: {
begin:
'(?i)(?:^|\\G|(?<=;))[ \\t]*(branch|checkout|cherry-pick|commit|merge|reset)(?=$|\\s)',
beginCaptures: {
1: {name: 'keyword.operator.git-action.${1:/downcase}.mermaid'}
},
end: '(?=\\s*(?:$|;))',
name: 'meta.${1:/downcase}.statement.mermaid',
patterns: [
{
captures: {1: {name: 'entity.name.object.mermaid'}},
match: '\\G\\s*([^"\\s:;]+)(?=$|\\s|;)(?!\\s*:)'
},
{include: '#string'},
{include: '#fields'}
]
},
fields: {
patterns: [
{include: '#order'},
{include: '#tag'},
{include: '#type'},
{
begin: '(?i)(?:^|\\G|(?<=\\s))\\s*((?=\\w)[-\\w]+)\\s*(:)[ \\t]*',
beginCaptures: {
1: {name: 'variable.assignment.field.user-defined.mermaid'},
2: {patterns: [{include: 'source.mermaid#colon'}]}
},
end: '(?!\\G)',
patterns: [{include: '#unquoted-string'}, {include: '#string'}]
}
]
},
main: {
patterns: [
{include: 'source.mermaid#a11y'},
{include: 'source.mermaid#directive'},
{include: 'source.mermaid#comment'},
{include: 'source.mermaid#terminator'},
{include: '#options'},
{include: '#command'}
]
},
options: {
begin: '(?i)(?:^|\\G|(?<=\\s))(options)[ \\t]*$',
beginCaptures: {1: {name: 'keyword.control.options.begin.mermaid'}},
contentName: 'source.embedded.json',
end: '^\\s*(end)(?=$|\\s)',
endCaptures: {1: {name: 'keyword.control.options.end.mermaid'}},
name: 'meta.options.mermaid',
patterns: [{include: 'source.json'}]
},
order: {
begin: '(?i)(?:^|\\G|(?<=\\s))\\s*(order)\\s*(:)[ \\t]*',
beginCaptures: {
1: {name: 'variable.assignment.field.mermaid'},
2: {patterns: [{include: 'source.mermaid#colon'}]}
},
end: '(?!\\G)',
name: 'meta.field.order.mermaid',
patterns: [
{
match: '\\G[-+]?\\d+(?:\\.\\d+)?',
name: 'constant.numeric.decimal.order.index.mermaid'
}
]
},
string: {
begin: '(?:^|\\G|(?<=\\s))"',
beginCaptures: {0: {name: 'punctuation.definition.string.begin.mermaid'}},
end: '(")|([^"\\r\\n]*)$',
endCaptures: {
1: {name: 'punctuation.definition.string.end.mermaid'},
2: {name: 'invalid.illegal.unclosed-string.mermaid'}
},
name: 'string.quoted.double.mermaid',
patterns: [{include: 'source.mermaid#entity'}]
},
tag: {
begin: '(?i)(?:^|\\G|(?<=\\s))\\s*(tag)\\s*(:)[ \\t]*',
beginCaptures: {
1: {name: 'variable.assignment.field.mermaid'},
2: {patterns: [{include: 'source.mermaid#colon'}]}
},
end: '(?!\\G)',
name: 'meta.field.tag.mermaid',
patterns: [{include: '#string'}]
},
type: {
begin: '(?i)(?:^|\\G|(?<=\\s))\\s*(type)\\s*(:)[ \\t]*',
beginCaptures: {
1: {name: 'variable.assignment.field.mermaid'},
2: {patterns: [{include: 'source.mermaid#colon'}]}
},
end: '(?!\\G)',
name: 'meta.field.type.mermaid',
patterns: [
{
match: '\\G(HIGHLIGHT|NORMAL|REVERSE)(?=$|\\s)',
name: 'constant.language.merge-type.mermaid'
},
{
match: '\\G[^\\s;]+',
name: 'invalid.illegal.unrecognised-type.mermaid'
}
]
},
'unquoted-string': {
match: '(?:\\G)[^\\s":;]+(?!\\s*:)',
name: 'string.unquoted.bareword.mermaid'
}
},
scopeName: 'source.mermaid.gitgraph'
}
export default grammar