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 445 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 505 of file c_api.cpp.
◆ 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 592 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 567 of file c_api.cpp.