mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-05 00:54:51 +08:00
Generic ast (#1829)
Remove dependency on yaml.Node for internal AST representation. Yaml decoder is now just another decoder.
This commit is contained in:
@@ -2,8 +2,6 @@ package yqlib
|
||||
|
||||
import (
|
||||
"container/list"
|
||||
|
||||
yaml "gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
type recursiveDescentPreferences struct {
|
||||
@@ -27,13 +25,11 @@ func recursiveDecent(results *list.List, context Context, preferences recursiveD
|
||||
for el := context.MatchingNodes.Front(); el != nil; el = el.Next() {
|
||||
candidate := el.Value.(*CandidateNode)
|
||||
|
||||
candidate.Node = unwrapDoc(candidate.Node)
|
||||
|
||||
log.Debugf("Recursive Decent, added %v", NodeToString(candidate))
|
||||
results.PushBack(candidate)
|
||||
|
||||
if candidate.Node.Kind != yaml.AliasNode && len(candidate.Node.Content) > 0 &&
|
||||
(preferences.RecurseArray || candidate.Node.Kind != yaml.SequenceNode) {
|
||||
if candidate.Kind != AliasNode && len(candidate.Content) > 0 &&
|
||||
(preferences.RecurseArray || candidate.Kind != SequenceNode) {
|
||||
|
||||
children, err := splat(context.SingleChildContext(candidate), preferences.TraversePreferences)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user