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

Function loadTextMateLanguage

src/eepp/ui/doc/syntaxdefinitionmanager.cpp:905–926  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

903}
904
905static SyntaxDefinition loadTextMateLanguage( const nlohmann::json& json, SyntaxDefinition& def ) {
906 if ( json.contains( "fileTypes" ) && json["fileTypes"].is_array() ) {
907 const auto& files = json["fileTypes"];
908 for ( const auto& file : files )
909 if ( file.is_string() ) {
910 auto ext( file.get<std::string>() );
911 def.addFileType( ( !String::contains( ext, "." ) ? "%." : "" ) + ext + "$" );
912 }
913 } else if ( json.contains( "filetypes" ) && json["filetypes"].is_array() ) {
914 const auto& files = json["filetypes"];
915 for ( const auto& file : files )
916 if ( file.is_string() ) {
917 auto ext( file.get<std::string>() );
918 def.addFileType( ( !String::contains( ext, "." ) ? "%." : "" ) + ext + "$" );
919 }
920 } else if ( json.contains( "scopeName" ) && json["scopeName"].is_string() ) {
921 const auto& scopeName = json.value( "scopeName", "" );
922 def.addFileType( "%." + FileSystem::fileExtension( scopeName ) + "$" );
923 }
924 def.compile();
925 return def;
926}
927
928static void parseRepositoryItem( SyntaxDefinition& def, const std::string& name,
929 const nlohmann::json& item ) {

Callers 1

loadLanguageFunction · 0.85

Calls 4

containsFunction · 0.50
containsMethod · 0.45
valueMethod · 0.45
compileMethod · 0.45

Tested by

no test coverage detected