pfalcon / pycopy-lib

Standard library of the Pycopy project, minimalist and light-weight Python language implementation
https://github.com/pfalcon/pycopy
Other
248 stars 70 forks source link

Add basic comment spec to uyaml #63

Open Pheotis opened 3 years ago

Pheotis commented 3 years ago

Would it be possible to add comment parsing to yaml / uyaml?

Doesn't necessarily need the full spec, just some way of delivering information to end-users. Perhaps, any lines starting with # could be ignored?

Thank you!

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

test.py


import yaml

print(yaml.safe_load(open("commented.yml"))) print(yaml.safe_load(open("uncommented.yml")))


> commented.yml
```yaml
# This will print, even though it is a comment.
but: "this will not"

uncommented.yml

however: "this will in fact print"

image

pfalcon commented 3 years ago

(Current) uyaml is a quick implementation of a rather adhoc subset of YAML which I quickly made for a specific need. It really needs to be rewritten from scratch (or alternatively, existing unbloated implementation found and ported to Pycopy). I have a long TODO list, and not sure when I get to that.