Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/eyelash/prism
- Owner: eyelash
- License: mit
- Created: 2021-12-01T22:35:41.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-31T07:35:07.000Z (5 months ago)
- Last Synced: 2024-10-25T09:22:58.155Z (2 months ago)
- Topics: cpp, syntax-highlighting
- Language: C++
- Homepage:
- Size: 206 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
#includeint 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);
}
```