diff options
Diffstat (limited to 'vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/scan_string_lit.go')
-rw-r--r-- | vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/scan_string_lit.go | 301 |
1 files changed, 301 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/scan_string_lit.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/scan_string_lit.go new file mode 100644 index 0000000..de1f524 --- /dev/null +++ b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/scan_string_lit.go | |||
@@ -0,0 +1,301 @@ | |||
1 | // line 1 "scan_string_lit.rl" | ||
2 | |||
3 | package hclsyntax | ||
4 | |||
5 | // This file is generated from scan_string_lit.rl. DO NOT EDIT. | ||
6 | |||
7 | // line 9 "scan_string_lit.go" | ||
8 | var _hclstrtok_actions []byte = []byte{ | ||
9 | 0, 1, 0, 1, 1, 2, 1, 0, | ||
10 | } | ||
11 | |||
12 | var _hclstrtok_key_offsets []byte = []byte{ | ||
13 | 0, 0, 2, 4, 6, 10, 14, 18, | ||
14 | 22, 27, 31, 36, 41, 46, 51, 57, | ||
15 | 62, 74, 85, 96, 107, 118, 129, 140, | ||
16 | 151, | ||
17 | } | ||
18 | |||
19 | var _hclstrtok_trans_keys []byte = []byte{ | ||
20 | 128, 191, 128, 191, 128, 191, 10, 13, | ||
21 | 36, 37, 10, 13, 36, 37, 10, 13, | ||
22 | 36, 37, 10, 13, 36, 37, 10, 13, | ||
23 | 36, 37, 123, 10, 13, 36, 37, 10, | ||
24 | 13, 36, 37, 92, 10, 13, 36, 37, | ||
25 | 92, 10, 13, 36, 37, 92, 10, 13, | ||
26 | 36, 37, 92, 10, 13, 36, 37, 92, | ||
27 | 123, 10, 13, 36, 37, 92, 85, 117, | ||
28 | 128, 191, 192, 223, 224, 239, 240, 247, | ||
29 | 248, 255, 10, 13, 36, 37, 92, 48, | ||
30 | 57, 65, 70, 97, 102, 10, 13, 36, | ||
31 | 37, 92, 48, 57, 65, 70, 97, 102, | ||
32 | 10, 13, 36, 37, 92, 48, 57, 65, | ||
33 | 70, 97, 102, 10, 13, 36, 37, 92, | ||
34 | 48, 57, 65, 70, 97, 102, 10, 13, | ||
35 | 36, 37, 92, 48, 57, 65, 70, 97, | ||
36 | 102, 10, 13, 36, 37, 92, 48, 57, | ||
37 | 65, 70, 97, 102, 10, 13, 36, 37, | ||
38 | 92, 48, 57, 65, 70, 97, 102, 10, | ||
39 | 13, 36, 37, 92, 48, 57, 65, 70, | ||
40 | 97, 102, | ||
41 | } | ||
42 | |||
43 | var _hclstrtok_single_lengths []byte = []byte{ | ||
44 | 0, 0, 0, 0, 4, 4, 4, 4, | ||
45 | 5, 4, 5, 5, 5, 5, 6, 5, | ||
46 | 2, 5, 5, 5, 5, 5, 5, 5, | ||
47 | 5, | ||
48 | } | ||
49 | |||
50 | var _hclstrtok_range_lengths []byte = []byte{ | ||
51 | 0, 1, 1, 1, 0, 0, 0, 0, | ||
52 | 0, 0, 0, 0, 0, 0, 0, 0, | ||
53 | 5, 3, 3, 3, 3, 3, 3, 3, | ||
54 | 3, | ||
55 | } | ||
56 | |||
57 | var _hclstrtok_index_offsets []byte = []byte{ | ||
58 | 0, 0, 2, 4, 6, 11, 16, 21, | ||
59 | 26, 32, 37, 43, 49, 55, 61, 68, | ||
60 | 74, 82, 91, 100, 109, 118, 127, 136, | ||
61 | 145, | ||
62 | } | ||
63 | |||
64 | var _hclstrtok_indicies []byte = []byte{ | ||
65 | 0, 1, 2, 1, 3, 1, 5, 6, | ||
66 | 7, 8, 4, 10, 11, 12, 13, 9, | ||
67 | 14, 11, 12, 13, 9, 10, 11, 15, | ||
68 | 13, 9, 10, 11, 12, 13, 14, 9, | ||
69 | 10, 11, 12, 15, 9, 17, 18, 19, | ||
70 | 20, 21, 16, 23, 24, 25, 26, 27, | ||
71 | 22, 0, 24, 25, 26, 27, 22, 23, | ||
72 | 24, 28, 26, 27, 22, 23, 24, 25, | ||
73 | 26, 27, 0, 22, 23, 24, 25, 28, | ||
74 | 27, 22, 29, 30, 22, 2, 3, 31, | ||
75 | 22, 0, 23, 24, 25, 26, 27, 32, | ||
76 | 32, 32, 22, 23, 24, 25, 26, 27, | ||
77 | 33, 33, 33, 22, 23, 24, 25, 26, | ||
78 | 27, 34, 34, 34, 22, 23, 24, 25, | ||
79 | 26, 27, 30, 30, 30, 22, 23, 24, | ||
80 | 25, 26, 27, 35, 35, 35, 22, 23, | ||
81 | 24, 25, 26, 27, 36, 36, 36, 22, | ||
82 | 23, 24, 25, 26, 27, 37, 37, 37, | ||
83 | 22, 23, 24, 25, 26, 27, 0, 0, | ||
84 | 0, 22, | ||
85 | } | ||
86 | |||
87 | var _hclstrtok_trans_targs []byte = []byte{ | ||
88 | 11, 0, 1, 2, 4, 5, 6, 7, | ||
89 | 9, 4, 5, 6, 7, 9, 5, 8, | ||
90 | 10, 11, 12, 13, 15, 16, 10, 11, | ||
91 | 12, 13, 15, 16, 14, 17, 21, 3, | ||
92 | 18, 19, 20, 22, 23, 24, | ||
93 | } | ||
94 | |||
95 | var _hclstrtok_trans_actions []byte = []byte{ | ||
96 | 0, 0, 0, 0, 0, 1, 1, 1, | ||
97 | 1, 3, 5, 5, 5, 5, 0, 0, | ||
98 | 0, 1, 1, 1, 1, 1, 3, 5, | ||
99 | 5, 5, 5, 5, 0, 0, 0, 0, | ||
100 | 0, 0, 0, 0, 0, 0, | ||
101 | } | ||
102 | |||
103 | var _hclstrtok_eof_actions []byte = []byte{ | ||
104 | 0, 0, 0, 0, 0, 3, 3, 3, | ||
105 | 3, 3, 0, 3, 3, 3, 3, 3, | ||
106 | 3, 3, 3, 3, 3, 3, 3, 3, | ||
107 | 3, | ||
108 | } | ||
109 | |||
110 | const hclstrtok_start int = 4 | ||
111 | const hclstrtok_first_final int = 4 | ||
112 | const hclstrtok_error int = 0 | ||
113 | |||
114 | const hclstrtok_en_quoted int = 10 | ||
115 | const hclstrtok_en_unquoted int = 4 | ||
116 | |||
117 | // line 10 "scan_string_lit.rl" | ||
118 | |||
119 | func scanStringLit(data []byte, quoted bool) [][]byte { | ||
120 | var ret [][]byte | ||
121 | |||
122 | // line 61 "scan_string_lit.rl" | ||
123 | |||
124 | // Ragel state | ||
125 | p := 0 // "Pointer" into data | ||
126 | pe := len(data) // End-of-data "pointer" | ||
127 | ts := 0 | ||
128 | te := 0 | ||
129 | eof := pe | ||
130 | |||
131 | var cs int // current state | ||
132 | switch { | ||
133 | case quoted: | ||
134 | cs = hclstrtok_en_quoted | ||
135 | default: | ||
136 | cs = hclstrtok_en_unquoted | ||
137 | } | ||
138 | |||
139 | // Make Go compiler happy | ||
140 | _ = ts | ||
141 | _ = eof | ||
142 | |||
143 | /*token := func () { | ||
144 | ret = append(ret, data[ts:te]) | ||
145 | }*/ | ||
146 | |||
147 | // line 154 "scan_string_lit.go" | ||
148 | { | ||
149 | } | ||
150 | |||
151 | // line 158 "scan_string_lit.go" | ||
152 | { | ||
153 | var _klen int | ||
154 | var _trans int | ||
155 | var _acts int | ||
156 | var _nacts uint | ||
157 | var _keys int | ||
158 | if p == pe { | ||
159 | goto _test_eof | ||
160 | } | ||
161 | if cs == 0 { | ||
162 | goto _out | ||
163 | } | ||
164 | _resume: | ||
165 | _keys = int(_hclstrtok_key_offsets[cs]) | ||
166 | _trans = int(_hclstrtok_index_offsets[cs]) | ||
167 | |||
168 | _klen = int(_hclstrtok_single_lengths[cs]) | ||
169 | if _klen > 0 { | ||
170 | _lower := int(_keys) | ||
171 | var _mid int | ||
172 | _upper := int(_keys + _klen - 1) | ||
173 | for { | ||
174 | if _upper < _lower { | ||
175 | break | ||
176 | } | ||
177 | |||
178 | _mid = _lower + ((_upper - _lower) >> 1) | ||
179 | switch { | ||
180 | case data[p] < _hclstrtok_trans_keys[_mid]: | ||
181 | _upper = _mid - 1 | ||
182 | case data[p] > _hclstrtok_trans_keys[_mid]: | ||
183 | _lower = _mid + 1 | ||
184 | default: | ||
185 | _trans += int(_mid - int(_keys)) | ||
186 | goto _match | ||
187 | } | ||
188 | } | ||
189 | _keys += _klen | ||
190 | _trans += _klen | ||
191 | } | ||
192 | |||
193 | _klen = int(_hclstrtok_range_lengths[cs]) | ||
194 | if _klen > 0 { | ||
195 | _lower := int(_keys) | ||
196 | var _mid int | ||
197 | _upper := int(_keys + (_klen << 1) - 2) | ||
198 | for { | ||
199 | if _upper < _lower { | ||
200 | break | ||
201 | } | ||
202 | |||
203 | _mid = _lower + (((_upper - _lower) >> 1) & ^1) | ||
204 | switch { | ||
205 | case data[p] < _hclstrtok_trans_keys[_mid]: | ||
206 | _upper = _mid - 2 | ||
207 | case data[p] > _hclstrtok_trans_keys[_mid+1]: | ||
208 | _lower = _mid + 2 | ||
209 | default: | ||
210 | _trans += int((_mid - int(_keys)) >> 1) | ||
211 | goto _match | ||
212 | } | ||
213 | } | ||
214 | _trans += _klen | ||
215 | } | ||
216 | |||
217 | _match: | ||
218 | _trans = int(_hclstrtok_indicies[_trans]) | ||
219 | cs = int(_hclstrtok_trans_targs[_trans]) | ||
220 | |||
221 | if _hclstrtok_trans_actions[_trans] == 0 { | ||
222 | goto _again | ||
223 | } | ||
224 | |||
225 | _acts = int(_hclstrtok_trans_actions[_trans]) | ||
226 | _nacts = uint(_hclstrtok_actions[_acts]) | ||
227 | _acts++ | ||
228 | for ; _nacts > 0; _nacts-- { | ||
229 | _acts++ | ||
230 | switch _hclstrtok_actions[_acts-1] { | ||
231 | case 0: | ||
232 | // line 40 "scan_string_lit.rl" | ||
233 | |||
234 | // If te is behind p then we've skipped over some literal | ||
235 | // characters which we must now return. | ||
236 | if te < p { | ||
237 | ret = append(ret, data[te:p]) | ||
238 | } | ||
239 | ts = p | ||
240 | |||
241 | case 1: | ||
242 | // line 48 "scan_string_lit.rl" | ||
243 | |||
244 | te = p | ||
245 | ret = append(ret, data[ts:te]) | ||
246 | |||
247 | // line 255 "scan_string_lit.go" | ||
248 | } | ||
249 | } | ||
250 | |||
251 | _again: | ||
252 | if cs == 0 { | ||
253 | goto _out | ||
254 | } | ||
255 | p++ | ||
256 | if p != pe { | ||
257 | goto _resume | ||
258 | } | ||
259 | _test_eof: | ||
260 | { | ||
261 | } | ||
262 | if p == eof { | ||
263 | __acts := _hclstrtok_eof_actions[cs] | ||
264 | __nacts := uint(_hclstrtok_actions[__acts]) | ||
265 | __acts++ | ||
266 | for ; __nacts > 0; __nacts-- { | ||
267 | __acts++ | ||
268 | switch _hclstrtok_actions[__acts-1] { | ||
269 | case 1: | ||
270 | // line 48 "scan_string_lit.rl" | ||
271 | |||
272 | te = p | ||
273 | ret = append(ret, data[ts:te]) | ||
274 | |||
275 | // line 281 "scan_string_lit.go" | ||
276 | } | ||
277 | } | ||
278 | } | ||
279 | |||
280 | _out: | ||
281 | { | ||
282 | } | ||
283 | } | ||
284 | |||
285 | // line 89 "scan_string_lit.rl" | ||
286 | |||
287 | if te < p { | ||
288 | // Collect any leftover literal characters at the end of the input | ||
289 | ret = append(ret, data[te:p]) | ||
290 | } | ||
291 | |||
292 | // If we fall out here without being in a final state then we've | ||
293 | // encountered something that the scanner can't match, which should | ||
294 | // be impossible (the scanner matches all bytes _somehow_) but we'll | ||
295 | // tolerate it and let the caller deal with it. | ||
296 | if cs < hclstrtok_first_final { | ||
297 | ret = append(ret, data[p:len(data)]) | ||
298 | } | ||
299 | |||
300 | return ret | ||
301 | } | ||