Commit 9e345650 authored by jbeder's avatar jbeder
Browse files

Added Anchor() regex (so that we're not just using Alphanumeric to match...

Added Anchor() regex (so that we're not just using Alphanumeric to match anchors), but it's still not 100% right (it shouldn't allow non-printable characters, e.g.). Also fixed a test that was broken along these lines (if a colon immediately follows an anchor, it's part of the anchor)
parent 7fd040c3
...@@ -112,6 +112,10 @@ namespace YAML ...@@ -112,6 +112,10 @@ namespace YAML
static const RegEx e = RegEx('#'); static const RegEx e = RegEx('#');
return e; return e;
} }
inline const RegEx& Anchor() {
static const RegEx e = !(RegEx("[]{},", REGEX_OR) || BlankOrBreak());
return e;
}
inline const RegEx& AnchorEnd() { inline const RegEx& AnchorEnd() {
static const RegEx e = RegEx("?:,]}%@`", REGEX_OR) || BlankOrBreak(); static const RegEx e = RegEx("?:,]}%@`", REGEX_OR) || BlankOrBreak();
return e; return e;
......
...@@ -238,7 +238,7 @@ namespace YAML ...@@ -238,7 +238,7 @@ namespace YAML
alias = (indicator == Keys::Alias); alias = (indicator == Keys::Alias);
// now eat the content // now eat the content
while(Exp::AlphaNumeric().Matches(INPUT)) while(INPUT && Exp::Anchor().Matches(INPUT))
name += INPUT.get(); name += INPUT.get();
// we need to have read SOMETHING! // we need to have read SOMETHING!
......
...@@ -472,7 +472,7 @@ namespace Test ...@@ -472,7 +472,7 @@ namespace Test
bool AliasAsSimpleKey() bool AliasAsSimpleKey()
{ {
std::string input = "- &a b\n- *a: c"; std::string input = "- &a b\n- *a : c";
std::stringstream stream(input); std::stringstream stream(input);
YAML::Parser parser(stream); YAML::Parser parser(stream);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment