|
TextMateLib 1.0
Modern C++ implementation of the TextMate syntax highlighting engine
|
C language API for TextMateLib. More...
#include "tml_export.h"#include <stdint.h>Go to the source code of this file.
Classes | |
| struct | TextMateToken |
| Represents a single token in tokenized text. More... | |
| struct | TextMateTokenizeResult |
| Result from tokenizing a single line with decoded tokens. More... | |
| struct | TextMateTokenizeResult2 |
| Result from tokenizing a single line with encoded tokens. More... | |
| struct | TextMateTokenizeMultiLinesResult |
| Result from batch tokenizing multiple lines. More... | |
Functions | |
| TML_API TextMateTheme | textmate_theme_load_from_file (const char *themePath) |
| Load a theme from a JSON file. | |
| TML_API TextMateTheme | textmate_theme_load_from_json (const char *jsonContent) |
| Load a theme from a JSON string. | |
| TML_API uint32_t | textmate_theme_get_foreground (TextMateTheme theme, const char *scopePath, uint32_t defaultColor) |
| Get the foreground color for a scope path. | |
| TML_API uint32_t | textmate_theme_get_background (TextMateTheme theme, const char *scopePath, uint32_t defaultColor) |
| Get the background color for a scope path. | |
| TML_API int32_t | textmate_theme_get_font_style (TextMateTheme theme, const char *scopePath, int32_t defaultStyle) |
| Get the font style flags for a scope path. | |
| TML_API uint32_t | textmate_theme_get_default_foreground (TextMateTheme theme) |
| Get the default/fallback foreground color for the entire theme. | |
| TML_API uint32_t | textmate_theme_get_default_background (TextMateTheme theme) |
| Get the default/fallback background color for the entire theme. | |
| TML_API void | textmate_theme_dispose (TextMateTheme theme) |
| Free a theme object and release resources. | |
| TML_API TextMateOnigLib | textmate_oniglib_create () |
| Initialize the Oniguruma regular expression library. | |
| TML_API TextMateRegistry | textmate_registry_create (TextMateOnigLib onigLib) |
| Create a new grammar registry. | |
| TML_API void | textmate_registry_dispose (TextMateRegistry registry) |
| Free a registry and all its resources. | |
| TML_API int | textmate_registry_add_grammar_from_file (TextMateRegistry registry, const char *grammarPath) |
| Register a grammar from a JSON file. | |
| TML_API int | textmate_registry_add_grammar_from_json (TextMateRegistry registry, const char *jsonContent) |
| Register a grammar from a JSON string. | |
| 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. | |
| TML_API TextMateGrammar | textmate_registry_load_grammar (TextMateRegistry registry, const char *scopeName) |
| Load a grammar by scope name. | |
| TML_API TextMateStateStack | textmate_get_initial_state () |
| Get the initial parsing state. | |
| TML_API TextMateTokenizeResult * | textmate_tokenize_line (TextMateGrammar grammar, const char *lineText, TextMateStateStack prevState) |
| Tokenize a single line of text with decoded scopes. | |
| TML_API TextMateTokenizeResult2 * | textmate_tokenize_line2 (TextMateGrammar grammar, const char *lineText, TextMateStateStack prevState) |
| Tokenize a single line of text with encoded tokens (more efficient) | |
| TML_API TextMateTokenizeMultiLinesResult * | textmate_tokenize_lines (TextMateGrammar grammar, const char **lines, int32_t lineCount, TextMateStateStack initialState) |
| Tokenize multiple lines in a single call. | |
| TML_API void | textmate_free_tokenize_result (TextMateTokenizeResult *result) |
| Free a line tokenization result. | |
| TML_API void | textmate_free_tokenize_result2 (TextMateTokenizeResult2 *result) |
| Free an encoded line tokenization result. | |
| TML_API void | textmate_free_tokenize_lines_result (TextMateTokenizeMultiLinesResult *result) |
| Free a batch tokenization result. | |
| TML_API TextMateTokenizeResult * | textmate_tokenize_line_utf16 (TextMateGrammar grammar, const char *lineText, TextMateStateStack prevState) |
| Tokenize a single line with decoded scopes, returning UTF-16 indices. | |
| TML_API TextMateTokenizeResult2 * | textmate_tokenize_line2_utf16 (TextMateGrammar grammar, const char *lineText, TextMateStateStack prevState) |
| Tokenize a single line with encoded tokens, returning UTF-16 indices. | |
| TML_API TextMateTokenizeMultiLinesResult * | textmate_tokenize_lines_utf16 (TextMateGrammar grammar, const char **lines, int32_t lineCount, TextMateStateStack initialState) |
| Tokenize multiple lines in a single call, returning UTF-16 indices. | |
| TML_API const char * | textmate_grammar_get_scope_name (TextMateGrammar grammar) |
| Get the scope name (language identifier) of a grammar. | |
| TML_API void | textmate_oniglib_dispose (TextMateOnigLib onigLib) |
| Free the Oniguruma library. | |
C language API for TextMateLib.
This header provides a C FFI (Foreign Function Interface) for TextMateLib, enabling use from C code and language bindings (C#, Python, Node.js, etc.).
API Organization:
Typical Workflow:
Definition in file c_api.h.