FlowEnd
| 102 | |
| 103 | // FlowEnd |
| 104 | void Scanner::ScanFlowEnd() { |
| 105 | if (InBlockContext()) |
| 106 | throw ParserException(INPUT.mark(), ErrorMsg::FLOW_END); |
| 107 | |
| 108 | // we might have a solo entry in the flow context |
| 109 | if (InFlowContext()) { |
| 110 | if (m_flows.top() == FLOW_MAP && VerifySimpleKey()) |
| 111 | m_tokens.push(Token(Token::VALUE, INPUT.mark())); |
| 112 | else if (m_flows.top() == FLOW_SEQ) |
| 113 | InvalidateSimpleKey(); |
| 114 | } |
| 115 | |
| 116 | m_simpleKeyAllowed = false; |
| 117 | m_canBeJSONFlow = true; |
| 118 | |
| 119 | // eat |
| 120 | Mark mark = INPUT.mark(); |
| 121 | char ch = INPUT.get(); |
| 122 | |
| 123 | // check that it matches the start |
| 124 | FLOW_MARKER flowType = (ch == Keys::FlowSeqEnd ? FLOW_SEQ : FLOW_MAP); |
| 125 | if (m_flows.top() != flowType) |
| 126 | throw ParserException(mark, ErrorMsg::FLOW_END); |
| 127 | m_flows.pop(); |
| 128 | |
| 129 | Token::TYPE type = (flowType ? Token::FLOW_SEQ_END : Token::FLOW_MAP_END); |
| 130 | m_tokens.push(Token(type, mark)); |
| 131 | } |
| 132 | |
| 133 | // FlowEntry |
| 134 | void Scanner::ScanFlowEntry() { |