1#ifndef TEXTMATELIB_BASIC_SCOPES_ATTRIBUTE_PROVIDER_H
2#define TEXTMATELIB_BASIC_SCOPES_ATTRIBUTE_PROVIDER_H
14class BasicScopeAttributes {
19 BasicScopeAttributes() : languageId(0), tokenType() {}
24template<
typename TValue>
27 std::map<std::string, TValue> values;
28 std::regex* scopesRegExp;
32 ScopeMatcher(
const std::vector<std::pair<std::string, TValue>>& valuesList);
39class BasicScopeAttributesProvider {
41 BasicScopeAttributes _defaultAttributes;
42 ScopeMatcher<int>* _embeddedLanguagesMatcher;
43 CachedFn<ScopeName, BasicScopeAttributes>* _getBasicScopeAttributesCache;
45 static std::regex STANDARD_TOKEN_TYPE_REGEXP;
46 static BasicScopeAttributes NULL_SCOPE_METADATA;
49 BasicScopeAttributesProvider(
int initialLanguageId,
const EmbeddedLanguagesMap* embeddedLanguages);
50 ~BasicScopeAttributesProvider();
52 BasicScopeAttributes getDefaultAttributes()
const;
53 BasicScopeAttributes getBasicScopeAttributes(
const ScopeName* scopeName);
56 int _scopeToLanguage(
const ScopeName& scope);
std::string ScopeName
Semantic name identifying a scope (e.g., "source.javascript", "comment.line")
std::map< std::string, int > EmbeddedLanguagesMap
Map from embedded language name to token type ID.
OptionalStandardTokenType
Standard token type with optional (unknown) state.
Core type definitions and interfaces for TextMateLib.