| 39 | } |
| 40 | |
| 41 | void Parser::ParseDirectives() { |
| 42 | bool readDirective = false; |
| 43 | |
| 44 | while (!m_pScanner->empty()) { |
| 45 | Token& token = m_pScanner->peek(); |
| 46 | if (token.type != Token::DIRECTIVE) { |
| 47 | break; |
| 48 | } |
| 49 | |
| 50 | // we keep the directives from the last document if none are specified; |
| 51 | // but if any directives are specific, then we reset them |
| 52 | if (!readDirective) { |
| 53 | m_pDirectives.reset(new Directives); |
| 54 | } |
| 55 | |
| 56 | readDirective = true; |
| 57 | HandleDirective(token); |
| 58 | m_pScanner->pop(); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | void Parser::HandleDirective(const Token& token) { |
| 63 | if (token.value == "YAML") { |