Colortemplate Data Model - lifepillar/vim-colortemplate GitHub Wiki
Colortemplate Data Model
Colortemplate takes the definition of a color scheme in a custom syntax and outputs a color scheme in Vim syntax. Its architecture is modular, consisting of three main components:
- a parser;
- a Vim9 script in-memory database;
- a generator.
Typically, a parser returns a more or less abstract and hierarchical representation of the parsed text in the form of a parse tree or abstract syntax tree. Colortemplate, instead, transforms the parsed text into an in-memory Relational database, which can then be conveniently queried by the generator to produce the output (or by other components for other purposes, e.g., to produce color statistics).
Colortemplate can use different generators targeting different outputs such as, for instance, Vim9 script, VimL script, and the templating language itself (this is useful to generate a template from the color scheme currently in use).
The parser can also be swapped for a different parser, although currently only one parser is implemented.
The database is the glue between parsers and generators. The data model, depicted below, is implemented in autoload/colorscheme.vim
: