Skip to content

multiline assignment will make the line number is not correctly #260

@CairoLee

Description

@CairoLee

Description

When yaml include | mark for multiline assignment, the line number is not correctly

Example Code

ryml::Parser parser;

ryml::Tree tree = parser.parse_in_arena("source.yml", R"(Body:
  - Id: 1
    Name: Apple
    Script: |
      Line One
      Line Two
  - Id: 2
    Name: Cat
    Script: |
      Line One
      Line Two
  - Id: 3
    Name: Dog
    Script: |
      Line One
      Line Two)");

ryml::Location loc = parser.location(tree.rootref());
loc = parser.location(tree["Body"][2]["Name"]);

sprintf("loc.line = %d\n", loc.line + 1);

Expected results

loc.line = 13

Current results

loc.line = 15

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions