-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsyntax_test.cue
152 lines (117 loc) · 3.62 KB
/
syntax_test.cue
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// SYNTAX TEST "Packages/Cuelang Syntax/cue.sublime-syntax"
// ********** Comments **********
// foo
// ^ source.cue comment.line
// <- punctuation.definition.comment
// ********** Packages **********
package test
// ^ source.cue meta.namespace
// <- keyword.declaration.namespace
// ^ entity.name.namespace
import "pkg/dev"
// <- source.cue keyword.control.import
import (
"pkg/dev"
// ^ punctuation.definition.string.begin.cue
// ^ string.quoted.double
// ^ punctuation.definition.string.end.cue
rename "pkg/other:identifier"
// ^ string.quoted.double
)
// ********** Attributes **********
@json(hello)
// <- source.cue punctuation.definition.annotation
// ^ meta.annotation.identifier
// ^ meta.annotation.parameters
// ********** Literals **********
// It is technically to valid to have those here,
// We are only detecting elements to highlight in the syntax parser, not parsing the full language as per the specification.
true false null _ _|_
// <- source.cue constant.language
// ^ constant.language
// ^ constant.language
// ^ constant.language
// ^ constant.language
int uint8 string
// <- source.cue support.type.builtin
// ^ support.type.builtin
// ^ support.type.builtin
name?: int
// <- source.cue
// ^ support.type.builtin
+ || < <=
// <- source.cue keyword.operator
// ^ keyword.operator
// ^ keyword.operator
// ^ keyword.operator
for in if let
// <- source.cue keyword.control
// ^ keyword.control
// ^ keyword.control
// ^ keyword.control
// *** Strings ***
"string"
// <- punctuation.definition.string.begin
// ^ meta.string string.quoted.double
// ^ punctuation.definition.string.end
"unicode: \u0001 \U0001F60A"
// ^ constant.character.escape.unicode.16bit
// ^ constant.character.escape.unicode.32bit
"\' \n \#a"
//^ constant.character.escape
// ^ constant.character.escape
// ^ constant.character.escape
'\x03abc\#777'
// <- meta.string string.quoted.single
//^ constant.character.escape.hex.cue
// ^ constant.character.escape.octal.cue
"Hello \(name)"
// ^ meta.interpolation punctuation.section.interpolation.begin
// ^ source.cue.embedded
// ^ punctuation.section.interpolation.end
// ^ punctuation.definition.string.end
"""
This is a multiline string
"""
// <- meta.string string.quoted.triple
//^ punctuation.definition.string.end
'''
Bytes multiline string
'''
// <- meta.string string.quoted.triple
//^ punctuation.definition.string.end
#"avoid using \ to "escape""#
// <- punctuation.definition.string.begin
// ^ meta.string string.quoted.other
// *** Numbers ***
42
// <- meta.number.integer.decimal constant.numeric.value
123.4Ki
// <- meta.number.integer.decimal constant.numeric.value
// ^ punctuation.separator.decimal
329.14e4 // Need to readjust backtrack for first portion of float
// <- meta.number.integer.decimal constant.numeric.value
// ^ punctuation.separator.decimal
// ^ meta.number.float.decimal constant.numeric.value
0xBad_Face
// <- meta.number.integer.hexadecimal constant.numeric.base
// ^ constant.numeric.value
0o755
// <- meta.number.integer.octal constant.numeric.base
// ^ constant.numeric.value
0b0101_0001
// <- meta.number.integer.binary constant.numeric.base
// ^ constant.numeric.value
// ********** Declarations **********
net.IPv4
// <- source.cue variable.other
_test
// <- source.cue variable.other
_test
// <- source.cue variable.other
// *** Built-in functions ***
len()
// <- meta.function-call support.function
// *** Functions ***
hello(abc)
// <- meta.function-call variable.function