Codebase list golang-yaml.v2 / 4f03e94
runs 'gofmt -w *.go' on gopkg.in/yaml.v2 Henrik Jonsson 9 years ago
3 changed file(s) with 8 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
3131 // Parser, produces a node tree out of a libyaml event stream.
3232
3333 type parser struct {
34 parser yaml_parser_t
35 event yaml_event_t
36 doc *node
34 parser yaml_parser_t
35 event yaml_event_t
36 doc *node
3737 }
3838
3939 func newParser(b []byte) *parser {
193193 }
194194
195195 var (
196 mapItemType = reflect.TypeOf(MapItem{})
197 durationType = reflect.TypeOf(time.Duration(0))
196 mapItemType = reflect.TypeOf(MapItem{})
197 durationType = reflect.TypeOf(time.Duration(0))
198198 defaultMapType = reflect.TypeOf(map[interface{}]interface{}{})
199 ifaceType = defaultMapType.Elem()
199 ifaceType = defaultMapType.Elem()
200200 )
201201
202202 func newDecoder() *decoder {
501501 }
502502 return true
503503 }
504
505
506504
507505 func (d *decoder) mapping(n *node, out reflect.Value) (good bool) {
508506 switch out.Kind() {
3030 type Unmarshaler interface {
3131 UnmarshalYAML(unmarshal func(interface{}) error) error
3232 }
33
3433
3534 // The Marshaler interface may be implemented by types to customize their
3635 // behavior when being marshaled into a YAML document. The returned value
163162 }
164163
165164 func failf(format string, args ...interface{}) {
166 panic(yamlError{fmt.Errorf("yaml: " + format, args...)})
165 panic(yamlError{fmt.Errorf("yaml: "+format, args...)})
167166 }
168167
169168 // A TypeError is returned by Unmarshal when one or more fields in
295295
296296 // Not in original libyaml.
297297 yaml_BINARY_TAG = "tag:yaml.org,2002:binary"
298 yaml_MERGE_TAG = "tag:yaml.org,2002:merge"
298 yaml_MERGE_TAG = "tag:yaml.org,2002:merge"
299299
300300 yaml_DEFAULT_SCALAR_TAG = yaml_STR_TAG // The default scalar tag is !!str.
301301 yaml_DEFAULT_SEQUENCE_TAG = yaml_SEQ_TAG // The default sequence tag is !!seq.