| 37 | {} |
| 38 | |
| 39 | void DeclarationFolderParser::parse(std::istream& stream, const vfs::FileInfo& fileInfo, const std::string& modDir) |
| 40 | { |
| 41 | // Parse the incoming stream into syntax blocks |
| 42 | parser::DefBlockSyntaxParser<std::istream> parser(stream); |
| 43 | |
| 44 | auto syntaxTree = parser.parse(); |
| 45 | |
| 46 | for (const auto& node : syntaxTree->getRoot()->getChildren()) |
| 47 | { |
| 48 | if (node->getType() != parser::DefSyntaxNode::Type::DeclBlock) |
| 49 | { |
| 50 | continue; |
| 51 | } |
| 52 | |
| 53 | const auto& blockNode = static_cast<const parser::DefBlockSyntax&>(*node); |
| 54 | |
| 55 | // Convert the incoming block to a DeclarationBlockSyntax |
| 56 | auto blockSyntax = createBlock(blockNode, fileInfo, modDir); |
| 57 | |
| 58 | // Move the block in the correct bucket |
| 59 | auto declType = determineBlockType(blockSyntax); |
| 60 | auto& blockList = _parsedBlocks.try_emplace(declType).first->second; |
| 61 | blockList.emplace_back(std::move(blockSyntax)); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | void DeclarationFolderParser::onFinishParsing() |
| 66 | { |
no test coverage detected