| 1 | package yamlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/ |
| 2 | |
| 3 | import ( |
| 4 | "bytesscip-go gomod github.com/golang/go/src go1.25 bytes/" |
| 5 | "errorsscip-go gomod github.com/golang/go/src go1.25 errors/" |
| 6 | "fmtscip-go gomod github.com/golang/go/src go1.25 fmt/" |
| 7 | "ioscip-go gomod github.com/golang/go/src go1.25 io/" |
| 8 | "strconvscip-go gomod github.com/golang/go/src go1.25 strconv/" |
| 9 | "stringsscip-go gomod github.com/golang/go/src go1.25 strings/" |
| 10 | |
| 11 | "github.com/tomwright/dasel/v3/modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/" |
| 12 | "github.com/tomwright/dasel/v3/parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/" |
| 13 | "go.yaml.in/yaml/v4scip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/" |
| 14 | ) |
| 15 | |
| 16 | var _ parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.Readerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader# = (*yamlReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlReader#)(nil) |
| 17 | |
| 18 | func newYAMLReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/newYAMLReader().(options parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.ReaderOptionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/ReaderOptions#) (parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.Readerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#, error) { |
| 19 | return &yamlReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlReader#{ |
| 20 | maxExpansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlReader#maxExpansionDepth.: maxExpansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/maxExpansionDepth., |
| 21 | maxExpansionBudgetscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlReader#maxExpansionBudget.: maxExpansionBudgetscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/maxExpansionBudget., |
| 22 | }, nil |
| 23 | } |
| 24 | |
| 25 | type yamlReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlReader# struct { |
| 26 | maxExpansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlReader#maxExpansionDepth. int |
| 27 | maxExpansionBudgetscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlReader#maxExpansionBudget. int |
| 28 | } |
| 29 | |
| 30 | // ErrYamlExpansionDepthExceeded is returned when the maximum expansion depth is exceeded. |
| 31 | var ErrYamlExpansionDepthExceededscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/ErrYamlExpansionDepthExceeded. = errorsscip-go gomod github.com/golang/go/src go1.25 errors/.Newscip-go gomod github.com/golang/go/src go1.25 errors/New().("yaml expansion depth exceeded") |
| 32 | |
| 33 | // ErrYamlExpansionBudgetExceeded is returned when the maximum expansion budget is exceeded. |
| 34 | var ErrYamlExpansionBudgetExceededscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/ErrYamlExpansionBudgetExceeded. = errorsscip-go gomod github.com/golang/go/src go1.25 errors/.Newscip-go gomod github.com/golang/go/src go1.25 errors/New().("yaml expansion budget exceeded") |
| 35 | |
| 36 | const maxExpansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/maxExpansionDepth. = 32 |
| 37 | const maxExpansionBudgetscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/maxExpansionBudget. = 1000 |
| 38 | |
| 39 | // Read reads a value from a byte slice. |
| 40 | func (j *yamlReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlReader#) Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlReader#Read().(data []byte) (*modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#, error) { |
| 41 | d := yamlscip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/.NewDecoderscip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/NewDecoder().(bytesscip-go gomod github.com/golang/go/src go1.25 bytes/.NewReaderscip-go gomod github.com/golang/go/src go1.25 bytes/NewReader().(data)) |
| 42 | res := make([]*yamlValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#, 0) |
| 43 | for { |
| 44 | expansionBudget := j.maxExpansionBudgetscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlReader#maxExpansionBudget. |
| 45 | unmarshalled := &yamlValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#{ |
| 46 | expansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#expansionDepth.: 0, |
| 47 | maxExpansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#maxExpansionDepth.: j.maxExpansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlReader#maxExpansionDepth., |
| 48 | expansionBudgetscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#expansionBudget.: &expansionBudget, |
| 49 | } |
| 50 | if err := d.Decodescip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/Decoder#Decode().(&unmarshalled); err != nil { |
| 51 | if err == ioscip-go gomod github.com/golang/go/src go1.25 io/.EOFscip-go gomod github.com/golang/go/src go1.25 io/EOF. { |
| 52 | break |
| 53 | } |
| 54 | return nil, err |
| 55 | } |
| 56 | if unmarshalled == nil { |
| 57 | expansionBudget := j.maxExpansionBudgetscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlReader#maxExpansionBudget. |
| 58 | unmarshalled = &yamlValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#{ |
| 59 | nodescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#node.: nil, |
| 60 | valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#value.: modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewNullValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewNullValue().(), |
| 61 | expansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#expansionDepth.: 0, |
| 62 | maxExpansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#maxExpansionDepth.: j.maxExpansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlReader#maxExpansionDepth., |
| 63 | expansionBudgetscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#expansionBudget.: &expansionBudget, |
| 64 | } |
| 65 | } |
| 66 | res = append(res, unmarshalled) |
| 67 | } |
| 68 | |
| 69 | switch len(res) { |
| 70 | case 0: |
| 71 | return modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewNullValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewNullValue().(), nil |
| 72 | case 1: |
| 73 | return res[0].valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#value., nil |
| 74 | default: |
| 75 | slice := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().() |
| 76 | slice.MarkAsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#MarkAsBranch().() |
| 77 | for _, v := range res { |
| 78 | if v == nil { |
| 79 | continue |
| 80 | } |
| 81 | if err := slice.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(v.valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#value.); err != nil { |
| 82 | return nil, err |
| 83 | } |
| 84 | } |
| 85 | return slice, nil |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | func (yv *yamlValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#) UnmarshalYAMLscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#UnmarshalYAML().(value *yamlscip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/.Nodescip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/Node#) error { |
| 90 | yv.nodescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#node. = value |
| 91 | if yv.expansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#expansionDepth. > yv.maxExpansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#maxExpansionDepth. { |
| 92 | return ErrYamlExpansionDepthExceededscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/ErrYamlExpansionDepthExceeded. |
| 93 | } |
| 94 | switch value.Kindscip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/Node#Kind. { |
| 95 | case yamlscip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/.ScalarNodescip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/ScalarNode.: |
| 96 | switch value.Tagscip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/Node#Tag. { |
| 97 | case "!!bool": |
| 98 | yv.valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#value. = modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewBoolValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewBoolValue().(value.Valuescip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/Node#Value. == "true") |
| 99 | case "!!int": |
| 100 | i, err := parseYAMLIntscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/parseYAMLInt().(value.Valuescip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/Node#Value.) |
| 101 | if err != nil { |
| 102 | return err |
| 103 | } |
| 104 | yv.valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#value. = modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(i) |
| 105 | case "!!float": |
| 106 | f, err := strconvscip-go gomod github.com/golang/go/src go1.25 strconv/.ParseFloatscip-go gomod github.com/golang/go/src go1.25 strconv/ParseFloat().(value.Valuescip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/Node#Value., 64) |
| 107 | if err != nil { |
| 108 | return err |
| 109 | } |
| 110 | yv.valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#value. = modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewFloatValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewFloatValue().(f) |
| 111 | case "!!null": |
| 112 | yv.valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#value. = modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewNullValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewNullValue().() |
| 113 | case "!!str": |
| 114 | yv.valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#value. = modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().(value.Valuescip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/Node#Value.) |
| 115 | if value.Stylescip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/Node#Style. != 0 { |
| 116 | yv.valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#value..SetMetadataValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMetadataValue().("yaml-style", value.Stylescip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/Node#Style.) |
| 117 | } |
| 118 | default: |
| 119 | yv.valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#value. = modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().(value.Valuescip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/Node#Value.) |
| 120 | if value.Stylescip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/Node#Style. != 0 { |
| 121 | yv.valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#value..SetMetadataValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMetadataValue().("yaml-style", value.Stylescip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/Node#Style.) |
| 122 | } |
| 123 | } |
| 124 | case yamlscip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/.DocumentNodescip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/DocumentNode.: |
| 125 | yv.valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#value. = modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewNullValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewNullValue().() |
| 126 | case yamlscip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/.SequenceNodescip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/SequenceNode.: |
| 127 | res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().() |
| 128 | for _, item := range value.Contentscip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/Node#Content. { |
| 129 | newItem := &yamlValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#{ |
| 130 | expansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#expansionDepth.: yv.expansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#expansionDepth., |
| 131 | maxExpansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#maxExpansionDepth.: yv.maxExpansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#maxExpansionDepth., |
| 132 | expansionBudgetscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#expansionBudget.: yv.expansionBudgetscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#expansionBudget., |
| 133 | } |
| 134 | if err := newItem.UnmarshalYAMLscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#UnmarshalYAML().(item); err != nil { |
| 135 | return err |
| 136 | } |
| 137 | if err := res.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(newItem.valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#value.); err != nil { |
| 138 | return err |
| 139 | } |
| 140 | } |
| 141 | yv.valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#value. = res |
| 142 | case yamlscip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/.MappingNodescip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/MappingNode.: |
| 143 | res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().() |
| 144 | for i := 0; i < len(value.Contentscip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/Node#Content.); i += 2 { |
| 145 | key := value.Contentscip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/Node#Content.[i] |
| 146 | val := value.Contentscip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/Node#Content.[i+1] |
| 147 | |
| 148 | newKey := &yamlValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#{ |
| 149 | expansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#expansionDepth.: yv.expansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#expansionDepth., |
| 150 | maxExpansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#maxExpansionDepth.: yv.maxExpansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#maxExpansionDepth., |
| 151 | expansionBudgetscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#expansionBudget.: yv.expansionBudgetscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#expansionBudget., |
| 152 | } |
| 153 | if err := newKey.UnmarshalYAMLscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#UnmarshalYAML().(key); err != nil { |
| 154 | return err |
| 155 | } |
| 156 | |
| 157 | newVal := &yamlValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#{ |
| 158 | expansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#expansionDepth.: yv.expansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#expansionDepth., |
| 159 | maxExpansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#maxExpansionDepth.: yv.maxExpansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#maxExpansionDepth., |
| 160 | expansionBudgetscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#expansionBudget.: yv.expansionBudgetscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#expansionBudget., |
| 161 | } |
| 162 | if err := newVal.UnmarshalYAMLscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#UnmarshalYAML().(val); err != nil { |
| 163 | return err |
| 164 | } |
| 165 | |
| 166 | keyStr, err := newKey.valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#value..StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().() |
| 167 | if err != nil { |
| 168 | return fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25 fmt/Errorf().("keys are expected to be strings: %w", err) |
| 169 | } |
| 170 | |
| 171 | if err := res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().(keyStr, newVal.valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#value.); err != nil { |
| 172 | return err |
| 173 | } |
| 174 | } |
| 175 | yv.valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#value. = res |
| 176 | case yamlscip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/.AliasNodescip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/AliasNode.: |
| 177 | if yv.expansionBudgetscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#expansionBudget. != nil { |
| 178 | *yv.expansionBudgetscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#expansionBudget. = *yv.expansionBudgetscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#expansionBudget. - 1 |
| 179 | if *yv.expansionBudgetscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#expansionBudget. < 0 { |
| 180 | return ErrYamlExpansionBudgetExceededscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/ErrYamlExpansionBudgetExceeded. |
| 181 | } |
| 182 | } |
| 183 | newVal := &yamlValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#{ |
| 184 | expansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#expansionDepth.: yv.expansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#expansionDepth. + 1, |
| 185 | maxExpansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#maxExpansionDepth.: yv.maxExpansionDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#maxExpansionDepth., |
| 186 | expansionBudgetscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#expansionBudget.: yv.expansionBudgetscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#expansionBudget., |
| 187 | } |
| 188 | if err := newVal.UnmarshalYAMLscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#UnmarshalYAML().(value.Aliasscip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/Node#Alias.); err != nil { |
| 189 | return err |
| 190 | } |
| 191 | yv.valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#value. = newVal.valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#value. |
| 192 | yv.valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/yamlValue#value..SetMetadataValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMetadataValue().("yaml-alias", value.Valuescip-go gomod go.yaml.in/yaml/v4 v4.0.0-rc.3 `go.yaml.in/yaml/v4`/Node#Value.) |
| 193 | } |
| 194 | return nil |
| 195 | } |
| 196 | |
| 197 | func parseYAMLIntscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/yaml`/parseYAMLInt().(s string) (int64, error) { |
| 198 | // Strip leading sign for prefix detection. |
| 199 | clean := s |
| 200 | if len(clean) > 0 && (clean[0] == '+' || clean[0] == '-') { |
| 201 | clean = clean[1:] |
| 202 | } |
| 203 | |
| 204 | switch { |
| 205 | case stringsscip-go gomod github.com/golang/go/src go1.25 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25 strings/HasPrefix().(clean, "0x") || stringsscip-go gomod github.com/golang/go/src go1.25 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25 strings/HasPrefix().(clean, "0X"): |
| 206 | return strconvscip-go gomod github.com/golang/go/src go1.25 strconv/.ParseIntscip-go gomod github.com/golang/go/src go1.25 strconv/ParseInt().(s, 0, 64) |
| 207 | case stringsscip-go gomod github.com/golang/go/src go1.25 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25 strings/HasPrefix().(clean, "0o") || stringsscip-go gomod github.com/golang/go/src go1.25 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25 strings/HasPrefix().(clean, "0O"): |
| 208 | return strconvscip-go gomod github.com/golang/go/src go1.25 strconv/.ParseIntscip-go gomod github.com/golang/go/src go1.25 strconv/ParseInt().(s, 0, 64) |
| 209 | case stringsscip-go gomod github.com/golang/go/src go1.25 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25 strings/HasPrefix().(clean, "0b") || stringsscip-go gomod github.com/golang/go/src go1.25 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25 strings/HasPrefix().(clean, "0B"): |
| 210 | return strconvscip-go gomod github.com/golang/go/src go1.25 strconv/.ParseIntscip-go gomod github.com/golang/go/src go1.25 strconv/ParseInt().(s, 0, 64) |
| 211 | default: |
| 212 | // YAML 1.2 allows underscores in decimal integers (e.g. 1_000). |
| 213 | // strconv.ParseInt with base 10 does not support underscores, |
| 214 | // so we strip them before parsing. |
| 215 | return strconvscip-go gomod github.com/golang/go/src go1.25 strconv/.ParseIntscip-go gomod github.com/golang/go/src go1.25 strconv/ParseInt().(stringsscip-go gomod github.com/golang/go/src go1.25 strings/.ReplaceAllscip-go gomod github.com/golang/go/src go1.25 strings/ReplaceAll().(s, "_", ""), 10, 64) |
| 216 | } |
| 217 | } |