1 //line scan_string_lit.rl:1
5 // This file is generated from scan_string_lit.rl. DO NOT EDIT.
7 //line scan_string_lit.go:9
8 var _hclstrtok_actions []byte = []byte{
9 0, 1, 0, 1, 1, 2, 1, 0,
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,
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,
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,
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,
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,
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,
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,
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,
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,
110 const hclstrtok_start int = 4
111 const hclstrtok_first_final int = 4
112 const hclstrtok_error int = 0
114 const hclstrtok_en_quoted int = 10
115 const hclstrtok_en_unquoted int = 4
117 //line scan_string_lit.rl:10
119 func scanStringLit(data []byte, quoted bool) [][]byte {
122 //line scan_string_lit.rl:61
125 p := 0 // "Pointer" into data
126 pe := len(data) // End-of-data "pointer"
131 var cs int // current state
134 cs = hclstrtok_en_quoted
136 cs = hclstrtok_en_unquoted
139 // Make Go compiler happy
144 ret = append(ret, data[ts:te])
147 //line scan_string_lit.go:154
151 //line scan_string_lit.go:158
165 _keys = int(_hclstrtok_key_offsets[cs])
166 _trans = int(_hclstrtok_index_offsets[cs])
168 _klen = int(_hclstrtok_single_lengths[cs])
172 _upper := int(_keys + _klen - 1)
178 _mid = _lower + ((_upper - _lower) >> 1)
180 case data[p] < _hclstrtok_trans_keys[_mid]:
182 case data[p] > _hclstrtok_trans_keys[_mid]:
185 _trans += int(_mid - int(_keys))
193 _klen = int(_hclstrtok_range_lengths[cs])
197 _upper := int(_keys + (_klen << 1) - 2)
203 _mid = _lower + (((_upper - _lower) >> 1) & ^1)
205 case data[p] < _hclstrtok_trans_keys[_mid]:
207 case data[p] > _hclstrtok_trans_keys[_mid+1]:
210 _trans += int((_mid - int(_keys)) >> 1)
218 _trans = int(_hclstrtok_indicies[_trans])
219 cs = int(_hclstrtok_trans_targs[_trans])
221 if _hclstrtok_trans_actions[_trans] == 0 {
225 _acts = int(_hclstrtok_trans_actions[_trans])
226 _nacts = uint(_hclstrtok_actions[_acts])
228 for ; _nacts > 0; _nacts-- {
230 switch _hclstrtok_actions[_acts-1] {
232 //line scan_string_lit.rl:40
234 // If te is behind p then we've skipped over some literal
235 // characters which we must now return.
237 ret = append(ret, data[te:p])
242 //line scan_string_lit.rl:48
245 ret = append(ret, data[ts:te])
247 //line scan_string_lit.go:253
263 __acts := _hclstrtok_eof_actions[cs]
264 __nacts := uint(_hclstrtok_actions[__acts])
266 for ; __nacts > 0; __nacts-- {
268 switch _hclstrtok_actions[__acts-1] {
270 //line scan_string_lit.rl:48
273 ret = append(ret, data[ts:te])
275 //line scan_string_lit.go:278
285 //line scan_string_lit.rl:89
288 // Collect any leftover literal characters at the end of the input
289 ret = append(ret, data[te:p])
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)])