diff options
author | 2015-08-24 17:52:52 +0300 | |
---|---|---|
committer | 2015-08-24 17:52:52 +0300 | |
commit | 36c6c87fe4380b214f8ff8a45dc0213fa109821c (patch) | |
tree | ac4886a9e36fef3d0d7f621ac46678ebb7486015 /external_libs/cpp/yaml-cpp/src/scantag.cpp | |
parent | 7d3be8c612e295820649779335288c197b80ccb2 (diff) |
fix compile issues with external libarries
Diffstat (limited to 'external_libs/cpp/yaml-cpp/src/scantag.cpp')
-rwxr-xr-x | external_libs/cpp/yaml-cpp/src/scantag.cpp | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/external_libs/cpp/yaml-cpp/src/scantag.cpp b/external_libs/cpp/yaml-cpp/src/scantag.cpp new file mode 100755 index 00000000..b71cbcc4 --- /dev/null +++ b/external_libs/cpp/yaml-cpp/src/scantag.cpp @@ -0,0 +1,84 @@ +#include "scanner.h" +#include "regex.h" +#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); + } + + 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; + } +} + |