-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
text.sfd.js
165 lines (163 loc) · 5.23 KB
/
text.sfd.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is developed at
// <https://github.com/Alhadis/language-fontforge>
// 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.fontforge'],
extensions: ['.sfd'],
names: ['spline-font-database'],
patterns: [{include: '#main'}],
repository: {
address: {
match: '\\d+[xX][A-Fa-f0-9]+',
name: 'constant.numeric.hexadecimal.sfd'
},
colour: {
captures: {1: {name: 'punctuation.definition.colour.sfd'}},
match: '(#)[A-Fa-f0-9]{3,}|(?<=\\s)[A-Fa-f0-9]{6,8}',
name: 'constant.other.hex.colour.sfd'
},
comment: {
begin: '^(U?Comments?)(:)',
beginCaptures: {
1: {name: 'variable.assignment.property.sfd'},
2: {name: 'punctuation.separator.dictionary.key-value.sfd'}
},
contentName: 'comment.line.field.sfd',
end: '$',
name: 'meta.user-comments.sfd',
patterns: [{include: '#source.fontforge#stringEscapes'}]
},
control: {
match: '\\b(Fore|Back|SplineSet|^End\\w+)\\b',
name: 'keyword.control.${1:/downcase}.sfd'
},
copyright: {
begin: '^(Copyright)(:)',
beginCaptures: {
1: {name: 'variable.assignment.property.sfd'},
2: {name: 'punctuation.separator.dictionary.key-value.sfd'}
},
contentName: 'string.unquoted.copyright.info.sfd',
end: '$',
name: 'meta.copyright-string.sfd',
patterns: [{include: 'source.fontforge#stringEscapes'}]
},
encoding: {
match: '(?i)\\b(ISO[-\\w]+)(?<=\\d)(?=\\s|$)',
name: 'constant.language.encoding.sfd'
},
gaspTable: {
begin: '^(GaspTable)(:|(?=\\s))',
beginCaptures: {
1: {name: 'variable.assignment.property.sfd'},
2: {name: 'punctuation.separator.dictionary.key-value.sfd'}
},
end: '$',
name: 'meta.gasp-table.sfd',
patterns: [{include: '#main'}]
},
header: {
captures: {
1: {name: 'keyword.control.start.file.afm'},
2: {name: 'punctuation.separator.dictionary.key-value.sfd'}
},
match: '^(SplineFontDB)(:)',
name: 'meta.header.sfd'
},
image: {
begin: '^(Image)(?=:)(.+)$',
beginCaptures: {
1: {name: 'keyword.control.begin.image.sfd'},
2: {patterns: [{include: '#main'}]}
},
contentName: 'string.unquoted.raw.data.sfd',
end: '^(EndImage)\\b',
endCaptures: {1: {name: 'keyword.control.end.image.sfd'}},
name: 'meta.image.sfd'
},
main: {
patterns: [
{include: '#punctuation'},
{include: '#private'},
{include: '#header'},
{include: '#names'},
{include: '#image'},
{include: '#pickleData'},
{include: '#sections'},
{include: '#copyright'},
{include: '#comment'},
{include: '#gaspTable'},
{include: '#property'},
{include: '#control'},
{include: '#address'},
{include: '#encoding'},
{include: 'source.fontforge#shared'},
{include: '#colour'},
{include: '#unquoted'}
]
},
names: {
captures: {
1: {name: 'variable.assignment.property.sfd'},
3: {name: 'punctuation.separator.dictionary.key-value.sfd'},
4: {name: 'entity.name.${2:/downcase},sfd'}
},
match: '^((\\w+)Name)(:)\\s*(\\S+.*?)\\s$',
name: 'meta.dictionary.key-value.sfd'
},
pickleData: {
begin: '^(PickledData)(:)\\s*(")',
beginCaptures: {
1: {name: 'variable.assignment.property.sfd'},
2: {name: 'punctuation.separator.dictionary.key-value.sfd'},
3: {name: 'punctuation.definition.string.begin.sfd'}
},
end: '"',
endCaptures: {0: {name: 'punctuation.definition.string.end.sfd'}},
name: 'meta.pickle-data.sfd',
patterns: [{match: '\\\\.', name: 'constant.character.escape.sfd'}]
},
private: {
begin: '^BeginPrivate(?=:)',
beginCaptures: {0: {name: 'keyword.control.begin.private.sfd'}},
end: '^EndPrivate\\b',
endCaptures: {0: {name: 'keyword.control.end.private.sfd'}},
name: 'meta.section.private.sfd',
patterns: [
{match: '^\\S+', name: 'entity.name.private.property.sfd'},
{include: '#main'}
]
},
property: {
captures: {
1: {name: 'variable.assignment.property.sfd'},
2: {name: 'punctuation.separator.dictionary.key-value.sfd'}
},
match: '^([^:]+)(:)',
name: 'meta.dictionary.key-value.sfd'
},
punctuation: {
patterns: [
{match: '<|>', name: 'punctuation.definition.brackets.angle.sfd'},
{match: '[{}]', name: 'punctuation.definition.brackets.curly.sfd'}
]
},
sections: {
begin: '^(Start|Begin)([A-Z]\\w+)(?=:)',
beginCaptures: {0: {name: 'keyword.control.begin.${2:/downcase}.sfd'}},
end: '^(End\\2)\\b',
endCaptures: {0: {name: 'keyword.control.end.${2:/downcase}.sfd'}},
name: 'meta.section.${2:/downcase}.sfd',
patterns: [{include: '#main'}]
},
unquoted: {match: '\\S+', name: 'string.unquoted.property.sfd'}
},
scopeName: 'text.sfd'
}
export default grammar