http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/4dd46e29/thirdparty/yaml-cpp-yaml-cpp-0.5.3/src/scantoken.cpp
--
diff --git a/thirdparty/yaml-cpp-yaml-cpp-0.5.3/src/scantoken.cpp
b/thirdparty/yaml-cpp-yaml-cpp-0.5.3/src/scantoken.cpp
new file mode 100644
index 000..180ad00
--- /dev/null
+++ b/thirdparty/yaml-cpp-yaml-cpp-0.5.3/src/scantoken.cpp
@@ -0,0 +1,436 @@
+#include
+
+#include "exp.h"
+#include "regex_yaml.h"
+#include "regeximpl.h"
+#include "scanner.h"
+#include "scanscalar.h"
+#include "scantag.h" // IWYU pragma: keep
+#include "tag.h" // IWYU pragma: keep
+#include "token.h"
+#include "yaml-cpp/exceptions.h" // IWYU pragma: keep
+#include "yaml-cpp/mark.h"
+
+namespace YAML {
+///
+// Specialization for scanning specific tokens
+
+// Directive
+// . Note: no semantic checking is done here (that's for the parser to do)
+void Scanner::ScanDirective() {
+ std::string name;
+ std::vector params;
+
+ // pop indents and simple keys
+ PopAllIndents();
+ PopAllSimpleKeys();
+
+ m_simpleKeyAllowed = false;
+ m_canBeJSONFlow = false;
+
+ // store pos and eat indicator
+ Token token(Token::DIRECTIVE, INPUT.mark());
+ INPUT.eat(1);
+
+ // read name
+ while (INPUT && !Exp::BlankOrBreak().Matches(INPUT))
+token.value += INPUT.get();
+
+ // read parameters
+ while (1) {
+// first get rid of whitespace
+while (Exp::Blank().Matches(INPUT))
+ INPUT.eat(1);
+
+// break on newline or comment
+if (!INPUT || Exp::Break().Matches(INPUT) || Exp::Comment().Matches(INPUT))
+ break;
+
+// now read parameter
+std::string param;
+while (INPUT && !Exp::BlankOrBreak().Matches(INPUT))
+ param += INPUT.get();
+
+token.params.push_back(param);
+ }
+
+ m_tokens.push(token);
+}
+
+// DocStart
+void Scanner::ScanDocStart() {
+ PopAllIndents();
+ PopAllSimpleKeys();
+ m_simpleKeyAllowed = false;
+ m_canBeJSONFlow = false;
+
+ // eat
+ Mark mark = INPUT.mark();
+ INPUT.eat(3);
+ m_tokens.push(Token(Token::DOC_START, mark));
+}
+
+// DocEnd
+void Scanner::ScanDocEnd() {
+ PopAllIndents();
+ PopAllSimpleKeys();
+ m_simpleKeyAllowed = false;
+ m_canBeJSONFlow = false;
+
+ // eat
+ Mark mark = INPUT.mark();
+ INPUT.eat(3);
+ m_tokens.push(Token(Token::DOC_END, mark));
+}
+
+// FlowStart
+void Scanner::ScanFlowStart() {
+ // flows can be simple keys
+ InsertPotentialSimpleKey();
+ m_simpleKeyAllowed = true;
+ m_canBeJSONFlow = false;
+
+ // eat
+ Mark mark = INPUT.mark();
+ char ch = INPUT.get();
+ FLOW_MARKER flowType = (ch == Keys::FlowSeqStart ? FLOW_SEQ : FLOW_MAP);
+ m_flows.push(flowType);
+ Token::TYPE type =
+ (flowType == FLOW_SEQ ? Token::FLOW_SEQ_START : Token::FLOW_MAP_START);
+ m_tokens.push(Token(type, mark));
+}
+
+// FlowEnd
+void Scanner::ScanFlowEnd() {
+ if (InBlockContext())
+throw ParserException(INPUT.mark(), ErrorMsg::FLOW_END);
+
+ // we might have a solo entry in the flow context
+ if (InFlowContext()) {
+if (m_flows.top() == FLOW_MAP && VerifySimpleKey())
+ m_tokens.push(Token(Token::VALUE, INPUT.mark()));
+else if (m_flows.top() == FLOW_SEQ)
+ InvalidateSimpleKey();
+ }
+
+ m_simpleKeyAllowed = false;
+ m_canBeJSONFlow = true;
+
+ // eat
+ Mark mark = INPUT.mark();
+ char ch = INPUT.get();
+
+ // check that it matches the start
+ FLOW_MARKER flowType = (ch == Keys::FlowSeqEnd ? FLOW_SEQ : FLOW_MAP);
+ if (m_flows.top() != flowType)
+throw ParserException(mark, ErrorMsg::FLOW_END);
+ m_flows.pop();
+
+ Token::TYPE type = (flowType ? Token::FLOW_SEQ_END : Token::FLOW_MAP_END);
+ m_tokens.push(Token(type, mark));
+}
+
+// FlowEntry
+void Scanner::ScanFlowEntry() {
+ // we might have a solo entry in the flow context
+ if (InFlowContext()) {
+if (m_flows.top() == FLOW_MAP && VerifySimpleKey())
+ m_tokens.push(Token(Token::VALUE, INPUT.mark()));
+else if (m_flows.top() == FLOW_SEQ)
+ InvalidateSimpleKey();
+ }
+
+ m_simpleKeyAllowed = true;
+ m_canBeJSONFlow = false;
+
+ // eat
+ Mark mark = INPUT.mark();
+ INPUT.eat(1);
+ m_tokens.push(Token(Token::FLOW_ENTRY, mark));
+}
+
+// BlockEntry
+void Scanner::ScanBlockEntry() {
+ // we better be in the block context!
+ if (InFlowContext())
+throw ParserException(INPUT.mark(), ErrorMsg::BLOCK_ENTRY);
+
+ // can we put it here?
+ if (!m_simpleKeyAllowed)
+throw ParserException(INPUT.mark(), ErrorMsg::BLOCK_ENTRY);
+
+ PushIndentTo(INPUT.column(), IndentMarker::SEQ);
+ m_simpleKeyAllowed = true;
+ m_canBeJSONFlow = false;
+
+ // eat
+ Mark mark = INPUT.mark();
+ INPUT.eat(1);
+ m_tokens.push(Token(Token::BLOCK_ENTRY, mark));
+}
+
+// Key
+void Scanner::ScanKey() {
+ // handle keys diffently in the block context (and manage indents)
+ if (InBlockContext()) {
+if (!m_simpleKeyAllowed)
+ throw ParserException(INPUT.mark(),