-
-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathsource.bst.js
86 lines (84 loc) · 2.85 KB
/
source.bst.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
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is developed at
// <https://github.com/zyoshoka/bst.tmLanguage>
// and licensed `mit`.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
extensions: ['.bst'],
names: ['bibtex-style'],
patterns: [
{include: '#comments'},
{include: '#function-declaration'},
{include: '#command-keywords'},
{include: '#operators'},
{include: '#builtin-objects'},
{include: '#string'},
{include: '#number'}
],
repository: {
'builtin-objects': {
patterns: [
{
match: '\\b(?<!\\.)(if\\$|while\\$)(?!(\\w|\\.))',
name: 'keyword.control.bst'
},
{
match:
'\\b(?<!\\.)(add\\.period\\$|call\\.type\\$|change\\.case\\$|chr\\.to\\.int\\$|cite\\$|duplicate\\$|empty\\$|format\\.name\\$|int\\.to\\.chr\\$|int\\.to\\.chr\\$|int\\.to\\.str\\$|missing\\$|newline\\$|num\\.names\\$|pop\\$|preamble\\$|purify\\$|quote\\$|skip\\$|stack\\$|substring\\$|swap\\$|text\\.length\\$|text\\.prefix\\$|top\\$|type\\$|warning\\$|width\\$|write\\$)(?!(\\w|\\.))',
name: 'support.function.bst'
},
{
match: '\\b(?<!\\.)(entry\\.max\\$|global\\.max\\$)(?!(\\w|\\.))',
name: 'support.constant.bst'
},
{
match: '\\b(?<!\\.)sort\\.key\\$(?!(\\w|\\.))',
name: 'support.variable.bst'
}
]
},
'command-keywords': {
patterns: [
{match: '\\b(?<!\\.)INTEGERS\\b(?!\\.)', name: 'storage.type.int.bst'},
{
match: '\\b(?<!\\.)(ENTRY|MACRO|STRINGS)\\b(?!\\.)',
name: 'storage.type.var.bst'
},
{
match: '\\b(?<!\\.)(READ|EXECUTE|ITERATE|REVERSE|SORT)\\b(?!\\.)',
name: 'support.function.bst'
}
]
},
comments: {begin: '%', end: '$', name: 'comment.line.percentage.bst'},
'function-declaration': {
begin: '\\b(FUNCTION)\\s*\\{\\s*([[:alpha:]_.\\$]*\\$?)',
beginCaptures: {
1: {name: 'storage.type.function.bst'},
2: {name: 'entity.name.function.bst'}
},
end: '\\}',
name: 'meta.function.bst'
},
number: {match: '#-?\\d+\\b', name: 'constant.numeric.bst'},
operators: {
patterns: [
{match: '<|>', name: 'keyword.operator.relational.bst'},
{match: '\\=', name: 'keyword.operator.comparison.bst'},
{match: '\\+|-|\\*', name: 'keyword.operator.arithmetic.bst'},
{match: ':\\=', name: 'keyword.operator.assignment.bst'},
{
match: '\\b(?<!\\.)(and|or|not)(?!(\\w|\\.))',
name: 'keyword.operator.logic.bst'
}
]
},
string: {begin: '"', end: '"', name: 'string.quoted.double.bst'}
},
scopeName: 'source.bst'
}
export default grammar