mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 20:51:16 +00:00
Run clang-format
This commit is contained in:
141
src/scantag.cpp
141
src/scantag.cpp
@@ -3,82 +3,77 @@
|
||||
#include "exp.h"
|
||||
#include "yaml-cpp/exceptions.h"
|
||||
|
||||
namespace YAML
|
||||
{
|
||||
const std::string ScanVerbatimTag(Stream& INPUT)
|
||||
{
|
||||
std::string tag;
|
||||
|
||||
// eat the start character
|
||||
INPUT.get();
|
||||
|
||||
while(INPUT) {
|
||||
if(INPUT.peek() == Keys::VerbatimTagEnd) {
|
||||
// eat the end character
|
||||
INPUT.get();
|
||||
return tag;
|
||||
}
|
||||
|
||||
int n = Exp::URI().Match(INPUT);
|
||||
if(n <= 0)
|
||||
break;
|
||||
|
||||
tag += INPUT.get(n);
|
||||
}
|
||||
namespace YAML {
|
||||
const std::string ScanVerbatimTag(Stream& INPUT) {
|
||||
std::string tag;
|
||||
|
||||
throw ParserException(INPUT.mark(), ErrorMsg::END_OF_VERBATIM_TAG);
|
||||
}
|
||||
|
||||
const std::string ScanTagHandle(Stream& INPUT, bool& canBeHandle)
|
||||
{
|
||||
std::string tag;
|
||||
canBeHandle = true;
|
||||
Mark firstNonWordChar;
|
||||
|
||||
while(INPUT) {
|
||||
if(INPUT.peek() == Keys::Tag) {
|
||||
if(!canBeHandle)
|
||||
throw ParserException(firstNonWordChar, ErrorMsg::CHAR_IN_TAG_HANDLE);
|
||||
break;
|
||||
}
|
||||
// eat the start character
|
||||
INPUT.get();
|
||||
|
||||
int n = 0;
|
||||
if(canBeHandle) {
|
||||
n = Exp::Word().Match(INPUT);
|
||||
if(n <= 0) {
|
||||
canBeHandle = false;
|
||||
firstNonWordChar = INPUT.mark();
|
||||
}
|
||||
}
|
||||
|
||||
if(!canBeHandle)
|
||||
n = Exp::Tag().Match(INPUT);
|
||||
while (INPUT) {
|
||||
if (INPUT.peek() == Keys::VerbatimTagEnd) {
|
||||
// eat the end character
|
||||
INPUT.get();
|
||||
return tag;
|
||||
}
|
||||
|
||||
if(n <= 0)
|
||||
break;
|
||||
|
||||
tag += INPUT.get(n);
|
||||
}
|
||||
int n = Exp::URI().Match(INPUT);
|
||||
if (n <= 0)
|
||||
break;
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
const std::string ScanTagSuffix(Stream& INPUT)
|
||||
{
|
||||
std::string tag;
|
||||
|
||||
while(INPUT) {
|
||||
int n = Exp::Tag().Match(INPUT);
|
||||
if(n <= 0)
|
||||
break;
|
||||
|
||||
tag += INPUT.get(n);
|
||||
}
|
||||
|
||||
if(tag.empty())
|
||||
throw ParserException(INPUT.mark(), ErrorMsg::TAG_WITH_NO_SUFFIX);
|
||||
|
||||
return tag;
|
||||
}
|
||||
tag += INPUT.get(n);
|
||||
}
|
||||
|
||||
throw ParserException(INPUT.mark(), ErrorMsg::END_OF_VERBATIM_TAG);
|
||||
}
|
||||
|
||||
const std::string ScanTagHandle(Stream& INPUT, bool& canBeHandle) {
|
||||
std::string tag;
|
||||
canBeHandle = true;
|
||||
Mark firstNonWordChar;
|
||||
|
||||
while (INPUT) {
|
||||
if (INPUT.peek() == Keys::Tag) {
|
||||
if (!canBeHandle)
|
||||
throw ParserException(firstNonWordChar, ErrorMsg::CHAR_IN_TAG_HANDLE);
|
||||
break;
|
||||
}
|
||||
|
||||
int n = 0;
|
||||
if (canBeHandle) {
|
||||
n = Exp::Word().Match(INPUT);
|
||||
if (n <= 0) {
|
||||
canBeHandle = false;
|
||||
firstNonWordChar = INPUT.mark();
|
||||
}
|
||||
}
|
||||
|
||||
if (!canBeHandle)
|
||||
n = Exp::Tag().Match(INPUT);
|
||||
|
||||
if (n <= 0)
|
||||
break;
|
||||
|
||||
tag += INPUT.get(n);
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
const std::string ScanTagSuffix(Stream& INPUT) {
|
||||
std::string tag;
|
||||
|
||||
while (INPUT) {
|
||||
int n = Exp::Tag().Match(INPUT);
|
||||
if (n <= 0)
|
||||
break;
|
||||
|
||||
tag += INPUT.get(n);
|
||||
}
|
||||
|
||||
if (tag.empty())
|
||||
throw ParserException(INPUT.mark(), ErrorMsg::TAG_WITH_NO_SUFFIX);
|
||||
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user