Manage grammar definitions, handle dependencies, and perform tokenization.
More...
Manage grammar definitions, handle dependencies, and perform tokenization.
The registry is the central component for working with multiple grammars and themes.
◆ textmate_oniglib_create()
Initialize the Oniguruma regular expression library.
- Returns
- Opaque Oniguruma library handle on success, NULL on error
- Note
- This must be created before creating a registry
-
The returned handle must be disposed with textmate_oniglib_dispose()
Definition at line 446 of file c_api.cpp.
◆ textmate_registry_add_grammar_from_file()
| TML_API int textmate_registry_add_grammar_from_file |
( |
TextMateRegistry |
registry, |
|
|
const char * |
grammarPath |
|
) |
| |
◆ textmate_registry_add_grammar_from_json()
| TML_API int textmate_registry_add_grammar_from_json |
( |
TextMateRegistry |
registry, |
|
|
const char * |
jsonContent |
|
) |
| |
◆ textmate_registry_create()
◆ textmate_registry_dispose()
Free a registry and all its resources.
- Parameters
-
- Warning
- Do not use registry after calling this function
-
All grammars loaded from this registry become invalid
- Note
- Safe to call with NULL
Definition at line 506 of file c_api.cpp.
◆ textmate_registry_get_color_map()
◆ textmate_registry_load_grammar()
Load a grammar by scope name.
- Parameters
-
| registry | Valid registry handle |
| scopeName | Scope name of the grammar to load (e.g., "source.javascript", "text.html.markdown") |
- Returns
- Grammar handle on success, NULL if grammar not found or registration failed
- Note
- Automatically resolves grammar dependencies and includes
-
The grammar must have been previously registered with textmate_registry_add_grammar_*()
- See also
- textmate_registry_add_grammar_from_file(), textmate_registry_add_grammar_from_json()
Definition at line 642 of file c_api.cpp.
◆ textmate_registry_set_injections()
| TML_API void textmate_registry_set_injections |
( |
TextMateRegistry |
registry, |
|
|
const char * |
scopeName, |
|
|
const char ** |
injections, |
|
|
int32_t |
injectionCount |
|
) |
| |
Set grammar injection rules for a scope.
- Parameters
-
| registry | Valid registry handle |
| scopeName | Scope to inject grammars into (e.g., "source.js string.quoted.single") |
| injections | Array of grammar scope names to inject |
| injectionCount | Number of injections in the array |
- Note
- Call before loading the target grammar to take effect
-
Allows embedding one grammar within another (e.g., regex highlighting in string literals)
Definition at line 568 of file c_api.cpp.
◆ textmate_registry_set_theme()
| TML_API int textmate_registry_set_theme |
( |
TextMateRegistry |
registry, |
|
|
const char * |
themeJsonContent |
|
) |
| |
Set the color theme on the registry.
- Parameters
-
| registry | Valid registry handle |
| themeJsonContent | Theme JSON content as a null-terminated string (TextMate theme format) |
- Returns
- Non-zero on success, 0 on error (invalid JSON, etc.)
- Note
- Must be called before tokenizeLine2 to get meaningful themed tokens
- See also
- textmate_tokenize_line2(), textmate_tokenize_line2_utf16()
Definition at line 593 of file c_api.cpp.