cuelang.org/go@v0.13.0/internal/astinternal/testdata/debugprint/comprehensions.txtar (about) 1 -- comprehensions.cue -- 2 if condition { 3 a: true 4 } 5 for k, v in input if v > 2 { 6 (k): v 7 } 8 -- out/debugprint/comprehensions.cue -- 9 *ast.File{ 10 Filename: "comprehensions.cue" 11 Decls: []ast.Decl{ 12 *ast.Comprehension{ 13 Clauses: []ast.Clause{ 14 *ast.IfClause{ 15 If: token.Pos("comprehensions.cue:1:1", nospace) 16 Condition: *ast.Ident{ 17 NamePos: token.Pos("comprehensions.cue:1:4", blank) 18 Name: "condition" 19 } 20 } 21 } 22 Value: *ast.StructLit{ 23 Lbrace: token.Pos("comprehensions.cue:1:14", blank) 24 Elts: []ast.Decl{ 25 *ast.Field{ 26 Label: *ast.Ident{ 27 NamePos: token.Pos("comprehensions.cue:2:2", newline) 28 Name: "a" 29 } 30 Optional: token.Pos("-") 31 Constraint: token.Token("ILLEGAL") 32 TokenPos: token.Pos("comprehensions.cue:2:3", nospace) 33 Token: token.Token(":") 34 Value: *ast.BasicLit{ 35 ValuePos: token.Pos("comprehensions.cue:2:5", blank) 36 Kind: token.Token("true") 37 Value: "true" 38 } 39 Attrs: []*ast.Attribute{} 40 } 41 } 42 Rbrace: token.Pos("comprehensions.cue:3:1", newline) 43 } 44 } 45 *ast.Comprehension{ 46 Clauses: []ast.Clause{ 47 *ast.ForClause{ 48 For: token.Pos("comprehensions.cue:4:1", newline) 49 Key: *ast.Ident@ref002{ 50 NamePos: token.Pos("comprehensions.cue:4:5", blank) 51 Name: "k" 52 } 53 Colon: token.Pos("comprehensions.cue:4:6", nospace) 54 Value: *ast.Ident@ref001{ 55 NamePos: token.Pos("comprehensions.cue:4:8", blank) 56 Name: "v" 57 } 58 In: token.Pos("comprehensions.cue:4:10", blank) 59 Source: *ast.Ident{ 60 NamePos: token.Pos("comprehensions.cue:4:13", blank) 61 Name: "input" 62 } 63 } 64 *ast.IfClause{ 65 If: token.Pos("comprehensions.cue:4:19", blank) 66 Condition: *ast.BinaryExpr{ 67 X: *ast.Ident{ 68 NamePos: token.Pos("comprehensions.cue:4:22", blank) 69 Name: "v" 70 Node: @ref001 (*ast.Ident) 71 } 72 OpPos: token.Pos("comprehensions.cue:4:24", blank) 73 Op: token.Token(">") 74 Y: *ast.BasicLit{ 75 ValuePos: token.Pos("comprehensions.cue:4:26", blank) 76 Kind: token.Token("INT") 77 Value: "2" 78 } 79 } 80 } 81 } 82 Value: *ast.StructLit{ 83 Lbrace: token.Pos("comprehensions.cue:4:28", blank) 84 Elts: []ast.Decl{ 85 *ast.Field{ 86 Label: *ast.ParenExpr{ 87 Lparen: token.Pos("comprehensions.cue:5:2", newline) 88 X: *ast.Ident{ 89 NamePos: token.Pos("comprehensions.cue:5:3", nospace) 90 Name: "k" 91 Node: @ref002 (*ast.Ident) 92 } 93 Rparen: token.Pos("comprehensions.cue:5:4", nospace) 94 } 95 Optional: token.Pos("-") 96 Constraint: token.Token("ILLEGAL") 97 TokenPos: token.Pos("comprehensions.cue:5:5", nospace) 98 Token: token.Token(":") 99 Value: *ast.Ident{ 100 NamePos: token.Pos("comprehensions.cue:5:7", blank) 101 Name: "v" 102 Node: @ref001 (*ast.Ident) 103 } 104 Attrs: []*ast.Attribute{} 105 } 106 } 107 Rbrace: token.Pos("comprehensions.cue:6:1", newline) 108 } 109 } 110 } 111 Imports: []*ast.ImportSpec{} 112 } 113 -- out/debugprint/comprehensions.cue/omitempty-strings -- 114 *ast.File{ 115 Filename: "comprehensions.cue" 116 Decls: []ast.Decl{ 117 *ast.Comprehension{ 118 Clauses: []ast.Clause{ 119 *ast.IfClause{ 120 Condition: *ast.Ident{ 121 Name: "condition" 122 } 123 } 124 } 125 Value: *ast.StructLit{ 126 Elts: []ast.Decl{ 127 *ast.Field{ 128 Label: *ast.Ident{ 129 Name: "a" 130 } 131 Value: *ast.BasicLit{ 132 Value: "true" 133 } 134 } 135 } 136 } 137 } 138 *ast.Comprehension{ 139 Clauses: []ast.Clause{ 140 *ast.ForClause{ 141 Key: *ast.Ident{ 142 Name: "k" 143 } 144 Value: *ast.Ident{ 145 Name: "v" 146 } 147 Source: *ast.Ident{ 148 Name: "input" 149 } 150 } 151 *ast.IfClause{ 152 Condition: *ast.BinaryExpr{ 153 X: *ast.Ident{ 154 Name: "v" 155 } 156 Y: *ast.BasicLit{ 157 Value: "2" 158 } 159 } 160 } 161 } 162 Value: *ast.StructLit{ 163 Elts: []ast.Decl{ 164 *ast.Field{ 165 Label: *ast.ParenExpr{ 166 X: *ast.Ident{ 167 Name: "k" 168 } 169 } 170 Value: *ast.Ident{ 171 Name: "v" 172 } 173 } 174 } 175 } 176 } 177 } 178 }