| 25 | SyntaxDefMap<SyntaxStyleType, std::string> SyntaxPattern::SyntaxStyleTypeCache = {}; |
| 26 | |
| 27 | static 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 | |
| 47 | template <typename SyntaxStyleType> void updateCache( const SyntaxPattern& ptrn ) { |
| 48 | if constexpr ( std::is_same_v<SyntaxStyleType, std::string> ) { |