-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
source.meson.js
123 lines (121 loc) · 5.1 KB
/
source.meson.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
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is developed at
// <https://github.com/TingPing/language-meson>
// and licensed `apache-2.0`.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
extensions: [],
names: ['meson'],
patterns: [
{match: '\\#.*$', name: 'comment.line.meson'},
{include: '#string_quoted_single'},
{
match: '\\b(elif|else|if|endif)\\b',
name: 'keyword.control.conditional.meson'
},
{match: '\\b(foreach|endforeach)\\b', name: 'keyword.control.repeat.meson'},
{match: '\\b(continue|break)\\b', name: 'keyword.control.statement.meson'},
{match: '\\b(and|not|or|in)\\b', name: 'keyword.operator.logical.meson'},
{match: '\\b(true|false)\\b', name: 'constant.language.meson'},
{
match: '\\b(?i:(0x[[:xdigit:]]+))',
name: 'constant.numeric.integer.hexadecimal.meson'
},
{
match: '\\b(?i:(0o?[0-7]+))',
name: 'constant.numeric.integer.octal.meson'
},
{match: '\\b(?i:(0b[01]+))', name: 'constant.numeric.integer.binary.meson'},
{
match: '\\b([1-9]+[0-9]*|0)',
name: 'constant.numeric.integer.decimal.meson'
},
{
match: '\\b(meson|build_machine|host_machine|target_machine)\\b',
name: 'support.variable.meson'
},
{
match: '\\b([\\w_]+)\\s*(?=:)',
name: 'variable.parameter.function.keyword.meson'
},
{
match: '<\\=|>\\=|\\=\\=|<|>|\\!\\=',
name: 'keyword.operator.comparison.meson'
},
{match: '\\+\\=', name: 'keyword.operator.assignment.augmented.meson'},
{match: '\\=', name: 'keyword.operator.assignment.meson'},
{match: '\\+|\\-|\\*|%|\\/', name: 'keyword.operator.arithmetic.meson'},
{
match:
'(?x)\n\\b(add_global_arguments|add_global_link_arguments|add_languages|\nadd_project_arguments|add_project_link_arguments|add_test_setup|\nalias_target|assert|benchmark|both_libraries|build_target|\nconfiguration_data|configure_file|custom_target|declare_dependency|\ndependency|disabler|environment|error|executable|files|find_library|\nfind_program|generator|get_option|get_variable|gettext|import|\ninclude_directories|install_data|install_headers|install_man|\ninstall_subdir|is_disabler|is_variable|jar|join_paths|library|message|\noption|project|run_command|run_target|set_variable|shared_library|\nshared_module|static_library|subdir|subdir_done|subproject|summary|test|\nvcs_tag|warning)\\b\\s*(?=\\()',
name: 'support.function.builtin.meson'
}
],
repository: {
escaped_character: {
captures: {
1: {name: 'constant.character.escape.backlash.meson'},
10: {name: 'constant.character.escape.octal.meson'},
11: {name: 'constant.character.escape.hex.meson'},
12: {name: 'constant.character.escape.unicode.16-bit-hex.meson'},
13: {name: 'constant.character.escape.unicode.32-bit-hex.meson'},
14: {name: 'constant.character.escape.unicode.name.meson'},
2: {name: 'constant.character.escape.single-quote.meson'},
3: {name: 'constant.character.escape.bell.meson'},
4: {name: 'constant.character.escape.backspace.meson'},
5: {name: 'constant.character.escape.formfeed.meson'},
6: {name: 'constant.character.escape.linefeed.meson'},
7: {name: 'constant.character.escape.return.meson'},
8: {name: 'constant.character.escape.tab.meson'},
9: {name: 'constant.character.escape.vertical-tab.meson'}
},
match:
"(?x)\n(\\\\\\\\)|\n(\\\\')|\n(\\\\a)|\n(\\\\b)|\n(\\\\f)|\n(\\\\n)|\n(\\\\r)|\n(\\\\t)|\n(\\\\v)|\n(\\\\[0-7]{1,3})|\n(\\\\x[[:xdigit:]]{2})|\n(\\\\u[[:xdigit:]]{4})|\n(\\\\U[[:xdigit:]]{8})|\n(\\\\N\\{[[:alpha:] ]+\\})"
},
string_quoted_single: {
patterns: [
{
captures: {
1: {name: 'puncutation.definition.string.begin.meson'},
2: {name: 'puncutation.definition.string.end.meson'},
3: {name: 'meta.empty-string.single.meson'}
},
match: "(?<!')(')(('))(?!')",
name: 'string.quoted.single.single-line.meson'
},
{
begin: "(''')",
beginCaptures: {
1: {name: 'punctuation.definition.string.begin.meson'}
},
end: "((?<=''')(')''|''')",
endCaptures: {
1: {name: 'punctuation.definition.string.end.meson'},
2: {name: 'meta.empty-string.single.meson'}
},
name: 'string.quoted.single.block.meson',
patterns: [{include: '#escaped_character'}]
},
{
begin: "(')",
beginCaptures: {
1: {name: 'punctuation.definition.string.begin.meson'}
},
end: "(')|(\\n)",
endCaptures: {
1: {name: 'punctuation.definition.string.end.meson'},
2: {name: 'invalid.illegal.unclosed-string.meson'}
},
name: 'string.quoted.single.single-line.meson',
patterns: [{include: '#escaped_character'}]
}
]
}
},
scopeName: 'source.meson'
}
export default grammar