MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / parse

Method parse

radiantcore/decl/DeclarationFolderParser.cpp:39–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37{}
38
39void 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
65void DeclarationFolderParser::onFinishParsing()
66{

Callers 2

saveDeclarationMethod · 0.45

Calls 5

createBlockFunction · 0.85
moveFunction · 0.85
getChildrenMethod · 0.80
getRootMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected