Skip to content

Commit

Permalink
[fix] fix parsing of tags followed by comments in seq values
Browse files Browse the repository at this point in the history
  • Loading branch information
biojppm committed Oct 19, 2021
1 parent 2129d07 commit bf79ec4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
11 changes: 11 additions & 0 deletions changelog/current.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@

### New features
- Add support for CPU architectures aarch64, ppc64le, s390x
- Update c4core to [0.1.5](https://github.com/biojppm/c4core/releases/tag/v0.1.5)
- Add sample showing how to load a file and parse with ryml

### Fixes

- Fix parsing of tags followed by comments in sequences:
```yaml
# test case 735Y
- !!map # Block collection
foo : bar
```
9 changes: 7 additions & 2 deletions src/c4/yml/parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1749,6 +1749,11 @@ bool Parser::_handle_types()
_c4dbgpf("there was a tag: '%.*s', indentation=%zu", _c4prsp(t), tag_indentation);
RYML_ASSERT(t.end() > m_state->line_contents.rem.begin());
_line_progressed(static_cast<size_t>(t.end() - m_state->line_contents.rem.begin()));
{
size_t pos = m_state->line_contents.rem.first_not_of(" \t");
if(pos != csubstr::npos)
_line_progressed(pos);
}

if(has_all(RMAP|RKEY))
{
Expand All @@ -1763,7 +1768,7 @@ bool Parser::_handle_types()
* !!str : bar */
rem = m_state->line_contents.rem;
rem = rem.left_of(rem.find("#"));
rem = rem.trim(" \t");
rem = rem.trimr(" \t");
_c4dbgpf("rem='%.*s'", _c4prsp(rem));
if(rem == ':' || rem.begins_with(": "))
{
Expand Down Expand Up @@ -1799,7 +1804,7 @@ bool Parser::_handle_types()
{
rem = m_state->line_contents.rem;
rem = rem.left_of(rem.find("#"));
rem = rem.trim(" \t");
rem = rem.trimr(" \t");
if(rem.empty())
{
_c4dbgpf("saving val tag '%.*s'", _c4prsp(t));
Expand Down
1 change: 0 additions & 1 deletion test/test_suite/test_suite_parts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ constexpr const AllowedFailure allowed_failures[] = {
// These tests are temporarily skipped, and cover issues that must be fixed.

// plain scalars (ie, not quoted, not folded)
{"735Y", IN______________ , "plain scalar parsing"},
{"82AN", IN______________ , "plain scalar parsing, same indentation on next line is problematic"},
{"9YRD", IN______________ , "plain scalar parsing, same indentation on next line is problematic"},
{"EX5H", IN_____EMIT_____ , "plain scalar parsing, same indentation on next line is problematic"},
Expand Down

0 comments on commit bf79ec4

Please sign in to comment.