zclsyntax: scan multi-character punctuation tokens

This commit is contained in:
Martin Atkins 2017-05-28 09:40:58 -07:00
parent bb87c7a0f9
commit c50317a2e0
3 changed files with 259 additions and 195 deletions

View File

@ -12,8 +12,9 @@ var _zcltok_actions []byte = []byte{
0, 1, 0, 1, 1, 1, 2, 1, 5,
1, 6, 1, 7, 1, 8, 1, 9,
1, 10, 1, 11, 1, 12, 1, 13,
1, 14, 1, 15, 1, 16, 2, 2,
3, 2, 2, 4,
1, 14, 1, 15, 1, 16, 1, 17,
1, 18, 1, 19, 1, 20, 1, 21,
1, 22, 2, 2, 3, 2, 2, 4,
}
var _zcltok_key_offsets []int16 = []int16{
@ -81,12 +82,12 @@ var _zcltok_key_offsets []int16 = []int16{
3163, 3181, 3182, 3192, 3193, 3202, 3210, 3212,
3215, 3217, 3219, 3221, 3226, 3239, 3243, 3258,
3287, 3298, 3300, 3304, 3308, 3313, 3317, 3319,
3326, 3330, 3338, 3342, 3408, 3409, 3410, 3415,
3458, 3460, 3465, 3469, 3469, 3471, 3473, 3484,
3494, 3502, 3503, 3505, 3506, 3510, 3514, 3524,
3528, 3535, 3546, 3553, 3557, 3563, 3574, 3606,
3655, 3670, 3685, 3690, 3692, 3697, 3729, 3737,
3739, 3761, 3783,
3326, 3330, 3338, 3342, 3411, 3412, 3413, 3414,
3415, 3420, 3421, 3422, 3465, 3466, 3468, 3473,
3477, 3477, 3479, 3481, 3492, 3502, 3510, 3511,
3513, 3514, 3518, 3522, 3532, 3536, 3543, 3554,
3561, 3565, 3571, 3582, 3614, 3663, 3678, 3693,
3698, 3700, 3705, 3737, 3745, 3747, 3769, 3791,
}
var _zcltok_trans_keys []byte = []byte{
@ -365,7 +366,7 @@ var _zcltok_trans_keys []byte = []byte{
128, 163, 164, 191, 128, 140, 141, 143,
144, 153, 154, 189, 190, 191, 128, 136,
137, 191, 173, 128, 168, 169, 177, 178,
180, 181, 182, 183, 191, 0, 127, 192,
180, 181, 182, 183, 191, 128, 255, 192,
255, 150, 151, 158, 159, 152, 154, 156,
158, 134, 135, 142, 143, 190, 191, 192,
255, 181, 189, 191, 128, 190, 133, 181,
@ -508,21 +509,22 @@ var _zcltok_trans_keys []byte = []byte{
128, 185, 187, 191, 192, 255, 162, 191,
192, 255, 160, 168, 128, 159, 161, 167,
169, 191, 158, 191, 192, 255, 9, 10,
32, 33, 38, 44, 64, 92, 95, 127,
194, 195, 198, 199, 203, 204, 205, 206,
207, 210, 212, 213, 214, 215, 216, 217,
219, 220, 221, 222, 223, 224, 225, 226,
227, 228, 233, 234, 237, 238, 239, 240,
0, 39, 40, 47, 48, 57, 58, 63,
65, 90, 91, 96, 97, 122, 123, 126,
192, 193, 196, 218, 229, 236, 241, 247,
9, 32, 46, 69, 101, 48, 57, 95,
194, 195, 198, 199, 203, 204, 205, 206,
207, 210, 212, 213, 214, 215, 216, 217,
219, 220, 221, 222, 223, 224, 225, 226,
227, 228, 233, 234, 237, 239, 240, 243,
48, 57, 65, 90, 97, 122, 196, 218,
229, 236, 128, 191, 170, 181, 186, 128,
32, 33, 38, 44, 60, 62, 64, 92,
95, 124, 127, 194, 195, 198, 199, 203,
204, 205, 206, 207, 210, 212, 213, 214,
215, 216, 217, 219, 220, 221, 222, 223,
224, 225, 226, 227, 228, 233, 234, 237,
238, 239, 240, 0, 39, 40, 47, 48,
57, 58, 63, 65, 90, 91, 96, 97,
122, 123, 126, 192, 193, 196, 218, 229,
236, 241, 247, 9, 32, 61, 38, 46,
69, 101, 48, 57, 61, 61, 95, 194,
195, 198, 199, 203, 204, 205, 206, 207,
210, 212, 213, 214, 215, 216, 217, 219,
220, 221, 222, 223, 224, 225, 226, 227,
228, 233, 234, 237, 239, 240, 243, 48,
57, 65, 90, 97, 122, 196, 218, 229,
236, 124, 128, 191, 170, 181, 186, 128,
191, 151, 183, 128, 255, 192, 255, 0,
127, 173, 130, 133, 146, 159, 165, 171,
175, 191, 192, 255, 181, 190, 128, 175,
@ -631,12 +633,12 @@ var _zcltok_single_lengths []byte = []byte{
12, 1, 4, 1, 5, 2, 0, 3,
2, 2, 2, 1, 7, 0, 7, 17,
3, 0, 2, 0, 3, 0, 0, 1,
0, 2, 0, 42, 1, 1, 3, 33,
0, 3, 2, 0, 0, 0, 1, 2,
4, 1, 0, 1, 0, 0, 0, 0,
1, 1, 1, 0, 0, 1, 30, 47,
13, 9, 3, 0, 1, 28, 2, 0,
18, 16, 0,
0, 2, 0, 45, 1, 1, 1, 1,
3, 1, 1, 33, 1, 0, 3, 2,
0, 0, 0, 1, 2, 4, 1, 0,
1, 0, 0, 0, 0, 1, 1, 1,
0, 0, 1, 30, 47, 13, 9, 3,
0, 1, 28, 2, 0, 18, 16, 0,
}
var _zcltok_range_lengths []byte = []byte{
@ -704,12 +706,12 @@ var _zcltok_range_lengths []byte = []byte{
3, 0, 3, 0, 2, 3, 1, 0,
0, 0, 0, 2, 3, 2, 4, 6,
4, 1, 1, 2, 1, 2, 1, 3,
2, 3, 2, 12, 0, 0, 1, 5,
1, 1, 1, 0, 1, 1, 5, 4,
2, 0, 1, 0, 2, 2, 5, 2,
3, 5, 3, 2, 3, 5, 1, 1,
1, 3, 1, 1, 2, 2, 3, 1,
2, 3, 1,
2, 3, 2, 12, 0, 0, 0, 0,
1, 0, 0, 5, 0, 1, 1, 1,
0, 1, 1, 5, 4, 2, 0, 1,
0, 2, 2, 5, 2, 3, 5, 3,
2, 3, 5, 1, 1, 1, 3, 1,
1, 2, 2, 3, 1, 2, 3, 1,
}
var _zcltok_index_offsets []int16 = []int16{
@ -777,12 +779,12 @@ var _zcltok_index_offsets []int16 = []int16{
2421, 2437, 2439, 2447, 2449, 2457, 2463, 2465,
2469, 2472, 2475, 2478, 2482, 2493, 2496, 2508,
2532, 2540, 2542, 2546, 2549, 2554, 2557, 2559,
2564, 2567, 2573, 2576, 2631, 2633, 2635, 2640,
2679, 2681, 2686, 2690, 2691, 2693, 2695, 2702,
2709, 2716, 2718, 2720, 2722, 2725, 2728, 2734,
2737, 2742, 2749, 2754, 2757, 2761, 2768, 2800,
2849, 2864, 2877, 2882, 2884, 2888, 2919, 2925,
2927, 2948, 2968,
2564, 2567, 2573, 2576, 2634, 2636, 2638, 2640,
2642, 2647, 2649, 2651, 2690, 2692, 2694, 2699,
2703, 2704, 2706, 2708, 2715, 2722, 2729, 2731,
2733, 2735, 2738, 2741, 2747, 2750, 2755, 2762,
2767, 2770, 2774, 2781, 2813, 2862, 2877, 2890,
2895, 2897, 2901, 2932, 2938, 2940, 2961, 2981,
}
var _zcltok_indicies []int16 = []int16{
@ -999,7 +1001,7 @@ var _zcltok_indicies []int16 = []int16{
254, 255, 4, 255, 4, 255, 4, 254,
255, 254, 4, 4, 255, 254, 255, 4,
255, 4, 255, 254, 4, 255, 254, 255,
255, 4, 255, 4, 255, 254, 254, 4,
255, 4, 255, 4, 255, 254, 4, 254,
254, 4, 255, 255, 4, 255, 255, 255,
255, 255, 255, 255, 254, 4, 255, 255,
255, 4, 254, 255, 255, 255, 4, 255,
@ -1108,60 +1110,61 @@ var _zcltok_indicies []int16 = []int16{
268, 10, 255, 254, 4, 255, 4, 349,
268, 256, 254, 10, 255, 254, 4, 259,
350, 256, 268, 256, 254, 255, 254, 4,
351, 352, 353, 352, 352, 255, 255, 255,
255, 255, 356, 357, 359, 360, 361, 355,
362, 363, 364, 365, 366, 367, 368, 369,
370, 371, 372, 373, 374, 375, 376, 377,
378, 379, 380, 381, 383, 384, 385, 386,
387, 388, 255, 352, 2, 352, 4, 352,
4, 352, 355, 358, 382, 389, 354, 351,
390, 353, 391, 2, 393, 393, 2, 392,
4, 395, 396, 74, 55, 397, 55, 398,
399, 400, 401, 402, 403, 404, 405, 406,
407, 408, 129, 409, 105, 410, 411, 412,
413, 414, 415, 416, 417, 418, 419, 420,
421, 4, 4, 4, 10, 150, 394, 255,
422, 4, 4, 4, 255, 422, 255, 255,
4, 422, 4, 422, 4, 422, 4, 255,
255, 255, 255, 255, 422, 4, 255, 255,
255, 4, 255, 4, 422, 4, 255, 255,
255, 255, 4, 422, 255, 4, 255, 4,
255, 4, 255, 255, 4, 255, 422, 4,
255, 4, 255, 4, 255, 422, 255, 4,
422, 255, 4, 255, 4, 422, 255, 255,
255, 255, 255, 422, 4, 4, 255, 4,
255, 422, 255, 4, 422, 255, 255, 422,
4, 4, 255, 4, 255, 4, 255, 422,
423, 424, 425, 426, 427, 428, 429, 430,
431, 432, 433, 300, 434, 435, 436, 437,
438, 439, 440, 441, 442, 443, 444, 445,
444, 446, 447, 448, 449, 450, 256, 422,
451, 452, 453, 454, 455, 456, 457, 458,
459, 460, 461, 462, 463, 464, 465, 466,
467, 468, 469, 310, 470, 471, 472, 277,
473, 474, 475, 476, 477, 478, 256, 479,
480, 481, 482, 483, 484, 485, 486, 259,
487, 256, 259, 488, 489, 490, 491, 268,
422, 492, 493, 494, 495, 288, 496, 497,
268, 498, 499, 500, 501, 502, 256, 422,
503, 462, 504, 505, 506, 268, 507, 508,
259, 256, 268, 10, 422, 472, 256, 259,
268, 10, 268, 10, 509, 268, 422, 10,
259, 510, 511, 259, 512, 513, 266, 514,
515, 516, 517, 518, 468, 519, 520, 521,
522, 523, 524, 525, 526, 527, 528, 529,
530, 487, 531, 259, 268, 10, 422, 532,
533, 268, 256, 422, 10, 256, 422, 259,
534, 316, 535, 536, 537, 538, 539, 540,
541, 542, 256, 543, 544, 545, 546, 547,
548, 256, 268, 422, 550, 551, 552, 553,
554, 555, 556, 557, 558, 559, 560, 556,
562, 563, 564, 565, 549, 561, 549, 422,
549, 422,
351, 352, 353, 354, 355, 255, 356, 357,
255, 255, 255, 358, 255, 361, 362, 364,
365, 366, 360, 367, 368, 369, 370, 371,
372, 373, 374, 375, 376, 377, 378, 379,
380, 381, 382, 383, 384, 385, 386, 388,
389, 390, 391, 392, 393, 255, 352, 2,
352, 4, 352, 4, 352, 360, 363, 387,
394, 359, 351, 395, 353, 396, 398, 397,
399, 397, 2, 401, 401, 2, 400, 402,
397, 403, 397, 4, 405, 406, 74, 55,
407, 55, 408, 409, 410, 411, 412, 413,
414, 415, 416, 417, 418, 129, 419, 105,
420, 421, 422, 423, 424, 425, 426, 427,
428, 429, 430, 431, 4, 4, 4, 10,
150, 404, 432, 397, 255, 433, 4, 4,
4, 255, 433, 255, 255, 4, 433, 4,
433, 4, 433, 4, 255, 255, 255, 255,
255, 433, 4, 255, 255, 255, 4, 255,
4, 433, 4, 255, 255, 255, 255, 4,
433, 255, 4, 255, 4, 255, 4, 255,
255, 4, 255, 433, 4, 255, 4, 255,
4, 255, 433, 255, 4, 433, 255, 4,
255, 4, 433, 255, 255, 255, 255, 255,
433, 4, 4, 255, 4, 255, 433, 255,
4, 433, 255, 255, 433, 4, 4, 255,
4, 255, 4, 255, 433, 434, 435, 436,
437, 438, 439, 440, 441, 442, 443, 444,
300, 445, 446, 447, 448, 449, 450, 451,
452, 453, 454, 455, 456, 455, 457, 458,
459, 460, 461, 256, 433, 462, 463, 464,
465, 466, 467, 468, 469, 470, 471, 472,
473, 474, 475, 476, 477, 478, 479, 480,
310, 481, 482, 483, 277, 484, 485, 486,
487, 488, 489, 256, 490, 491, 492, 493,
494, 495, 496, 497, 259, 498, 256, 259,
499, 500, 501, 502, 268, 433, 503, 504,
505, 506, 288, 507, 508, 268, 509, 510,
511, 512, 513, 256, 433, 514, 473, 515,
516, 517, 268, 518, 519, 259, 256, 268,
10, 433, 483, 256, 259, 268, 10, 268,
10, 520, 268, 433, 10, 259, 521, 522,
259, 523, 524, 266, 525, 526, 527, 528,
529, 479, 530, 531, 532, 533, 534, 535,
536, 537, 538, 539, 540, 541, 498, 542,
259, 268, 10, 433, 543, 544, 268, 256,
433, 10, 256, 433, 259, 545, 316, 546,
547, 548, 549, 550, 551, 552, 553, 256,
554, 555, 556, 557, 558, 559, 256, 268,
433, 561, 562, 563, 564, 565, 566, 567,
568, 569, 570, 571, 567, 573, 574, 575,
576, 560, 572, 560, 433, 560, 433,
}
var _zcltok_trans_targs []int16 = []int16{
515, 1, 518, 515, 519, 515, 24, 25,
515, 1, 520, 515, 523, 515, 24, 25,
26, 27, 4, 28, 29, 30, 31, 32,
33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48,
@ -1205,37 +1208,39 @@ var _zcltok_trans_targs []int16 = []int16{
485, 486, 487, 489, 490, 491, 492, 493,
494, 495, 496, 497, 498, 499, 501, 502,
503, 504, 507, 509, 510, 512, 514, 516,
515, 517, 515, 520, 521, 522, 523, 524,
515, 517, 518, 519, 521, 522, 524, 515,
525, 526, 527, 528, 529, 530, 531, 532,
533, 534, 535, 536, 537, 538, 539, 540,
541, 542, 543, 544, 545, 546, 547, 548,
549, 550, 551, 552, 553, 554, 515, 515,
515, 0, 515, 2, 3, 7, 8, 9,
10, 11, 12, 13, 14, 15, 16, 17,
18, 20, 22, 23, 55, 96, 111, 118,
120, 122, 142, 145, 161, 274, 515, 278,
279, 280, 281, 282, 283, 284, 285, 286,
287, 288, 290, 291, 292, 293, 294, 295,
296, 297, 298, 299, 300, 301, 302, 303,
304, 305, 306, 307, 308, 309, 310, 312,
313, 314, 315, 316, 317, 318, 319, 320,
321, 322, 323, 324, 325, 326, 328, 329,
330, 332, 333, 334, 335, 336, 337, 338,
339, 340, 341, 342, 343, 344, 345, 347,
348, 349, 350, 351, 352, 353, 354, 355,
357, 358, 359, 360, 361, 362, 363, 364,
365, 366, 367, 368, 369, 370, 371, 372,
373, 374, 376, 377, 378, 379, 380, 381,
382, 383, 384, 385, 386, 387, 388, 389,
390, 391, 392, 393, 394, 395, 396, 398,
399, 400, 401, 402, 403, 404, 405, 406,
407, 408, 409, 410, 411, 412, 413, 442,
467, 470, 471, 473, 480, 481, 484, 488,
500, 505, 506, 508, 511, 513,
549, 550, 551, 552, 553, 554, 555, 556,
557, 558, 559, 515, 515, 515, 515, 515,
515, 0, 515, 515, 515, 2, 3, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 20, 22, 23, 55, 96,
111, 118, 120, 122, 142, 145, 161, 274,
515, 515, 278, 279, 280, 281, 282, 283,
284, 285, 286, 287, 288, 290, 291, 292,
293, 294, 295, 296, 297, 298, 299, 300,
301, 302, 303, 304, 305, 306, 307, 308,
309, 310, 312, 313, 314, 315, 316, 317,
318, 319, 320, 321, 322, 323, 324, 325,
326, 328, 329, 330, 332, 333, 334, 335,
336, 337, 338, 339, 340, 341, 342, 343,
344, 345, 347, 348, 349, 350, 351, 352,
353, 354, 355, 357, 358, 359, 360, 361,
362, 363, 364, 365, 366, 367, 368, 369,
370, 371, 372, 373, 374, 376, 377, 378,
379, 380, 381, 382, 383, 384, 385, 386,
387, 388, 389, 390, 391, 392, 393, 394,
395, 396, 398, 399, 400, 401, 402, 403,
404, 405, 406, 407, 408, 409, 410, 411,
412, 413, 442, 467, 470, 471, 473, 480,
481, 484, 488, 500, 505, 506, 508, 511,
513,
}
var _zcltok_trans_actions []byte = []byte{
23, 0, 5, 25, 31, 29, 0, 0,
35, 0, 5, 37, 43, 41, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@ -1266,7 +1271,7 @@ var _zcltok_trans_actions []byte = []byte{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 27, 9,
0, 0, 0, 0, 0, 0, 39, 19,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@ -1279,15 +1284,17 @@ var _zcltok_trans_actions []byte = []byte{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
7, 0, 11, 0, 0, 0, 0, 0,
17, 0, 0, 0, 0, 0, 0, 21,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 5, 5, 5, 34, 34, 34, 34,
34, 34, 5, 5, 34, 5, 19, 13,
15, 0, 17, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 5, 5,
5, 46, 46, 46, 46, 46, 46, 5,
5, 46, 5, 31, 23, 29, 7, 13,
25, 0, 11, 9, 27, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 21, 0,
0, 0, 0, 0, 0, 0, 0, 0,
15, 33, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@ -1305,7 +1312,7 @@ var _zcltok_trans_actions []byte = []byte{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0,
}
var _zcltok_to_state_actions []byte = []byte{
@ -1378,7 +1385,7 @@ var _zcltok_to_state_actions []byte = []byte{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
}
var _zcltok_from_state_actions []byte = []byte{
@ -1451,7 +1458,7 @@ var _zcltok_from_state_actions []byte = []byte{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
}
var _zcltok_eof_trans []int16 = []int16{
@ -1519,12 +1526,12 @@ var _zcltok_eof_trans []int16 = []int16{
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 0, 391, 392, 393, 395,
423, 423, 423, 423, 423, 423, 423, 423,
423, 423, 423, 423, 423, 423, 423, 423,
423, 423, 423, 423, 423, 423, 423, 423,
423, 423, 423, 423, 423, 423, 423, 423,
423, 423, 423,
255, 255, 255, 0, 396, 397, 398, 398,
401, 398, 398, 405, 398, 434, 434, 434,
434, 434, 434, 434, 434, 434, 434, 434,
434, 434, 434, 434, 434, 434, 434, 434,
434, 434, 434, 434, 434, 434, 434, 434,
434, 434, 434, 434, 434, 434, 434, 434,
}
const zcltok_start int = 515
@ -1542,7 +1549,7 @@ func scanTokens(data []byte, filename string, start zcl.Pos) []Token {
Pos: start,
}
// line 57 "scan_tokens.rl"
// line 70 "scan_tokens.rl"
// Ragel state
cs := 0 // Current State
@ -1571,7 +1578,7 @@ func scanTokens(data []byte, filename string, start zcl.Pos) []Token {
f.emitToken(TokenType(b[0]), ts, te)
}
// line 1581 "scan_tokens.go"
// line 1588 "scan_tokens.go"
{
cs = zcltok_start
ts = 0
@ -1579,7 +1586,7 @@ func scanTokens(data []byte, filename string, start zcl.Pos) []Token {
act = 0
}
// line 1589 "scan_tokens.go"
// line 1596 "scan_tokens.go"
{
var _klen int
var _trans int
@ -1601,7 +1608,7 @@ func scanTokens(data []byte, filename string, start zcl.Pos) []Token {
ts = p
// line 1610 "scan_tokens.go"
// line 1617 "scan_tokens.go"
}
}
@ -1678,94 +1685,137 @@ func scanTokens(data []byte, filename string, start zcl.Pos) []Token {
te = p + 1
case 3:
// line 50 "scan_tokens.rl"
// line 56 "scan_tokens.rl"
act = 3
case 4:
// line 54 "scan_tokens.rl"
// line 67 "scan_tokens.rl"
act = 7
act = 12
case 5:
// line 51 "scan_tokens.rl"
// line 58 "scan_tokens.rl"
te = p + 1
{
token(TokenNotEqual)
}
case 6:
// line 59 "scan_tokens.rl"
te = p + 1
{
token(TokenGreaterThanEq)
}
case 7:
// line 60 "scan_tokens.rl"
te = p + 1
{
token(TokenLessThanEq)
}
case 8:
// line 61 "scan_tokens.rl"
te = p + 1
{
token(TokenAnd)
}
case 9:
// line 62 "scan_tokens.rl"
te = p + 1
{
token(TokenOr)
}
case 10:
// line 63 "scan_tokens.rl"
te = p + 1
{
selfToken()
}
case 6:
// line 53 "scan_tokens.rl"
case 11:
// line 66 "scan_tokens.rl"
te = p + 1
{
token(TokenInvalid)
}
case 7:
// line 54 "scan_tokens.rl"
case 12:
// line 67 "scan_tokens.rl"
te = p + 1
{
token(TokenBadUTF8)
}
case 8:
// line 48 "scan_tokens.rl"
case 13:
// line 54 "scan_tokens.rl"
te = p
p--
case 9:
// line 49 "scan_tokens.rl"
case 14:
// line 55 "scan_tokens.rl"
te = p
p--
{
token(TokenNumberLit)
}
case 10:
// line 50 "scan_tokens.rl"
case 15:
// line 56 "scan_tokens.rl"
te = p
p--
{
token(TokenIdent)
}
case 11:
// line 52 "scan_tokens.rl"
case 16:
// line 63 "scan_tokens.rl"
te = p
p--
{
selfToken()
}
case 17:
// line 65 "scan_tokens.rl"
te = p
p--
{
token(TokenTabs)
}
case 12:
// line 54 "scan_tokens.rl"
case 18:
// line 67 "scan_tokens.rl"
te = p
p--
{
token(TokenBadUTF8)
}
case 13:
// line 49 "scan_tokens.rl"
case 19:
// line 55 "scan_tokens.rl"
p = (te) - 1
{
token(TokenNumberLit)
}
case 14:
// line 50 "scan_tokens.rl"
case 20:
// line 56 "scan_tokens.rl"
p = (te) - 1
{
token(TokenIdent)
}
case 15:
// line 54 "scan_tokens.rl"
case 21:
// line 67 "scan_tokens.rl"
p = (te) - 1
{
token(TokenBadUTF8)
}
case 16:
case 22:
// line 1 "NONE"
switch act {
@ -1774,14 +1824,14 @@ func scanTokens(data []byte, filename string, start zcl.Pos) []Token {
p = (te) - 1
token(TokenIdent)
}
case 7:
case 12:
{
p = (te) - 1
token(TokenBadUTF8)
}
}
// line 1765 "scan_tokens.go"
// line 1803 "scan_tokens.go"
}
}
@ -1797,7 +1847,7 @@ func scanTokens(data []byte, filename string, start zcl.Pos) []Token {
ts = 0
// line 1780 "scan_tokens.go"
// line 1818 "scan_tokens.go"
}
}
@ -1817,7 +1867,7 @@ func scanTokens(data []byte, filename string, start zcl.Pos) []Token {
}
// line 89 "scan_tokens.rl"
// line 102 "scan_tokens.rl"
// If we fall out here without being in a final state then we've
// encountered something that the scanner can't match, which we'll

View File

@ -37,6 +37,12 @@ func scanTokens(data []byte, filename string, start zcl.Pos) []Token {
# Symbols that just represent themselves are handled as a single rule.
SelfToken = "{" | "}" | "[" | "]" | "(" | ")" | "." | "*" | "/" | "+" | "-" | "=" | "<" | ">" | "!" | "?" | ":" | "\n" | "&" | "|" | "~" | "^" | ";" | "`";
NotEqual = "!=";
GreaterThanEqual = ">=";
LessThanEqual = "<=";
LogicalAnd = "&&";
LogicalOr = "||";
# Tabs are not valid, but we accept them in the scanner and mark them
# as tokens so that we can produce diagnostics advising the user to
# use spaces instead.
@ -48,7 +54,14 @@ func scanTokens(data []byte, filename string, start zcl.Pos) []Token {
Spaces => {};
NumberLit => { token(TokenNumberLit) };
Ident => { token(TokenIdent) };
NotEqual => { token(TokenNotEqual); };
GreaterThanEqual => { token(TokenGreaterThanEq); };
LessThanEqual => { token(TokenLessThanEq); };
LogicalAnd => { token(TokenAnd); };
LogicalOr => { token(TokenOr); };
SelfToken => { selfToken() };
Tabs => { token(TokenTabs) };
AnyUTF8 => { token(TokenInvalid) };
BrokenUTF8 => { token(TokenBadUTF8) };

View File

@ -4,7 +4,7 @@ package zclsyntax
import "fmt"
const _TokenType_name = "TokenNewlineTokenBangTokenBitwiseAndTokenOParenTokenCParenTokenStarTokenPlusTokenMinusTokenDotTokenSlashTokenColonTokenSemicolonTokenLessThanTokenEqualTokenGreaterThanTokenQuestionTokenHeredocTokenIdentTokenNumberLitTokenStringLitTokenOBrackTokenCBrackTokenBitwiseXorTokenBacktickTokenOBraceTokenBitwiseOrTokenCBraceTokenBitwiseNotTokenOQuoteTokenCQuoteTokenTemplateControlTokenTemplateSeqEndTokenAndTokenOrTokenTemplateInterpTokenNotEqualTokenLessThanEqTokenGreaterThanEqTokenEOFTokenTabsTokenStarStarTokenInvalidTokenBadUTF8"
const _TokenType_name = "TokenNewlineTokenBangTokenBitwiseAndTokenOParenTokenCParenTokenStarTokenPlusTokenMinusTokenDotTokenSlashTokenColonTokenSemicolonTokenLessThanTokenEqualTokenGreaterThanTokenQuestionTokenOHeredocTokenIdentTokenNumberLitTokenStringLitTokenOBrackTokenCBrackTokenBitwiseXorTokenBacktickTokenCHeredocTokenOBraceTokenBitwiseOrTokenCBraceTokenBitwiseNotTokenOQuoteTokenCQuoteTokenTemplateControlTokenTemplateSeqEndTokenAndTokenOrTokenTemplateInterpTokenNotEqualTokenLessThanEqTokenGreaterThanEqTokenEOFTokenTabsTokenStarStarTokenInvalidTokenBadUTF8"
var _TokenType_map = map[TokenType]string{
10: _TokenType_name[0:12],
@ -23,33 +23,34 @@ var _TokenType_map = map[TokenType]string{
61: _TokenType_name[141:151],
62: _TokenType_name[151:167],
63: _TokenType_name[167:180],
72: _TokenType_name[180:192],
73: _TokenType_name[192:202],
78: _TokenType_name[202:216],
83: _TokenType_name[216:230],
91: _TokenType_name[230:241],
93: _TokenType_name[241:252],
94: _TokenType_name[252:267],
96: _TokenType_name[267:280],
123: _TokenType_name[280:291],
124: _TokenType_name[291:305],
125: _TokenType_name[305:316],
126: _TokenType_name[316:331],
171: _TokenType_name[331:342],
187: _TokenType_name[342:353],
955: _TokenType_name[353:373],
8718: _TokenType_name[373:392],
8743: _TokenType_name[392:400],
8744: _TokenType_name[400:407],
8747: _TokenType_name[407:426],
8800: _TokenType_name[426:439],
8804: _TokenType_name[439:454],
8805: _TokenType_name[454:472],
9220: _TokenType_name[472:480],
9225: _TokenType_name[480:489],
10138: _TokenType_name[489:502],
65533: _TokenType_name[502:514],
128169: _TokenType_name[514:526],
72: _TokenType_name[180:193],
73: _TokenType_name[193:203],
78: _TokenType_name[203:217],
83: _TokenType_name[217:231],
91: _TokenType_name[231:242],
93: _TokenType_name[242:253],
94: _TokenType_name[253:268],
96: _TokenType_name[268:281],
104: _TokenType_name[281:294],
123: _TokenType_name[294:305],
124: _TokenType_name[305:319],
125: _TokenType_name[319:330],
126: _TokenType_name[330:345],
171: _TokenType_name[345:356],
187: _TokenType_name[356:367],
955: _TokenType_name[367:387],
8718: _TokenType_name[387:406],
8743: _TokenType_name[406:414],
8744: _TokenType_name[414:421],
8747: _TokenType_name[421:440],
8800: _TokenType_name[440:453],
8804: _TokenType_name[453:468],
8805: _TokenType_name[468:486],
9220: _TokenType_name[486:494],
9225: _TokenType_name[494:503],
10138: _TokenType_name[503:516],
65533: _TokenType_name[516:528],
128169: _TokenType_name[528:540],
}
func (i TokenType) String() string {