-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
source.prolog.eclipse.js
130 lines (128 loc) · 3.63 KB
/
source.prolog.eclipse.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
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is licensed `mpl-2.0`.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
dependencies: ['source.prolog'],
extensions: [],
names: ['eclipse'],
patterns: [
{include: '#comments'},
{
begin: '(?<=:-)\\s*',
end: '(\\.)[^(\\.\\.)]',
endCaptures: {1: {name: 'keyword.control.clause.bodyend.prolog'}},
name: 'meta.clause.body.prolog',
patterns: [
{include: '#comments'},
{include: '#builtin'},
{include: '#controlandkeywords'},
{include: '#atom'},
{include: '#variable'},
{include: '#constants'},
{match: '.', name: 'meta.clause.body.prolog'}
]
},
{
begin: '(?<=-->)\\s*',
end: '(\\.)[^(\\.\\.)]',
endCaptures: {1: {name: 'keyword.control.dcg.bodyend.prolog'}},
name: 'meta.dcg.body.prolog',
patterns: [
{include: '#comments'},
{include: '#controlandkeywords'},
{include: '#atom'},
{include: '#variable'},
{include: '#constants'},
{match: '.', name: 'meta.dcg.body.prolog'}
]
},
{include: 'source.prolog'}
],
repository: {
atom: {
patterns: [
{
match: '(?<![a-zA-Z0-9_])[a-z][a-zA-Z0-9_]*(?!\\s*\\(|[a-zA-Z0-9_])',
name: 'constant.other.atom.simple.prolog'
},
{match: "'.*?'", name: 'constant.other.atom.quoted.prolog'},
{match: '\\[\\]', name: 'constant.other.atom.emptylist.prolog'}
]
},
builtin: {
patterns: [
{
match: '\\b(op|findall|write|nl|writeln|fail|lib)\\b',
name: 'keyword.other.prolog'
},
{
match: '\\b(for(each(elem)?)?|fromto|do|param|dim)\\b',
name: 'keyword.other.prolog.eclipse'
}
]
},
comments: {
patterns: [
{match: '%.*', name: 'comment.line.percent-sign.prolog'},
{
begin: '/\\*',
captures: {0: {name: 'punctuation.definition.comment.prolog'}},
end: '\\*/',
name: 'comment.block.prolog'
}
]
},
constants: {
patterns: [
{
match: '(?<![a-zA-Z]|/)(\\d+|(\\d+\\.\\d+))',
name: 'constant.numeric.integer.prolog'
},
{match: '".*?"', name: 'string.quoted.double.prolog'}
]
},
controlandkeywords: {
patterns: [
{
begin: '(->)',
beginCaptures: {1: {name: 'keyword.control.if.prolog'}},
end: '(;)',
endCaptures: {1: {name: 'keyword.control.else.prolog'}},
name: 'meta.if.prolog',
patterns: [
{include: '$self'},
{include: '#builtin'},
{include: '#comments'},
{include: '#atom'},
{include: '#variable'},
{match: '.', name: 'meta.if.body.prolog'}
]
},
{match: '!', name: 'keyword.control.cut.prolog'},
{
match: '(\\s(is)\\s)|=:=|=?\\\\?=|\\\\\\+|@?>|@?=?<|\\+|\\*|\\-',
name: 'keyword.operator.prolog'
},
{
match: '(#|&|\\$)(<|>|=)|(#|&|\\$)?(::)|\\.\\.|or|and|(#|&|\\$)\\\\=',
name: 'keyword.operator.prolog.eclipse'
}
]
},
variable: {
patterns: [
{
match: '(?<![a-zA-Z0-9_])[A-Z][a-zA-Z0-9_]*',
name: 'variable.parameter.uppercase.prolog'
},
{match: '(?<!\\w)_', name: 'variable.language.anonymous.prolog'}
]
}
},
scopeName: 'source.prolog.eclipse'
}
export default grammar