Skip to content

Instantly share code, notes, and snippets.

@jlindsey
Last active September 23, 2020 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlindsey/11473f4e41c49881cc115a294f2b31f3 to your computer and use it in GitHub Desktop.
Save jlindsey/11473f4e41c49881cc115a294f2b31f3 to your computer and use it in GitHub Desktop.
❯ target/debug/hcl2 <<EOF | pbcopy
test block "label" {
a = 1.4e9
b = -73.19e-12
internal {
a = "test string here"
b = 5
c = 7.3
d = -3
e = -4.873
k = <<EOF
heredoc string
is here, doc
EOF
}
block two {
a = false
b = true
c = null
d = [1, 2, 3]
e = [false, null, "string", ["sub", "array", true]]
}
}
another test block {
a = "another test string"
b = 1.7e10
c = false
}
EOF
input: test block "label" {
a = 1.4e9
b = -73.19e-12
internal {
a = "test string here"
b = 5
c = 7.3
d = -3
e = -4.873
k = <<EOF
heredoc string
is here, doc
EOF
}
block two {
a = false
b = true
c = null
d = [1, 2, 3]
e = [false, null, "string", ["sub", "array", true]]
}
}
another test block {
a = "another test string"
b = 1.7e10
c = false
}
forward backward : parser : offset : fragment
1 : -> attribute : 0 : test block "label" {
2 : -> identifier : 0 : test block "label" {
1 : <- identifier : 4 : block "label" {
2 : <- attribute
forward backward : parser : offset : fragment
1 : -> block : 0 : test block "label" {
2 : -> one_line_block : 0 : test block "label" {
3 : -> identifier : 0 : test block "label" {
1 : <- identifier : 4 : block "label" {
4 : -> block_label : 5 : block "label" {
5 : -> identifier : 5 : block "label" {
2 : <- identifier : 10 : "label" {
3 : <- block_label : 10 : "label" {
6 : -> block_label : 11 : "label" {
7 : -> string : 11 : "label" {
8 : -> single_line_string : 11 : "label" {
4 : <- single_line_string : 18 : {
5 : <- string : 18 : {
6 : <- block_label : 18 : {
9 : -> block_label : 19 : {
10 : -> identifier : 19 : {
7 : <- identifier
8 : <- block_label
11 : -> attribute : 20 :
12 : -> identifier : 20 :
9 : <- identifier
10 : <- attribute
11 : <- one_line_block
13 : -> multi_line_block : 0 : test block "label" {
14 : -> identifier : 0 : test block "label" {
12 : <- identifier : 4 : block "label" {
15 : -> block_label : 5 : block "label" {
16 : -> identifier : 5 : block "label" {
13 : <- identifier : 10 : "label" {
14 : <- block_label : 10 : "label" {
17 : -> block_label : 11 : "label" {
18 : -> string : 11 : "label" {
19 : -> single_line_string : 11 : "label" {
15 : <- single_line_string : 18 : {
16 : <- string : 18 : {
17 : <- block_label : 18 : {
20 : -> block_label : 19 : {
21 : -> identifier : 19 : {
18 : <- identifier
19 : <- block_label
22 : -> body : 21 : a = 1.4e9
23 : -> attribute : 25 : a = 1.4e9
24 : -> identifier : 25 : a = 1.4e9
20 : <- identifier : 26 : = 1.4e9
25 : -> expr_item : 29 : 1.4e9
26 : -> literal_val : 29 : 1.4e9
27 : -> number : 29 : 1.4e9
28 : -> sign : 29 : 1.4e9
21 : <- sign
29 : -> exponent : 32 : e9
30 : -> sign : 33 : 9
22 : <- sign
23 : <- exponent : 34 :
24 : <- number : 34 :
25 : <- literal_val : 34 :
26 : <- expr_item : 34 :
27 : <- attribute : 35 : b = -73.19e-12
31 : -> attribute : 39 : b = -73.19e-12
32 : -> identifier : 39 : b = -73.19e-12
28 : <- identifier : 40 : = -73.19e-12
33 : -> expr_item : 43 : -73.19e-12
34 : -> literal_val : 43 : -73.19e-12
35 : -> number : 43 : -73.19e-12
36 : -> sign : 43 : -73.19e-12
29 : <- sign : 44 : 73.19e-12
37 : -> exponent : 49 : e-12
38 : -> sign : 50 : -12
30 : <- sign : 51 : 12
31 : <- exponent : 53 :
32 : <- number : 53 :
33 : <- literal_val : 53 :
34 : <- expr_item : 53 :
35 : <- attribute : 54 :
39 : -> attribute : 59 : internal {
40 : -> identifier : 59 : internal {
36 : <- identifier : 67 : {
37 : <- attribute
41 : -> block : 59 : internal {
42 : -> one_line_block : 59 : internal {
43 : -> identifier : 59 : internal {
38 : <- identifier : 67 : {
44 : -> block_label : 68 : {
45 : -> identifier : 68 : {
39 : <- identifier
40 : <- block_label
46 : -> attribute : 69 :
47 : -> identifier : 69 :
41 : <- identifier
42 : <- attribute
43 : <- one_line_block
48 : -> multi_line_block : 59 : internal {
49 : -> identifier : 59 : internal {
44 : <- identifier : 67 : {
50 : -> block_label : 68 : {
51 : -> identifier : 68 : {
45 : <- identifier
46 : <- block_label
52 : -> body : 70 : a = "test string here"
53 : -> attribute : 78 : a = "test string here"
54 : -> identifier : 78 : a = "test string here"
47 : <- identifier : 79 : = "test string here"
55 : -> expr_item : 82 : "test string here"
56 : -> literal_val : 82 : "test string here"
57 : -> string : 82 : "test string here"
58 : -> single_line_string : 82 : "test string here"
48 : <- single_line_string : 100 :
49 : <- string : 100 :
50 : <- literal_val : 100 :
51 : <- expr_item : 100 :
52 : <- attribute : 101 : b = 5
59 : -> attribute : 109 : b = 5
60 : -> identifier : 109 : b = 5
53 : <- identifier : 110 : = 5
61 : -> expr_item : 113 : 5
62 : -> literal_val : 113 : 5
63 : -> number : 113 : 5
64 : -> sign : 113 : 5
54 : <- sign
65 : -> exponent : 114 :
55 : <- exponent
56 : <- number : 114 :
57 : <- literal_val : 114 :
58 : <- expr_item : 114 :
59 : <- attribute : 115 : c = 7.3
66 : -> attribute : 123 : c = 7.3
67 : -> identifier : 123 : c = 7.3
60 : <- identifier : 124 : = 7.3
68 : -> expr_item : 127 : 7.3
69 : -> literal_val : 127 : 7.3
70 : -> number : 127 : 7.3
71 : -> sign : 127 : 7.3
61 : <- sign
72 : -> exponent : 130 :
62 : <- exponent
63 : <- number : 130 :
64 : <- literal_val : 130 :
65 : <- expr_item : 130 :
66 : <- attribute : 131 : d = -3
73 : -> attribute : 139 : d = -3
74 : -> identifier : 139 : d = -3
67 : <- identifier : 140 : = -3
75 : -> expr_item : 143 : -3
76 : -> literal_val : 143 : -3
77 : -> number : 143 : -3
78 : -> sign : 143 : -3
68 : <- sign : 144 : 3
79 : -> exponent : 145 :
69 : <- exponent
70 : <- number : 145 :
71 : <- literal_val : 145 :
72 : <- expr_item : 145 :
73 : <- attribute : 146 : e = -4.873
80 : -> attribute : 154 : e = -4.873
81 : -> identifier : 154 : e = -4.873
74 : <- identifier : 155 : = -4.873
82 : -> expr_item : 158 : -4.873
83 : -> literal_val : 158 : -4.873
84 : -> number : 158 : -4.873
85 : -> sign : 158 : -4.873
75 : <- sign : 159 : 4.873
86 : -> exponent : 164 :
76 : <- exponent
77 : <- number : 164 :
78 : <- literal_val : 164 :
79 : <- expr_item : 164 :
80 : <- attribute : 165 : k = <<EOF
87 : -> attribute : 173 : k = <<EOF
88 : -> identifier : 173 : k = <<EOF
81 : <- identifier : 174 : = <<EOF
89 : -> expr_item : 177 : <<EOF
90 : -> literal_val : 177 : <<EOF
91 : -> string : 177 : <<EOF
92 : -> heredoc : 177 : <<EOF
93 : -> identifier : 179 : EOF
82 : <- identifier : 182 :
83 : <- heredoc : 239 : }
84 : <- string : 239 : }
85 : <- literal_val : 239 : }
86 : <- expr_item : 239 : }
87 : <- attribute : 239 : }
94 : -> attribute : 243 : }
95 : -> identifier : 243 : }
88 : <- identifier
89 : <- attribute
96 : -> block : 243 : }
97 : -> one_line_block : 243 : }
98 : -> identifier : 243 : }
90 : <- identifier
91 : <- one_line_block
99 : -> multi_line_block : 243 : }
100 : -> identifier : 243 : }
92 : <- identifier
93 : <- multi_line_block
94 : <- block
95 : <- body : 239 : }
96 : <- multi_line_block : 245 :
97 : <- block : 245 :
101 : -> attribute : 250 : block two {
102 : -> identifier : 250 : block two {
98 : <- identifier : 255 : two {
99 : <- attribute
103 : -> block : 250 : block two {
104 : -> one_line_block : 250 : block two {
105 : -> identifier : 250 : block two {
100 : <- identifier : 255 : two {
106 : -> block_label : 256 : two {
107 : -> identifier : 256 : two {
101 : <- identifier : 259 : {
102 : <- block_label : 259 : {
108 : -> block_label : 260 : {
109 : -> identifier : 260 : {
103 : <- identifier
104 : <- block_label
110 : -> attribute : 261 :
111 : -> identifier : 261 :
105 : <- identifier
106 : <- attribute
107 : <- one_line_block
112 : -> multi_line_block : 250 : block two {
113 : -> identifier : 250 : block two {
108 : <- identifier : 255 : two {
114 : -> block_label : 256 : two {
115 : -> identifier : 256 : two {
109 : <- identifier : 259 : {
110 : <- block_label : 259 : {
116 : -> block_label : 260 : {
117 : -> identifier : 260 : {
111 : <- identifier
112 : <- block_label
118 : -> body : 262 : a = false
119 : -> attribute : 270 : a = false
120 : -> identifier : 270 : a = false
113 : <- identifier : 271 : = false
121 : -> expr_item : 274 : false
122 : -> literal_val : 274 : false
123 : -> boolean : 274 : false
124 : -> false_literal : 274 : false
114 : <- false_literal : 279 :
115 : <- boolean : 279 :
116 : <- literal_val : 279 :
117 : <- expr_item : 279 :
118 : <- attribute : 280 : b = true
125 : -> attribute : 288 : b = true
126 : -> identifier : 288 : b = true
119 : <- identifier : 289 : = true
127 : -> expr_item : 292 : true
128 : -> literal_val : 292 : true
129 : -> boolean : 292 : true
130 : -> true_literal : 292 : true
120 : <- true_literal : 296 :
121 : <- boolean : 296 :
122 : <- literal_val : 296 :
123 : <- expr_item : 296 :
124 : <- attribute : 297 : c = null
131 : -> attribute : 305 : c = null
132 : -> identifier : 305 : c = null
125 : <- identifier : 306 : = null
133 : -> expr_item : 309 : null
134 : -> literal_val : 309 : null
135 : -> null_literal : 309 : null
126 : <- null_literal : 313 :
127 : <- literal_val : 313 :
128 : <- expr_item : 313 :
129 : <- attribute : 314 : d = [1, 2, 3]
136 : -> attribute : 322 : d = [1, 2, 3]
137 : -> identifier : 322 : d = [1, 2, 3]
130 : <- identifier : 323 : = [1, 2, 3]
138 : -> expr_item : 326 : [1, 2, 3]
139 : -> literal_val : 326 : [1, 2, 3]
131 : <- literal_val
140 : -> collection_val : 326 : [1, 2, 3]
141 : -> array : 326 : [1, 2, 3]
142 : -> expr_item : 327 : 1, 2, 3]
143 : -> literal_val : 327 : 1, 2, 3]
144 : -> number : 327 : 1, 2, 3]
145 : -> sign : 327 : 1, 2, 3]
132 : <- sign
146 : -> exponent : 328 : , 2, 3]
133 : <- exponent
134 : <- number : 328 : , 2, 3]
135 : <- literal_val : 328 : , 2, 3]
136 : <- expr_item : 328 : , 2, 3]
147 : -> expr_item : 330 : 2, 3]
148 : -> literal_val : 330 : 2, 3]
149 : -> number : 330 : 2, 3]
150 : -> sign : 330 : 2, 3]
137 : <- sign
151 : -> exponent : 331 : , 3]
138 : <- exponent
139 : <- number : 331 : , 3]
140 : <- literal_val : 331 : , 3]
141 : <- expr_item : 331 : , 3]
152 : -> expr_item : 333 : 3]
153 : -> literal_val : 333 : 3]
154 : -> number : 333 : 3]
155 : -> sign : 333 : 3]
142 : <- sign
156 : -> exponent : 334 : ]
143 : <- exponent
144 : <- number : 334 : ]
145 : <- literal_val : 334 : ]
146 : <- expr_item : 334 : ]
147 : <- array : 335 :
148 : <- collection_val : 335 :
149 : <- expr_item : 335 :
150 : <- attribute : 336 : e = [false, null, "string", ["sub", "array", true]]
157 : -> attribute : 344 : e = [false, null, "string", ["sub", "array", true]]
158 : -> identifier : 344 : e = [false, null, "string", ["sub", "array", true]]
151 : <- identifier : 345 : = [false, null, "string", ["sub", "array", true]]
159 : -> expr_item : 348 : [false, null, "string", ["sub", "array", true]]
160 : -> literal_val : 348 : [false, null, "string", ["sub", "array", true]]
152 : <- literal_val
161 : -> collection_val : 348 : [false, null, "string", ["sub", "array", true]]
162 : -> array : 348 : [false, null, "string", ["sub", "array", true]]
163 : -> expr_item : 349 : false, null, "string", ["sub", "array", true]]
164 : -> literal_val : 349 : false, null, "string", ["sub", "array", true]]
165 : -> boolean : 349 : false, null, "string", ["sub", "array", true]]
166 : -> false_literal : 349 : false, null, "string", ["sub", "array", true]]
153 : <- false_literal : 354 : , null, "string", ["sub", "array", true]]
154 : <- boolean : 354 : , null, "string", ["sub", "array", true]]
155 : <- literal_val : 354 : , null, "string", ["sub", "array", true]]
156 : <- expr_item : 354 : , null, "string", ["sub", "array", true]]
167 : -> expr_item : 356 : null, "string", ["sub", "array", true]]
168 : -> literal_val : 356 : null, "string", ["sub", "array", true]]
169 : -> null_literal : 356 : null, "string", ["sub", "array", true]]
157 : <- null_literal : 360 : , "string", ["sub", "array", true]]
158 : <- literal_val : 360 : , "string", ["sub", "array", true]]
159 : <- expr_item : 360 : , "string", ["sub", "array", true]]
170 : -> expr_item : 362 : "string", ["sub", "array", true]]
171 : -> literal_val : 362 : "string", ["sub", "array", true]]
172 : -> string : 362 : "string", ["sub", "array", true]]
173 : -> single_line_string : 362 : "string", ["sub", "array", true]]
160 : <- single_line_string : 370 : , ["sub", "array", true]]
161 : <- string : 370 : , ["sub", "array", true]]
162 : <- literal_val : 370 : , ["sub", "array", true]]
163 : <- expr_item : 370 : , ["sub", "array", true]]
174 : -> expr_item : 372 : ["sub", "array", true]]
175 : -> literal_val : 372 : ["sub", "array", true]]
164 : <- literal_val
176 : -> collection_val : 372 : ["sub", "array", true]]
177 : -> array : 372 : ["sub", "array", true]]
178 : -> expr_item : 373 : "sub", "array", true]]
179 : -> literal_val : 373 : "sub", "array", true]]
180 : -> string : 373 : "sub", "array", true]]
181 : -> single_line_string : 373 : "sub", "array", true]]
165 : <- single_line_string : 378 : , "array", true]]
166 : <- string : 378 : , "array", true]]
167 : <- literal_val : 378 : , "array", true]]
168 : <- expr_item : 378 : , "array", true]]
182 : -> expr_item : 380 : "array", true]]
183 : -> literal_val : 380 : "array", true]]
184 : -> string : 380 : "array", true]]
185 : -> single_line_string : 380 : "array", true]]
169 : <- single_line_string : 387 : , true]]
170 : <- string : 387 : , true]]
171 : <- literal_val : 387 : , true]]
172 : <- expr_item : 387 : , true]]
186 : -> expr_item : 389 : true]]
187 : -> literal_val : 389 : true]]
188 : -> boolean : 389 : true]]
189 : -> true_literal : 389 : true]]
173 : <- true_literal : 393 : ]]
174 : <- boolean : 393 : ]]
175 : <- literal_val : 393 : ]]
176 : <- expr_item : 393 : ]]
177 : <- array : 394 : ]
178 : <- collection_val : 394 : ]
179 : <- expr_item : 394 : ]
180 : <- array : 395 :
181 : <- collection_val : 395 :
182 : <- expr_item : 395 :
183 : <- attribute : 396 : }
190 : -> attribute : 400 : }
191 : -> identifier : 400 : }
184 : <- identifier
185 : <- attribute
192 : -> block : 400 : }
193 : -> one_line_block : 400 : }
194 : -> identifier : 400 : }
186 : <- identifier
187 : <- one_line_block
195 : -> multi_line_block : 400 : }
196 : -> identifier : 400 : }
188 : <- identifier
189 : <- multi_line_block
190 : <- block
191 : <- body : 396 : }
192 : <- multi_line_block : 402 : }
193 : <- block : 402 : }
197 : -> attribute : 402 : }
198 : -> identifier : 402 : }
194 : <- identifier
195 : <- attribute
199 : -> block : 402 : }
200 : -> one_line_block : 402 : }
201 : -> identifier : 402 : }
196 : <- identifier
197 : <- one_line_block
202 : -> multi_line_block : 402 : }
203 : -> identifier : 402 : }
198 : <- identifier
199 : <- multi_line_block
200 : <- block
201 : <- body : 402 : }
202 : <- multi_line_block : 404 :
203 : <- block : 404 :
forward backward : parser : offset : fragment
1 : -> attribute : 405 : another test block {
2 : -> identifier : 405 : another test block {
1 : <- identifier : 412 : test block {
2 : <- attribute
forward backward : parser : offset : fragment
1 : -> block : 405 : another test block {
2 : -> one_line_block : 405 : another test block {
3 : -> identifier : 405 : another test block {
1 : <- identifier : 412 : test block {
4 : -> block_label : 413 : test block {
5 : -> identifier : 413 : test block {
2 : <- identifier : 417 : block {
3 : <- block_label : 417 : block {
6 : -> block_label : 418 : block {
7 : -> identifier : 418 : block {
4 : <- identifier : 423 : {
5 : <- block_label : 423 : {
8 : -> block_label : 424 : {
9 : -> identifier : 424 : {
6 : <- identifier
7 : <- block_label
10 : -> attribute : 425 :
11 : -> identifier : 425 :
8 : <- identifier
9 : <- attribute
10 : <- one_line_block
12 : -> multi_line_block : 405 : another test block {
13 : -> identifier : 405 : another test block {
11 : <- identifier : 412 : test block {
14 : -> block_label : 413 : test block {
15 : -> identifier : 413 : test block {
12 : <- identifier : 417 : block {
13 : <- block_label : 417 : block {
16 : -> block_label : 418 : block {
17 : -> identifier : 418 : block {
14 : <- identifier : 423 : {
15 : <- block_label : 423 : {
18 : -> block_label : 424 : {
19 : -> identifier : 424 : {
16 : <- identifier
17 : <- block_label
20 : -> body : 426 : a = "another test string"
21 : -> attribute : 430 : a = "another test string"
22 : -> identifier : 430 : a = "another test string"
18 : <- identifier : 431 : = "another test string"
23 : -> expr_item : 434 : "another test string"
24 : -> literal_val : 434 : "another test string"
25 : -> string : 434 : "another test string"
26 : -> single_line_string : 434 : "another test string"
19 : <- single_line_string : 455 :
20 : <- string : 455 :
21 : <- literal_val : 455 :
22 : <- expr_item : 455 :
23 : <- attribute : 456 : b = 1.7e10
27 : -> attribute : 460 : b = 1.7e10
28 : -> identifier : 460 : b = 1.7e10
24 : <- identifier : 461 : = 1.7e10
29 : -> expr_item : 464 : 1.7e10
30 : -> literal_val : 464 : 1.7e10
31 : -> number : 464 : 1.7e10
32 : -> sign : 464 : 1.7e10
25 : <- sign
33 : -> exponent : 467 : e10
34 : -> sign : 468 : 10
26 : <- sign
27 : <- exponent : 470 :
28 : <- number : 470 :
29 : <- literal_val : 470 :
30 : <- expr_item : 470 :
31 : <- attribute : 471 : c = false
35 : -> attribute : 475 : c = false
36 : -> identifier : 475 : c = false
32 : <- identifier : 476 : = false
37 : -> expr_item : 479 : false
38 : -> literal_val : 479 : false
39 : -> boolean : 479 : false
40 : -> false_literal : 479 : false
33 : <- false_literal : 484 :
34 : <- boolean : 484 :
35 : <- literal_val : 484 :
36 : <- expr_item : 484 :
37 : <- attribute : 485 : }
41 : -> attribute : 485 : }
42 : -> identifier : 485 : }
38 : <- identifier
39 : <- attribute
43 : -> block : 485 : }
44 : -> one_line_block : 485 : }
45 : -> identifier : 485 : }
40 : <- identifier
41 : <- one_line_block
46 : -> multi_line_block : 485 : }
47 : -> identifier : 485 : }
42 : <- identifier
43 : <- multi_line_block
44 : <- block
45 : <- body : 485 : }
46 : <- multi_line_block : 487 :
47 : <- block : 487 :
forward backward : parser : offset : fragment
1 : -> attribute : 487 :
2 : -> identifier : 487 :
1 : <- identifier
2 : <- attribute
forward backward : parser : offset : fragment
1 : -> block : 487 :
2 : -> one_line_block : 487 :
3 : -> identifier : 487 :
1 : <- identifier
2 : <- one_line_block
4 : -> multi_line_block : 487 :
5 : -> identifier : 487 :
3 : <- identifier
4 : <- multi_line_block
5 : <- block
parsed ast: [
Node {
offset: 0,
line: 1,
column: 1,
token: Block(
Block {
ident: Node {
offset: 0,
line: 1,
column: 1,
token: Identifier(
"test",
),
},
labels: [
Node {
offset: 5,
line: 1,
column: 6,
token: Identifier(
"block",
),
},
Node {
offset: 12,
line: 1,
column: 13,
token: String(
"label",
),
},
],
body: Some(
Node {
offset: 21,
line: 2,
column: 1,
token: Body(
[
Node {
offset: 25,
line: 2,
column: 5,
token: Attribute(
Attribute {
ident: Node {
offset: 25,
line: 2,
column: 5,
token: Identifier(
"a",
),
},
expr: Node {
offset: 29,
line: 2,
column: 9,
token: Number(
Int(
1400000000,
),
),
},
},
),
},
Node {
offset: 39,
line: 3,
column: 5,
token: Attribute(
Attribute {
ident: Node {
offset: 39,
line: 3,
column: 5,
token: Identifier(
"b",
),
},
expr: Node {
offset: 43,
line: 3,
column: 9,
token: UnaryOp(
UnaryOp {
operator: Node {
offset: 43,
line: 3,
column: 9,
token: Operator(
Minus,
),
},
operand: Node {
offset: 43,
line: 3,
column: 9,
token: Number(
Float(
0.00000000007319,
),
),
},
},
),
},
},
),
},
Node {
offset: 59,
line: 5,
column: 5,
token: Block(
Block {
ident: Node {
offset: 59,
line: 5,
column: 5,
token: Identifier(
"internal",
),
},
labels: [],
body: Some(
Node {
offset: 70,
line: 6,
column: 1,
token: Body(
[
Node {
offset: 78,
line: 6,
column: 9,
token: Attribute(
Attribute {
ident: Node {
offset: 78,
line: 6,
column: 9,
token: Identifier(
"a",
),
},
expr: Node {
offset: 83,
line: 6,
column: 14,
token: String(
"test string here",
),
},
},
),
},
Node {
offset: 109,
line: 7,
column: 9,
token: Attribute(
Attribute {
ident: Node {
offset: 109,
line: 7,
column: 9,
token: Identifier(
"b",
),
},
expr: Node {
offset: 113,
line: 7,
column: 13,
token: Number(
Int(
5,
),
),
},
},
),
},
Node {
offset: 123,
line: 8,
column: 9,
token: Attribute(
Attribute {
ident: Node {
offset: 123,
line: 8,
column: 9,
token: Identifier(
"c",
),
},
expr: Node {
offset: 127,
line: 8,
column: 13,
token: Number(
Float(
7.3,
),
),
},
},
),
},
Node {
offset: 139,
line: 9,
column: 9,
token: Attribute(
Attribute {
ident: Node {
offset: 139,
line: 9,
column: 9,
token: Identifier(
"d",
),
},
expr: Node {
offset: 143,
line: 9,
column: 13,
token: UnaryOp(
UnaryOp {
operator: Node {
offset: 143,
line: 9,
column: 13,
token: Operator(
Minus,
),
},
operand: Node {
offset: 143,
line: 9,
column: 13,
token: Number(
Int(
3,
),
),
},
},
),
},
},
),
},
Node {
offset: 154,
line: 10,
column: 9,
token: Attribute(
Attribute {
ident: Node {
offset: 154,
line: 10,
column: 9,
token: Identifier(
"e",
),
},
expr: Node {
offset: 158,
line: 10,
column: 13,
token: UnaryOp(
UnaryOp {
operator: Node {
offset: 158,
line: 10,
column: 13,
token: Operator(
Minus,
),
},
operand: Node {
offset: 158,
line: 10,
column: 13,
token: Number(
Float(
4.873,
),
),
},
},
),
},
},
),
},
Node {
offset: 173,
line: 11,
column: 9,
token: Attribute(
Attribute {
ident: Node {
offset: 173,
line: 11,
column: 9,
token: Identifier(
"k",
),
},
expr: Node {
offset: 177,
line: 11,
column: 13,
token: Heredoc(
Heredoc {
ident: Node {
offset: 179,
line: 11,
column: 15,
token: Identifier(
"EOF",
),
},
truncate: false,
content: " heredoc string\n is here, doc\n",
},
),
},
},
),
},
],
),
},
),
},
),
},
Node {
offset: 250,
line: 17,
column: 5,
token: Block(
Block {
ident: Node {
offset: 250,
line: 17,
column: 5,
token: Identifier(
"block",
),
},
labels: [
Node {
offset: 256,
line: 17,
column: 11,
token: Identifier(
"two",
),
},
],
body: Some(
Node {
offset: 262,
line: 18,
column: 1,
token: Body(
[
Node {
offset: 270,
line: 18,
column: 9,
token: Attribute(
Attribute {
ident: Node {
offset: 270,
line: 18,
column: 9,
token: Identifier(
"a",
),
},
expr: Node {
offset: 274,
line: 18,
column: 13,
token: False,
},
},
),
},
Node {
offset: 288,
line: 19,
column: 9,
token: Attribute(
Attribute {
ident: Node {
offset: 288,
line: 19,
column: 9,
token: Identifier(
"b",
),
},
expr: Node {
offset: 292,
line: 19,
column: 13,
token: True,
},
},
),
},
Node {
offset: 305,
line: 20,
column: 9,
token: Attribute(
Attribute {
ident: Node {
offset: 305,
line: 20,
column: 9,
token: Identifier(
"c",
),
},
expr: Node {
offset: 309,
line: 20,
column: 13,
token: Null,
},
},
),
},
Node {
offset: 322,
line: 21,
column: 9,
token: Attribute(
Attribute {
ident: Node {
offset: 322,
line: 21,
column: 9,
token: Identifier(
"d",
),
},
expr: Node {
offset: 326,
line: 21,
column: 13,
token: List(
[
Node {
offset: 327,
line: 21,
column: 14,
token: Number(
Int(
1,
),
),
},
Node {
offset: 330,
line: 21,
column: 17,
token: Number(
Int(
2,
),
),
},
Node {
offset: 333,
line: 21,
column: 20,
token: Number(
Int(
3,
),
),
},
],
),
},
},
),
},
Node {
offset: 344,
line: 22,
column: 9,
token: Attribute(
Attribute {
ident: Node {
offset: 344,
line: 22,
column: 9,
token: Identifier(
"e",
),
},
expr: Node {
offset: 348,
line: 22,
column: 13,
token: List(
[
Node {
offset: 349,
line: 22,
column: 14,
token: False,
},
Node {
offset: 356,
line: 22,
column: 21,
token: Null,
},
Node {
offset: 363,
line: 22,
column: 28,
token: String(
"string",
),
},
Node {
offset: 372,
line: 22,
column: 37,
token: List(
[
Node {
offset: 374,
line: 22,
column: 39,
token: String(
"sub",
),
},
Node {
offset: 381,
line: 22,
column: 46,
token: String(
"array",
),
},
Node {
offset: 389,
line: 22,
column: 54,
token: True,
},
],
),
},
],
),
},
},
),
},
],
),
},
),
},
),
},
],
),
},
),
},
),
},
Node {
offset: 405,
line: 26,
column: 1,
token: Block(
Block {
ident: Node {
offset: 405,
line: 26,
column: 1,
token: Identifier(
"another",
),
},
labels: [
Node {
offset: 413,
line: 26,
column: 9,
token: Identifier(
"test",
),
},
Node {
offset: 418,
line: 26,
column: 14,
token: Identifier(
"block",
),
},
],
body: Some(
Node {
offset: 426,
line: 27,
column: 1,
token: Body(
[
Node {
offset: 430,
line: 27,
column: 5,
token: Attribute(
Attribute {
ident: Node {
offset: 430,
line: 27,
column: 5,
token: Identifier(
"a",
),
},
expr: Node {
offset: 435,
line: 27,
column: 10,
token: String(
"another test string",
),
},
},
),
},
Node {
offset: 460,
line: 28,
column: 5,
token: Attribute(
Attribute {
ident: Node {
offset: 460,
line: 28,
column: 5,
token: Identifier(
"b",
),
},
expr: Node {
offset: 464,
line: 28,
column: 9,
token: Number(
Int(
17000000000,
),
),
},
},
),
},
Node {
offset: 475,
line: 29,
column: 5,
token: Attribute(
Attribute {
ident: Node {
offset: 475,
line: 29,
column: 5,
token: Identifier(
"c",
),
},
expr: Node {
offset: 479,
line: 29,
column: 9,
token: False,
},
},
),
},
],
),
},
),
},
),
},
]
parser | histogram | count
---------------- | -------------------------------------------------- | -----
identifier | .................................................. | 2
multi_line_block | ......................... | 1
block | ......................... | 1
one_line_block | ......................... | 1
parser | cumulative histogram | count
---------------- | -------------------------------------------------- | -----
block | .................................................. | 5
one_line_block | .................... | 2
multi_line_block | .................... | 2
identifier | .................... | 2
duration: 8.338278ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment