MCPcopy Create free account
hub / github.com/brimdata/super / decorate

Method decorate

sup/parser-values.go:78–103  ·  view source on GitHub ↗
(any ast.Any, err error)

Source from the content-addressed store, hash-verified

76}
77
78func (p *Parser) decorate(any ast.Any, err error) (ast.Value, error) {
79 if err != nil {
80 return nil, err
81 }
82 // See if there's a first decorator.
83 val, ok, err := p.matchDecorator(any, nil)
84 if err != nil {
85 return nil, err
86 }
87 if !ok {
88 // No decorator. Just return the input value.
89 return anyAsValue(any), nil
90 }
91 // Now see if there are additional decorators to apply as casts and
92 // return value chain, wrapped if at all, as an ast.Value.
93 for {
94 outer, ok, err := p.matchDecorator(nil, val)
95 if err != nil {
96 return nil, err
97 }
98 if !ok {
99 return val, nil
100 }
101 val = outer
102 }
103}
104
105// We pass both any and val in here to avoid having to backtrack.
106// If we had proper backtracking, this would look a little more sensible.

Callers 1

matchValueMethod · 0.95

Calls 2

matchDecoratorMethod · 0.95
anyAsValueFunction · 0.85

Tested by

no test coverage detected