We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 18450eb commit a142a71Copy full SHA for a142a71
docs/Usage.md
@@ -196,12 +196,14 @@ For example if you want to collect all variable names:
196
import "github.com/antonmedv/expr/ast"
197
198
type visitor struct {
199
- ast.BaseVisitor
200
identifiers []string
201
}
202
203
-func (v *visitor) IdentifierNode(node *ast.IdentifierNode) {
204
- v.identifiers = append(v.identifiers, node.Value)
+func (v *visitor) Enter(node *ast.Node) {}
+func (v *visitor) Exit(node *ast.Node) {
+ if v, ok := node.(*ast.IdentifierNode); ok {
205
+ v.identifiers = append(v.identifiers, node.Value)
206
+ }
207
208
209
program, err := expr.Compile("foo + bar", expr.Env(env))
0 commit comments