Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for reading comments #108

Open
mmeroberts opened this issue Aug 11, 2023 · 3 comments
Open

Support for reading comments #108

mmeroberts opened this issue Aug 11, 2023 · 3 comments

Comments

@mmeroberts
Copy link

SnakeYaml has an option to process comments. It would be good to be able to have access to that option from clj, ideally from bb as well.

See https://github.com/snakeyaml/snakeyaml/blob/master/src/main/java/org/yaml/snakeyaml/LoaderOptions.java

private boolean processComments = false;

My use case is to parse yaml documents that are very heavily commented as they main audience is human.

I am raising the issue first and could explore having a go at adding it, but following instructions from the Developer docs, it suggests raising issue first.

@borkdude
Copy link
Collaborator

OK, PR welcome to see what can be done about it. Please also add a test :)

@mmeroberts
Copy link
Author

I have played around with the options - something is happening - for example when parsing the list-yaml in the tests I get a exception as there is an open issue in Snake yaml for a comment in that position. What I found is that setting the option does not change the output at all. There is a line in one of the snakeyaml files that says:
while (scanner.checkToken(Token.ID.Comment)) { // TODO: till we figure out what todo with the comments scanner.getToken(); }

Which does not give me any confidence that the comments will end up somewhere. There is also an old issue where the devs just say that the comment is over-ridden by the node that comes next.

Shame. Would appreciate someone else confirming this.

@asomov
Copy link

asomov commented Jul 7, 2024

@mmeroberts thank you very much for the contribution. The mentioned TODO was removed as non applicable any longer.
For your information. The parsing/dumping comments in SnakeYAML is fully functional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants