Skip to content

Commit cfb7606

Browse files
outcoldmanjbeder
authored andcommitted
Fix tag parsing with () (#532)
1 parent 86ae3a5 commit cfb7606

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/exp.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ inline const RegEx& URI() {
135135
return e;
136136
}
137137
inline const RegEx& Tag() {
138-
static const RegEx e = Word() || RegEx("#;/?:@&=+$_.~*'", REGEX_OR) ||
138+
static const RegEx e = Word() || RegEx("#;/?:@&=+$_.~*'()", REGEX_OR) ||
139139
(RegEx('%') + Hex() + Hex());
140140
return e;
141141
}
@@ -200,7 +200,7 @@ inline const RegEx& Chomp() {
200200

201201
// and some functions
202202
std::string Escape(Stream& in);
203-
}
203+
} // namespace Exp
204204

205205
namespace Keys {
206206
const char Directive = '%';
@@ -216,7 +216,7 @@ const char LiteralScalar = '|';
216216
const char FoldedScalar = '>';
217217
const char VerbatimTagStart = '<';
218218
const char VerbatimTagEnd = '>';
219-
}
220-
}
219+
} // namespace Keys
220+
} // namespace YAML
221221

222222
#endif // EXP_H_62B23520_7C8E_11DE_8A39_0800200C9A66

test/integration/load_node_test.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,12 @@ TEST(NodeTest, LoadTildeAsNull) {
230230
Node node = Load("~");
231231
ASSERT_TRUE(node.IsNull());
232232
}
233+
234+
TEST(NodeTest, LoadTagWithParenthesis) {
235+
Node node = Load("!Complex(Tag) foo");
236+
EXPECT_EQ(node.Tag(), "!Complex(Tag)");
237+
EXPECT_EQ(node.as<std::string>(), "foo");
238+
}
233239

234240
} // namespace
235241
} // namespace YAML

0 commit comments

Comments
 (0)