github.com/joomcode/cue@v0.4.4-0.20221111115225-539fe3512047/internal/core/export/testdata/docs.txtar (about) 1 2 -- in.cue -- 3 // foobar defines at least foo. 4 package foobar 5 6 // A Foo fooses stuff. 7 Foo: { 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. 18 foos: [string]: Foo 19 20 // My first little foo. 21 foos: 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 34 bar: { 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 41 baz: bar & { 42 // comment from baz on field 1 43 field1: int 44 field2: int 45 } 46 -- out.txt -- 47 -- out/doc -- 48 [] 49 - foobar defines at least foo. 50 51 [Foo] 52 - A Foo fooses stuff. 53 54 [Foo field1] 55 - field1 is an int. 56 57 [Foo field2] 58 [Foo dup3] 59 - duplicate field comment 60 61 [foos] 62 - foos are instances of Foo. 63 64 [foos MyFoo] 65 - My first little foo. 66 67 [foos MyFoo field1] 68 - local field comment. 69 70 - field1 is an int. 71 72 [foos MyFoo field2] 73 - other field comment. 74 75 [foos MyFoo dup3] 76 - duplicate field comment 77 78 [bar] 79 [bar field1] 80 - comment from bar on field 1 81 82 [bar field2] 83 - comment from bar on field 2 84 85 [baz] 86 [baz field1] 87 - comment from bar on field 1 88 89 - comment from baz on field 1 90 91 [baz field2] 92 - comment from bar on field 2 93 94 -- out/definition -- 95 // foobar defines at least foo. 96 package foobar 97 98 // A Foo fooses stuff. 99 Foo: { 100 // field1 is an int. 101 field1: int 102 field2: int 103 104 // duplicate field comment 105 dup3: int 106 } 107 108 // foos are instances of Foo. 109 foos: { 110 { 111 [string]: Foo 112 } 113 MyFoo: { 114 // local field comment. 115 field1: 0 116 117 // other field comment. 118 field2: 1 119 120 // duplicate field comment 121 dup3: int 122 } 123 } 124 bar: { 125 // comment from bar on field 1 126 field1: int 127 // comment from bar on field 2 128 field2: int 129 } 130 baz: bar & { 131 // comment from baz on field 1 132 field1: int 133 field2: int 134 } 135 -- out/value -- 136 == Simplified 137 { 138 // A Foo fooses stuff. 139 Foo: { 140 // field1 is an int. 141 field1: int 142 field2: int 143 144 // duplicate field comment 145 dup3: int 146 } 147 148 // foos are instances of Foo. 149 foos: { 150 // My first little foo. 151 MyFoo: { 152 // local field comment. 153 154 // field1 is an int. 155 field1: 0 156 157 // other field comment. 158 field2: 1 159 160 // duplicate field comment 161 dup3: int 162 } 163 } 164 bar: { 165 // comment from bar on field 1 166 field1: int 167 // comment from bar on field 2 168 field2: int 169 } 170 baz: { 171 // comment from bar on field 1 172 173 // comment from baz on field 1 174 field1: int 175 // comment from bar on field 2 176 field2: int 177 } 178 } 179 == Raw 180 { 181 // A Foo fooses stuff. 182 Foo: { 183 // field1 is an int. 184 field1: int 185 field2: int 186 187 // duplicate field comment 188 dup3: int 189 } 190 191 // foos are instances of Foo. 192 foos: { 193 // My first little foo. 194 MyFoo: { 195 // local field comment. 196 197 // field1 is an int. 198 field1: 0 199 200 // other field comment. 201 field2: 1 202 203 // duplicate field comment 204 dup3: int 205 } 206 } 207 bar: { 208 // comment from bar on field 1 209 field1: int 210 // comment from bar on field 2 211 field2: int 212 } 213 baz: { 214 // comment from bar on field 1 215 216 // comment from baz on field 1 217 field1: int 218 // comment from bar on field 2 219 field2: int 220 } 221 } 222 == Final 223 { 224 Foo: { 225 field1: int 226 field2: int 227 dup3: int 228 } 229 foos: { 230 MyFoo: { 231 field1: 0 232 field2: 1 233 dup3: int 234 } 235 } 236 bar: { 237 field1: int 238 field2: int 239 } 240 baz: { 241 field1: int 242 field2: int 243 } 244 } 245 == All 246 { 247 // A Foo fooses stuff. 248 Foo: { 249 // field1 is an int. 250 field1: int 251 field2: int 252 253 // duplicate field comment 254 dup3: int 255 } 256 257 // foos are instances of Foo. 258 foos: { 259 // My first little foo. 260 MyFoo: { 261 // local field comment. 262 263 // field1 is an int. 264 field1: 0 265 266 // other field comment. 267 field2: 1 268 269 // duplicate field comment 270 dup3: int 271 } 272 } 273 bar: { 274 // comment from bar on field 1 275 field1: int 276 // comment from bar on field 2 277 field2: int 278 } 279 baz: { 280 // comment from bar on field 1 281 282 // comment from baz on field 1 283 field1: int 284 // comment from bar on field 2 285 field2: int 286 } 287 } 288 == Eval 289 { 290 Foo: { 291 field1: int 292 field2: int 293 dup3: int 294 } 295 foos: { 296 MyFoo: { 297 field1: 0 298 field2: 1 299 dup3: int 300 } 301 } 302 bar: { 303 field1: int 304 field2: int 305 } 306 baz: { 307 field1: int 308 field2: int 309 } 310 }