Comments (3)
Hi @divoxx
There are plans to separate GlobalTag
and LocalTag
in future improvements,
but for now they cannot be distinguished.
However, you can call GetToken()
of ast.TagNode
and
get the tag string with token.Value
.
You can determine whether it is LocalTag
by looking at its contents.
Also, if you want to use an already manipulated AST,
can I solve it by preparing an I/F like (*Decoder).DecodeWithFile(interface{}, *ast.File)
?
from go-yaml.
Thanks for the quick answer and the explanation for global vs local tags.
As far as the decode method, I think accepting a *ast.Node
would be more flexible. For example, I might want to parse the whole document (*ast.Document
) but I also might want to parse just a subset of the document. That said, taking an *ast.File
is already helpful.
That said, I'm not sure if it's currently possible to manipulate the ast? For example, would it be possible to replace value node by another programmatically created one, using the public interface of the ast package?
from go-yaml.
I will add more helpful features at next minor update .
Thanks !
from go-yaml.
Related Issues (20)
- Handling of Carriage Return (`\r`) in a double-quoted string differs from `gopkg.in/yaml.*.`
- Panic when unmarshalling specific data into map HOT 1
- Parser returns two documents instead of one
- Marshaler interfaces not checked against addressable non-pointers
- Diff to go-yaml/yaml HOT 1
- [Question] Is it possible to merge 2 yamls preserving anchors?
- ast.Merge error `cannot merge Mapping into Anchor`
- Expose useJSONMarshaler option in NewEncoder HOT 1
- Please verify 0b*** binary content and fallback to string
- Compile error HOT 1
- Multi-line strings don't work when there are curly braces
- comment after `-` causes subsequent queries to fail HOT 3
- 1.11.2 is mis-tagged HOT 1
- Get positional (Line / Column) information on a node HOT 6
- Add option to support mandatory field when decode
- Block with indent indicator is not parsed correctly
- Possibility of encoding tags
- Empty null value gets converted to "null" in token
- Empty null value with line comment causes seg fault
- Trailing new lines are added to literal strings
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-yaml.