zclsyntax: properly scan the modulo operator

Previously we missed the '%' character in our "SelfToken" production,
which meant that the modulo operator could not parse properly due to it
being represented as a TokenInvalid.
This commit is contained in:
Martin Atkins 2018-03-03 07:56:54 -08:00
parent 386ab3257c
commit 440debc6d4
4 changed files with 296 additions and 247 deletions

View File

@ -36,6 +36,18 @@ func TestExpressionParseAndValue(t *testing.T) {
cty.NumberIntVal(5),
0,
},
{
`2*5+1`,
nil,
cty.NumberIntVal(11),
0,
},
{
`9%8`,
nil,
cty.NumberIntVal(1),
0,
},
{
`(2+unk)`,
&hcl.EvalContext{

View File

@ -220,22 +220,22 @@ var _hcltok_key_offsets []int16 = []int16{
9121, 9125, 9131, 9139, 9157, 9158, 9168, 9169,
9178, 9186, 9188, 9191, 9193, 9195, 9197, 9202,
9215, 9219, 9234, 9263, 9274, 9276, 9280, 9284,
9289, 9293, 9295, 9302, 9306, 9314, 9318, 9393,
9395, 9396, 9397, 9398, 9399, 9400, 9402, 9403,
9408, 9410, 9412, 9413, 9457, 9458, 9459, 9461,
9466, 9470, 9470, 9472, 9474, 9485, 9495, 9503,
9504, 9506, 9507, 9511, 9515, 9525, 9529, 9536,
9547, 9554, 9558, 9564, 9575, 9607, 9656, 9671,
9686, 9691, 9693, 9698, 9730, 9738, 9740, 9762,
9784, 9786, 9802, 9818, 9833, 9842, 9856, 9870,
9886, 9887, 9888, 9889, 9890, 9892, 9894, 9896,
9910, 9924, 9925, 9926, 9928, 9930, 9932, 9946,
9960, 9961, 9962, 9964, 9966, 9968, 10016, 10060,
10062, 10067, 10071, 10071, 10073, 10075, 10086, 10096,
10104, 10105, 10107, 10108, 10112, 10116, 10126, 10130,
10137, 10148, 10155, 10159, 10165, 10176, 10208, 10257,
10272, 10287, 10292, 10294, 10299, 10331, 10339, 10341,
10363, 10385,
9289, 9293, 9295, 9302, 9306, 9314, 9318, 9394,
9396, 9397, 9398, 9399, 9400, 9401, 9403, 9404,
9409, 9411, 9413, 9414, 9458, 9459, 9460, 9462,
9467, 9471, 9471, 9473, 9475, 9486, 9496, 9504,
9505, 9507, 9508, 9512, 9516, 9526, 9530, 9537,
9548, 9555, 9559, 9565, 9576, 9608, 9657, 9672,
9687, 9692, 9694, 9699, 9731, 9739, 9741, 9763,
9785, 9787, 9803, 9819, 9834, 9843, 9857, 9871,
9887, 9888, 9889, 9890, 9891, 9893, 9895, 9897,
9911, 9925, 9926, 9927, 9929, 9931, 9933, 9947,
9961, 9962, 9963, 9965, 9967, 9969, 10017, 10061,
10063, 10068, 10072, 10072, 10074, 10076, 10087, 10097,
10105, 10106, 10108, 10109, 10113, 10117, 10127, 10131,
10138, 10149, 10156, 10160, 10166, 10177, 10209, 10258,
10273, 10288, 10293, 10295, 10300, 10332, 10340, 10342,
10364, 10386,
}
var _hcltok_trans_keys []byte = []byte{
@ -258,7 +258,7 @@ var _hcltok_trans_keys []byte = []byte{
234, 237, 239, 240, 243, 48, 57, 65,
90, 97, 122, 196, 218, 229, 236, 10,
170, 181, 183, 186, 128, 150, 152, 182,
184, 255, 192, 255, 128, 255, 173, 130,
184, 255, 192, 255, 0, 127, 173, 130,
133, 146, 159, 165, 171, 175, 255, 181,
190, 184, 185, 192, 255, 140, 134, 138,
142, 161, 163, 255, 182, 130, 136, 137,
@ -1404,99 +1404,24 @@ var _hcltok_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,
13, 32, 33, 34, 35, 38, 46, 47,
60, 61, 62, 64, 92, 95, 123, 124,
125, 126, 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, 45, 48,
57, 58, 63, 65, 90, 91, 96, 97,
122, 192, 193, 196, 218, 229, 236, 241,
247, 9, 32, 10, 61, 10, 38, 46,
42, 47, 42, 46, 69, 101, 48, 57,
60, 61, 61, 62, 61, 45, 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, 125, 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, 176, 183, 184, 185, 186, 191, 134,
139, 141, 162, 128, 135, 136, 255, 182,
130, 137, 176, 151, 152, 154, 160, 136,
191, 192, 255, 128, 143, 144, 170, 171,
175, 176, 178, 179, 191, 128, 159, 160,
191, 176, 128, 138, 139, 173, 174, 255,
148, 150, 164, 167, 173, 176, 185, 189,
190, 192, 255, 144, 128, 145, 146, 175,
176, 191, 128, 140, 141, 255, 166, 176,
178, 191, 192, 255, 186, 128, 137, 138,
170, 171, 179, 180, 181, 182, 191, 160,
161, 162, 164, 165, 166, 167, 168, 169,
170, 171, 172, 173, 174, 175, 176, 177,
178, 179, 180, 181, 182, 183, 184, 185,
186, 187, 188, 189, 190, 128, 191, 128,
129, 130, 131, 137, 138, 139, 140, 141,
142, 143, 144, 153, 154, 155, 156, 157,
158, 159, 160, 161, 162, 163, 164, 165,
166, 167, 168, 169, 170, 171, 172, 173,
174, 175, 176, 177, 178, 179, 180, 182,
183, 184, 188, 189, 190, 191, 132, 187,
129, 130, 132, 133, 134, 176, 177, 178,
179, 180, 181, 182, 183, 128, 191, 128,
129, 130, 131, 132, 133, 134, 135, 144,
136, 143, 145, 191, 192, 255, 182, 183,
184, 128, 191, 128, 191, 191, 128, 190,
192, 255, 128, 146, 147, 148, 152, 153,
154, 155, 156, 158, 159, 160, 161, 162,
163, 164, 165, 166, 167, 168, 169, 170,
171, 172, 173, 174, 175, 176, 129, 191,
192, 255, 158, 159, 128, 157, 160, 191,
192, 255, 128, 191, 164, 169, 171, 172,
173, 174, 175, 180, 181, 182, 183, 184,
185, 187, 188, 189, 190, 191, 128, 163,
165, 186, 144, 145, 146, 147, 148, 150,
151, 152, 155, 157, 158, 160, 170, 171,
172, 175, 128, 159, 161, 169, 173, 191,
128, 191, 10, 13, 34, 36, 37, 92,
128, 191, 192, 223, 224, 239, 240, 247,
248, 255, 10, 13, 34, 92, 36, 37,
128, 191, 192, 223, 224, 239, 240, 247,
248, 255, 10, 13, 92, 36, 37, 128,
191, 192, 223, 224, 239, 240, 247, 248,
255, 92, 36, 37, 192, 223, 224, 239,
240, 247, 10, 13, 34, 92, 36, 37,
192, 223, 224, 239, 240, 247, 248, 255,
10, 13, 34, 92, 36, 37, 128, 223,
224, 239, 240, 247, 248, 255, 10, 13,
34, 92, 36, 37, 128, 191, 192, 223,
224, 239, 240, 247, 248, 255, 123, 126,
123, 126, 128, 191, 128, 191, 128, 191,
10, 13, 36, 37, 128, 191, 192, 223,
224, 239, 240, 247, 248, 255, 10, 13,
36, 37, 128, 191, 192, 223, 224, 239,
240, 247, 248, 255, 126, 126, 128, 191,
128, 191, 128, 191, 10, 13, 36, 37,
128, 191, 192, 223, 224, 239, 240, 247,
248, 255, 10, 13, 36, 37, 128, 191,
192, 223, 224, 239, 240, 247, 248, 255,
126, 126, 128, 191, 128, 191, 128, 191,
13, 32, 33, 34, 35, 37, 38, 46,
47, 60, 61, 62, 64, 92, 95, 123,
124, 125, 126, 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, 45,
48, 57, 58, 63, 65, 90, 91, 96,
97, 122, 192, 193, 196, 218, 229, 236,
241, 247, 9, 32, 10, 61, 10, 38,
46, 42, 47, 42, 46, 69, 101, 48,
57, 60, 61, 61, 62, 61, 45, 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, 238, 239, 240,
65, 90, 97, 122, 128, 191, 192, 193,
196, 218, 229, 236, 241, 247, 248, 255,
45, 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,
227, 228, 233, 234, 237, 239, 240, 243,
48, 57, 65, 90, 97, 122, 196, 218,
229, 236, 124, 125, 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,
@ -1537,7 +1462,82 @@ var _hcltok_trans_keys []byte = []byte{
163, 165, 186, 144, 145, 146, 147, 148,
150, 151, 152, 155, 157, 158, 160, 170,
171, 172, 175, 128, 159, 161, 169, 173,
191, 128, 191,
191, 128, 191, 10, 13, 34, 36, 37,
92, 128, 191, 192, 223, 224, 239, 240,
247, 248, 255, 10, 13, 34, 92, 36,
37, 128, 191, 192, 223, 224, 239, 240,
247, 248, 255, 10, 13, 92, 36, 37,
128, 191, 192, 223, 224, 239, 240, 247,
248, 255, 92, 36, 37, 192, 223, 224,
239, 240, 247, 10, 13, 34, 92, 36,
37, 192, 223, 224, 239, 240, 247, 248,
255, 10, 13, 34, 92, 36, 37, 128,
223, 224, 239, 240, 247, 248, 255, 10,
13, 34, 92, 36, 37, 128, 191, 192,
223, 224, 239, 240, 247, 248, 255, 123,
126, 123, 126, 128, 191, 128, 191, 128,
191, 10, 13, 36, 37, 128, 191, 192,
223, 224, 239, 240, 247, 248, 255, 10,
13, 36, 37, 128, 191, 192, 223, 224,
239, 240, 247, 248, 255, 126, 126, 128,
191, 128, 191, 128, 191, 10, 13, 36,
37, 128, 191, 192, 223, 224, 239, 240,
247, 248, 255, 10, 13, 36, 37, 128,
191, 192, 223, 224, 239, 240, 247, 248,
255, 126, 126, 128, 191, 128, 191, 128,
191, 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, 65, 90, 97, 122, 128, 191, 192,
193, 196, 218, 229, 236, 241, 247, 248,
255, 45, 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, 191, 151, 183, 128, 255,
192, 255, 0, 127, 173, 130, 133, 146,
159, 165, 171, 175, 191, 192, 255, 181,
190, 128, 175, 176, 183, 184, 185, 186,
191, 134, 139, 141, 162, 128, 135, 136,
255, 182, 130, 137, 176, 151, 152, 154,
160, 136, 191, 192, 255, 128, 143, 144,
170, 171, 175, 176, 178, 179, 191, 128,
159, 160, 191, 176, 128, 138, 139, 173,
174, 255, 148, 150, 164, 167, 173, 176,
185, 189, 190, 192, 255, 144, 128, 145,
146, 175, 176, 191, 128, 140, 141, 255,
166, 176, 178, 191, 192, 255, 186, 128,
137, 138, 170, 171, 179, 180, 181, 182,
191, 160, 161, 162, 164, 165, 166, 167,
168, 169, 170, 171, 172, 173, 174, 175,
176, 177, 178, 179, 180, 181, 182, 183,
184, 185, 186, 187, 188, 189, 190, 128,
191, 128, 129, 130, 131, 137, 138, 139,
140, 141, 142, 143, 144, 153, 154, 155,
156, 157, 158, 159, 160, 161, 162, 163,
164, 165, 166, 167, 168, 169, 170, 171,
172, 173, 174, 175, 176, 177, 178, 179,
180, 182, 183, 184, 188, 189, 190, 191,
132, 187, 129, 130, 132, 133, 134, 176,
177, 178, 179, 180, 181, 182, 183, 128,
191, 128, 129, 130, 131, 132, 133, 134,
135, 144, 136, 143, 145, 191, 192, 255,
182, 183, 184, 128, 191, 128, 191, 191,
128, 190, 192, 255, 128, 146, 147, 148,
152, 153, 154, 155, 156, 158, 159, 160,
161, 162, 163, 164, 165, 166, 167, 168,
169, 170, 171, 172, 173, 174, 175, 176,
129, 191, 192, 255, 158, 159, 128, 157,
160, 191, 192, 255, 128, 191, 164, 169,
171, 172, 173, 174, 175, 180, 181, 182,
183, 184, 185, 187, 188, 189, 190, 191,
128, 163, 165, 186, 144, 145, 146, 147,
148, 150, 151, 152, 155, 157, 158, 160,
170, 171, 172, 175, 128, 159, 161, 169,
173, 191, 128, 191,
}
var _hcltok_single_lengths []byte = []byte{
@ -1723,7 +1723,7 @@ var _hcltok_single_lengths []byte = []byte{
0, 0, 0, 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, 53, 2,
0, 0, 1, 0, 2, 0, 54, 2,
1, 1, 1, 1, 1, 2, 1, 3,
2, 2, 1, 34, 1, 1, 0, 3,
2, 0, 0, 0, 1, 2, 4, 1,
@ -2125,22 +2125,22 @@ var _hcltok_index_offsets []int16 = []int16{
7169, 7172, 7176, 7181, 7197, 7199, 7207, 7209,
7217, 7223, 7225, 7229, 7232, 7235, 7238, 7242,
7253, 7256, 7268, 7292, 7300, 7302, 7306, 7309,
7314, 7317, 7319, 7324, 7327, 7333, 7336, 7401,
7404, 7406, 7408, 7410, 7412, 7414, 7417, 7419,
7424, 7427, 7430, 7432, 7472, 7474, 7476, 7478,
7483, 7487, 7488, 7490, 7492, 7499, 7506, 7513,
7515, 7517, 7519, 7522, 7525, 7531, 7534, 7539,
7546, 7551, 7554, 7558, 7565, 7597, 7646, 7661,
7674, 7679, 7681, 7685, 7716, 7722, 7724, 7745,
7765, 7767, 7779, 7790, 7800, 7806, 7816, 7826,
7837, 7839, 7841, 7843, 7845, 7847, 7849, 7851,
7861, 7870, 7872, 7874, 7876, 7878, 7880, 7890,
7899, 7901, 7903, 7905, 7907, 7909, 7950, 7990,
7992, 7997, 8001, 8002, 8004, 8006, 8013, 8020,
8027, 8029, 8031, 8033, 8036, 8039, 8045, 8048,
8053, 8060, 8065, 8068, 8072, 8079, 8111, 8160,
8175, 8188, 8193, 8195, 8199, 8230, 8236, 8238,
8259, 8279,
7314, 7317, 7319, 7324, 7327, 7333, 7336, 7402,
7405, 7407, 7409, 7411, 7413, 7415, 7418, 7420,
7425, 7428, 7431, 7433, 7473, 7475, 7477, 7479,
7484, 7488, 7489, 7491, 7493, 7500, 7507, 7514,
7516, 7518, 7520, 7523, 7526, 7532, 7535, 7540,
7547, 7552, 7555, 7559, 7566, 7598, 7647, 7662,
7675, 7680, 7682, 7686, 7717, 7723, 7725, 7746,
7766, 7768, 7780, 7791, 7801, 7807, 7817, 7827,
7838, 7840, 7842, 7844, 7846, 7848, 7850, 7852,
7862, 7871, 7873, 7875, 7877, 7879, 7881, 7891,
7900, 7902, 7904, 7906, 7908, 7910, 7951, 7991,
7993, 7998, 8002, 8003, 8005, 8007, 8014, 8021,
8028, 8030, 8032, 8034, 8037, 8040, 8046, 8049,
8054, 8061, 8066, 8069, 8073, 8080, 8112, 8161,
8176, 8189, 8194, 8196, 8200, 8231, 8237, 8239,
8260, 8280,
}
var _hcltok_indicies []int16 = []int16{
@ -2162,7 +2162,7 @@ var _hcltok_indicies []int16 = []int16{
64, 65, 40, 42, 66, 44, 67, 68,
69, 14, 14, 14, 17, 41, 3, 47,
3, 14, 14, 14, 14, 3, 14, 14,
14, 3, 14, 3, 14, 14, 3, 3,
14, 3, 14, 3, 14, 3, 14, 3,
3, 3, 3, 3, 14, 3, 3, 3,
3, 14, 14, 14, 14, 14, 3, 3,
14, 3, 3, 14, 3, 14, 3, 3,
@ -3062,124 +3062,124 @@ var _hcltok_indicies []int16 = []int16{
1055, 1043, 1041, 797, 1042, 1041, 791, 1046,
1137, 1043, 1055, 1043, 1041, 1042, 1041, 791,
1138, 1139, 1140, 1138, 1141, 1142, 1143, 1144,
1146, 1147, 1148, 1149, 1150, 672, 672, 672,
1151, 1152, 1153, 1154, 672, 1157, 1158, 1160,
1161, 1162, 1156, 1163, 1164, 1165, 1166, 1167,
1168, 1169, 1170, 1171, 1172, 1173, 1174, 1175,
1176, 1177, 1178, 1179, 1180, 1181, 1182, 1184,
1185, 1186, 1187, 1188, 1189, 672, 1145, 10,
1145, 422, 1145, 422, 1156, 1159, 1183, 1190,
1155, 1138, 1138, 1191, 1139, 1192, 1194, 1193,
2, 1, 1195, 1193, 1196, 1193, 5, 1,
1193, 6, 5, 9, 11, 11, 10, 1198,
1199, 1200, 1193, 1201, 1202, 1193, 1203, 1193,
422, 422, 1205, 1206, 491, 472, 1207, 472,
1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215,
1216, 1217, 1218, 546, 1219, 522, 1220, 1221,
1222, 1223, 1224, 1225, 1226, 1227, 1228, 1229,
1230, 1231, 422, 422, 422, 427, 567, 1204,
1232, 1193, 1233, 1193, 672, 1234, 422, 422,
422, 672, 1234, 672, 672, 422, 1234, 422,
1234, 422, 1234, 422, 672, 672, 672, 672,
672, 1234, 422, 672, 672, 672, 422, 672,
422, 1234, 422, 672, 672, 672, 672, 422,
1234, 672, 422, 672, 422, 672, 422, 672,
672, 422, 672, 1234, 422, 672, 422, 672,
422, 672, 1234, 672, 422, 1234, 672, 422,
672, 422, 1234, 672, 672, 672, 672, 672,
1234, 422, 422, 672, 422, 672, 1234, 672,
422, 1234, 672, 672, 1234, 422, 422, 672,
422, 672, 422, 672, 1234, 1235, 1236, 1237,
1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245,
717, 1246, 1247, 1248, 1249, 1250, 1251, 1252,
1253, 1254, 1255, 1256, 1257, 1256, 1258, 1259,
1260, 1261, 1262, 673, 1234, 1263, 1264, 1265,
1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273,
1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281,
727, 1282, 1283, 1284, 694, 1285, 1286, 1287,
1288, 1289, 1290, 673, 1291, 1292, 1293, 1294,
1295, 1296, 1297, 1298, 676, 1299, 673, 676,
1300, 1301, 1302, 1303, 685, 1234, 1304, 1305,
1306, 1307, 705, 1308, 1309, 685, 1310, 1311,
1312, 1313, 1314, 673, 1234, 1315, 1274, 1316,
1317, 1318, 685, 1319, 1320, 676, 673, 685,
427, 1234, 1284, 673, 676, 685, 427, 685,
427, 1321, 685, 1234, 427, 676, 1322, 1323,
676, 1324, 1325, 683, 1326, 1327, 1328, 1329,
1330, 1280, 1331, 1332, 1333, 1334, 1335, 1336,
1337, 1338, 1339, 1340, 1341, 1342, 1299, 1343,
676, 685, 427, 1234, 1344, 1345, 685, 673,
1234, 427, 673, 1234, 676, 1346, 733, 1347,
1348, 1349, 1350, 1351, 1352, 1353, 1354, 673,
1355, 1356, 1357, 1358, 1359, 1360, 673, 685,
1234, 1362, 1363, 1364, 1365, 1366, 1367, 1368,
1369, 1370, 1371, 1372, 1368, 1374, 1375, 1376,
1377, 1361, 1373, 1361, 1234, 1361, 1234, 1378,
1378, 1379, 1380, 1381, 1382, 1383, 1384, 1385,
1386, 1383, 769, 1387, 1387, 1387, 1382, 1388,
1387, 770, 771, 1389, 1387, 769, 1387, 1387,
1382, 1390, 1387, 770, 771, 1389, 1387, 769,
1382, 1390, 1391, 1392, 1393, 769, 1387, 1387,
1387, 1382, 1388, 770, 771, 1389, 1387, 769,
1387, 1387, 1387, 1382, 1388, 770, 771, 1389,
1387, 769, 1387, 1387, 1387, 1382, 1388, 771,
770, 771, 1389, 1387, 769, 1395, 769, 1397,
1396, 1398, 769, 1400, 1399, 769, 1401, 773,
1401, 1402, 1401, 775, 1403, 1404, 1405, 1406,
1407, 1408, 1409, 1406, 777, 775, 1403, 1411,
1410, 778, 779, 1412, 1410, 777, 1414, 1413,
1416, 1415, 777, 1417, 778, 1417, 779, 1417,
783, 1418, 1419, 1420, 1421, 1422, 1423, 1424,
1421, 785, 783, 1418, 1426, 1425, 786, 787,
1427, 1425, 785, 1429, 1428, 1431, 1430, 785,
1432, 786, 1432, 787, 1432, 1435, 1436, 1438,
1439, 1440, 1434, 1441, 1442, 1443, 1444, 1445,
1446, 1447, 1448, 1449, 1450, 1451, 1452, 1453,
1454, 1455, 1456, 1457, 1458, 1459, 1460, 1462,
1463, 1464, 1465, 1466, 1467, 791, 791, 1433,
1434, 1437, 1461, 1468, 1433, 1042, 791, 791,
1470, 1471, 861, 842, 1472, 842, 1473, 1474,
1475, 1476, 1477, 1478, 1479, 1480, 1481, 1482,
1483, 916, 1484, 892, 1485, 1486, 1487, 1488,
1489, 1490, 1491, 1492, 1493, 1494, 1495, 1496,
791, 791, 791, 797, 937, 1469, 1042, 1497,
791, 791, 791, 1042, 1497, 1042, 1042, 791,
1497, 791, 1497, 791, 1497, 791, 1042, 1042,
1042, 1042, 1042, 1497, 791, 1042, 1042, 1042,
791, 1042, 791, 1497, 791, 1042, 1042, 1042,
1042, 791, 1497, 1042, 791, 1042, 791, 1042,
791, 1042, 1042, 791, 1042, 1497, 791, 1042,
791, 1042, 791, 1042, 1497, 1042, 791, 1497,
1042, 791, 1042, 791, 1497, 1042, 1042, 1042,
1042, 1042, 1497, 791, 791, 1042, 791, 1042,
1497, 1042, 791, 1497, 1042, 1042, 1497, 791,
791, 1042, 791, 1042, 791, 1042, 1497, 1498,
1499, 1500, 1501, 1502, 1503, 1504, 1505, 1506,
1507, 1508, 1087, 1509, 1510, 1511, 1512, 1513,
1514, 1515, 1516, 1517, 1518, 1519, 1520, 1519,
1521, 1522, 1523, 1524, 1525, 1043, 1497, 1526,
1527, 1528, 1529, 1530, 1531, 1532, 1533, 1534,
1535, 1536, 1537, 1538, 1539, 1540, 1541, 1542,
1543, 1544, 1097, 1545, 1546, 1547, 1064, 1548,
1549, 1550, 1551, 1552, 1553, 1043, 1554, 1555,
1556, 1557, 1558, 1559, 1560, 1561, 1046, 1562,
1043, 1046, 1563, 1564, 1565, 1566, 1055, 1497,
1567, 1568, 1569, 1570, 1075, 1571, 1572, 1055,
1573, 1574, 1575, 1576, 1577, 1043, 1497, 1578,
1537, 1579, 1580, 1581, 1055, 1582, 1583, 1046,
1043, 1055, 797, 1497, 1547, 1043, 1046, 1055,
797, 1055, 797, 1584, 1055, 1497, 797, 1046,
1585, 1586, 1046, 1587, 1588, 1053, 1589, 1590,
1591, 1592, 1593, 1543, 1594, 1595, 1596, 1597,
1598, 1599, 1600, 1601, 1602, 1603, 1604, 1605,
1562, 1606, 1046, 1055, 797, 1497, 1607, 1608,
1055, 1043, 1497, 797, 1043, 1497, 1046, 1609,
1103, 1610, 1611, 1612, 1613, 1614, 1615, 1616,
1617, 1043, 1618, 1619, 1620, 1621, 1622, 1623,
1043, 1055, 1497, 1625, 1626, 1627, 1628, 1629,
1630, 1631, 1632, 1633, 1634, 1635, 1631, 1637,
1638, 1639, 1640, 1624, 1636, 1624, 1497, 1624,
1497,
1145, 1146, 1147, 1148, 1149, 1150, 672, 672,
672, 1151, 1152, 1153, 1154, 672, 1157, 1158,
1160, 1161, 1162, 1156, 1163, 1164, 1165, 1166,
1167, 1168, 1169, 1170, 1171, 1172, 1173, 1174,
1175, 1176, 1177, 1178, 1179, 1180, 1181, 1182,
1184, 1185, 1186, 1187, 1188, 1189, 672, 1144,
10, 1144, 422, 1144, 422, 1156, 1159, 1183,
1190, 1155, 1138, 1138, 1191, 1139, 1192, 1194,
1193, 2, 1, 1195, 1193, 1196, 1193, 5,
1, 1193, 6, 5, 9, 11, 11, 10,
1198, 1199, 1200, 1193, 1201, 1202, 1193, 1203,
1193, 422, 422, 1205, 1206, 491, 472, 1207,
472, 1208, 1209, 1210, 1211, 1212, 1213, 1214,
1215, 1216, 1217, 1218, 546, 1219, 522, 1220,
1221, 1222, 1223, 1224, 1225, 1226, 1227, 1228,
1229, 1230, 1231, 422, 422, 422, 427, 567,
1204, 1232, 1193, 1233, 1193, 672, 1234, 422,
422, 422, 672, 1234, 672, 672, 422, 1234,
422, 1234, 422, 1234, 422, 672, 672, 672,
672, 672, 1234, 422, 672, 672, 672, 422,
672, 422, 1234, 422, 672, 672, 672, 672,
422, 1234, 672, 422, 672, 422, 672, 422,
672, 672, 422, 672, 1234, 422, 672, 422,
672, 422, 672, 1234, 672, 422, 1234, 672,
422, 672, 422, 1234, 672, 672, 672, 672,
672, 1234, 422, 422, 672, 422, 672, 1234,
672, 422, 1234, 672, 672, 1234, 422, 422,
672, 422, 672, 422, 672, 1234, 1235, 1236,
1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244,
1245, 717, 1246, 1247, 1248, 1249, 1250, 1251,
1252, 1253, 1254, 1255, 1256, 1257, 1256, 1258,
1259, 1260, 1261, 1262, 673, 1234, 1263, 1264,
1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272,
1273, 1274, 1275, 1276, 1277, 1278, 1279, 1280,
1281, 727, 1282, 1283, 1284, 694, 1285, 1286,
1287, 1288, 1289, 1290, 673, 1291, 1292, 1293,
1294, 1295, 1296, 1297, 1298, 676, 1299, 673,
676, 1300, 1301, 1302, 1303, 685, 1234, 1304,
1305, 1306, 1307, 705, 1308, 1309, 685, 1310,
1311, 1312, 1313, 1314, 673, 1234, 1315, 1274,
1316, 1317, 1318, 685, 1319, 1320, 676, 673,
685, 427, 1234, 1284, 673, 676, 685, 427,
685, 427, 1321, 685, 1234, 427, 676, 1322,
1323, 676, 1324, 1325, 683, 1326, 1327, 1328,
1329, 1330, 1280, 1331, 1332, 1333, 1334, 1335,
1336, 1337, 1338, 1339, 1340, 1341, 1342, 1299,
1343, 676, 685, 427, 1234, 1344, 1345, 685,
673, 1234, 427, 673, 1234, 676, 1346, 733,
1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354,
673, 1355, 1356, 1357, 1358, 1359, 1360, 673,
685, 1234, 1362, 1363, 1364, 1365, 1366, 1367,
1368, 1369, 1370, 1371, 1372, 1368, 1374, 1375,
1376, 1377, 1361, 1373, 1361, 1234, 1361, 1234,
1378, 1378, 1379, 1380, 1381, 1382, 1383, 1384,
1385, 1386, 1383, 769, 1387, 1387, 1387, 1382,
1388, 1387, 770, 771, 1389, 1387, 769, 1387,
1387, 1382, 1390, 1387, 770, 771, 1389, 1387,
769, 1382, 1390, 1391, 1392, 1393, 769, 1387,
1387, 1387, 1382, 1388, 770, 771, 1389, 1387,
769, 1387, 1387, 1387, 1382, 1388, 770, 771,
1389, 1387, 769, 1387, 1387, 1387, 1382, 1388,
771, 770, 771, 1389, 1387, 769, 1395, 769,
1397, 1396, 1398, 769, 1400, 1399, 769, 1401,
773, 1401, 1402, 1401, 775, 1403, 1404, 1405,
1406, 1407, 1408, 1409, 1406, 777, 775, 1403,
1411, 1410, 778, 779, 1412, 1410, 777, 1414,
1413, 1416, 1415, 777, 1417, 778, 1417, 779,
1417, 783, 1418, 1419, 1420, 1421, 1422, 1423,
1424, 1421, 785, 783, 1418, 1426, 1425, 786,
787, 1427, 1425, 785, 1429, 1428, 1431, 1430,
785, 1432, 786, 1432, 787, 1432, 1435, 1436,
1438, 1439, 1440, 1434, 1441, 1442, 1443, 1444,
1445, 1446, 1447, 1448, 1449, 1450, 1451, 1452,
1453, 1454, 1455, 1456, 1457, 1458, 1459, 1460,
1462, 1463, 1464, 1465, 1466, 1467, 791, 791,
1433, 1434, 1437, 1461, 1468, 1433, 1042, 791,
791, 1470, 1471, 861, 842, 1472, 842, 1473,
1474, 1475, 1476, 1477, 1478, 1479, 1480, 1481,
1482, 1483, 916, 1484, 892, 1485, 1486, 1487,
1488, 1489, 1490, 1491, 1492, 1493, 1494, 1495,
1496, 791, 791, 791, 797, 937, 1469, 1042,
1497, 791, 791, 791, 1042, 1497, 1042, 1042,
791, 1497, 791, 1497, 791, 1497, 791, 1042,
1042, 1042, 1042, 1042, 1497, 791, 1042, 1042,
1042, 791, 1042, 791, 1497, 791, 1042, 1042,
1042, 1042, 791, 1497, 1042, 791, 1042, 791,
1042, 791, 1042, 1042, 791, 1042, 1497, 791,
1042, 791, 1042, 791, 1042, 1497, 1042, 791,
1497, 1042, 791, 1042, 791, 1497, 1042, 1042,
1042, 1042, 1042, 1497, 791, 791, 1042, 791,
1042, 1497, 1042, 791, 1497, 1042, 1042, 1497,
791, 791, 1042, 791, 1042, 791, 1042, 1497,
1498, 1499, 1500, 1501, 1502, 1503, 1504, 1505,
1506, 1507, 1508, 1087, 1509, 1510, 1511, 1512,
1513, 1514, 1515, 1516, 1517, 1518, 1519, 1520,
1519, 1521, 1522, 1523, 1524, 1525, 1043, 1497,
1526, 1527, 1528, 1529, 1530, 1531, 1532, 1533,
1534, 1535, 1536, 1537, 1538, 1539, 1540, 1541,
1542, 1543, 1544, 1097, 1545, 1546, 1547, 1064,
1548, 1549, 1550, 1551, 1552, 1553, 1043, 1554,
1555, 1556, 1557, 1558, 1559, 1560, 1561, 1046,
1562, 1043, 1046, 1563, 1564, 1565, 1566, 1055,
1497, 1567, 1568, 1569, 1570, 1075, 1571, 1572,
1055, 1573, 1574, 1575, 1576, 1577, 1043, 1497,
1578, 1537, 1579, 1580, 1581, 1055, 1582, 1583,
1046, 1043, 1055, 797, 1497, 1547, 1043, 1046,
1055, 797, 1055, 797, 1584, 1055, 1497, 797,
1046, 1585, 1586, 1046, 1587, 1588, 1053, 1589,
1590, 1591, 1592, 1593, 1543, 1594, 1595, 1596,
1597, 1598, 1599, 1600, 1601, 1602, 1603, 1604,
1605, 1562, 1606, 1046, 1055, 797, 1497, 1607,
1608, 1055, 1043, 1497, 797, 1043, 1497, 1046,
1609, 1103, 1610, 1611, 1612, 1613, 1614, 1615,
1616, 1617, 1043, 1618, 1619, 1620, 1621, 1622,
1623, 1043, 1055, 1497, 1625, 1626, 1627, 1628,
1629, 1630, 1631, 1632, 1633, 1634, 1635, 1631,
1637, 1638, 1639, 1640, 1624, 1636, 1624, 1497,
1624, 1497,
}
var _hcltok_trans_targs []int16 = []int16{
@ -3326,7 +3326,7 @@ var _hcltok_trans_targs []int16 = []int16{
1438, 1439, 1440, 1441, 1442, 1443, 1444, 1445,
1446, 1448, 1449, 1450, 1451, 1454, 1456, 1457,
1459, 1461, 1463, 1462, 1464, 1465, 1462, 1466,
1467, 1462, 1468, 1469, 1472, 1473, 1474, 1462,
1462, 1467, 1468, 1469, 1472, 1473, 1474, 1462,
1476, 1462, 1477, 1462, 1478, 1479, 1480, 1481,
1482, 1483, 1484, 1485, 1486, 1487, 1488, 1489,
1490, 1491, 1492, 1493, 1494, 1495, 1496, 1497,
@ -3535,7 +3535,7 @@ var _hcltok_trans_actions []byte = []byte{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 87, 0, 0, 113, 178,
0, 105, 5, 172, 5, 0, 0, 107,
105, 0, 5, 172, 5, 0, 0, 107,
0, 109, 0, 117, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,

View File

@ -39,7 +39,7 @@ func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []To
Ident = ID_Start (ID_Continue | '-')*;
# Symbols that just represent themselves are handled as a single rule.
SelfToken = "[" | "]" | "(" | ")" | "." | "," | "*" | "/" | "+" | "-" | "=" | "<" | ">" | "!" | "?" | ":" | "\n" | "&" | "|" | "~" | "^" | ";" | "`";
SelfToken = "[" | "]" | "(" | ")" | "." | "," | "*" | "/" | "%" | "+" | "-" | "=" | "<" | ">" | "!" | "?" | ":" | "\n" | "&" | "|" | "~" | "^" | ";" | "`";
EqualOp = "==";
NotEqual = "!=";

View File

@ -1049,6 +1049,43 @@ EOF
},
},
},
{
`9%8`,
[]Token{
{
Type: TokenNumberLit,
Bytes: []byte(`9`),
Range: hcl.Range{
Start: hcl.Pos{Byte: 0, Line: 1, Column: 1},
End: hcl.Pos{Byte: 1, Line: 1, Column: 2},
},
},
{
Type: TokenPercent,
Bytes: []byte(`%`),
Range: hcl.Range{
Start: hcl.Pos{Byte: 1, Line: 1, Column: 2},
End: hcl.Pos{Byte: 2, Line: 1, Column: 3},
},
},
{
Type: TokenNumberLit,
Bytes: []byte(`8`),
Range: hcl.Range{
Start: hcl.Pos{Byte: 2, Line: 1, Column: 3},
End: hcl.Pos{Byte: 3, Line: 1, Column: 4},
},
},
{
Type: TokenEOF,
Bytes: []byte(``),
Range: hcl.Range{
Start: hcl.Pos{Byte: 3, Line: 1, Column: 4},
End: hcl.Pos{Byte: 3, Line: 1, Column: 4},
},
},
},
},
{
"\na = 1\n",
[]Token{