| |
| -- in.cue -- |
| // foobar defines at least foo. |
| package foobar |
| |
| // A Foo fooses stuff. |
| Foo: { |
| // field1 is an int. |
| field1: int |
| |
| field2: int |
| |
| // duplicate field comment |
| dup3: int |
| } |
| |
| // foos are instances of Foo. |
| foos: [string]: Foo |
| |
| // My first little foo. |
| foos: MyFoo: { |
| // local field comment. |
| field1: 0 |
| |
| // Dangling comment. |
| |
| // other field comment. |
| field2: 1 |
| |
| // duplicate field comment |
| dup3: int |
| } |
| |
| bar: { |
| // comment from bar on field 1 |
| field1: int |
| // comment from bar on field 2 |
| field2: int // don't include this |
| } |
| |
| baz: bar & { |
| // comment from baz on field 1 |
| field1: int |
| field2: int |
| } |
| |
| -- out.txt -- |
| -- out/doc -- |
| [] |
| - foobar defines at least foo. |
| |
| [Foo] |
| - A Foo fooses stuff. |
| |
| [Foo field1] |
| - field1 is an int. |
| |
| [Foo field2] |
| [Foo dup3] |
| - duplicate field comment |
| |
| [foos] |
| - foos are instances of Foo. |
| |
| [foos MyFoo] |
| - My first little foo. |
| |
| [foos MyFoo field1] |
| - local field comment. |
| |
| - field1 is an int. |
| |
| [foos MyFoo field2] |
| - other field comment. |
| |
| [foos MyFoo dup3] |
| - duplicate field comment |
| |
| [bar] |
| [bar field1] |
| - comment from bar on field 1 |
| |
| [bar field2] |
| - comment from bar on field 2 |
| |
| [baz] |
| [baz field1] |
| - comment from bar on field 1 |
| |
| - comment from baz on field 1 |
| |
| [baz field2] |
| - comment from bar on field 2 |
| |
| -- out/definition -- |
| // foobar defines at least foo. |
| package foobar |
| |
| // A Foo fooses stuff. |
| Foo: { |
| // field1 is an int. |
| field1: int |
| field2: int |
| |
| // duplicate field comment |
| dup3: int |
| } |
| |
| // foos are instances of Foo. |
| foos: { |
| { |
| [string]: Foo |
| } |
| MyFoo: { |
| // local field comment. |
| field1: 0 |
| |
| // other field comment. |
| field2: 1 |
| |
| // duplicate field comment |
| dup3: int |
| } |
| } |
| bar: { |
| // comment from bar on field 1 |
| field1: int |
| // comment from bar on field 2 |
| field2: int |
| } |
| baz: bar & { |
| // comment from baz on field 1 |
| field1: int |
| field2: int |
| } |
| -- out/value -- |
| == Simplified |
| { |
| // A Foo fooses stuff. |
| Foo: { |
| // field1 is an int. |
| field1: int |
| field2: int |
| |
| // duplicate field comment |
| dup3: int |
| } |
| |
| // foos are instances of Foo. |
| foos: { |
| // My first little foo. |
| MyFoo: { |
| // local field comment. |
| |
| // field1 is an int. |
| field1: 0 |
| |
| // other field comment. |
| field2: 1 |
| |
| // duplicate field comment |
| dup3: int |
| } |
| } |
| bar: { |
| // comment from bar on field 1 |
| field1: int |
| // comment from bar on field 2 |
| field2: int |
| } |
| baz: { |
| // comment from bar on field 1 |
| |
| // comment from baz on field 1 |
| field1: int |
| // comment from bar on field 2 |
| field2: int |
| } |
| } |
| == Raw |
| { |
| // A Foo fooses stuff. |
| Foo: { |
| // field1 is an int. |
| field1: int |
| field2: int |
| |
| // duplicate field comment |
| dup3: int |
| } |
| |
| // foos are instances of Foo. |
| foos: { |
| // My first little foo. |
| MyFoo: { |
| // local field comment. |
| |
| // field1 is an int. |
| field1: 0 |
| |
| // other field comment. |
| field2: 1 |
| |
| // duplicate field comment |
| dup3: int |
| } |
| } |
| bar: { |
| // comment from bar on field 1 |
| field1: int |
| // comment from bar on field 2 |
| field2: int |
| } |
| baz: { |
| // comment from bar on field 1 |
| |
| // comment from baz on field 1 |
| field1: int |
| // comment from bar on field 2 |
| field2: int |
| } |
| } |
| == Final |
| { |
| Foo: { |
| field1: int |
| field2: int |
| dup3: int |
| } |
| foos: { |
| MyFoo: { |
| field1: 0 |
| field2: 1 |
| dup3: int |
| } |
| } |
| bar: { |
| field1: int |
| field2: int |
| } |
| baz: { |
| field1: int |
| field2: int |
| } |
| } |
| == All |
| { |
| // A Foo fooses stuff. |
| Foo: { |
| // field1 is an int. |
| field1: int |
| field2: int |
| |
| // duplicate field comment |
| dup3: int |
| } |
| |
| // foos are instances of Foo. |
| foos: { |
| // My first little foo. |
| MyFoo: { |
| // local field comment. |
| |
| // field1 is an int. |
| field1: 0 |
| |
| // other field comment. |
| field2: 1 |
| |
| // duplicate field comment |
| dup3: int |
| } |
| } |
| bar: { |
| // comment from bar on field 1 |
| field1: int |
| // comment from bar on field 2 |
| field2: int |
| } |
| baz: { |
| // comment from bar on field 1 |
| |
| // comment from baz on field 1 |
| field1: int |
| // comment from bar on field 2 |
| field2: int |
| } |
| } |
| == Eval |
| { |
| Foo: { |
| field1: int |
| field2: int |
| dup3: int |
| } |
| foos: { |
| MyFoo: { |
| field1: 0 |
| field2: 1 |
| dup3: int |
| } |
| } |
| bar: { |
| field1: int |
| field2: int |
| } |
| baz: { |
| field1: int |
| field2: int |
| } |
| } |