...
1
2-- in.cue --
3// foobar defines at least foo.
4package foobar
5
6// A Foo fooses stuff.
7Foo: {
8 // field1 is an int.
9 field1: int
10
11 field2: int
12
13 // duplicate field comment
14 dup3: int
15}
16
17// foos are instances of Foo.
18foos: [string]: Foo
19
20// My first little foo.
21foos: MyFoo: {
22 // local field comment.
23 field1: 0
24
25 // Dangling comment.
26
27 // other field comment.
28 field2: 1
29
30 // duplicate field comment
31 dup3: int
32}
33
34bar: {
35 // comment from bar on field 1
36 field1: int
37 // comment from bar on field 2
38 field2: int // don't include this
39}
40
41baz: bar & {
42 // comment from baz on field 1
43 field1: int
44 field2: int
45}
46
47sub: {
48 // comment on comprehension
49 if true {
50 // comment inside of if comprehension
51 field1: int
52 }
53
54 // comprehension with nesting.
55 for x in [1]
56 // nested let
57 let y = x
58 // nested for
59 for z in [y]
60
61 // nested if
62 if z == 1 {
63 innerField: y
64 }
65
66}
67-- out.txt --
68-- out/doc --
69[]
70- foobar defines at least foo.
71
72[Foo]
73- A Foo fooses stuff.
74
75[Foo field1]
76- field1 is an int.
77
78[Foo field2]
79[Foo dup3]
80- duplicate field comment
81
82[foos]
83- foos are instances of Foo.
84
85[foos MyFoo]
86- My first little foo.
87
88[foos MyFoo field1]
89- local field comment.
90
91- field1 is an int.
92
93[foos MyFoo field2]
94- other field comment.
95
96[foos MyFoo dup3]
97- duplicate field comment
98
99[bar]
100[bar field1]
101- comment from bar on field 1
102
103[bar field2]
104- comment from bar on field 2
105
106[baz]
107[baz field1]
108- comment from bar on field 1
109
110- comment from baz on field 1
111
112[baz field2]
113- comment from bar on field 2
114
115[sub]
116[sub field1]
117- comment inside of if comprehension
118
119[sub innerField]
120-- out/definition --
121// foobar defines at least foo.
122package foobar
123
124// A Foo fooses stuff.
125Foo: {
126 // field1 is an int.
127 field1: int
128 field2: int
129
130 // duplicate field comment
131 dup3: int
132}
133
134// foos are instances of Foo.
135foos: {
136 {
137 [string]: Foo
138 }
139 MyFoo: {
140 // local field comment.
141 field1: 0
142
143 // other field comment.
144 field2: 1
145
146 // duplicate field comment
147 dup3: int
148 }
149}
150bar: {
151 // comment from bar on field 1
152 field1: int
153 // comment from bar on field 2
154 field2: int
155}
156baz: bar & {
157 // comment from baz on field 1
158 field1: int
159 field2: int
160}
161sub: {
162 // comment on comprehension
163 if true {
164 // comment inside of if comprehension
165 field1: int
166 }
167
168 // comprehension with nesting.
169 for x in [1]
170 // nested let
171 let y = x
172 // nested for
173 for z in [y]
174
175 // nested if
176 if z == 1 {
177 innerField: y
178 }
179}
180-- out/value --
181== Simplified
182{
183 // A Foo fooses stuff.
184 Foo: {
185 // field1 is an int.
186 field1: int
187 field2: int
188
189 // duplicate field comment
190 dup3: int
191 }
192
193 // foos are instances of Foo.
194 foos: {
195 // My first little foo.
196 MyFoo: {
197 // local field comment.
198
199 // field1 is an int.
200 field1: 0
201
202 // other field comment.
203 field2: 1
204
205 // duplicate field comment
206 dup3: int
207 }
208 }
209 bar: {
210 // comment from bar on field 1
211 field1: int
212 // comment from bar on field 2
213 field2: int
214 }
215 baz: {
216 // comment from bar on field 1
217
218 // comment from baz on field 1
219 field1: int
220 // comment from bar on field 2
221 field2: int
222 }
223 sub: {
224 // comment inside of if comprehension
225 field1: int
226 innerField: 1
227 }
228}
229== Raw
230{
231 // A Foo fooses stuff.
232 Foo: {
233 // field1 is an int.
234 field1: int
235 field2: int
236
237 // duplicate field comment
238 dup3: int
239 }
240
241 // foos are instances of Foo.
242 foos: {
243 // My first little foo.
244 MyFoo: {
245 // local field comment.
246
247 // field1 is an int.
248 field1: 0
249
250 // other field comment.
251 field2: 1
252
253 // duplicate field comment
254 dup3: int
255 }
256 }
257 bar: {
258 // comment from bar on field 1
259 field1: int
260 // comment from bar on field 2
261 field2: int
262 }
263 baz: {
264 // comment from bar on field 1
265
266 // comment from baz on field 1
267 field1: int
268 // comment from bar on field 2
269 field2: int
270 }
271 sub: {
272 // comment inside of if comprehension
273 field1: int
274 innerField: 1
275 }
276}
277== Final
278{
279 Foo: {
280 field1: int
281 field2: int
282 dup3: int
283 }
284 foos: {
285 MyFoo: {
286 field1: 0
287 field2: 1
288 dup3: int
289 }
290 }
291 bar: {
292 field1: int
293 field2: int
294 }
295 baz: {
296 field1: int
297 field2: int
298 }
299 sub: {
300 field1: int
301 innerField: 1
302 }
303}
304== All
305{
306 // A Foo fooses stuff.
307 Foo: {
308 // field1 is an int.
309 field1: int
310 field2: int
311
312 // duplicate field comment
313 dup3: int
314 }
315
316 // foos are instances of Foo.
317 foos: {
318 // My first little foo.
319 MyFoo: {
320 // local field comment.
321
322 // field1 is an int.
323 field1: 0
324
325 // other field comment.
326 field2: 1
327
328 // duplicate field comment
329 dup3: int
330 }
331 }
332 bar: {
333 // comment from bar on field 1
334 field1: int
335 // comment from bar on field 2
336 field2: int
337 }
338 baz: {
339 // comment from bar on field 1
340
341 // comment from baz on field 1
342 field1: int
343 // comment from bar on field 2
344 field2: int
345 }
346 sub: {
347 // comment inside of if comprehension
348 field1: int
349 innerField: 1
350 }
351}
352== Eval
353{
354 Foo: {
355 field1: int
356 field2: int
357 dup3: int
358 }
359 foos: {
360 MyFoo: {
361 field1: 0
362 field2: 1
363 dup3: int
364 }
365 }
366 bar: {
367 field1: int
368 field2: int
369 }
370 baz: {
371 field1: int
372 field2: int
373 }
374 sub: {
375 field1: int
376 innerField: 1
377 }
378}
View as plain text