This commit is contained in:
Jesse Beder 2008-06-29 00:33:34 +00:00
parent 2e27c5d9c3
commit d076252dff
6 changed files with 74 additions and 104 deletions

View file

@ -191,6 +191,36 @@ namespace YAML
return pToken;
}
// AnchorToken
template <> AnchorToken *Scanner::ScanToken(AnchorToken *pToken)
{
// insert a potential simple key
if(m_simpleKeyAllowed)
InsertSimpleKey();
m_simpleKeyAllowed = false;
// eat the indicator
char indicator = GetChar();
pToken->alias = (indicator == Keys::Alias);
// now eat the content
std::string tag;
while(Exp::AlphaNumeric.Matches(INPUT))
tag += GetChar();
// we need to have read SOMETHING!
if(tag.empty())
throw AnchorNotFound();
// and needs to end correctly
if(INPUT.peek() != EOF && !Exp::AnchorEnd.Matches(INPUT))
throw IllegalCharacterInAnchor();
// and we're done
pToken->value = tag;
return pToken;
}
// PlainScalarToken
// . We scan these in passes of two steps each: First, grab all non-whitespace
// characters we can, and then grab all whitespace characters we can.