Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/eyelash/prism

incremental PEG-based syntax highlighting engine
https://github.com/eyelash/prism

cpp syntax-highlighting

Last synced: 21 days ago
JSON representation

incremental PEG-based syntax highlighting engine

Awesome Lists containing this project

README

        

prism 🌈️
--------

An incremental [PEG](https://en.wikipedia.org/wiki/Parsing_expression_grammar)-based syntax highlighting engine written in C++.

```cpp
#include
#include

int main() {
const StringInput input = "int main() { return 42; }";
const Language* language = prism::get_language("file.c");
Cache cache;
auto spans = prism::highlight(language, &input, cache, 0, input.size());

std::vector expected = {
{0, 3, Style::TYPE},
{13, 19, Style::KEYWORD},
{20, 22, Style::LITERAL},
};
assert(spans == expected);
}
```