-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
Allow commas in unquoted string + empty map #42
Conversation
From: https://yaml.org/spec/1.2.2/#733-plain-style **inside** flow collections, plain scalars must not contain the “[”, “]”, “{”, “}” and “,” characters. added test cases
73188a6
to
83d5fdf
Compare
else => { | ||
log.err("Unhandled token in map: {}", .{key}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let me know if you find this is too much
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine but I think if we had some error reporting layer setup it would have been even better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I've got some questions if you wouldn't mind answering them and helping me to understand the changes better.
@@ -6,6 +6,7 @@ const testing = std.testing; | |||
|
|||
buffer: []const u8, | |||
index: usize = 0, | |||
in_flow: usize = 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come it's not enough for in_flow
to be a bool?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this handle nesting of list/mapping. If there are several nested list, I need to remember how many closing tag I need to see before setting "in_flow" to false.
Great work! I think there's also a problem when parsing unquoted strings containing colon. For instance, the following currently fails for me: key: a::b |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Hi Jakub,
thanks for the lib.
I found two minor issues with the libraries:
,
is a valid character for unquoted string, except in flowFrom: https://yaml.org/spec/1.2.2/#733-plain-style
inside flow collections, plain scalars must not contain the “[”, “]”, “{”, “}” and “,” characters.
To handle this the tokenizer need to tracks if it's within a flow or not.
{}
is a valid map.I can split the PR in two if you prefer, but also the two commits are easy to review independently.