| -- in.cue -- |
| import mystrings "strings" |
| |
| @foo(bar) |
| |
| p1: [X=string]: name: X |
| |
| d1: "foo\(bar)": int |
| bar: "bar" |
| |
| // XXX: reference not resolving. |
| d2: C="foo\(bar)": { |
| name: "xx" |
| foo: C.name |
| } |
| |
| bytes: '\xeb \x1a\xf5\xaa\xf0\xd6\x06)' |
| |
| c1: mystrings.Contains("aa", "a") |
| |
| s1: """ |
| multi |
| \(bar) |
| line |
| """ |
| |
| l1: [3, ...int] |
| l2: [...int] |
| l3: [] |
| l4: [1, 2] |
| l5: [1, 3] & { |
| [1, 3] |
| |
| #foo: int |
| } |
| |
| #foo: int |
| l6: [1, #foo] & { |
| [1, 3] |
| |
| #foo: int |
| } |
| |
| n1: 1.0 |
| n10: 10 |
| |
| // Ignored comment. |
| |
| // t is true |
| t: true |
| |
| // Dangling comment. |
| |
| e1: <n1 |
| e2: >n1 & <n10 |
| e3: l4[2] |
| e4: l4[2:3] |
| e5: e1 + e2 - e3 |
| e6: !t |
| e7: !t || !false |
| e8?: !false |
| |
| m1: {[string]: uint} & { |
| // this is a pattern constraint |
| {[string]: int} & {[string]: int64} |
| // foo is an optional field |
| foo?: 3 |
| |
| // Dangling comment. |
| |
| // bar is a field |
| bar: 4 |
| |
| // a comment too many. |
| |
| ... |
| } |
| |
| if true { |
| x: int |
| } |
| |
| y1: { |
| src: [1, 2, 3] |
| for i, v in src for j, w in src if i < j { |
| "foo\(i)": v |
| "bar\(j)": w |
| } |
| |
| for i, v in src { |
| "foo\(i)": v |
| } |
| |
| x: [ |
| for x in src |
| let y = x { |
| y |
| } |
| ] |
| } |
| |
| errorStructDef: { |
| a: 1 |
| b: 1 & 2 |
| |
| #Def: 1 |
| } |
| |
| errorList: [ |
| 1, |
| 1 & 2, |
| ] |
| |
| errorListDef: { |
| errorList |
| |
| #Def: 1 |
| } |
| |
| -- out/definition -- |
| import mystrings "strings" |
| |
| @foo(bar) |
| p1: { |
| [X=string]: { |
| name: X |
| } |
| } |
| d1: { |
| "foo\(bar)": int |
| } |
| bar: "bar" |
| d2: { |
| C="foo\(bar)": { |
| name: "xx" |
| foo: C.name |
| } |
| } |
| bytes: '\xeb \x1a\xf5\xaa\xf0\xd6\x06)' |
| c1: mystrings.Contains("aa", "a") |
| s1: """ |
| multi |
| \(bar) |
| line |
| """ |
| l1: [3, ...int] |
| l2: [...int] |
| l3: [] |
| l4: [1, 2] |
| l5: [1, 3] & { |
| [1, 3] |
| #foo: int |
| } |
| #foo: int |
| l6: [1, #foo] & { |
| [1, 3] |
| #foo: int |
| } |
| n1: 1.0 |
| n10: 10 |
| t: true |
| e1: <n1 |
| e2: >n1 & <n10 |
| e3: l4[2] |
| e4: l4[2:3] |
| e5: e1 + e2 - e3 |
| e6: !t |
| e7: !t || !false |
| e8?: !false |
| m1: { |
| [string]: int & >=0 |
| } & { |
| { |
| [string]: int |
| } & { |
| [string]: int64 |
| } |
| |
| // foo is an optional field |
| foo?: 3 |
| |
| // bar is a field |
| bar: 4 |
| ... |
| } |
| if true { |
| x: int |
| } |
| y1: { |
| src: [1, 2, 3] |
| for i, v in src for j, w in src if i < j { |
| "foo\(i)": v |
| "bar\(j)": w |
| } |
| for i, v in src { |
| "foo\(i)": v |
| } |
| x: [ for x in src let y = x { |
| y |
| }] |
| } |
| errorStructDef: { |
| a: 1 |
| b: _|_ // conflicting values 2 and 1 |
| #Def: 1 |
| } |
| errorList: [1, 1 & 2] |
| errorListDef: { |
| errorList |
| #Def: 1 |
| } |
| -- out/doc -- |
| [] |
| [p1] |
| [d1] |
| [d1 foobar] |
| [bar] |
| [d2] |
| - XXX: reference not resolving. |
| |
| [d2 foobar] |
| [d2 foobar name] |
| [d2 foobar foo] |
| [bytes] |
| [c1] |
| [s1] |
| [l1] |
| [l1 0] |
| [l2] |
| [l3] |
| [l4] |
| [l4 0] |
| [l4 1] |
| [l5] |
| [l5 #foo] |
| [l5 0] |
| [l5 1] |
| [#foo] |
| [l6] |
| [l6 #foo] |
| [l6 0] |
| [l6 1] |
| [n1] |
| [n10] |
| [t] |
| - t is true |
| |
| [e1] |
| [e2] |
| [e3] |
| [e4] |
| [e5] |
| [e6] |
| [e7] |
| [m1] |
| [m1 bar] |
| - bar is a field |
| |
| [y1] |
| [y1 src] |
| [y1 src 0] |
| [y1 src 1] |
| [y1 src 2] |
| [y1 x] |
| [y1 x 0] |
| [y1 x 1] |
| [y1 x 2] |
| [y1 foo0] |
| [y1 bar1] |
| [y1 bar2] |
| [y1 foo1] |
| [y1 foo2] |
| [errorStructDef] |
| [errorStructDef a] |
| [errorStructDef b] |
| [errorStructDef #Def] |
| [errorList] |
| [errorList 0] |
| [errorList 1] |
| [errorListDef] |
| [errorListDef #Def] |
| [errorListDef 0] |
| [errorListDef 1] |
| [x] |
| -- out/value -- |
| == Simplified |
| _|_ // e3: index out of range [2] with length 2 |
| == Raw |
| _|_ // e3: index out of range [2] with length 2 |
| == Final |
| _|_ // e3: index out of range [2] with length 2 |
| == All |
| { |
| @foo(bar) |
| p1: {} |
| d1: { |
| foobar: int |
| } |
| bar: "bar" |
| |
| // XXX: reference not resolving. |
| d2: { |
| foobar: { |
| name: "xx" |
| foo: "xx" |
| } |
| } |
| bytes: '\xeb \x1a\xf5\xaa\xf0\xd6\x06)' |
| c1: true |
| s1: """ |
| multi |
| bar |
| line |
| """ |
| l1: [3] |
| l2: [] |
| l3: [] |
| l4: [1, 2] |
| l5: { |
| #foo: int |
| [1, 3] |
| } |
| #foo: int |
| l6: { |
| #foo: int |
| [1, 3] |
| } |
| n1: 1.0 |
| n10: 10 |
| |
| // t is true |
| t: true |
| e1: <1.0 |
| e2: >1.0 & <10 |
| e3: _|_ // e3: index out of range [2] with length 2 |
| e4: _|_ // e4: index 3 out of range |
| e5: _|_ // e3: index out of range [2] with length 2 |
| e6: false |
| e7: true |
| e8?: true |
| m1: { |
| // foo is an optional field |
| foo?: 3 |
| |
| // bar is a field |
| bar: 4 |
| } |
| y1: { |
| src: [1, 2, 3] |
| foo0: 1 |
| bar1: 2 |
| bar2: 3 |
| foo1: 2 |
| x: [1, 2, 3] |
| foo2: 3 |
| } |
| errorStructDef: { |
| a: 1 |
| b: _|_ // errorStructDef.b: conflicting values 2 and 1 |
| #Def: 1 |
| } |
| errorList: [1, _|_] |
| x: int |
| errorListDef: { |
| #Def: 1 |
| [1, _|_] |
| } |
| } |
| == Eval |
| _|_ // e3: index out of range [2] with length 2 |