game/data: adapt to engine-parity parse API (items->key_quoted pairs; lenient unterminated quote)
This commit is contained in:
parent
4d5b573668
commit
4f0a9dbd82
2 changed files with 7 additions and 5 deletions
|
|
@ -93,9 +93,7 @@ Block snapshot(const mars::parse::Node& node) {
|
|||
b.attrs.push_back(std::move(a));
|
||||
break;
|
||||
}
|
||||
case Entry::Kind::Item:
|
||||
b.items.push_back(e.value);
|
||||
break;
|
||||
// (bare quoted items are now Pair entries with key_quoted; engine-parity change)
|
||||
case Entry::Kind::Block: {
|
||||
Block sub = snapshot(*e.block);
|
||||
sub.name = e.key;
|
||||
|
|
|
|||
|
|
@ -155,9 +155,13 @@ TEST(weapon_no_block_is_fatal) {
|
|||
}
|
||||
|
||||
TEST(weapon_syntax_error_is_fatal_and_recovery_is_reported) {
|
||||
// Engine parity: an unterminated quote is NOT fatal -- the string runs to EOF (swallowing the
|
||||
// '}') and EOF closes the block; the recovery is reported as a Syntax-kind problem.
|
||||
auto bad = parse_weapon("weapon { name \"unterminated }");
|
||||
CHECK(!bad.ok());
|
||||
CHECK(bad.problems[0].kind == Problem::Kind::Syntax);
|
||||
CHECK(bad.ok());
|
||||
bool reported = false;
|
||||
for (const auto& p : bad.problems) if (p.kind == Problem::Kind::Syntax) reported = true;
|
||||
CHECK(reported);
|
||||
auto rec = parse_weapon("weapon { name @W weaponclass bullet turretsize small turretclass standard\n"); // EOF closes
|
||||
CHECK(rec.ok());
|
||||
CHECK_EQ(rec.problems.size(), std::size_t{1});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue