ZepSyntax class as a base for all syntax providers.
ZepSyntax Overview
TheZepSyntax class provides the foundation for syntax highlighting:
Zep includes built-in syntax support for C/C++, GLSL, HLSL, Lua, Python, SQL, CMake, Janet, Lisp, and Markdown. You can add support for additional languages by extending
ZepSyntax.Basic Syntax Provider
Simple Keyword-Based Highlighting
Simple Keyword-Based Highlighting
Built-in Language Support
Pre-defined Language Sets
Pre-defined Language Sets
Custom Syntax Provider
Extending ZepSyntax
Extending ZepSyntax
For advanced syntax highlighting, extend the
ZepSyntax class:Syntax Data Structure
SyntaxResult and SyntaxData
SyntaxResult and SyntaxData
Advanced Features
Syntax Adornments
Syntax Adornments
Add overlays on top of base syntax:
Multi-line Comments and Strings
Multi-line Comments and Strings
The base The system maintains start/end positions of multi-line comments and strings, ensuring correct highlighting even when editing in the middle.
ZepSyntax class handles multi-line comments automatically:Complete Example
JSON Syntax Provider
JSON Syntax Provider
Registering File Extensions
Auto-detect Syntax by Extension
Auto-detect Syntax by Extension
Register your syntax provider for specific file extensions:
Performance Considerations
Async Syntax Updates
Async Syntax Updates
Zep’s syntax system runs asynchronously to avoid blocking:
Implementation Reference
The syntax system is defined in:include/zep/syntax.h:19-118- Base syntax classessrc/syntax_providers.cpp- Built-in language definitionssrc/syntax.cpp- Core syntax implementation (not shown but referenced)
Related
Theming
Learn how to customize syntax highlighting colors
REPL Integration
Add REPL support for your custom language
