You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an embedded script in a YAML file, and I want to provide users with exact line/col information of possible syntax errors. I am having trouble getting the correct column for a multiline string.
For instance, for the print() statement in
script: | print()
I expect location.col to be 2.
This is how I do it, not sure if I use the correct API.
TEST(rapidyaml, fails)
{
ryml::Parser parser{ ryml::ParserOptions().locations(true) };
auto tree = parser.parse_in_arena("file", "script: |\n print()");
auto script = tree["script"];
auto val = script.val();
EXPECT_TRUE(val == "print()\n");
auto location = parser.val_location(val.str);
EXPECT_EQ(location.line, 1);
EXPECT_EQ(location.col, 2);
}
however, the test fails with col == 0:
location.col
Which is: 0
2
Any help would be greatly appreciated. TIA!
The text was updated successfully, but these errors were encountered:
Thanks for rapidyaml!
I have an embedded script in a YAML file, and I want to provide users with exact line/col information of possible syntax errors. I am having trouble getting the correct column for a multiline string.
For instance, for the
print()
statement inI expect location.col to be 2.
This is how I do it, not sure if I use the correct API.
however, the test fails with col == 0:
Any help would be greatly appreciated. TIA!
The text was updated successfully, but these errors were encountered: