github.com/hashicorp/hcl/v2@v2.20.0/hclsyntax/node.go (about)

     1  // Copyright (c) HashiCorp, Inc.
     2  // SPDX-License-Identifier: MPL-2.0
     3  
     4  package hclsyntax
     5  
     6  import (
     7  	"github.com/hashicorp/hcl/v2"
     8  )
     9  
    10  // Node is the abstract type that every AST node implements.
    11  //
    12  // This is a closed interface, so it cannot be implemented from outside of
    13  // this package.
    14  type Node interface {
    15  	// This is the mechanism by which the public-facing walk functions
    16  	// are implemented. Implementations should call the given function
    17  	// for each child node and then replace that node with its return value.
    18  	// The return value might just be the same node, for non-transforming
    19  	// walks.
    20  	walkChildNodes(w internalWalkFunc)
    21  
    22  	Range() hcl.Range
    23  }
    24  
    25  type internalWalkFunc func(Node)