mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-05 14:31:24 +12:00
Added directives and tags.
This commit is contained in:
parent
2b8628922f
commit
07d4cac48f
6 changed files with 120 additions and 159 deletions
|
@ -35,6 +35,44 @@ namespace YAML
|
|||
return pToken;
|
||||
}
|
||||
|
||||
// DirectiveToken
|
||||
// . Note: no semantic checking is done here (that's for the parser to do)
|
||||
template <> DirectiveToken *Scanner::ScanToken(DirectiveToken *pToken)
|
||||
{
|
||||
// pop indents and simple keys
|
||||
PopIndentTo(-1);
|
||||
VerifyAllSimpleKeys();
|
||||
|
||||
m_simpleKeyAllowed = false;
|
||||
|
||||
// eat indicator
|
||||
INPUT.Eat(1);
|
||||
|
||||
// read name
|
||||
while(INPUT.peek() != EOF && !Exp::BlankOrBreak.Matches(INPUT))
|
||||
pToken->name += INPUT.GetChar();
|
||||
|
||||
// read parameters
|
||||
while(1) {
|
||||
// first get rid of whitespace
|
||||
while(Exp::Blank.Matches(INPUT))
|
||||
INPUT.Eat(1);
|
||||
|
||||
// break on newline or comment
|
||||
if(INPUT.peek() == EOF || Exp::Break.Matches(INPUT) || Exp::Comment.Matches(INPUT))
|
||||
break;
|
||||
|
||||
// now read parameter
|
||||
std::string param;
|
||||
while(INPUT.peek() != EOF && !Exp::BlankOrBreak.Matches(INPUT))
|
||||
param += INPUT.GetChar();
|
||||
|
||||
pToken->params.push_back(param);
|
||||
}
|
||||
|
||||
return pToken;
|
||||
}
|
||||
|
||||
// DocumentStartToken
|
||||
template <> DocumentStartToken *Scanner::ScanToken(DocumentStartToken *pToken)
|
||||
{
|
||||
|
@ -222,6 +260,34 @@ namespace YAML
|
|||
return pToken;
|
||||
}
|
||||
|
||||
// TagToken
|
||||
template <> TagToken *Scanner::ScanToken(TagToken *pToken)
|
||||
{
|
||||
// insert a potential simple key
|
||||
if(m_simpleKeyAllowed)
|
||||
InsertSimpleKey();
|
||||
m_simpleKeyAllowed = false;
|
||||
|
||||
// eat the indicator
|
||||
INPUT.Eat(1);
|
||||
|
||||
// read the handle
|
||||
while(INPUT.peek() != EOF && INPUT.peek() != Keys::Tag && !Exp::BlankOrBreak.Matches(INPUT))
|
||||
pToken->handle += INPUT.GetChar();
|
||||
|
||||
// is there a suffix?
|
||||
if(INPUT.peek() == Keys::Tag) {
|
||||
// eat the indicator
|
||||
INPUT.Eat(1);
|
||||
|
||||
// then read it
|
||||
while(INPUT.peek() != EOF && !Exp::BlankOrBreak.Matches(INPUT))
|
||||
pToken->suffix += INPUT.GetChar();
|
||||
}
|
||||
|
||||
return pToken;
|
||||
}
|
||||
|
||||
// PlainScalarToken
|
||||
template <> PlainScalarToken *Scanner::ScanToken(PlainScalarToken *pToken)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue