MCPcopy Create free account
hub / github.com/SpartanJ/eepp / liftContentPatternsRecursive

Function liftContentPatternsRecursive

src/eepp/ui/doc/syntaxdefinition.cpp:27–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25SyntaxDefMap<SyntaxStyleType, std::string> SyntaxPattern::SyntaxStyleTypeCache = {};
26
27static void liftContentPatternsRecursive( SyntaxDefinition& def, SyntaxPattern& pattern,
28 std::string_view namePrefixSeed,
29 Uint64& uniqueIdCounter ) {
30 for ( Uint64 i = 0; i < pattern.contentPatterns.size(); ++i ) {
31 // Pass a new prefix seed for children to ensure unique names
32 std::string childPrefixSeed = String::format( "%s_cp%zu", namePrefixSeed, i );
33 liftContentPatternsRecursive( def, pattern.contentPatterns[i], childPrefixSeed,
34 uniqueIdCounter );
35 }
36
37 if ( !pattern.contentPatterns.empty() ) {
38 // Generate a unique repository name for this pattern's content scope
39 std::string contentRepoName =
40 String::format( "$CONTENT_%s_%s_uid%zu", def.getLanguageNameForFileSystem(),
41 namePrefixSeed, uniqueIdCounter++ );
42 pattern.contentScopeRepoHash = String::hash( contentRepoName );
43 def.addRepository( std::move( contentRepoName ), std::move( pattern.contentPatterns ) );
44 }
45}
46
47template <typename SyntaxStyleType> void updateCache( const SyntaxPattern& ptrn ) {
48 if constexpr ( std::is_same_v<SyntaxStyleType, std::string> ) {

Callers 1

compileMethod · 0.85

Calls 5

formatFunction · 0.85
hashFunction · 0.85
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected