-
-
Notifications
You must be signed in to change notification settings - Fork 382
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
Basic support for lists in config.yaml #342
base: main
Are you sure you want to change the base?
Conversation
while (_parser.token_.is_list_) { | ||
_parser.token_.is_list_ = false; | ||
entryIndent = _parser.token_.indent_; | ||
_parser.token_.indent_ += 2; |
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.
Looks a bit fishy. I could introduce another member on Token as well, but it would basically do the same, I assume.
@@ -8,6 +8,22 @@ | |||
#include "HandlerBase.h" | |||
|
|||
namespace Configuration { | |||
template <typename BaseType> |
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.
Had to make BuilderBase a non-inner class to be able to forward declare it in HandlerBase.h
if (IsListItem()) { | ||
token_.is_list_ = true; | ||
Inc(); | ||
// skip expected whitespace. TODO: validate that it's indeed a whitespace |
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.
Reason: It could also be a plain scalar (e.g. -42
)
But did this YAML parser support that before? I guess not, it always relied on "key: value" pairs.
DRAFT
This is just a FYI PR in case anyone is interested in what I'm doing.
No expectations from my side attached to it at the moment (no expectation to have it merged, reviewed, ...)
Initial work on allowing YAML lists to instantiate multiple objects of the same type (see #341 for a use case).
There are many things that need to be improved or that are missing at this point. (also see @MitchBradley's comments on #341)
Currently it allows me to do what I had in mind (but not much more, I assume):
Next steps:
enterSectionList
on the otherHandlerBase
subclasses.