-
-
Notifications
You must be signed in to change notification settings - Fork 30
/
source.pascal.js
105 lines (103 loc) · 3.65 KB
/
source.pascal.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
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is licensed permissive.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
extensions: ['.cps', '.dfm', '.dpr', '.lpr', '.pas', '.pascal', '.pp'],
names: ['component-pascal', 'delphi', 'objectpascal', 'pascal'],
patterns: [
{
match:
'\\b(?i:(absolute|abstract|all|and|and_then|array|as|asm|attribute|begin|bindable|case|class|const|constructor|destructor|div|do|downto|else|end|except|export|exports|external|far|file|finalization|finally|for|forward|generic|goto|helper|if|implementation|import|in|inherited|initialization|interface|interrupt|is|label|library|mod|module|name|near|nil|not|object|of|only|operator|or|or_else|otherwise|packed|pow|private|program|property|protected|public|published|qualified|record|repeat|resident|restricted|segment|set|specialize|shl|shr|then|to|try|type|unit|until|uses|value|var|view|virtual|while|with|xor))\\b',
name: 'keyword.control.pascal'
},
{
captures: {
1: {name: 'storage.type.prototype.pascal'},
2: {name: 'entity.name.function.prototype.pascal'}
},
match:
'\\b(?i:(function|procedure))\\b\\s+(\\w+(\\.\\w+)?)(\\(.*?\\))?;\\s*(?=(?i:attribute|forward|external))',
name: 'meta.function.prototype.pascal'
},
{
captures: {
1: {name: 'storage.type.function.pascal'},
2: {name: 'entity.name.function.pascal'}
},
match: '\\b(?i:(function|procedure))\\b\\s+(\\w+(\\.\\w+)?)',
name: 'meta.function.pascal'
},
{
match:
'\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b',
name: 'constant.numeric.pascal'
},
{
begin: '(^[ \\t]+)?(?=--)',
beginCaptures: {
1: {name: 'punctuation.whitespace.comment.leading.pascal'}
},
end: '(?!\\G)',
patterns: [
{
begin: '--',
beginCaptures: {0: {name: 'punctuation.definition.comment.pascal'}},
end: '\\n',
name: 'comment.line.double-dash.pascal.one'
}
]
},
{
begin: '(^[ \\t]+)?(?=//)',
beginCaptures: {
1: {name: 'punctuation.whitespace.comment.leading.pascal'}
},
end: '(?!\\G)',
patterns: [
{
begin: '//',
beginCaptures: {0: {name: 'punctuation.definition.comment.pascal'}},
end: '\\n',
name: 'comment.line.double-slash.pascal.two'
}
]
},
{
begin: '\\(\\*',
captures: {0: {name: 'punctuation.definition.comment.pascal'}},
end: '\\*\\)',
name: 'comment.block.pascal.one'
},
{
begin: '\\{',
captures: {0: {name: 'punctuation.definition.comment.pascal'}},
end: '\\}',
name: 'comment.block.pascal.two'
},
{
begin: '"',
beginCaptures: {0: {name: 'punctuation.definition.string.begin.pascal'}},
end: '"',
endCaptures: {0: {name: 'punctuation.definition.string.end.pascal'}},
name: 'string.quoted.double.pascal',
patterns: [{match: '\\\\.', name: 'constant.character.escape.pascal'}]
},
{
applyEndPatternLast: true,
begin: "'",
beginCaptures: {0: {name: 'punctuation.definition.string.begin.pascal'}},
end: "'",
endCaptures: {0: {name: 'punctuation.definition.string.end.pascal'}},
name: 'string.quoted.single.pascal',
patterns: [
{match: "''", name: 'constant.character.escape.apostrophe.pascal'}
]
}
],
scopeName: 'source.pascal'
}
export default grammar