@@ -46,7 +46,7 @@ func NewParser(plugins ...server.Plugin) (*Parser, error) {
46
46
////////////////////////////////////////////////////////////////////////////////
47
47
// PUBLIC METHODS
48
48
49
- // Append an ast.Tree node
49
+ // Append configurations from a JSON file
50
50
func (p * Parser ) ParseJSON (r io.Reader ) error {
51
51
var result error
52
52
@@ -90,9 +90,23 @@ func (p *Parser) ParseJSON(r io.Reader) error {
90
90
func (p * Parser ) Bind () error {
91
91
var result error
92
92
93
- // Set the evaluation function
93
+ // Evaluate each set instruction, creating a dependency graph
94
94
ctx := ast .NewContext (func (ctx * ast.Context , value any ) (any , error ) {
95
- fmt .Printf ("EVAL %s.%s => %q (%T)\n " , ctx .Label (), ctx .Path (), value , value )
95
+ switch value := value .(type ) {
96
+ case string :
97
+ var expanded bool
98
+ value = Expand (value , func (key string ) string {
99
+ expanded = true
100
+ return "(ref:" + key + ")"
101
+ })
102
+ if expanded {
103
+ fmt .Printf ("EVAL %s.%s => %q (%T)\n " , ctx .Label (), ctx .Path (), value , value )
104
+ } else {
105
+ fmt .Printf ("SET %s.%s => %q (%T)\n " , ctx .Label (), ctx .Path (), value , value )
106
+ }
107
+ default :
108
+ fmt .Printf ("SET %s.%s => %q (%T)\n " , ctx .Label (), ctx .Path (), value , value )
109
+ }
96
110
return nil , nil
97
111
})
98
112
0 commit comments