-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
source.fontdir.js
76 lines (74 loc) · 2.06 KB
/
source.fontdir.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
// 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.xlfd'],
extensions: [],
names: ['x-font-directory-index'],
patterns: [{include: '#main'}],
repository: {
comment: {
begin: '^!',
beginCaptures: {0: {name: 'punctuation.definition.comment.fontdir'}},
end: '(?=$)',
name: 'comment.line.bang.exclamation-mark.fontdir'
},
entryCount: {
match: '\\A([0-9]+)(?=\\s|$)',
name: 'constant.numeric.integer.int.decimal.fontdir'
},
entryName: {
patterns: [
{include: '#string'},
{
match: '^(?:[^-\\s]|\\s(?!-|\\S+$)|(?<!\\s)-)+',
name: 'string.unquoted.font-name.fontdir'
}
]
},
keywords: {
match: '^(FILE_NAMES_ALIASES)(?=\\s|$)',
name: 'keyword.control.directive.font-name-aliases.fontdir'
},
main: {
patterns: [
{include: '#comment'},
{include: '#keywords'},
{include: '#entryCount'},
{include: '#entryName'},
{include: 'source.xlfd#name'},
{include: '#otherField'}
]
},
otherField: {
patterns: [
{include: '#string'},
{match: '(?<=\\s)\\S+$', name: 'constant.language.other.fontdir'}
]
},
string: {
begin: '"',
beginCaptures: {0: {name: 'punctuation.definition.string.begin.fontdir'}},
end: '"|(?=$)',
endCaptures: {0: {name: 'punctuation.definition.string.end.fontdir'}},
name: 'string.quoted.double.font-name.fontdir',
patterns: [
{
captures: {
1: {name: 'punctuation.definition.escape.backslash.fontdir'}
},
match: '(\\\\).',
name: 'constant.character.escape.backslash.fontdir'
}
]
}
},
scopeName: 'source.fontdir'
}
export default grammar