67 Commits

Author SHA1 Message Date
c683754d49 Cleanup / optimizations 2026-02-12 01:01:52 +00:00
e9d164d769 Rewrite diagnostics popup with new api 2026-02-11 19:51:45 +00:00
5b66f503e4 Improve highlighting structure
- switched to a sparse delta based map
- true lazy-loading to avoid any unneccessary allocations
- fixed windows management api
2026-02-11 18:18:28 +00:00
d79ea4e75a Fix parser bug on newlines 2026-02-05 14:23:52 +00:00
dd474cc38d Fix deadlock 2026-02-05 13:03:41 +00:00
a62d4a18a8 Switch to OOP style code 2026-02-04 00:38:11 +00:00
e3fc5323df Cleanup 2026-02-02 10:45:22 +00:00
15cef855d6 Update installer 2026-02-01 20:49:38 +00:00
59fe554259 Fix bar dead code 2026-02-01 20:47:41 +00:00
8b93b955e8 Fix parsing bugs and add better indentation support 2026-02-01 20:40:52 +00:00
f77caf604f Post release cleanup 2026-02-01 17:06:27 +00:00
8b49ab6085 Update mruby api. 2026-02-01 17:01:57 +00:00
154e557339 Fix memory leaks 2026-01-31 23:23:08 +00:00
04cce4224e Embed mruby and better clipboard support 2026-01-31 17:19:08 +00:00
410222b82a Fix minor bugs 2026-01-31 10:54:03 +00:00
f93afc0d14 Make binary portable and other fixes 2026-01-31 10:25:39 +00:00
86d5b7a021 Fix dependancies and precompile ruby module 2026-01-29 23:21:47 +00:00
78949bc770 Remove unneccesary dependancy
Signed-off-by: Syed Daanish <me@syedm.dev>
2026-01-29 15:00:57 +00:00
17a04bdddc Fix url 2026-01-29 13:59:55 +00:00
eafed64bea Use embedded mruby for portablity 2026-01-29 13:52:46 +00:00
9757a8db31 Fix installation stuff 2026-01-28 23:16:59 +00:00
cef357ffdc Fixes 2026-01-28 22:19:32 +00:00
515d5559a7 Allow ruby versions 3.2 and 3.4 for installation 2026-01-28 22:12:37 +00:00
1312c09501 Fix bug 2026-01-28 19:01:45 +00:00
b018877c03 Cleanup 2026-01-28 19:00:34 +00:00
e6f51d69b6 Add installer script 2026-01-28 18:57:23 +00:00
6abdefa808 Cleanup and minor Fixes 2026-01-28 18:46:44 +00:00
cca0177929 Allow ruby based configs and custom syntax parsers 2026-01-22 19:25:15 +00:00
6dc0813b49 Random stuff to do with scripting 2026-01-21 15:05:37 +00:00
81da75dc15 Fix bugs with hl line data structures 2026-01-20 09:37:54 +00:00
fd894e4e9f Remove unneccesary grammar files and tree-ditter mentions 2026-01-18 17:52:09 +00:00
b5c49f4277 Improve highlighters 2026-01-18 17:49:36 +00:00
c9324c13aa Fix ruby true/false detection bug 2026-01-18 13:23:54 +00:00
c8db7b14a3 Cleanup 2026-01-18 13:20:51 +00:00
d0e811904c Allow dynamic theming and improve ruby parser 2026-01-18 13:00:41 +00:00
1fda5bf246 Add custom syntax highlighter and optimize 2026-01-16 21:47:05 +00:00
04cce25bf2 Add indentation engine and other fixes 2026-01-12 22:48:51 +00:00
9ed640c88e Fix autocomplete bug when local filtering is used 2026-01-11 01:16:54 +00:00
bb87ae32f9 Whitespace cleanup 2026-01-11 01:15:49 +00:00
f2f176e8c8 Make TODO.md better structured 2026-01-11 01:14:37 +00:00
cdddb35d7c Fix mistake in README 2026-01-10 19:41:57 +00:00
e37d291e1d Cleanup 2026-01-10 19:29:56 +00:00
78bf2d666d Completions bug fixes and switch to a better html lsp 2026-01-10 19:24:38 +00:00
b20702928a Fix diagnostics box width to be a bit more smarter 2026-01-10 18:16:18 +00:00
3f2046bf9f Fix broken lsp links 2026-01-10 18:15:50 +00:00
672e1a5c4e Fix broken link 2026-01-10 17:52:53 +00:00
ae7bb754ae README.md fixes 2026-01-10 17:51:47 +00:00
9bd4145d8c Fix readme.md 2026-01-10 17:49:05 +00:00
8f69ee487b Add more features listing 2026-01-10 17:44:45 +00:00
4134c4d96d Markdown cleanup 2026-01-10 17:38:54 +00:00
7d35799394 Update README.md 2026-01-10 17:31:19 +00:00
2c1e69181a Bug Fixes and optimizations 2026-01-10 17:15:09 +00:00
b2a64f219f Completions bug fixes 2026-01-10 07:56:40 +00:00
e9da17eb34 Basic completion support 2026-01-06 11:39:17 +00:00
a905e333fc Lsp completion logic 2026-01-04 03:27:17 +00:00
ac04754318 Cleanup and ui bar 2026-01-03 17:46:04 +00:00
0390a1bc5d Cleanup 2025-12-30 15:22:09 +00:00
dc507dfc23 Make syntax highlighting smoother 2025-12-30 10:56:31 +00:00
26e0b06e24 Add strikethrough support 2025-12-30 10:55:32 +00:00
235eafb01c Rearrange code and cleanup 2025-12-30 01:19:50 +00:00
04179d1a4e Cleanup and add visible whitespaces. 2025-12-29 21:55:49 +00:00
c7068d33d7 Feat: add hover boxes and diagnostics from lsp 2025-12-29 15:56:51 +00:00
6108f78be3 Fix lsp bugs
- Fix: Incorrect setting of incremental edits for lsp and more
2025-12-27 09:53:46 +00:00
bfaba81317 Add lsp's for many different languages and minor fixes 2025-12-27 04:31:08 +00:00
a38ba1f813 Minor fixes and optimizations 2025-12-26 22:13:11 +00:00
655f0e7d77 Feat: Add syntax highlighting for a lot more languages 2025-12-26 20:46:36 +00:00
9ff3a32abd Fix highlight colors and other minor fixes 2025-12-25 23:37:49 +00:00
154 changed files with 14130 additions and 6750 deletions

9
.clangd Normal file
View File

@@ -0,0 +1,9 @@
CompileFlags:
Add: [
-I/home/syed/main/crib/include,
-I/home/syed/main/crib/libs,
-I/home/syed/main/crib/libs/mruby/include,
-std=c++23
]
Remove: []
Compiler: clang++

3
.gitattributes vendored
View File

@@ -1,2 +1 @@
/libs/unicode_width/** linguist-vendored
*.scm linguist-language=Tree-sitter-Query
/libs/** linguist-vendored

9
.gitignore vendored
View File

@@ -3,13 +3,20 @@
*.a
*.o
*.so
!libs/libruby/libruby.so
*.yml
.vscode
samples/t_*
samples/tmp*
build
bin
.thinlto-cache/
Gemfile*
.ruby-lsp/
include/scripting/ruby_compiled.h
__old__

138
.gitmodules vendored
View File

@@ -2,139 +2,7 @@
path = libs/libgrapheme
url = git://git.suckless.org/libgrapheme
ignore = dirty
; tree-sitter
[submodule "libs/tree-sitter"]
path = libs/tree-sitter
url = https://github.com/tree-sitter/tree-sitter.git
ignore = dirty
; Tree-sitter languages
[submodule "libs/tree-sitter-ruby"]
path = libs/tree-sitter-ruby
url = https://github.com/tree-sitter/tree-sitter-ruby.git
ignore = dirty
[submodule "libs/tree-sitter-c"]
path = libs/tree-sitter-c
url = https://github.com/tree-sitter/tree-sitter-c.git
ignore = dirty
[submodule "libs/tree-sitter-cpp"]
path = libs/tree-sitter-cpp
url = https://github.com/tree-sitter/tree-sitter-cpp.git
ignore = dirty
[submodule "libs/tree-sitter-css"]
path = libs/tree-sitter-css
url = https://github.com/tree-sitter/tree-sitter-css.git
ignore = dirty
[submodule "libs/tree-sitter-html"]
path = libs/tree-sitter-html
url = https://github.com/tree-sitter/tree-sitter-html.git
ignore = dirty
[submodule "libs/tree-sitter-javascript"]
path = libs/tree-sitter-javascript
url = https://github.com/tree-sitter/tree-sitter-javascript.git
ignore = dirty
[submodule "libs/tree-sitter-json"]
path = libs/tree-sitter-json
url = https://github.com/tree-sitter/tree-sitter-json.git
ignore = dirty
[submodule "libs/tree-sitter-python"]
path = libs/tree-sitter-python
url = https://github.com/tree-sitter/tree-sitter-python.git
ignore = dirty
[submodule "libs/tree-sitter-haskell"]
path = libs/tree-sitter-haskell
url = https://github.com/tree-sitter/tree-sitter-haskell.git
ignore = dirty
[submodule "libs/tree-sitter-go"]
path = libs/tree-sitter-go
url = https://github.com/tree-sitter/tree-sitter-go.git
ignore = dirty
[submodule "libs/tree-sitter-bash"]
path = libs/tree-sitter-bash
url = https://github.com/tree-sitter/tree-sitter-bash.git
ignore = dirty
[submodule "libs/tree-sitter-make"]
path = libs/tree-sitter-make
url = https://github.com/tree-sitter-grammars/tree-sitter-make
ignore = dirty
[submodule "libs/tree-sitter-lua"]
path = libs/tree-sitter-lua
url = https://github.com/tree-sitter-grammars/tree-sitter-lua
ignore = dirty
[submodule "libs/tree-sitter-fish"]
path = libs/tree-sitter-fish
url = https://github.com/ram02z/tree-sitter-fish
ignore = dirty
[submodule "libs/tree-sitter-rust"]
path = libs/tree-sitter-rust
url = https://github.com/tree-sitter/tree-sitter-rust.git
ignore = dirty
[submodule "libs/tree-sitter-nginx"]
path = libs/tree-sitter-nginx
url = https://gitlab.com/joncoole/tree-sitter-nginx
ignore = dirty
[submodule "libs/tree-sitter-yaml"]
path = libs/tree-sitter-yaml
url = https://github.com/tree-sitter-grammars/tree-sitter-yaml.git
ignore = dirty
[submodule "libs/tree-sitter-gdscript"]
path = libs/tree-sitter-gdscript
url = https://github.com/PrestonKnopp/tree-sitter-gdscript
ignore = dirty
[submodule "libs/tree-sitter-ini"]
path = libs/tree-sitter-ini
url = https://github.com/justinmk/tree-sitter-ini
ignore = dirty
[submodule "libs/tree-sitter-php"]
path = libs/tree-sitter-php
url = https://github.com/tree-sitter/tree-sitter-php
ignore = dirty
[submodule "libs/tree-sitter-query"]
path = libs/tree-sitter-query
url = https://github.com/tree-sitter-grammars/tree-sitter-query
ignore = dirty
[submodule "libs/tree-sitter-cabal"]
path = libs/tree-sitter-cabal
url = https://gitlab.com/magus/tree-sitter-cabal
ignore = dirty
[submodule "libs/tree-sitter-go-mod"]
path = libs/tree-sitter-go-mod
url = https://github.com/camdencheek/tree-sitter-go-mod
ignore = dirty
[submodule "libs/tree-sitter-gitattributes"]
path = libs/tree-sitter-gitattributes
url = https://github.com/tree-sitter-grammars/tree-sitter-gitattributes
ignore = dirty
[submodule "libs/tree-sitter-gitignore"]
path = libs/tree-sitter-gitignore
url = https://github.com/shunsambongi/tree-sitter-gitignore
ignore = dirty
[submodule "libs/tree-sitter-diff"]
path = libs/tree-sitter-diff
url = https://github.com/tree-sitter-grammars/tree-sitter-diff
ignore = dirty
[submodule "libs/tree-sitter-regex"]
path = libs/tree-sitter-regex
url = https://github.com/tree-sitter/tree-sitter-regex
ignore = dirty
[submodule "libs/tree-sitter-embedded-template"]
path = libs/tree-sitter-embedded-template
url = https://github.com/tree-sitter/tree-sitter-embedded-template
ignore = dirty
[submodule "libs/tree-sitter-sql"]
path = libs/tree-sitter-sql
url = https://github.com/DerekStride/tree-sitter-sql.git
ignore = dirty
[submodule "libs/libs/tree-sitter-yaml"]
path = libs/libs/tree-sitter-yaml
url = https://github.com/tree-sitter-grammars/tree-sitter-yaml.git
ignore = dirty
[submodule "libs/tree-sitter-toml"]
path = libs/tree-sitter-toml
url = https://github.com/tree-sitter-grammars/tree-sitter-toml.git
ignore = dirty
[submodule "libs/tree-sitter-markdown"]
path = libs/tree-sitter-markdown
url = https://github.com/tree-sitter-grammars/tree-sitter-markdown.git
[submodule "libs/mruby"]
path = libs/mruby
url = https://github.com/mruby/mruby.git
ignore = dirty

View File

@@ -9,18 +9,31 @@ TARGET_RELEASE := $(BIN_DIR)/crib
PCH_DEBUG := $(OBJ_DIR)/debug/pch.h.gch
PCH_RELEASE := $(OBJ_DIR)/release/pch.h.gch
CCACHE := ccache
CXX_DEBUG := $(CCACHE) g++
CXX_RELEASE := $(CCACHE) clang++
GENERATED_HEADER := $(INCLUDE_DIR)/scripting/ruby_compiled.h
CFLAGS_DEBUG := -std=c++20 -Wall -Wextra -O0 -fno-inline -gsplit-dwarf -g -fsanitize=address -fno-omit-frame-pointer
CFLAGS_RELEASE := -std=c++20 -O3 -march=native -flto=thin \
-fno-exceptions -fno-rtti -fstrict-aliasing \
-ffast-math -funroll-loops \
CCACHE := ccache
CXX := $(CCACHE) clang++
CC := $(CCACHE) musl-clang
CFLAGS_DEBUG :=\
-std=c++20 -Wall -Wextra \
-O0 -fno-inline -gsplit-dwarf \
-g -fno-omit-frame-pointer \
-Wno-unused-command-line-argument \
-I./include -I./libs -I/home/syed/main/crib/libs/mruby/include
# C_SANITIZER := -fsanitize=address
CFLAGS_RELEASE :=\
-static --target=x86_64-linux-musl \
-std=c++20 -O3 -march=x86-64 -mtune=generic \
-fno-rtti \
-ffast-math -flto=thin \
-fvisibility=hidden \
-fomit-frame-pointer -DNDEBUG -s \
-mllvm -vectorize-loops \
-fno-unwind-tables -fno-asynchronous-unwind-tables
-Wno-unused-command-line-argument \
-I./include -I./libs -I/home/syed/main/crib/libs/mruby/include
PCH_CFLAGS_DEBUG := $(CFLAGS_DEBUG) -x c++-header
PCH_CFLAGS_RELEASE := $(CFLAGS_RELEASE) -x c++-header
@@ -30,39 +43,15 @@ UNICODE_SRC := $(wildcard libs/unicode_width/*.c)
UNICODE_OBJ_DEBUG := $(patsubst libs/unicode_width/%.c,$(OBJ_DIR)/debug/unicode_width/%.o,$(UNICODE_SRC))
UNICODE_OBJ_RELEASE := $(patsubst libs/unicode_width/%.c,$(OBJ_DIR)/release/unicode_width/%.o,$(UNICODE_SRC))
TREE_SITTER_LIBS := $(wildcard libs/tree-sitter-*/libtree-sitter*.a)
LIBS_RELEASE := \
libs/libgrapheme/libgrapheme.a ./libs/mruby/build/host/lib/libmruby.a \
-Wl,-Bstatic,--gc-sections -lpcre2-8
PHP_LIB := libs/tree-sitter-php/php/libtree-sitter-php.a
LIBS_DEBUG := \
libs/libgrapheme/libgrapheme.a ./libs/mruby/build/host/lib/libmruby.a \
-Wl,-Bdynamic -lpcre2-8
FISH_OBJ_PARSER := libs/tree-sitter-fish/build/Release/obj.target/tree_sitter_fish_binding/src/parser.o
FISH_OBJ_SCANNER := libs/tree-sitter-fish/build/Release/obj.target/tree_sitter_fish_binding/src/scanner.o
NGINX_OBJ_PARSER := libs/tree-sitter-nginx/build/Release/obj.target/tree_sitter_nginx_binding/src/parser.o
CABAL_OBJ_PARSER := libs/tree-sitter-cabal/build/Release/obj.target/tree_sitter_cabal_binding/src/parser.o
CABAL_OBJ_SCANNER := libs/tree-sitter-cabal/src/scanner.o
GITIGNORE_OBJ_PARSER := libs/tree-sitter-gitignore/build/Release/obj.target/tree_sitter_ignore_binding/src/parser.o
MD_OBJ_PARSER := libs/tree-sitter-markdown/build/Release/obj.target/tree_sitter_markdown_binding/tree-sitter-markdown/src/parser.o
MD_OBJ_SCANNER := libs/tree-sitter-markdown/build/Release/obj.target/tree_sitter_markdown_binding/tree-sitter-markdown/src/scanner.o
LIBS := \
libs/libgrapheme/libgrapheme.a \
libs/tree-sitter/libtree-sitter.a \
$(TREE_SITTER_LIBS) \
$(PHP_LIB) \
$(NGINX_OBJ_PARSER) \
$(GITIGNORE_OBJ_PARSER) \
$(FISH_OBJ_PARSER) \
$(CABAL_OBJ_PARSER) \
$(CABAL_OBJ_SCANNER) \
$(FISH_OBJ_SCANNER) \
$(MD_OBJ_PARSER) \
$(MD_OBJ_SCANNER) \
-lpcre2-8 -lmagic
SRC := $(wildcard $(SRC_DIR)/*.cc)
SRC := $(wildcard $(SRC_DIR)/**/*.cc) $(wildcard $(SRC_DIR)/*.cc)
OBJ_DEBUG := $(patsubst $(SRC_DIR)/%.cc,$(OBJ_DIR)/debug/%.o,$(SRC))
OBJ_RELEASE := $(patsubst $(SRC_DIR)/%.cc,$(OBJ_DIR)/release/%.o,$(SRC))
@@ -77,37 +66,40 @@ test: $(TARGET_DEBUG)
release: $(TARGET_RELEASE)
$(GENERATED_HEADER): $(INCLUDE_DIR)/syntax/tokens.def $(INCLUDE_DIR)/ruby/libcrib.rb src/ruby_compile.sh
src/ruby_compile.sh
$(PCH_DEBUG): $(INCLUDE_DIR)/pch.h
mkdir -p $(dir $@)
$(CXX_DEBUG) $(PCH_CFLAGS_DEBUG) -o $@ $<
$(CXX) $(PCH_CFLAGS_DEBUG) -o $@ $<
$(PCH_RELEASE): $(INCLUDE_DIR)/pch.h
mkdir -p $(dir $@)
$(CXX_RELEASE) $(PCH_CFLAGS_RELEASE) -o $@ $<
$(CXX) $(PCH_CFLAGS_RELEASE) -o $@ $<
$(TARGET_DEBUG): $(PCH_DEBUG) $(OBJ_DEBUG) $(UNICODE_OBJ_DEBUG)
mkdir -p $(BIN_DIR)
$(CXX_DEBUG) $(CFLAGS_DEBUG) -o $@ $(OBJ_DEBUG) $(UNICODE_OBJ_DEBUG) $(LIBS)
$(CXX) $(CFLAGS_DEBUG) $(C_SANITIZER) -o $@ $(OBJ_DEBUG) $(UNICODE_OBJ_DEBUG) $(LIBS_DEBUG)
$(TARGET_RELEASE): $(PCH_RELEASE) $(OBJ_RELEASE) $(UNICODE_OBJ_RELEASE)
mkdir -p $(BIN_DIR)
$(CXX_RELEASE) $(CFLAGS_RELEASE) -o $@ $(OBJ_RELEASE) $(UNICODE_OBJ_RELEASE) $(LIBS)
$(CXX) $(CFLAGS_RELEASE) -o $@ $(OBJ_RELEASE) $(UNICODE_OBJ_RELEASE) $(LIBS_RELEASE)
$(OBJ_DIR)/debug/%.o: $(SRC_DIR)/%.cc $(PCH_DEBUG)
$(OBJ_DIR)/debug/%.o: $(SRC_DIR)/%.cc $(PCH_DEBUG) $(GENERATED_HEADER)
mkdir -p $(dir $@)
$(CXX_DEBUG) $(CFLAGS_DEBUG) -include $(INCLUDE_DIR)/pch.h -MMD -MP -c $< -o $@
$(CXX) $(CFLAGS_DEBUG) -include $(INCLUDE_DIR)/pch.h -MMD -MP -c $< -o $@
$(OBJ_DIR)/release/%.o: $(SRC_DIR)/%.cc $(PCH_RELEASE)
$(OBJ_DIR)/release/%.o: $(SRC_DIR)/%.cc $(PCH_RELEASE) $(GENERATED_HEADER)
mkdir -p $(dir $@)
$(CXX_RELEASE) $(CFLAGS_RELEASE) -include $(INCLUDE_DIR)/pch.h -MMD -MP -c $< -o $@
$(CXX) $(CFLAGS_RELEASE) -include $(INCLUDE_DIR)/pch.h -MMD -MP -c $< -o $@
$(OBJ_DIR)/debug/unicode_width/%.o: libs/unicode_width/%.c
mkdir -p $(dir $@)
$(CXX_DEBUG) $(CFLAGS_DEBUG) -MMD -MP -c $< -o $@
$(CC) -MMD -MP -c $< -o $@
$(OBJ_DIR)/release/unicode_width/%.o: libs/unicode_width/%.c
mkdir -p $(dir $@)
$(CXX_RELEASE) $(CFLAGS_RELEASE) -MMD -MP -c $< -o $@
$(CC) -MMD -MP -c $< -o $@
DEP_DEBUG += $(UNICODE_OBJ_DEBUG:.o=.d)
DEP_RELEASE += $(UNICODE_OBJ_RELEASE:.o=.d)

254
README.md
View File

@@ -1,57 +1,207 @@
Copyright 2025 Syed Daanish
# Crib
# Crib - a text editor
A TUI IDE.
### About
# TODO
Crib is a TUI based text editor built primaririly for personal use.<br>
Crib has a vim-style editor modes system but navigation and shortcuts are very different.<br>
It supports superfast incremental syntax highlighting.<br>
And LSP for auto-completion, diagnostics, hover docs etc.<br>
It aims to be complete general purpose IDE.<br>
(It is still very much a work in progress so a lot of things may seem incomplete)<br>
For now it is just a single file editor. I plan to add a multi-file support with file pickers and tabs soon.<br>
- [ ] Get all tree-sitter grammars needed and write down their scm files.
- [ ] Add support for LSP & autocomplete / snippets.
- First research
- `textDocument/documentHighlight` - for highlighting stuff (probably tree-sitter is enough)
- `textDocument/selectionRange` //
- `textDocument/completion` - Obviously
- `textDocument/onTypeFormatting` - seems promising for auto formatting (indentation etc)
- `textDocument/inlayHint` & `textDocument/inlineHint` & `textDocument/codeLens`
- `textDocument/formatting` & `textDocument/rangeFormatting`
- `textDocument/semanticTokens/*` (probably tree-sitter is enough)
- `textDocument/linkedEditingRange` - probably useful
- `textDocument/foldingRange` - i will never use this for folding but it might be useful for other things.
- `textDocument/rename` & `textDocument/prepareRename` - probably useful
- And a lot more (just go through each for `clangd` and then expand to say `solargraph`).
- Make incremental edits apply. // make a bool field in LSP qhich says if it supports incremental and based on it apply edits
- Make a universal plug for lsp. So focus more on making a general purpose solid communication interface. Instead of something specific.
- With a 4ish pass system. (more like each returned value from the lsp is used in 4 ways)
1. One for stuff like jump to x position. or rename symbol x to y. (stuff that explicitly requires user request to do something)
- Maybe even hover goes here
2. One for stuff that only affects highlighting and styles . like symbol highlighting etc.
3. One for Warnings/errors and inlay hints etc. (stuff that adds virtual text to the editor)
4. One for fromatting and stuff like that. (stuff that edits the buffer text)
- [ ] Use LSP to add inlay hints in order to test virtual text. then make an iterator over screen that mimics the renderer for scrolling functions.
- [ ] Add codeium/copilot support for auto-completion (uses the VAI virtual text) as a test phase.
- [ ] Add a whitespace highlighter (nerd font). for spaces and tabs at start/end of line. not as virtual but instead at render time.
- [ ] Once renderer is proven to work well (i.e. redo this commit) merge `experimental` branch into `main`. commit `43f443e` on `experimental`.
- [ ] Add snippets from wherever i get them. (like luasnip or vsnip)
- [ ] Add this thing where select at end of screen scrolls down. (and vice versa)
- Can be acheived by updating `main.cc` to send drag events to the selected editor instead of just under cursor.
- Then a drag event above or below will scroll the selected editor.
- [ ] Add support for virtual cursor where edits apply at all the places.
- [ ] Add alt + click to set multiple cursors.
- [ ] Add search / replace along with search / virtual cursors are searched pos.
- [ ] Add support for undo/redo.
- [ ] Add `.scm` files for all the supported languages. (2/14) Done.
- [ ] Add splash screen / minigame jumping.
- [ ] Normalize / validate unicode on file open.
- [ ] Add git stuff.
- [ ] Add SQL support. (viewer and basic editor)
- [ ] Add color picker/palette for hex or other css colors.
- [ ] Fix bug where alt+up at eof adds extra line.
- [ ] Think about how i would keep fold states sensical if i added code prettying/formatting.
- [ ] Use tree-sitter to get the node path of the current node under cursor and add an indicator bar.
- (possibly with a picker to jump to any node)
- [ ] Add the highlight of block edges when cursor is on a bracket (or in). (prolly from lsp)
- [ ] Add this thing where selection double click on a bracket selects whole block.
- (only on the first time) and sets mode to `WORD`.
- [ ] Redo folding system and its relation to move_line_* functions. (Currently its a mess)
- [ ] Make whole thing event driven and not clock driven.
## Installation
Binary can be installed with the following command:
```bash
curl https://syedm.dev/crib | sh
```
Currently only for Linux.<br>
*Tested with arch linux and ubuntu and void*<br>
## Building
### Get started
Make sure the repo is cloned with submodules to get `libgrapheme`.
```bash
git clone --recurse-submodules https://git.syedm.dev/SyedM/crib.git
```
### Dependencies
#### System-wide libraries
Make sure you have the following dependencies installed (apart from the standard C++ libraries):
* **[nlohmann/json](https://github.com/nlohmann/json)**
Install it via your package manager. Once installed, the header should be available as:
```cpp
#include <nlohmann/json.hpp>
```
* **[PCRE2](https://github.com/PCRE2Project/pcre2)**
Install the library to use its headers:
```cpp
#include <pcre2.h>
```
It also uses `xclip` at runtime for copying/pasting *(TODO: make it os portable)*.
And any modern terminal should work fine - preferably `kitty` or `wezterm`.<br>
#### `./libs` folder
Some other dependancies are added as submodules or copied.<br>
- `unicode_width` is compiled by the makefile so nothing to do there.<br>
- `libgrapheme` needs to be compiled using `make` in it's folder.<br>
- `mruby` needs to be compiled using `rake` in it's folder (needs ruby).<br>
- Need to add the following lines to the `build_config/default.rb` file (in the `MRuby::Build.new` block)
```ruby
conf.gem :mgem => 'pure-regexp'
conf.gem :mgem => 'env'
conf.gem :mgem => 'process'
conf.gem :mgem => 'marshal-c'
```
#### config file
The config file is a ruby file placed in one of these places (in order, first one found will be used):
- `$CRIB_CONFIG`
- `$CRIB_CONFIG_DIR/crib.rb`
- `$CRIB_CONFIG_DIR/main.rb`
- `./crib.rb`
- `$XDG_CONFIG_HOME/crib/crib.rb`
- `$XDG_CONFIG_HOME/crib/main.rb`
- `$XDG_CONFIG_HOME/crib.rb`
- `$HOME/.config/crib/crib.rb`
- `$HOME/.config/crib/main.rb`
- `$HOME/.config/crib.rb`
#### LSPs
Lsp's are defined in the `libcrib.rb` file and you can use your config file to add more.<br>
The following lsp's are added by default and can be installed anywhere in your `$PATH`<br>
* [clangd](https://clangd.llvm.org/)
* [ruby-lsp](https://shopify.github.io/ruby-lsp/)
* [bash-language-server](https://github.com/bash-lsp/bash-language-server)
* [vscode-css-language-server](https://github.com/hrsh7th/vscode-langservers-extracted)
* [vscode-json-language-server](https://github.com/hrsh7th/vscode-langservers-extracted)
* [fish-lsp](https://github.com/ndonfris/fish-lsp)
* [gopls](https://pkg.go.dev/golang.org/x/tools/gopls)
* [haskell-language-server](https://github.com/haskell/haskell-language-server)
* [emmet-language-server](https://github.com/olrtg/emmet-language-server)
* [typescript-language-server](https://github.com/typescript-language-server/typescript-language-server)
* [lua-language-server](https://github.com/LuaLS/lua-language-server)
* [pyright-langserver](https://github.com/microsoft/pyright)
* [rust-analyzer](https://github.com/rust-analyzer/rust-analyzer)
* [intelephense](https://intelephense.com/)
* [marksman](https://github.com/artempyanykh/marksman)
* [nginx-language-server](https://github.com/pappasam/nginx-language-server)
* [taplo](https://taplo.tamasfe.dev/)
* [yaml-language-server](https://github.com/redhat-developer/yaml-language-server)
* [sqls](https://github.com/sqls-server/sqls)
* [make-language-server](https://github.com/Freed-Wu/autotools-language-server)
> As it is still in development, some of these may not work as expected or that well.<br>
> It should work even if the lsp is not installed but lsp features will not work.<br>
#### Compiler
`g++` or `clang++` should work fine but `c++20+` is required.<br>
Can remove `ccache` if you want from the makefile.<br>
#### Compliling
```bash
make release
```
### Running
Preferably add the `bin` folder to PATH or move `bin/crib` to somewhere in PATH.<br>
For some LSP's to work properly `crib` needs to be run from the root folder of the project. *To be fixed*<br>
then do -<br>
```bash
crib ./filename.ext
```
*If `filename.ext` does not exist, it will be created*<br>
*memory usage is average case 10MB + 2x size of file*<br>
## Keybindings
TODO: add keybind information on how to set in config file
and default / unchangeable keybinds
## Features Implemented
#### Core workflow:
- NORMAL / INSERT / SELECT / RUNNER / JUMPER modes
- full mouse support for scrolling and multi-click word/line selection.
- Double click to select word
- Triple click to select line
#### Core editing tools:
- indent/dedent
- move lines up/down
- folding on a selected range
- yank/cut/paste via system clipboard
- per-language smart auto-indent on new line insert
- bracket/quote auto-pairing
- hooks jumping (bookmarking)
- color hex code highlighting
- current line highlighting
- all instances of current word under cursor highlighting
#### syntax highlighting and filetype detection for:
- ruby
<!-- TODO: -->
<!-- - bash -->
<!-- - c/cpp (and headers) -->
<!-- - css -->
<!-- - fish -->
<!-- - go/gomod -->
<!-- - haskell -->
<!-- - html/erb -->
<!-- - javascript -->
<!-- - typescript/tsx -->
<!-- - json/jsonc -->
<!-- - lua -->
<!-- - python -->
<!-- - rust -->
<!-- - php -->
<!-- - markdown -->
<!-- - nginx -->
<!-- - toml -->
<!-- - yaml -->
<!-- - sql -->
<!-- - make -->
<!-- - gdscript -->
<!-- - man pages -->
<!-- - diff/patch -->
<!-- - gitattributes/gitignore -->
<!-- - tree-sitter queries -->
<!-- - regex -->
<!-- - ini -->
#### LSP-powered features:
- diagnostics
- autocompletion
- hover docs
- formatting support
- Full file formatting on save
- Ontype formatting when inserting special characters defined by the language server
- *(few lsp's actually support this - try to configure a few more which can but need configuration and for others need to add support for external formatters)*
- A list of some lsp's can be found [here](#lsps).
- Any lsp can be added to the `config/main.rb` file.
- Though not all might work well. Open an issue if you find a lsp that doesn't work well.
**A lot lot more to come**

156
TODO.md Normal file
View File

@@ -0,0 +1,156 @@
Copyright 2025 Syed Daanish
# TODO
## Next few super long boring things to do::
* redo lsp threads such that no mutex needed for any rope stuff (done)
- Also make the classes own the methods in lsp (done)
- This will mean that parsers/renderers and keystrokes will not need to be individually locked (done)
- And so it will be much faster (done)
- At which point the main thread can also be blocked on user input or lsp responses and still be faster
* Add a superclass for editor called Window (which can be popup or tiled) (done)
* Add a recursive tiling class for windows (done)
* Handled by a single renderer that calls and renders each window (done)
* Make editor's functions into its own methods (classify it) (done)
- While at it
- Seperate system functions into a class that branches to support local / ssh / server modes.
- Even lsp shouldnt be directly controlled because it can branch on local and server modes
- check wolfSSH stuff for remote editing
- Thick and thin mode
- thin mode only shares screen diffing over the network - uses server settings / themes
- thick only shared fileio and lsp data with local used for all else - uses local settings / themes
- Redo hooks as a engine of its own.
- And factorize renderer into its own class (and make it just return an array of the render without knowing teh x,y)
- which is just managed by the renderer
- which is reused by scrollers/ensurers too
- this will then allow inlay hints to be possible
- and also make VAI easier to implement
* Allow keybinds to be set in ruby
* then the fun part:
* Then allow ruby code to create and handle windows as extentions
* Then 3 inbuilt extentions being file manager, theme picker, tab selector
* Extentions can also be used as file openers (for like databases . diffing . images . audio etc)
* Local cache for state management (like undo history, cursor positions etc) (location can be set in config)
* make sure to write inbuilt extentions in cpp and not ruby
* also move default bar and clipboard back into cpp
* all lsp popups are no longer their own classes but instead windows (extention like) in popup mode
* also **fix click handling to send mouse unclick to the same focus window as the click And also for drag to be same as the starter**
* skip opening binary files
* apply themeing in bg log bar lsp popus etc. to keep visual consistency
* searching/replace/Multi-Cursor (for just one lsp command for all) with pcre2 with regex (started by a slash) (disabled for large files)
* add links support in xterm (kitty like clickable links)
* And preprocess markdown in popups to be more like styled than just highlighted
* In the ruby libcrib populate toplevel binding and file and dir and rubybuild stuff and other similar constants
* in require_relative allow requiring without appending .rb if possible.
* Possibly in the future limit memory usage by parser for larger files
* Add a file picker suggestion while typing a path (including stuff like ~ and .. and $HOME etc)
* allow opening directory after filemanger is sorted out.
* commands to:
change pwd
load a rb file
run a ruby command
close a window etc.
* [ ] Add mgems for most common things and a ruby library to allow combining true ruby with mruby
* add command to set and use a file type at runtime
* [ ] color alpha in ini files
* [ ] Make warning before ctrl+q for saving
* [ ] **LSP Bug:** Check why `fish-lsp` is behaving so off with completions filtering.
* [ ] **Line move:** fix the move line functions to work without the calculations from folds as folds are removed.
* [ ] **Editor Indentation Fix:** - Main : merger indentation with the parser for more accurate results.
* [ ] Ignore comments/strings from parser when auto-indenting.
* [ ] Support for stuff like bash \ and math operators in other languages and comma and line starting with a dot (like in ruby)
etc.
* [ ] **Readme:** Update readme to show ruby based config in detail.
* [ ] **UI Refinement:**
* [ ] Finish autocomplete box style functions.
* [ ] **Documentation UI:** Capture `Ctrl+h` / `Ctrl+l` for scrolling documentation windows.
* Cap line_tree data limit for large files and just store about a thousand previous lines maybe? (lazily loaded)
* add `:j<n>` command to jump to line \<n> in the current file
* and give warning for invalid commands
* and upon escape clear the current command
* allow multiline logging which captures the input entirely and y will copy the log and anything else will exit
* it will then collapse to being the first line from the log only
* allow flushing functions in ruby to tell c++ to refresh keybinds/themes etc.
* [ ] **LSP:**
support snippets in completion properly
check::
pull diagnostics for ruby-lsp
lsp selection range - use to highlight start / end of range maybe?
goto definiton
signature help
document symbol for the top bar maybe? (or workspace symbol)
also setup workspaces
Semantic highlighting
Quick fixes
Rename symbols
* Allow ruby to config lsp capabilities
* also try to fix why solargraph is the only one breaking on edits near emojis
* ruby-lsp also supports erb so thats a plus
* the ruby should have an api to be able to draw windows and add mappings to them
* **Syntax highlighting**
* ruby done!!
* finish bash then do all the directive-like ones like jsonc (first to help with theme files) / toml / yaml / ini / nginx
* then [ch](++)? then gdscript and python then erb then php
* then markdown / html
* then gitignore / gitattributes
* then fish then sql then css and [jt]sx? then lua (make with type annotations for lsp results)
* then haskell then gomod then go then rust
* [ ] **Undo/Redo:** Add support for undo/redo history.
* [ ] **Auto brace selection:** Add support for auto brace selection.
* [ ] **Tree-sitter Indent:** Attempt to allow Tree-sitter to handle indentation if possible.
### UX
* [ ] **Completion Filtering:**
* [ ] Stop filtering case-sensitive.
* [ ] Normalize completion edits if local filtering is used.
* [ ] **Basic Autocomplete:** Keep a list of words in the current buffer for non-LSP fallback.
### Major Features
* [ ] **Search & Replace:**
* [ ] Add Search/Replace UI.
* [ ] Support capture groups (`$1`, `$2`) or allow Perl regex directly.
* [ ] Ensure virtual cursors are included in search positions.
* [ ] **Multi-Cursor:**
* [ ] Add virtual cursor support (edits apply to all locations).
* [ ] Add `Alt+Click` to set multiple cursors.
* [ ] Allow search and place cursor at all matches.
* [ ] **Block Selection:**
* [ ] Double-clicking a bracket selects the whole block and sets mode to `WORD`.
### Visuals, UI & Extensions?
* [ ] Add color picker/palette (as a floating extention).
* [ ] **Git:** Add Git integration (status, diffs).
* [ ] **AI/Snippets:**
* [ ] Add snippets support (LuaSnip/VSnip style).
* [ ] Add Codeium/Copilot support (using VAI virtual text) as a test phase.
* [ ] **SQL:** Add SQL support (Viewer and Basic Editor) (as ruby extension).
* [ ] **Prolly?:** Add Splash Screen / Minigame.
### Unimportant optimizations
* [ ] **Performance:**
* [ ] Switch JSON parser to `RapidJSON` (or similar high-performance lib).
* [ ] Decrease usage of `std::string` in UI, LSP, warnings etc.
* [ ] Also for vectors into managed memory especially for completions/lsp-stuff.

98
config/main.rb Normal file
View File

@@ -0,0 +1,98 @@
# Files can be insluded using Kernel#require_relative
# but it can be called with binding as the second argument
# skipping it will call it with global binding which is usually fine
# Kernel#load can also be used
require_relative "theme"
# basic configuration
# This can also be used to do speacail configs for different projects.
# its ruby guys script whatever you want.
# puts "Loading main config..."
C.startup do
puts "Starting crib..."
end
C.shutdown do
puts "Exiting crib..."
end
# TODO: to be done once a proper api for binding and window drawing is made
# The binds will be connected to either `editor` or windows where editor can
# only use a preset set of stuff to bind while teh windows are purely custom
# # this part uses dsl bindings to define the bind function
# # Hopefully extend to give more context/power to bindings
# # but try to keep simple for performance
# # for default keybindings
# C.bind [:normal, :select], :a => "insert_mode"
# # for custom keybindings
# C.bind :select, [:x, :c] do
# puts "cut"
# end
# C.bind :jumper do
# set [:x, :c] do
# puts "jump to first bookmark"
# end
# end
# # they can also be defined conditionally
# # This code is just an example and doesnt actually work
# if using_tmux?
# bind :C-p do
# system("tmux select-pane -U")
# end
# end
# This can, for example, be modified by user bindings during runtime
# TODO: dynamic registration to actually be implemented once keybinds and extentions are implemented
# A predefined list already exists and can be found in libcrib.rb
# C.lsp_config["solargraph"] = ["stdio"]
#
# C.languages[:ruby] = {
# color: 0xff8087,
# symbol: "󰴭 ",
# extensions: ["rb"],
# filenames: ["Gemfile"],
# lsp: "solargraph"
# }
C.line_endings = :auto_unix # or :unix or :windows or :auto_windows
C.extra_highlights do |_line, _idx|
# the return can be an array of
# [fg, bg. flags, start, end]
# where fg and bg are integers (using 24 bit color)
# and flags is a bitmask of bold/underline/italic etc
# and start and end are integers strictly inside the line
return []
end
# The highlighter will be aplied to the language as long as the langauge is defined in C.languages
C.highlighters[:string] = {
parser: ->(line, state, line_idx) {
# the return value is a hash
# it contains the state and the highlights
# state can be of any type but will be consistent between calls
# initially nil is sent for uninitialized state the returned must be anything but nil
# the same state can be used for multiple lines
# the highlights can be an array of
# [K_type, start, end]
# K_type is a constant from the constants defined in libcrib.rb
# for ex: for strings it would be Tokens::K_STRING or for numbers Tokens::K_NUMBER etc.
# and start and end are integers strictly inside the line
return {
state: "",
tokens: [
# This will highlight the entire line as a string
# Any wrong format will not be handled and lead to crashes
{ type: Tokens::K_STRING, start: 0, end: line.length }
]
}
},
matcher: ->(state1, state2) {
# returns true if the states are equal
# And so would not need recomputation for further lines
return state1 == state2
}
}

36
config/theme.rb Normal file
View File

@@ -0,0 +1,36 @@
# this can be modified by the user during runtime through keybindings
# But i need to know how to ever read this value only when needed.
# maybe i can write a function that notifies if theme maybe changed then reload
# It can also be scripted to load different theme formats into a hash usable by crib
C.theme = {
:default => { fg: 0xEEEEEE },
:shebang => { fg: 0x7DCFFF },
:error => { fg: 0xEF5168 },
:comment => { fg: 0xAAAAAA, italic: true },
:string => { fg: 0xAAD94C },
:escape => { fg: 0x7DCFFF },
:interpolation => { fg: 0x7DCFFF },
:regexp => { fg: 0xD2A6FF },
:number => { fg: 0xE6C08A },
# rubocop:disable Lint/BooleanSymbol
:true => { fg: 0x7AE93C },
:false => { fg: 0xEF5168 },
# rubocop:enable Lint/BooleanSymbol
:char => { fg: 0xFFAF70 },
:keyword => { fg: 0xFF8F40 },
:keywordoperator => { fg: 0xF07178 },
:operator => { fg: 0xFFFFFF, italic: true },
:function => { fg: 0xFFAF70 },
:type => { fg: 0xF07178 },
:constant => { fg: 0x7DCFFF },
:variableinstance => { fg: 0x95E6CB },
:variableglobal => { fg: 0xF07178 },
:annotation => { fg: 0x7DCFFF },
:directive => { fg: 0xFF8F40 },
:label => { fg: 0xD2A6FF },
:brace1 => { fg: 0xD2A6FF },
:brace2 => { fg: 0xFFAFAF },
:brace3 => { fg: 0xFFFF00 },
:brace4 => { fg: 0x0FFF0F },
:brace5 => { fg: 0xFF0F0F }
}

View File

@@ -1,278 +0,0 @@
;; #bd9ae6 #000000 0 0 0 1
[
"("
")"
"{"
"}"
"["
"]"
"[["
"]]"
"(("
"))"
] @punctuation.bracket
;; #bd9ae6 #000000 0 0 0 1
[
";"
";;"
";&"
";;&"
"&"
] @punctuation.delimiter
;; #ffffff #000000 0 1 0 1
[
">"
">>"
"<"
"<<"
"&&"
"|"
"|&"
"||"
"="
"+="
"=~"
"=="
"!="
"&>"
"&>>"
"<&"
">&"
">|"
"<&-"
">&-"
"<<-"
"<<<"
".."
"!"
] @operator
;; #aad84c #000000 0 0 0 1
[
(string)
(raw_string)
(ansi_c_string)
(heredoc_body)
] @string
;; #fbb152 #000000 0 0 0 1
[
(heredoc_start)
(heredoc_end)
] @label
(variable_assignment
(word) @string)
(command
argument: "$" @string) ; bare dollar
(concatenation
(word) @string)
;; #fbb152 #000000 0 0 0 1
[
"if"
"then"
"else"
"elif"
"fi"
"case"
"in"
"esac"
] @keyword.conditional
;; #fbb152 #000000 0 0 0 1
[
"for"
"do"
"done"
"select"
"until"
"while"
] @keyword.repeat
;; #fbb152 #000000 0 0 0 1
[
"declare"
"typeset"
"readonly"
"local"
"unset"
"unsetenv"
] @keyword
;; #fbb152 #000000 0 0 0 1
"export" @keyword.import
;; #fbb152 #000000 0 0 0 1
"function" @keyword.function
;; #ebda8c #000000 0 0 0 1
(special_variable_name) @constant
;; #ebda8c #000000 0 0 0 1
((word) @constant.builtin
(#match? @constant.builtin "^(SIGHUP|SIGINT|SIGQUIT|SIGILL|SIGTRAP|SIGABRT|SIGBUS|SIGFPE|SIGKILL|SIGUSR1|SIGSEGV|SIGUSR2|SIGPIPE|SIGALRM|SIGTERM|SIGSTKFLT|SIGCHLD|SIGCONT|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU|SIGURG|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGIO|SIGPWR|SIGSYS|SIGRTMIN|SIGRTMIN\+1|SIGRTMIN\+2|SIGRTMIN\+3|SIGRTMIN\+4|SIGRTMIN\+5|SIGRTMIN\+6|SIGRTMIN\+7|SIGRTMIN\+8|SIGRTMIN\+9|SIGRTMIN\+10|SIGRTMIN\+11|SIGRTMIN\+12|SIGRTMIN\+13|SIGRTMIN\+14|SIGRTMIN\+15|SIGRTMAX\-14|SIGRTMAX\-13|SIGRTMAX\-12|SIGRTMAX\-11|SIGRTMAX\-10|SIGRTMAX\-9|SIGRTMAX\-8|SIGRTMAX\-7|SIGRTMAX\-6|SIGRTMAX\-5|SIGRTMAX\-4|SIGRTMAX\-3|SIGRTMAX\-2|SIGRTMAX\-1|SIGRTMAX)$"))
;; #51eeba #000000 0 0 0 1
((word) @boolean.true
(#match? @boolean.true "^true$"))
;; #ee513a #000000 0 0 0 1
((word) @boolean.false
(#match? @boolean.false "^false$"))
;; #AAAAAA #000000 0 1 0 1
(comment) @comment @spell
;; #ffffff #000000 0 0 0 1
(test_operator) @operator
;; #e6a24c #000000 0 0 0 2
(command_substitution
"$(" @punctuation.special
")" @punctuation.special)
;; #e6a24c #000000 0 0 0 2
(process_substitution
[
"<("
">("
] @punctuation.special
")" @punctuation.special)
;; #e6a24c #000000 0 0 0 2
(arithmetic_expansion
[
"$(("
"(("
] @punctuation.special
"))" @punctuation.special)
;; #bd9ae6 #000000 0 0 0 1
(arithmetic_expansion
"," @punctuation.delimiter)
;; #ffffff #000000 0 0 0 1
(ternary_expression
[
"?"
":"
] @keyword.conditional.ternary)
;; #ffffff #000000 0 0 0 1
(binary_expression
operator: _ @operator)
;; #ffffff #000000 0 0 0 1
(unary_expression
operator: _ @operator)
;; #ffffff #000000 0 0 0 1
(postfix_expression
operator: _ @operator)
;; #aad84c #000000 0 0 0 3
(function_definition
name: (word) @function)
;; #aad84c #000000 0 0 0 3
(command_name
(word) @function.call)
;; #aad84c #000000 0 0 0 3
(command_name
(word) @function.builtin
(#match? @function.builtin "^(\.|\:|alias|bg|bind|break|builtin|caller|cd|command|compgen|complete|compopt|continue|coproc|dirs|disown|echo|enable|eval|exec|exit|false|fc|fg|getopts|hash|help|history|jobs|kill|let|logout|mapfile|popd|printf|pushd|pwd|read|readarray|return|set|shift|shopt|source|suspend|test|time|times|trap|true|type|typeset|ulimit|umask|unalias|wait)$"))
;; #ffffff #000000 0 0 0 1
(command
argument: [
(word) @variable.parameter
(concatenation
(word) @variable.parameter)
])
;; #ffffff #000000 0 0 0 1
(declaration_command
(word) @variable.parameter)
;; #ffffff #000000 0 0 0 1
(unset_command
(word) @variable.parameter)
;; #ebda8c #000000 0 0 0 2
(number) @number
;; #ebda8c #000000 0 0 0 2
((word) @number
(#match? @number "^[0-9]+$"))
;; #aad84c #000000 0 0 0 1
(file_redirect
(word) @string.special.path)
;; #aad84c #000000 0 0 0 1
(herestring_redirect
(word) @string)
;; #ffffff #000000 0 0 0 1
(file_descriptor) @operator
;; #e6a24c #000000 0 0 0 2
(simple_expansion
"$" @punctuation.special) @none
;; #e6a24c #000000 0 0 0 2
(expansion
"${" @punctuation.special
"}" @punctuation.special) @none
;; #e6a24c #000000 0 0 0 2
(expansion
operator: _ @punctuation.special)
;; #e6a24c #000000 0 0 0 2
(expansion
"@"
.
operator: _ @character.special)
;; #e6a24c #000000 0 0 0 2
((expansion
(subscript
index: (word) @character.special))
(#any-of? @character.special "@" "*"))
;; #e6a24c #000000 0 0 0 2
"``" @punctuation.special
;; #ffffff #000000 0 0 0 1
(variable_name) @variable
;; #ebda8c #000000 0 0 0 1
((variable_name) @constant
(#match? @constant "^[A-Z][A-Z_0-9]*$"))
;; #ffffff #000000 0 0 0 1
((variable_name) @variable.builtin
(#match? @variable.builtin "^(CDPATH|HOME|IFS|MAIL|MAILPATH|OPTARG|OPTIND|PATH|PS1|PS2|_|BASH|BASHOPTS|BASHPID|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_ARGV0|BASH_CMDS|BASH_COMMAND|BASH_COMPAT|BASH_ENV|BASH_EXECUTION_STRING|BASH_LINENO|BASH_LOADABLES_PATH|BASH_REMATCH|BASH_SOURCE|BASH_SUBSHELL|BASH_VERSINFO|BASH_VERSION|BASH_XTRACEFD|CHILD_MAX|COLUMNS|COMP_CWORD|COMP_LINE|COMP_POINT|COMP_TYPE|COMP_KEY|COMP_WORDBREAKS|COMP_WORDS|COMPREPLY|COPROC|DIRSTACK|EMACS|ENV|EPOCHREALTIME|EPOCHSECONDS|EUID|EXECIGNORE|FCEDIT|FIGNORE|FUNCNAME|FUNCNEST|GLOBIGNORE|GROUPS|histchars|HISTCMD|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTIGNORE|HISTSIZE|HISTTIMEFORMAT|HOSTFILE|HOSTNAME|HOSTTYPE|IGNOREEOF|INPUTRC|INSIDE_EMACS|LANG|LC_ALL|LC_COLLATE|LC_CTYPE|LC_MESSAGES|LC_NUMERIC|LC_TIME|LINENO|LINES|MACHTYPE|MAILCHECK|MAPFILE|OLDPWD|OPTERR|OSTYPE|PIPESTATUS|POSIXLY_CORRECT|PPID|PROMPT_COMMAND|PROMPT_DIRTRIM|PS0|PS3|PS4|PWD|RANDOM|READLINE_ARGUMENT|READLINE_LINE|READLINE_MARK|READLINE_POINT|REPLY|SECONDS|SHELL|SHELLOPTS|SHLVL|SRANDOM|TIMEFORMAT|TMOUT|TMPDIR|UID)$"))
;; #ffffff #000000 0 0 0 1
(case_item
value: (word) @variable.parameter)
;; #e6a24c #000000 0 0 0 2
[
(regex)
(extglob_pattern)
] @string.regexp
;; #51eeba #000000 0 0 0 3
((program
.
(comment) @keyword.directive @nospell)
(#match? @keyword.directive "^#!/"))

View File

@@ -1,613 +0,0 @@
;; #ffffff #000000 0 0 0 1
((identifier) @variable
(#set! priority 95))
(preproc_def
(preproc_arg) @variable)
;; #fbb152 #000000 0 0 0 1
[
"default"
"goto"
"asm"
"__asm__"
] @keyword
[
"enum"
"struct"
"union"
"typedef"
] @keyword.type
[
"sizeof"
"offsetof"
] @keyword.operator
(alignof_expression
.
_ @keyword.operator)
;; #fbb152 #000000 0 0 0 1
"return" @keyword.return
;; #fbb152 #000000 0 0 0 1
[
"while"
"for"
"do"
"continue"
"break"
] @keyword.repeat
;; #fbb152 #000000 0 0 0 1
[
"if"
"else"
"case"
"switch"
] @keyword.conditional
;; #fbb152 #000000 0 0 0 1
[
"#if"
"#ifdef"
"#ifndef"
"#else"
"#elif"
"#endif"
"#elifdef"
"#elifndef"
(preproc_directive)
] @keyword.directive
;; #fbb152 #000000 0 0 0 1
"#define" @keyword.directive.define
;; #fbb152 #000000 0 0 0 1
"#include" @keyword.import
;; #bd9ae6 #000000 0 0 0 1
[
";"
":"
","
"."
"::"
] @punctuation.delimiter
;; #e6a24c #000000 0 0 0 2
"..." @punctuation.special
;; #bd9ae6 #000000 0 0 0 1
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
;; #ffffff #000000 0 0 0 1
[
"="
"-"
"*"
"/"
"+"
"%"
"~"
"|"
"&"
"^"
"<<"
">>"
"->"
"<"
"<="
">="
">"
"=="
"!="
"!"
"&&"
"||"
"-="
"+="
"*="
"/="
"%="
"|="
"&="
"^="
">>="
"<<="
"--"
"++"
] @operator
;; #ffffff #000000 0 0 0 1
(comma_expression
"," @operator)
;; #51eeba #000000 0 0 0 1
[
(true)
(false)
] @boolean
;; #fbb152 #000000 0 0 0 1
(conditional_expression
[
"?"
":"
] @keyword.conditional.ternary)
;; #aad84c #000000 0 0 0 1
(string_literal) @string
(system_lib_string) @string
;; #e6a24c #000000 0 0 0 2
(escape_sequence) @string.escape
;; #ebda8c #000000 0 0 0 1
(null) @constant.builtin
;; #ebda8c #000000 0 0 0 1
(number_literal) @number
;; #ebda8c #000000 0 0 0 1
(char_literal) @character
;; #aad84c #000000 0 0 0 1
(preproc_defined) @function.macro
;; #ffffff #000000 0 0 0 1
((field_expression
(field_identifier) @property) @_parent)
(field_designator) @property
((field_identifier) @property)
;; #fbb152 #000000 0 0 0 1
(statement_identifier) @label
(declaration
type: (type_identifier) @_type
declarator: (identifier) @label
(#match? @_type "^__label__$"))
;; #aad84c #000000 0 0 0 1
[
(type_identifier)
(type_descriptor)
] @type
;; #fbb152 #000000 0 0 0 1
(storage_class_specifier) @keyword.modifier
[
(type_qualifier)
(gnu_asm_qualifier)
"__extension__"
] @keyword.modifier
;; #fbb152 #000000 0 0 0 1
(linkage_specification
"extern" @keyword.modifier)
;; #aad84c #000000 0 0 0 1
(type_definition
declarator: (type_identifier) @type.definition)
;; #aad84c #000000 0 0 0 1
(primitive_type) @type.builtin
(sized_type_specifier
_ @type.builtin
type: _?)
;; #ebda8c #000000 0 0 0 1
((identifier) @constant
(#match? @constant "^[A-Z][A-Z0-9_]+$"))
(preproc_def
(preproc_arg) @constant
(#match? @constant "^[A-Z][A-Z0-9_]+$"))
(enumerator
name: (identifier) @constant)
(case_statement
value: (identifier) @constant)
;; #ebda8c #000000 0 0 0 1
((identifier) @constant.builtin
(#match? @constant.builtin "^(stderr|stdin|stdout|__FILE__|__LINE__|__DATE__|__TIME__|__STDC__|__STDC_VERSION__|__STDC_HOSTED__|__cplusplus|__OBJC__|__ASSEMBLER__|__BASE_FILE__|__FILE_NAME__|__INCLUDE_LEVEL__|__TIMESTAMP__|__clang__|__clang_major__|__clang_minor__|__clang_patchlevel__|__clang_version__|__clang_literal_encoding__|__clang_wide_literal_encoding__|__FUNCTION__|__func__|__PRETTY_FUNCTION__|__VA_ARGS__|__VA_OPT__)$"))
(preproc_def
(preproc_arg) @constant.builtin
(#match? @constant.builtin "^(stderr|stdin|stdout|__FILE__|__LINE__|__DATE__|__TIME__|__STDC__|__STDC_VERSION__|__STDC_HOSTED__|__cplusplus|__OBJC__|__ASSEMBLER__|__BASE_FILE__|__FILE_NAME__|__INCLUDE_LEVEL__|__TIMESTAMP__|__clang__|__clang_major__|__clang_minor__|__clang_patchlevel__|__clang_version__|__clang_literal_encoding__|__clang_wide_literal_encoding__|__FUNCTION__|__func__|__PRETTY_FUNCTION__|__VA_ARGS__|__VA_OPT__)$"))
;; #ffffff #000000 0 0 0 1
(attribute_specifier
(argument_list
(identifier) @variable.builtin))
(attribute_specifier
(argument_list
(call_expression
function: (identifier) @variable.builtin)))
;; #aad84c #000000 0 0 0 1
((call_expression
function: (identifier) @function.builtin)
(#match? @function.builtin "^__builtin_"))
((call_expression
function: (identifier) @function.builtin))
;; #ebda8c #000000 0 0 0 1
(preproc_def
name: (_) @constant.macro)
(preproc_call
directive: (preproc_directive) @_u
argument: (_) @constant.macro
(#match? @_u "^#undef$"))
(preproc_ifdef
name: (identifier) @constant.macro)
(preproc_elifdef
name: (identifier) @constant.macro)
(preproc_defined
(identifier) @constant.macro)
;; #aad84c #000000 0 0 0 3
(call_expression
function: (identifier) @function.call)
(call_expression
function: (field_expression
field: (field_identifier) @function.call))
;; #aad84c #000000 0 0 0 3
(function_declarator
declarator: (identifier) @function)
(function_declarator
declarator: (parenthesized_declarator
(pointer_declarator
declarator: (field_identifier) @function)))
;; #aad84c #000000 0 0 0 3
(preproc_function_def
name: (identifier) @function.macro)
;; #AAAAAA #000000 0 1 0 1
(comment) @comment @spell
;; #AAAAAA #000000 0 1 0 1
((comment) @comment.documentation
(#match? @comment.documentation "^/[*][*][^*].*[*]/$"))
;; #ffffff #000000 0 0 0 1
(parameter_declaration
declarator: (identifier) @variable.parameter)
(parameter_declaration
declarator: (array_declarator) @variable.parameter)
(parameter_declaration
declarator: (pointer_declarator) @variable.parameter)
(preproc_params
(identifier) @variable.parameter)
;; #fbb152 #000000 0 0 0 1
[
"__attribute__"
"__declspec"
"__based"
"__cdecl"
"__clrcall"
"__stdcall"
"__fastcall"
"__thiscall"
"__vectorcall"
(ms_pointer_modifier)
(attribute_declaration)
] @attribute
;; #ffffff #000000 0 0 0 1
((identifier) @variable.member
(#match? @variable.member "^m_.*$"))
(parameter_declaration
declarator: (reference_declarator) @variable.parameter)
(variadic_parameter_declaration
declarator: (variadic_declarator
(_) @variable.parameter))
(optional_parameter_declaration
declarator: (_) @variable.parameter)
;; #ffffff #000000 0 0 0 1
((field_expression
(field_identifier) @function.method) @_parent)
(field_declaration
(field_identifier) @variable.member)
(field_initializer
(field_identifier) @property)
(function_declarator
declarator: (field_identifier) @function.method)
;; #aad84c #000000 0 0 0 3
(concept_definition
name: (identifier) @type.definition)
(alias_declaration
name: (type_identifier) @type.definition)
;; #aad84c #000000 0 0 0 1
(auto) @type.builtin
;; #aad84c #000000 0 0 0 1
(namespace_identifier) @module
;; #aad84c #000000 0 0 0 1
((namespace_identifier) @type
(#match? @type "^[A-Z]"))
;; #ebda8c #000000 0 0 0 1
(case_statement
value: (qualified_identifier
(identifier) @constant))
;; #fbb152 #000000 0 0 0 1
(using_declaration
.
"using"
.
"namespace"
.
[
(qualified_identifier)
(identifier)
] @module)
;; #aad84c #000000 0 0 0 3
(destructor_name
(identifier) @function.method)
;; #aad84c #000000 0 0 0 3
(function_declarator
(qualified_identifier
(identifier) @function))
(function_declarator
(qualified_identifier
(qualified_identifier
(identifier) @function)))
(function_declarator
(qualified_identifier
(qualified_identifier
(qualified_identifier
(identifier) @function))))
((qualified_identifier
(qualified_identifier
(qualified_identifier
(qualified_identifier
(identifier) @function)))) @_parent)
(function_declarator
(template_function
(identifier) @function))
(operator_name) @function
"operator" @function
;; #aad84c #000000 0 0 0 3
"static_assert" @function.builtin
;; #aad84c #000000 0 0 0 3
(call_expression
(qualified_identifier
(identifier) @function.call))
(call_expression
(qualified_identifier
(qualified_identifier
(identifier) @function.call)))
(call_expression
(qualified_identifier
(qualified_identifier
(qualified_identifier
(identifier) @function.call))))
((qualified_identifier
(qualified_identifier
(qualified_identifier
(qualified_identifier
(identifier) @function.call)))) @_parent)
(call_expression
(template_function
(identifier) @function.call))
(call_expression
(qualified_identifier
(template_function
(identifier) @function.call)))
(call_expression
(qualified_identifier
(qualified_identifier
(template_function
(identifier) @function.call))))
(call_expression
(qualified_identifier
(qualified_identifier
(qualified_identifier
(template_function
(identifier) @function.call)))))
((qualified_identifier
(qualified_identifier
(qualified_identifier
(qualified_identifier
(template_function
(identifier) @function.call))))) @_parent)
(function_declarator
(template_method
(field_identifier) @function.method))
;; #aad84c #000000 0 0 0 3
(call_expression
(field_expression
(field_identifier) @function.method.call))
(call_expression
(field_expression
(template_method
(field_identifier) @function.method.call)))
;; #aad84c #000000 0 0 0 3
((function_declarator
(qualified_identifier
(identifier) @constructor))
(#match? @constructor "^[A-Z]"))
((call_expression
function: (identifier) @constructor)
(#match? @constructor "^[A-Z]"))
((call_expression
function: (qualified_identifier
name: (identifier) @constructor))
(#match? @constructor "^[A-Z]"))
((call_expression
function: (field_expression
field: (field_identifier) @constructor))
(#match? @constructor "^[A-Z]"))
((field_initializer
(field_identifier) @constructor
(argument_list))
(#match? @constructor "^[A-Z]"))
;; #ffffff #000000 0 0 0 1
(this) @variable.builtin
;; #ebda8c #000000 0 0 0 1
(null
"nullptr" @constant.builtin)
;; #51eeba #000000 0 0 0 2
(true) @boolean_true
;; #ee513a #000000 0 0 0 2
(false) @boolean_false
;; #aad84c #000000 0 0 0 1
(raw_string_literal) @string
;; #fbb152 #000000 0 0 0 1
[
"try"
"catch"
"noexcept"
"throw"
] @keyword.exception
;; #fbb152 #000000 0 0 0 1
[
"decltype"
"explicit"
"friend"
"override"
"using"
"requires"
"constexpr"
] @keyword
;; #fbb152 #000000 0 0 0 1
[
"class"
"namespace"
"template"
"typename"
"concept"
] @keyword.type
;; #fbb152 #000000 0 0 0 1
[
"co_await"
"co_yield"
"co_return"
] @keyword.coroutine
;; #fbb152 #000000 0 0 0 1
[
"public"
"private"
"protected"
"final"
"virtual"
] @keyword.modifier
;; #fbb152 #000000 0 0 0 1
[
"new"
"delete"
"xor"
"bitand"
"bitor"
"compl"
"not"
"xor_eq"
"and_eq"
"or_eq"
"not_eq"
"and"
"or"
] @keyword.operator
;; #ffffff #000000 0 0 0 1
"<=>" @operator
;; #bd9ae6 #000000 0 0 0 1
"::" @punctuation.delimiter
;; #bd9ae6 #000000 0 0 0 1
(template_argument_list
[
"<"
">"
] @punctuation.bracket)
(template_parameter_list
[
"<"
">"
] @punctuation.bracket)
;; #ffffff #000000 0 0 0 1
(literal_suffix) @operator

View File

@@ -1,613 +0,0 @@
;; #ffffff #000000 0 0 0 1
((identifier) @variable
(#set! priority 95))
(preproc_def
(preproc_arg) @variable)
;; #fbb152 #000000 0 0 0 1
[
"default"
"goto"
"asm"
"__asm__"
] @keyword
[
"enum"
"struct"
"union"
"typedef"
] @keyword.type
[
"sizeof"
"offsetof"
] @keyword.operator
(alignof_expression
.
_ @keyword.operator)
;; #fbb152 #000000 0 0 0 1
"return" @keyword.return
;; #fbb152 #000000 0 0 0 1
[
"while"
"for"
"do"
"continue"
"break"
] @keyword.repeat
;; #fbb152 #000000 0 0 0 1
[
"if"
"else"
"case"
"switch"
] @keyword.conditional
;; #fbb152 #000000 0 0 0 1
[
"#if"
"#ifdef"
"#ifndef"
"#else"
"#elif"
"#endif"
"#elifdef"
"#elifndef"
(preproc_directive)
] @keyword.directive
;; #fbb152 #000000 0 0 0 1
"#define" @keyword.directive.define
;; #fbb152 #000000 0 0 0 1
"#include" @keyword.import
;; #bd9ae6 #000000 0 0 0 1
[
";"
":"
","
"."
"::"
] @punctuation.delimiter
;; #e6a24c #000000 0 0 0 2
"..." @punctuation.special
;; #bd9ae6 #000000 0 0 0 1
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
;; #ffffff #000000 0 0 0 1
[
"="
"-"
"*"
"/"
"+"
"%"
"~"
"|"
"&"
"^"
"<<"
">>"
"->"
"<"
"<="
">="
">"
"=="
"!="
"!"
"&&"
"||"
"-="
"+="
"*="
"/="
"%="
"|="
"&="
"^="
">>="
"<<="
"--"
"++"
] @operator
;; #ffffff #000000 0 0 0 1
(comma_expression
"," @operator)
;; #51eeba #000000 0 0 0 1
[
(true)
(false)
] @boolean
;; #fbb152 #000000 0 0 0 1
(conditional_expression
[
"?"
":"
] @keyword.conditional.ternary)
;; #aad84c #000000 0 0 0 1
(string_literal) @string
(system_lib_string) @string
;; #e6a24c #000000 0 0 0 2
(escape_sequence) @string.escape
;; #ebda8c #000000 0 0 0 1
(null) @constant.builtin
;; #ebda8c #000000 0 0 0 1
(number_literal) @number
;; #ebda8c #000000 0 0 0 1
(char_literal) @character
;; #aad84c #000000 0 0 0 1
(preproc_defined) @function.macro
;; #ffffff #000000 0 0 0 1
((field_expression
(field_identifier) @property) @_parent)
(field_designator) @property
((field_identifier) @property)
;; #fbb152 #000000 0 0 0 1
(statement_identifier) @label
(declaration
type: (type_identifier) @_type
declarator: (identifier) @label
(#match? @_type "^__label__$"))
;; #aad84c #000000 0 0 0 1
[
(type_identifier)
(type_descriptor)
] @type
;; #fbb152 #000000 0 0 0 1
(storage_class_specifier) @keyword.modifier
[
(type_qualifier)
(gnu_asm_qualifier)
"__extension__"
] @keyword.modifier
;; #fbb152 #000000 0 0 0 1
(linkage_specification
"extern" @keyword.modifier)
;; #aad84c #000000 0 0 0 1
(type_definition
declarator: (type_identifier) @type.definition)
;; #aad84c #000000 0 0 0 1
(primitive_type) @type.builtin
(sized_type_specifier
_ @type.builtin
type: _?)
;; #ebda8c #000000 0 0 0 1
((identifier) @constant
(#match? @constant "^[A-Z][A-Z0-9_]+$"))
(preproc_def
(preproc_arg) @constant
(#match? @constant "^[A-Z][A-Z0-9_]+$"))
(enumerator
name: (identifier) @constant)
(case_statement
value: (identifier) @constant)
;; #ebda8c #000000 0 0 0 1
((identifier) @constant.builtin
(#match? @constant.builtin "^(stderr|stdin|stdout|__FILE__|__LINE__|__DATE__|__TIME__|__STDC__|__STDC_VERSION__|__STDC_HOSTED__|__cplusplus|__OBJC__|__ASSEMBLER__|__BASE_FILE__|__FILE_NAME__|__INCLUDE_LEVEL__|__TIMESTAMP__|__clang__|__clang_major__|__clang_minor__|__clang_patchlevel__|__clang_version__|__clang_literal_encoding__|__clang_wide_literal_encoding__|__FUNCTION__|__func__|__PRETTY_FUNCTION__|__VA_ARGS__|__VA_OPT__)$"))
(preproc_def
(preproc_arg) @constant.builtin
(#match? @constant.builtin "^(stderr|stdin|stdout|__FILE__|__LINE__|__DATE__|__TIME__|__STDC__|__STDC_VERSION__|__STDC_HOSTED__|__cplusplus|__OBJC__|__ASSEMBLER__|__BASE_FILE__|__FILE_NAME__|__INCLUDE_LEVEL__|__TIMESTAMP__|__clang__|__clang_major__|__clang_minor__|__clang_patchlevel__|__clang_version__|__clang_literal_encoding__|__clang_wide_literal_encoding__|__FUNCTION__|__func__|__PRETTY_FUNCTION__|__VA_ARGS__|__VA_OPT__)$"))
;; #ffffff #000000 0 0 0 1
(attribute_specifier
(argument_list
(identifier) @variable.builtin))
(attribute_specifier
(argument_list
(call_expression
function: (identifier) @variable.builtin)))
;; #aad84c #000000 0 0 0 1
((call_expression
function: (identifier) @function.builtin)
(#match? @function.builtin "^__builtin_"))
((call_expression
function: (identifier) @function.builtin))
;; #ebda8c #000000 0 0 0 1
(preproc_def
name: (_) @constant.macro)
(preproc_call
directive: (preproc_directive) @_u
argument: (_) @constant.macro
(#match? @_u "^#undef$"))
(preproc_ifdef
name: (identifier) @constant.macro)
(preproc_elifdef
name: (identifier) @constant.macro)
(preproc_defined
(identifier) @constant.macro)
;; #aad84c #000000 0 0 0 3
(call_expression
function: (identifier) @function.call)
(call_expression
function: (field_expression
field: (field_identifier) @function.call))
;; #aad84c #000000 0 0 0 3
(function_declarator
declarator: (identifier) @function)
(function_declarator
declarator: (parenthesized_declarator
(pointer_declarator
declarator: (field_identifier) @function)))
;; #aad84c #000000 0 0 0 3
(preproc_function_def
name: (identifier) @function.macro)
;; #AAAAAA #000000 0 1 0 1
(comment) @comment @spell
;; #AAAAAA #000000 0 1 0 1
((comment) @comment.documentation
(#match? @comment.documentation "^/[*][*][^*].*[*]/$"))
;; #ffffff #000000 0 0 0 1
(parameter_declaration
declarator: (identifier) @variable.parameter)
(parameter_declaration
declarator: (array_declarator) @variable.parameter)
(parameter_declaration
declarator: (pointer_declarator) @variable.parameter)
(preproc_params
(identifier) @variable.parameter)
;; #fbb152 #000000 0 0 0 1
[
"__attribute__"
"__declspec"
"__based"
"__cdecl"
"__clrcall"
"__stdcall"
"__fastcall"
"__thiscall"
"__vectorcall"
(ms_pointer_modifier)
(attribute_declaration)
] @attribute
;; #ffffff #000000 0 0 0 1
((identifier) @variable.member
(#match? @variable.member "^m_.*$"))
(parameter_declaration
declarator: (reference_declarator) @variable.parameter)
(variadic_parameter_declaration
declarator: (variadic_declarator
(_) @variable.parameter))
(optional_parameter_declaration
declarator: (_) @variable.parameter)
;; #ffffff #000000 0 0 0 1
((field_expression
(field_identifier) @function.method) @_parent)
(field_declaration
(field_identifier) @variable.member)
(field_initializer
(field_identifier) @property)
(function_declarator
declarator: (field_identifier) @function.method)
;; #aad84c #000000 0 0 0 3
(concept_definition
name: (identifier) @type.definition)
(alias_declaration
name: (type_identifier) @type.definition)
;; #aad84c #000000 0 0 0 1
(auto) @type.builtin
;; #aad84c #000000 0 0 0 1
(namespace_identifier) @module
;; #aad84c #000000 0 0 0 1
((namespace_identifier) @type
(#match? @type "^[A-Z]"))
;; #ebda8c #000000 0 0 0 1
(case_statement
value: (qualified_identifier
(identifier) @constant))
;; #fbb152 #000000 0 0 0 1
(using_declaration
.
"using"
.
"namespace"
.
[
(qualified_identifier)
(identifier)
] @module)
;; #aad84c #000000 0 0 0 3
(destructor_name
(identifier) @function.method)
;; #aad84c #000000 0 0 0 3
(function_declarator
(qualified_identifier
(identifier) @function))
(function_declarator
(qualified_identifier
(qualified_identifier
(identifier) @function)))
(function_declarator
(qualified_identifier
(qualified_identifier
(qualified_identifier
(identifier) @function))))
((qualified_identifier
(qualified_identifier
(qualified_identifier
(qualified_identifier
(identifier) @function)))) @_parent)
(function_declarator
(template_function
(identifier) @function))
(operator_name) @function
"operator" @function
;; #aad84c #000000 0 0 0 3
"static_assert" @function.builtin
;; #aad84c #000000 0 0 0 3
(call_expression
(qualified_identifier
(identifier) @function.call))
(call_expression
(qualified_identifier
(qualified_identifier
(identifier) @function.call)))
(call_expression
(qualified_identifier
(qualified_identifier
(qualified_identifier
(identifier) @function.call))))
((qualified_identifier
(qualified_identifier
(qualified_identifier
(qualified_identifier
(identifier) @function.call)))) @_parent)
(call_expression
(template_function
(identifier) @function.call))
(call_expression
(qualified_identifier
(template_function
(identifier) @function.call)))
(call_expression
(qualified_identifier
(qualified_identifier
(template_function
(identifier) @function.call))))
(call_expression
(qualified_identifier
(qualified_identifier
(qualified_identifier
(template_function
(identifier) @function.call)))))
((qualified_identifier
(qualified_identifier
(qualified_identifier
(qualified_identifier
(template_function
(identifier) @function.call))))) @_parent)
(function_declarator
(template_method
(field_identifier) @function.method))
;; #aad84c #000000 0 0 0 3
(call_expression
(field_expression
(field_identifier) @function.method.call))
(call_expression
(field_expression
(template_method
(field_identifier) @function.method.call)))
;; #aad84c #000000 0 0 0 3
((function_declarator
(qualified_identifier
(identifier) @constructor))
(#match? @constructor "^[A-Z]"))
((call_expression
function: (identifier) @constructor)
(#match? @constructor "^[A-Z]"))
((call_expression
function: (qualified_identifier
name: (identifier) @constructor))
(#match? @constructor "^[A-Z]"))
((call_expression
function: (field_expression
field: (field_identifier) @constructor))
(#match? @constructor "^[A-Z]"))
((field_initializer
(field_identifier) @constructor
(argument_list))
(#match? @constructor "^[A-Z]"))
;; #ffffff #000000 0 0 0 1
(this) @variable.builtin
;; #ebda8c #000000 0 0 0 1
(null
"nullptr" @constant.builtin)
;; #51eeba #000000 0 0 0 2
(true) @boolean_true
;; #ee513a #000000 0 0 0 2
(false) @boolean_false
;; #aad84c #000000 0 0 0 1
(raw_string_literal) @string
;; #fbb152 #000000 0 0 0 1
[
"try"
"catch"
"noexcept"
"throw"
] @keyword.exception
;; #fbb152 #000000 0 0 0 1
[
"decltype"
"explicit"
"friend"
"override"
"using"
"requires"
"constexpr"
] @keyword
;; #fbb152 #000000 0 0 0 1
[
"class"
"namespace"
"template"
"typename"
"concept"
] @keyword.type
;; #fbb152 #000000 0 0 0 1
[
"co_await"
"co_yield"
"co_return"
] @keyword.coroutine
;; #fbb152 #000000 0 0 0 1
[
"public"
"private"
"protected"
"final"
"virtual"
] @keyword.modifier
;; #fbb152 #000000 0 0 0 1
[
"new"
"delete"
"xor"
"bitand"
"bitor"
"compl"
"not"
"xor_eq"
"and_eq"
"or_eq"
"not_eq"
"and"
"or"
] @keyword.operator
;; #ffffff #000000 0 0 0 1
"<=>" @operator
;; #bd9ae6 #000000 0 0 0 1
"::" @punctuation.delimiter
;; #bd9ae6 #000000 0 0 0 1
(template_argument_list
[
"<"
">"
] @punctuation.bracket)
(template_parameter_list
[
"<"
">"
] @punctuation.bracket)
;; #ffffff #000000 0 0 0 1
(literal_suffix) @operator

View File

@@ -1,331 +0,0 @@
(heredoc_body
;; !bash
(heredoc_content) @bash_injection
((heredoc_end) @lang
(#match? @lang "BASH"))
)
(heredoc_body
;; !ruby
(heredoc_content) @ruby_injection
((heredoc_end) @lang
(#match? @lang "RUBY"))
)
;; #ffffff #000000 0 0 0 1
[
(identifier)
(global_variable)
] @variable
;; #fbb152 #000000 0 0 0 1
[
"alias"
"begin"
"do"
"end"
"ensure"
"module"
"rescue"
"then"
] @keyword
;; #fbb152 #000000 0 0 0 1
"class" @keyword.type
;; #fbb152 #000000 0 0 0 1
[
"return"
"yield"
] @keyword.return
;; #fbb152 #000000 0 0 0 1
[
"and"
"or"
"in"
"not"
] @keyword.operator
;; #fbb152 #000000 0 0 0 1
[
"def"
"undef"
] @keyword.function
(method
"end" @keyword.function)
;; #fbb152 #000000 0 0 0 1
[
"case"
"else"
"elsif"
"if"
"unless"
"when"
"then"
] @keyword.conditional
(if
"end" @keyword.conditional)
;; #fbb152 #000000 0 0 0 1
[
"for"
"until"
"while"
"break"
"redo"
"retry"
"next"
] @keyword.repeat
;; #ebda8c #000000 0 0 0 1
(constant) @constant
;; #fbb152 #000000 0 0 0 1
[
"rescue"
"ensure"
] @keyword.exception
;; #aad84c #000000 0 0 0 3
"defined?" @function
;; #aad84c #000000 0 0 0 3
(call
receiver: (constant)? @type
method: [
(identifier)
(constant)
;; #ff5689 #000000 0 0 0 2
] @function.call)
(alias
(identifier) @function)
(setter
(identifier) @function)
(method
name: [
(identifier) @function
(constant) @type
])
(singleton_method
name: [
(identifier) @function
(constant) @type
])
(class
name: (constant) @type)
(module
name: (constant) @type)
(superclass
(constant) @type)
;; #ffffff #000000 0 0 0 1
[
(class_variable)
(instance_variable)
] @variable.member
((identifier) @keyword.modifier
(#match? @keyword.modifier "^(private|protected|public)$" ))
;; #fbb152 #000000 0 0 0 3
(program
(call
(identifier) @keyword.import)
(#match? @keyword.import "^(require|require_relative|load)$"))
;; #fbb152 #000000 0 0 0 4
((identifier) @constant.builtin
(#match? @constant.builtin "^(__callee__|__dir__|__id__|__method__|__send__|__ENCODING__|__FILE__|__LINE__)$" ))
;; #aad84c #000000 0 0 0 3
((identifier) @function.builtin
(#match? @function.builtin "^(attr_reader|attr_writer|attr_accessor|module_function)$" ))
((call
!receiver
method: (identifier) @function.builtin)
(#match? @function.builtin "^(include|extend|prepend|refine|using)$"))
((identifier) @keyword.exception
(#match? @keyword.exception "^(raise|fail|catch|throw)$" ))
;; #ffffff #000000 0 0 0 1
[
(self)
(super)
] @variable.builtin
;; #ffffff #000000 0 0 0 1
(method_parameters
(identifier) @variable.parameter)
(lambda_parameters
(identifier) @variable.parameter)
(block_parameters
(identifier) @variable.parameter)
(splat_parameter
(identifier) @variable.parameter)
(hash_splat_parameter
(identifier) @variable.parameter)
(optional_parameter
(identifier) @variable.parameter)
(destructured_parameter
(identifier) @variable.parameter)
(block_parameter
(identifier) @variable.parameter)
(keyword_parameter
(identifier) @variable.parameter)
;; #aad84c #000000 0 0 0 1
[
(string_content)
(heredoc_content)
"\""
"`"
] @string
;; #fbb152 #000000 0 0 0 1
[
(heredoc_beginning)
(heredoc_end)
] @label
;; #bd9ae6 #000000 0 0 0 2
[
(bare_symbol)
(simple_symbol)
(delimited_symbol)
(hash_key_symbol)
] @string.special.symbol
;; #e6a24c #000000 0 0 0 2
(regex
(string_content) @string.regexp)
;; #e6a24c #000000 0 0 0 2
(escape_sequence) @string.escape
;; #ebda8c #000000 0 0 0 2
(integer) @number
;; #ebda8c #000000 0 0 0 2
(float) @number.float
;; #51eeba #000000 0 0 0 1
(true) @boolean.true
;; #ee513a #000000 0 0 0 1
(false) @boolean.false
;; #ee8757 #000000 0 0 0 1
(nil) @constant.nil
;; #AAAAAA #000000 0 1 0 1
(comment) @comment
;; #51eeba #000000 0 0 0 3
((program
.
(comment) @shebang @nospell)
(#match? @shebang "^#!/"))
;; #ffffff #000000 0 0 0 1
[
"!"
"="
">>"
"<<"
">"
"<"
"**"
"*"
"/"
"%"
"+"
"-"
"&"
"|"
"^"
"%="
"+="
"-="
"*="
"/="
"=~"
"!~"
"?"
":"
] @operator
;; #ffffff #000000 0 1 0 1
[
"=="
"==="
"<=>"
"=>"
"->"
">="
"<="
"||"
"||="
"&&="
"&&"
"!="
".."
"..."
] @operator.ligature
;; #bd9ae6 #000000 0 0 0 1
[
","
";"
"."
"&."
"::"
] @punctuation.delimiter
(pair
":" @punctuation.delimiter)
;; #bd9ae6 #000000 0 0 0 1
[
"("
")"
"["
"]"
"{"
"}"
"%w("
"%i("
] @punctuation.bracket
(regex
"/" @punctuation.bracket)
(block_parameters
"|" @punctuation.bracket)
;; #e6a24c #000000 0 0 0 2
(interpolation
"#{" @punctuation.special
"}" @punctuation.special)

View File

@@ -1,269 +0,0 @@
#ifndef EDITOR_H
#define EDITOR_H
#include "./knot.h"
#include "./pch.h"
#include "./ui.h"
#include "./utils.h"
#include "ts_def.h"
#include <cstdint>
#include <shared_mutex>
#define CHAR 0
#define WORD 1
#define LINE 2
#define EXTRA_META 4
#define INDENT_WIDTH 2
struct Highlight {
uint32_t fg;
uint32_t bg;
uint32_t flags;
uint8_t priority;
};
struct Span {
uint32_t start;
uint32_t end;
Highlight *hl;
bool operator<(const Span &other) const { return start < other.start; }
};
struct Spans {
std::vector<Span> spans;
Queue<std::pair<uint32_t, int64_t>> edits;
bool mid_parse = false;
std::shared_mutex mtx;
};
struct Fold {
uint32_t start;
uint32_t end;
bool contains(uint32_t line) const { return line >= start && line <= end; }
bool operator<(const Fold &other) const { return start < other.start; }
};
struct SpanCursor {
Spans &spans;
size_t index = 0;
std::vector<Span *> active;
std::shared_lock<std::shared_mutex> lock;
SpanCursor(Spans &s) : spans(s) {}
Highlight *get_highlight(uint32_t byte_offset) {
for (int i = (int)active.size() - 1; i >= 0; i--)
if (active[i]->end <= byte_offset)
active.erase(active.begin() + i);
while (index < spans.spans.size() &&
spans.spans[index].start <= byte_offset) {
if (spans.spans[index].end > byte_offset)
active.push_back(const_cast<Span *>(&spans.spans[index]));
index++;
}
Highlight *best = nullptr;
int max_prio = -1;
for (auto *s : active)
if (s->hl->priority > max_prio) {
max_prio = s->hl->priority;
best = s->hl;
}
return best;
}
void sync(uint32_t byte_offset) {
lock = std::shared_lock(spans.mtx);
active.clear();
size_t left = 0, right = spans.spans.size();
while (left < right) {
size_t mid = (left + right) / 2;
if (spans.spans[mid].start <= byte_offset)
left = mid + 1;
else
right = mid;
}
index = left;
while (left > 0) {
left--;
if (spans.spans[left].end > byte_offset)
active.push_back(const_cast<Span *>(&spans.spans[left]));
else if (byte_offset - spans.spans[left].end > 1000)
break;
}
}
};
struct VHint {
Coord pos;
std::string hint;
bool operator<(const VHint &other) const { return pos < other.pos; }
};
struct VWarn {
uint32_t line;
std::string text;
int8_t type; // For hl
bool operator<(const VWarn &other) const { return line < other.line; }
};
struct VAI {
Coord pos;
char *text;
uint32_t len;
uint32_t lines; // number of \n in text for speed .. the ai part will not
// line wrap but multiline ones need to have its own lines
// after the first one
};
struct TSSetBase {
std::string lang;
TSParser *parser;
std::string query_file;
TSQuery *query;
std::map<uint16_t, Highlight> query_map;
std::map<uint16_t, Language> injection_map;
const TSLanguage *language;
};
struct TSSet : TSSetBase {
std::vector<TSRange> ranges;
};
struct TSSetMain : TSSetBase {
TSTree *tree;
std::unordered_map<std::string, TSSet> injections;
};
struct Editor {
std::string filename;
std::string uri;
Knot *root;
std::shared_mutex knot_mtx;
Coord cursor;
uint32_t cursor_preffered;
Coord selection;
bool selection_active;
int selection_type;
Coord position;
Coord size;
Coord scroll;
TSSetMain ts;
Queue<TSInputEdit> edit_queue;
std::vector<Fold> folds;
Spans spans;
Spans def_spans;
uint32_t hooks[94];
bool jumper_set;
std::shared_mutex v_mtx;
std::vector<VHint> hints;
std::vector<VWarn> warnings;
VAI ai;
std::shared_mutex lsp_mtx;
struct LSPInstance *lsp;
int lsp_version = 1;
};
inline const Fold *fold_for_line(const std::vector<Fold> &folds,
uint32_t line) {
auto it = std::lower_bound(
folds.begin(), folds.end(), line,
[](const Fold &fold, uint32_t value) { return fold.start < value; });
if (it != folds.end() && it->start == line)
return &(*it);
if (it != folds.begin()) {
--it;
if (it->contains(line))
return &(*it);
}
return nullptr;
}
inline Fold *fold_for_line(std::vector<Fold> &folds, uint32_t line) {
const auto *fold =
fold_for_line(static_cast<const std::vector<Fold> &>(folds), line);
return const_cast<Fold *>(fold);
}
inline bool line_is_fold_start(const std::vector<Fold> &folds, uint32_t line) {
const Fold *fold = fold_for_line(folds, line);
return fold && fold->start == line;
}
inline bool line_is_folded(const std::vector<Fold> &folds, uint32_t line) {
return fold_for_line(folds, line) != nullptr;
}
inline uint32_t next_unfolded_row(const Editor *editor, uint32_t row) {
uint32_t limit = editor && editor->root ? editor->root->line_count : 0;
while (row < limit) {
const Fold *fold = fold_for_line(editor->folds, row);
if (!fold)
return row;
row = fold->end + 1;
}
return limit;
}
inline uint32_t prev_unfolded_row(const Editor *editor, uint32_t row) {
while (row > 0) {
const Fold *fold = fold_for_line(editor->folds, row);
if (!fold)
return row;
if (fold->start == 0)
return 0;
row = fold->start - 1;
}
return 0;
}
void apply_edit(std::vector<Span> &spans, uint32_t x, int64_t y);
void apply_hook_insertion(Editor *editor, uint32_t line, uint32_t rows);
void apply_hook_deletion(Editor *editor, uint32_t removal_start,
uint32_t removal_end);
Editor *new_editor(const char *filename_arg, Coord position, Coord size);
void save_file(Editor *editor);
void free_editor(Editor *editor);
void render_editor(Editor *editor);
void fold(Editor *editor, uint32_t start_line, uint32_t end_line);
void cursor_up(Editor *editor, uint32_t number);
void cursor_down(Editor *editor, uint32_t number);
Coord move_left(Editor *editor, Coord cursor, uint32_t number);
Coord move_right(Editor *editor, Coord cursor, uint32_t number);
Coord move_left_pure(Editor *editor, Coord cursor, uint32_t number);
Coord move_right_pure(Editor *editor, Coord cursor, uint32_t number);
void cursor_left(Editor *editor, uint32_t number);
void cursor_right(Editor *editor, uint32_t number);
void scroll_up(Editor *editor, int32_t number);
void scroll_down(Editor *editor, uint32_t number);
void ensure_cursor(Editor *editor);
void indent_line(Editor *editor, uint32_t row);
void dedent_line(Editor *editor, uint32_t row);
void ensure_scroll(Editor *editor);
void handle_editor_event(Editor *editor, KeyEvent event);
void edit_erase(Editor *editor, Coord pos, int64_t len);
void edit_insert(Editor *editor, Coord pos, char *data, uint32_t len);
Coord editor_hit_test(Editor *editor, uint32_t x, uint32_t y);
char *get_selection(Editor *editor, uint32_t *out_len, Coord *out_start);
void editor_worker(Editor *editor);
void move_line_down(Editor *editor);
void move_line_up(Editor *editor);
void word_boundaries(Editor *editor, Coord coord, uint32_t *prev_col,
uint32_t *next_col, uint32_t *prev_clusters,
uint32_t *next_clusters);
void word_boundaries_exclusive(Editor *editor, Coord coord, uint32_t *prev_col,
uint32_t *next_col);
std::vector<Fold>::iterator find_fold_iter(Editor *editor, uint32_t line);
bool add_fold(Editor *editor, uint32_t start, uint32_t end);
bool remove_fold(Editor *editor, uint32_t line);
void apply_line_insertion(Editor *editor, uint32_t line, uint32_t rows);
void apply_line_deletion(Editor *editor, uint32_t removal_start,
uint32_t removal_end);
uint32_t leading_indent(const char *line, uint32_t len);
uint32_t get_indent(Editor *editor, Coord cursor);
bool closing_after_cursor(const char *line, uint32_t len, uint32_t col);
void editor_lsp_handle(Editor *editor, json msg);
#endif

View File

@@ -0,0 +1,54 @@
#ifndef EDITOR_COMPLETIONS_H
#define EDITOR_COMPLETIONS_H
#include "pch.h"
#include "ui/completionbox.h"
#include "ui/hover.h"
#include "utils/utils.h"
struct CompletionItem {
std::string label;
uint8_t kind;
std::optional<std::string> detail;
std::optional<std::string> documentation;
bool is_markup = false;
bool deprecated = false;
bool asis = true;
std::string sort;
std::string filter;
bool snippet = false;
std::vector<TextEdit> edits;
json original;
std::vector<char> end_chars;
};
struct CompletionSession {
struct Editor *editor;
std::shared_mutex mtx;
bool active = false;
Coord hook;
std::optional<std::string> prefix;
uint32_t select = 0;
uint32_t scroll = 0;
std::vector<CompletionItem> items;
std::vector<uint32_t> visible;
bool complete = true;
std::optional<char> trigger_char;
uint8_t trigger = 0;
CompletionBox box;
HoverBox hover;
uint32_t doc = UINT32_MAX;
std::atomic<bool> hover_dirty = false;
int version;
CompletionSession(Editor *editor) : editor(editor), box(this) {}
void resolve_doc();
void accept();
void next();
void prev();
void choose(uint8_t index);
void handle(KeyEvent event);
};
#endif

35
include/editor/decl.h Normal file
View File

@@ -0,0 +1,35 @@
#ifndef EDITOR_DECL_H
#define EDITOR_DECL_H
#include "utils/utils.h"
struct TextEdit {
Coord start;
Coord end;
std::string text;
};
struct VWarn {
uint32_t line;
std::string text;
std::string text_full;
std::string source;
std::string code;
std::vector<std::string> see_also;
int8_t type;
uint32_t start;
uint32_t end{UINT32_MAX};
bool operator<(const VWarn &other) const { return line < other.line; }
};
struct VAI {
Coord pos;
char *text;
uint32_t len;
uint32_t lines; // number of \n in text for speed .. the ai part will not
// line wrap but multiline ones need to have its own lines
// after the first one
};
#endif

176
include/editor/editor.h Normal file
View File

@@ -0,0 +1,176 @@
#ifndef EDITOR_H
#define EDITOR_H
#include "editor/indents.h"
#include "extentions/diagnostics.h"
#include "extentions/hover.h"
#include "io/knot.h"
#include "io/sysio.h"
#include "syntax/extras.h"
#include "syntax/parser.h"
#include "utils/utils.h"
#include "windows/decl.h"
#define CHAR 0
#define WORD 1
#define LINE 2
#define EXTRA_META 2
#define INDENT_WIDTH 2
struct Editor : Window {
std::string filename = "";
std::string uri = "";
Knot *root = nullptr;
Coord cursor = {0, 0};
uint32_t cursor_preffered = 0;
Coord selection = {0, 0};
bool selection_active = false;
bool unix_eol = true;
int selection_type = 0;
Coord size = {0, 0};
Coord scroll = {0, 0};
Language lang = {};
uint32_t hooks[94] = {0};
bool jumper_set = false;
std::vector<VWarn> warnings = {};
bool warnings_dirty = false;
VAI ai = {};
std::shared_mutex lsp_mtx;
std::atomic<struct LSPInstance *> lsp = nullptr;
HoverBox *hover_popup = init_hover();
DiagnosticBox *diagnostic_popup = init_diagnostic();
std::atomic<int> lsp_version = 1;
IndentationEngine indents = {};
Parser *parser = nullptr;
ExtraHighlighter extra_hl = {};
bool is_css_color = false;
Editor(const char *filename_arg, uint8_t eol);
~Editor();
void render(std::vector<ScreenCell> &buffer, Coord size, Coord pos) override;
void handle_event(KeyEvent event) override;
void handle_click(KeyEvent event, Coord size) override;
void handle_command(std::string &command) override;
void work() override;
std::array<std::string, 5> bar_info() override { return {}; };
void save();
void cursor_up(uint32_t number);
void cursor_down(uint32_t number);
void cursor_left(uint32_t number);
void cursor_right(uint32_t number);
void move_line_down();
void move_line_up();
void scroll_up(uint32_t number);
void scroll_down(uint32_t number);
void ensure_cursor();
void ensure_scroll();
void edit_erase(Coord pos, int64_t len);
void edit_insert(Coord pos, char *data, uint32_t len);
void edit_replace(Coord start, Coord end, const char *text, uint32_t len);
Coord click_coord(uint32_t x, uint32_t y);
char *get_selection(uint32_t *out_len, Coord *out_start);
void selection_bounds(Coord *out_start, Coord *out_end);
void insert_str(char *c, uint32_t len);
void insert_char(char c);
void normal_mode();
void backspace_edit();
void delete_prev_word();
void delete_next_word();
void clear_hooks_at_line(uint32_t line);
void cursor_prev_word();
void cursor_next_word();
void select_all();
void fetch_lsp_hover();
void indent_current_line();
void dedent_current_line();
void indent_selection();
void dedent_selection();
void paste();
void copy();
void cut();
void lsp_handle(json msg);
void apply_lsp_edits(std::vector<TextEdit> edits, bool move);
Coord move_left(Coord cursor, uint32_t number);
Coord move_right(Coord cursor, uint32_t number);
void word_boundaries(Coord coord, uint32_t *prev_col, uint32_t *next_col,
uint32_t *prev_clusters, uint32_t *next_clusters);
void word_boundaries_exclusive(Coord coord, uint32_t *prev_col,
uint32_t *next_col);
void utf8_normalize_edit(TextEdit *edit) {
if (edit->start.row > this->root->line_count) {
edit->start.row = this->root->line_count;
edit->start.col = UINT32_MAX;
}
if (edit->end.row > this->root->line_count) {
edit->end.row = this->root->line_count;
edit->end.col = UINT32_MAX;
}
LineIterator *it = begin_l_iter(this->root, edit->start.row);
if (!it)
return;
uint32_t len;
char *line = next_line(it, &len);
if (!line) {
free(it->buffer);
free(it);
return;
}
if (edit->start.col < len)
edit->start.col = utf16_offset_to_utf8(line, len, edit->start.col);
else
edit->start.col = len;
if (edit->end.row == edit->start.row) {
if (edit->end.col < len)
edit->end.col = utf16_offset_to_utf8(line, len, edit->end.col);
else
edit->end.col = len;
free(it->buffer);
free(it);
return;
}
free(it->buffer);
free(it);
it = begin_l_iter(this->root, edit->end.row);
if (!it)
return;
line = next_line(it, &len);
if (!line) {
free(it->buffer);
free(it);
return;
}
if (edit->end.col < len)
edit->end.col = utf16_offset_to_utf8(line, len, edit->end.col);
else
edit->end.col = len;
free(it->buffer);
free(it);
}
inline void apply_hook_insertion(uint32_t line, uint32_t rows) {
for (auto &hook : this->hooks)
if (hook > line)
hook += rows;
}
inline void apply_hook_deletion(uint32_t removal_start,
uint32_t removal_end) {
for (auto &hook : this->hooks)
if (hook > removal_start)
hook -= removal_end - removal_start + 1;
}
};
#endif

6
include/editor/helpers.h Normal file
View File

@@ -0,0 +1,6 @@
#ifndef EDITOR_HELPERS_H
#define EDITOR_HELPERS_H
#include "editor/editor.h"
#endif

158
include/editor/indents.h Normal file
View File

@@ -0,0 +1,158 @@
#ifndef EDITOR_INDENTS_H
#define EDITOR_INDENTS_H
#include "utils/utils.h"
static const std::unordered_map<std::string, uint8_t> kLangtoIndent = {
{"make", 1}, {"yaml", 2}};
// this indents the newline one level when the line (on the curser before \n is
// inserted) matches this at its end (stripped of whitespace)
static const std::unordered_map<std::string, const std::vector<std::string>>
kLangtoBlockStartsEnd = {
{"bash", {"then", "do", "in", "{", "(", "\\", "&&", "||", "|"}},
{"c", {"{", "(", ":"}},
{"cpp", {"{", "(", ":"}},
{"h", {"{", "(", ":"}},
{"css", {"{", "("}},
{"fish", {"{", "(", "^", "&&", "||", "|"}},
{"go", {"{", "(", ":"}},
{"gomod", {"{", "(", ":"}},
{"haskell", {"do", "where", "then", "else", "of"}},
{"javascript", {"{", "(", "[", ":"}},
{"typescript", {"{", "(", "[", ":"}},
{"json", {"{", "[", ":"}},
{"jsonc", {"{", "[", ":"}},
{"ruby", {"then", "else", "begin", "{", "(", "["}},
{"lua", {"then", "do", "else", "repeat", "{", "(", "["}},
{"python", {":", "(", "[", "{"}},
{"rust", {"{", "(", "[", ":"}},
{"php", {"{", "(", "[", ":"}},
{"nginx", {"{"}},
{"yaml", {":"}},
{"sql", {"("}},
{"make", {":"}},
{"gdscript", {":", "(", "[", "{"}},
};
// this indents the newline one level when the line (on the curser before \n is
// inserted) matches this at its start (stripped of whitespace)
static const std::unordered_map<std::string, const std::vector<std::string>>
kLangtoBlockStartsStart = {
{"c", {"if", "for", "while"}},
{"cpp", {"if", "for", "while"}},
{"h", {"if", "for", "while"}},
{"fish", {"if", "else", "for", "while", "switch", "case", "function"}},
{"javascript", {"if", "for", "while"}},
{"typescript", {"if", "for", "while"}},
{"ruby",
{"if", "do", "when", "rescue", "class", "module", "def", "unless",
"until", "elsif", "ensure"}},
{"lua", {"function"}},
{"nginx", {"{"}},
};
// This dedents the line (under the cursor before \n is inserted) when the line
// matches this fully (stripped of whitespace)
static const std::unordered_map<std::string, const std::vector<std::string>>
kLangtoBlockEndsFull = {
{"bash", {"fi", "done", "esac", "}", ")"}},
{"c", {"}", ")"}},
{"cpp", {"}", ")"}},
{"h", {"}", ")"}},
{"css", {"}", ")"}},
{"fish", {"end"}},
{"go", {"}", ")"}},
{"gomod", {"}", ")"}},
{"javascript", {"}", ")", "]"}},
{"typescript", {"}", ")", "]"}},
{"json", {"}", "]"}},
{"jsonc", {"}", "]"}},
{"ruby", {"end", "else", "}", ")", "]"}},
{"lua", {"else", "}", ")", "]"}},
{"python", {"}", ")", "]", "else:"}},
{"rust", {"}", ")", "]"}},
{"php",
{"}", ")", "]", "else:", "endif;", "endfor;", "endwhile;",
"endswitch;", "endcase;", "endfunction;"}},
{"nginx", {"}"}},
{"sql", {")"}},
{"gdscript", {"}", ")", "]"}},
};
// This dedents the line (under the cursor before \n is inserted) when the line
// matches this at its start (stripped of whitespace)
static const std::unordered_map<std::string, const std::vector<std::string>>
kLangtoBlockEndsStart = {
{"c", {"case", "default:", "} else"}},
{"cpp", {"case", "default:", "} else"}},
{"h", {"case", "default:", "} else"}},
{"fish", {"else if"}},
{"go", {"case", "default:", "} else"}},
{"gomod", {"}", ")"}},
{"javascript", {"case", "default:"}},
{"typescript", {"case", "default:"}},
{"json", {"}", "]"}},
{"python", {"elif"}},
{"jsonc", {"}", "]"}},
{"ruby", {"when", "elsif", "rescue", "ensure"}},
{"lua", {"end", "elseif", "until"}},
{"rust", {"case", "default:", "} else"}},
{"php", {"case", "default:", "} else"}},
};
struct IndentationEngine {
// tabs = 1, spaces = 2+
uint8_t indent = 0;
struct Editor *editor = nullptr;
void compute_indent(Editor *n_editor);
void insert_new_line(Coord cursor);
void insert_tab(Coord cursor);
uint32_t set_indent(uint32_t row, int64_t indent_level);
uint32_t indent_line(uint32_t row);
uint32_t dedent_line(uint32_t row);
void indent_block(uint32_t start_row, uint32_t end_row, int delta);
void indent_block(uint32_t start, uint32_t end);
void dedent_block(uint32_t start, uint32_t end);
// fixes a autocomplete block's indentation
char *block_to_asis(Coord cursor, std::string source, uint32_t *out_len);
private:
const std::vector<std::string> *start_end = nullptr;
const std::vector<std::string> *start_start = nullptr;
const std::vector<std::string> *end_full = nullptr;
const std::vector<std::string> *end_start = nullptr;
// TODO: Ignore comments/strings too
// returns the indent level of the line itself or of the previous non-empty
uint32_t indent_expected(uint32_t row);
// returns the indent level of the line
uint32_t indent_real(char *line, uint32_t len);
};
inline static bool ends_with(const std::string &str,
const std::string &suffix) {
const size_t str_len = str.size();
const size_t suf_len = suffix.size();
if (suf_len > str_len)
return false;
for (size_t i = 0; i < suf_len; i++)
if (str[str_len - suf_len + i] != suffix[i])
return false;
return true;
}
inline static bool starts_with(const std::string &str,
const std::string &prefix) {
const size_t str_len = str.size();
const size_t pre_len = prefix.size();
if (pre_len > str_len)
return false;
for (size_t i = 0; i < pre_len; i++)
if (str[i] != prefix[i])
return false;
return true;
}
#endif

View File

@@ -0,0 +1,22 @@
#ifndef EXTENTION_DIAGNOSTICS_H
#define EXTENTION_DIAGNOSTICS_H
#include "editor/decl.h"
#include "io/sysio.h"
#include "pch.h"
#include "utils/utils.h"
#include "windows/decl.h"
struct DiagnosticBox : Popup {
std::vector<VWarn> warnings;
DiagnosticBox() { this->hidden = true; }
void clear() { this->warnings.clear(); }
void render(std::vector<ScreenCell> &buffer, Coord size, Coord pos) override;
void handle_click(KeyEvent, Coord) override { this->hidden = true; };
~DiagnosticBox() {};
};
DiagnosticBox *init_diagnostic();
#endif

View File

@@ -0,0 +1,37 @@
#ifndef EXTENTION_HOVER_H
#define EXTENTION_HOVER_H
#include "io/sysio.h"
#include "pch.h"
#include "utils/utils.h"
#include "windows/decl.h"
struct HoverBox : Popup {
std::string text;
std::atomic<bool> is_markup;
uint32_t scroll_;
bool scroll_dirty;
HoverBox() : scroll_(0) { this->hidden = true; }
void clear() {
this->text = "";
this->hidden = true;
this->is_markup = false;
this->scroll_ = 0;
this->scroll_dirty = true;
}
void scroll(int32_t number);
void render(std::vector<ScreenCell> &buffer, Coord size, Coord pos) override;
void handle_click(KeyEvent ev, Coord) override {
if (ev.mouse_button == SCROLL_BTN && ev.mouse_state == SCROLL) {
this->scroll(ev.mouse_direction == SCROLL_UP ? -1 : 1);
return;
}
this->hidden = true;
};
~HoverBox() {};
};
HoverBox *init_hover();
#endif

View File

@@ -1,13 +1,11 @@
#ifndef ROPE_H
#define ROPE_H
#include "./pch.h"
#include "./utils.h"
#include "pch.h"
#include "utils/utils.h"
#define MIN_CHUNK_SIZE 64 // 64 Bytes
#define MAX_CHUNK_SIZE 1024 * 8 // 8192 Bytes (8 KiB)
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define DEPTH(n) ((n) ? (n)->depth : 0)
// Rope node definition
@@ -93,6 +91,9 @@ Knot *erase(Knot *node, uint32_t offset, uint32_t len);
// returns a null terminated string, should be freed by the caller
char *read(Knot *root, uint32_t offset, uint32_t len);
// Used to read into an existing buffer
void read_into(Knot *node, uint32_t offset, uint32_t len, char *dest);
// Used to split the rope into left and right ropes
// node is the rope to be split (it is no longer valid after call / do not free)
// offset is the position of the split relative to the start of the rope
@@ -113,9 +114,9 @@ LineIterator *begin_l_iter(Knot *root, uint32_t start_line);
// Each subsequent call returns the next line as a null terminated string
// `it` is the iterator returned from begin_l_iter
// After getting the necessary lines free the iterator (no need to go upto the
// end) returns null if there are no more lines All return strings `must` be
// freed by the caller
// After getting the necessary lines free the iterator (no need to go upto
// the end) returns null if there are no more lines
// The string must not be freed
char *next_line(LineIterator *it, uint32_t *out_len);
// Returns the previous line as a null terminated string
@@ -161,8 +162,10 @@ char *leaf_from_offset(Knot *root, uint32_t start_offset, uint32_t *out_len);
// compliant) I.e some forms of backtracking etc. are not supported
// root is the root of the rope to be searched
// Returns a vector of pairs of start and length offsets (in bytes)
std::vector<std::pair<size_t, size_t>> search_rope(Knot *root,
const char *pattern);
std::vector<std::pair<size_t, size_t>> search_rope_dfa(Knot *root,
const char *pattern);
std::vector<Match> search_rope(Knot *root, const char *pattern);
// Helper function to free the rope
// root is the root of the rope

View File

@@ -1,8 +1,8 @@
#ifndef UI_H
#define UI_H
#include "./pch.h"
#include "./utils.h"
#include "pch.h"
#include "utils/utils.h"
#define KEY_CHAR 0
#define KEY_SPECIAL 1
@@ -49,46 +49,66 @@ enum CellFlags : uint8_t {
CF_ITALIC = 1 << 0,
CF_BOLD = 1 << 1,
CF_UNDERLINE = 1 << 2,
CF_STRIKETHROUGH = 1 << 3
};
struct ScreenCell {
std::string utf8 = std::string("");
uint8_t width = 1;
uint32_t fg = 0;
uint32_t bg = 0;
uint8_t flags = CF_NONE;
uint32_t ul_color = 0;
};
struct KeyEvent {
/* KEY_CHAR, KEY_SPECIAL, KEY_MOUSE, KEY_PASTE, KEY_NONE */
uint8_t key_type;
/* the character / string if key_type == KEY_CHAR or KEY_PASTE */
char *c;
/* length of c */
uint32_t len;
/* KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, KEY_DELETE if key_type ==
* KEY_SPECIAL */
uint8_t special_key;
/* ALT, CNTRL, CNTRL_ALT, SHIFT if key_type == KEY_SPECIAL */
uint8_t special_modifier;
/* column of mouse click */
uint8_t mouse_x;
/* row of mouse click */
uint8_t mouse_y;
/* LEFT_BTN, MIDDLE_BTN, RIGHT_BTN, SCROLL_BTN, NONE_BTN if key_type ==
* KEY_MOUSE */
uint8_t mouse_button;
/* PRESS, RELEASE, DRAG, SCROLL if key_type == KEY_MOUSE */
uint8_t mouse_state;
/* SCROLL_UP, SCROLL_DOWN, SCROLL_LEFT, SCROLL_RIGHT if key_type ==
* KEY_MOUSE and mouse_state == SCROLL */
uint8_t mouse_direction;
/* ALT, CNTRL, CNTRL_ALT, SHIFT if key_type == KEY_MOUSE */
uint8_t mouse_modifier;
};
inline bool is_empty_cell(const ScreenCell &c) {
return c.utf8.empty() || c.utf8 == " " || c.utf8 == "\x1b";
}
namespace io {
extern std::vector<ScreenCell> new_screen;
extern uint32_t rows, cols;
extern std::vector<ScreenCell> screen;
extern bool show_cursor;
extern std::vector<ScreenCell> old_screen;
extern std::mutex screen_mutex;
extern termios orig_termios;
} // namespace io
Coord start_screen();
void end_screen();
void update(uint32_t row, uint32_t col, std::string utf8, uint32_t fg,
uint32_t bg, uint8_t flags);
void update(uint32_t row, uint32_t col, const char *utf8, uint32_t fg,
uint32_t bg, uint8_t flags);
void set_cursor(int row, int col, int type, bool show_cursor_param);
void render();
Coord get_size();
void set_cursor(uint8_t row, uint8_t col, uint32_t type,
bool show_cursor_param);
void io_render();
KeyEvent read_key();

View File

@@ -1,55 +0,0 @@
#ifndef LSP_H
#define LSP_H
#include "./editor.h"
#include "./pch.h"
#include "utils.h"
struct LSP {
const char *command;
std::vector<const char *> args;
};
struct LSPPending {
std::string method;
Editor *editor = nullptr;
std::function<void(Editor *, std::string, json)> callback;
};
struct LSPOpenRequest {
Language language;
Editor *editor;
};
struct LSPInstance {
std::shared_mutex mtx;
const LSP *lsp;
std::string root_dir;
int pid{-1};
int stdin_fd{-1};
int stdout_fd{-1};
bool initialized = false;
uint32_t last_id = 0;
Queue<json> inbox;
Queue<json> outbox;
std::unordered_map<uint32_t, LSPPending *> pending;
std::vector<Editor *> editors;
};
extern std::shared_mutex active_lsps_mtx;
extern std::unordered_map<uint8_t, LSPInstance *> active_lsps;
void lsp_worker();
void lsp_handle(LSPInstance *lsp, json message);
LSPInstance *get_or_init_lsp(uint8_t lsp_id);
void close_lsp(uint8_t lsp_id);
void request_add_to_lsp(Language language, Editor *editor);
void add_to_lsp(Language language, Editor *editor);
void remove_from_lsp(Editor *editor);
void lsp_send(LSPInstance *lsp, json message, LSPPending *pending);
#endif

452
include/lsp/lsp.h Normal file
View File

@@ -0,0 +1,452 @@
#ifndef LSP_H
#define LSP_H
#include "editor/editor.h"
#include "main.h"
#include "pch.h"
#include "utils/utils.h"
#include <cstdint>
#include <sys/types.h>
#define LSP_TIMEOUT_START 3000
#define LSP_TIMEOUT_QUIT_NORMAL 300
#define LSP_TIMEOUT_QUIT_FORCE 80
void lsp_worker();
static const json client_capabilities = {
{"general", {{"positionEncodings", {"utf-16"}}}},
{"textDocument",
{{"publishDiagnostics", {{"relatedInformation", true}}},
{"hover", {{"contentFormat", {"markdown", "plaintext"}}}},
{"formatting", {{"dynamicRegistration", false}}},
{"onTypeFormatting", {{"dynamicRegistration", false}}},
{"completion",
{{"completionItem",
{{"commitCharactersSupport", true},
{"dynamicRegistration", false},
{"snippetSupport", true},
{"documentationFormat", {"markdown", "plaintext"}},
{"resolveSupport", {{"properties", {"documentation"}}}},
{"insertReplaceSupport", true},
{"labelDetailsSupport", true},
{"insertTextModeSupport", {{"valueSet", {1, 2}}}},
{"deprecatedSupport", true}}},
{"completionItemKind",
{{"valueSet", {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25}}}},
{"contextSupport", true},
{"insertTextMode", 1}}}}}};
struct LSPMessage {
Editor *editor = nullptr;
json message;
std::function<void(const LSPMessage &)> callback;
};
namespace lsp {
extern std::mutex lsp_mutex;
extern std::unordered_map<std::string, std::unique_ptr<LSPInstance>>
active_lsps;
extern Queue<std::string> need_opening;
extern std::unordered_set<std::string> opened;
extern std::vector<Editor *> new_editors;
extern Queue<std::unique_ptr<LSPMessage>> response_queue;
} // namespace lsp
struct LSPInstance {
const LSP *lsp_info;
std::string root_dir;
int pid{-1};
int stdin_fd{-1};
int stdout_fd{-1};
std::atomic<bool> initialized = false;
std::atomic<bool> exited = false;
bool incremental_sync = false;
bool allow_hover = false;
bool allow_completion = false;
bool allow_resolve = false;
bool allow_formatting = false;
bool allow_formatting_on_type = false;
bool is_utf8 = false;
std::vector<char> format_chars;
std::vector<char> trigger_chars;
std::vector<char> end_chars;
uint32_t last_id = 0;
Queue<json> inbox;
Queue<json> outbox;
std::unordered_map<uint32_t, std::unique_ptr<LSPMessage>> pending;
std::vector<Editor *> editors;
LSPInstance(std::string lsp_id) {
lsp_info = &lsps[lsp_id];
if (!init_process()) {
exited = true;
return;
}
json initialize_message = {
{"jsonrpc", "2.0"},
{"id", ++last_id},
{"method", "initialize"},
{"params",
{{"processId", getpid()},
{"rootUri", "file://" + percent_encode(path_abs("."))},
{"capabilities", client_capabilities}}}};
send_raw(initialize_message);
pollfd pfd{stdout_fd, POLLIN, 0};
uint32_t waited = 0;
while (waited < LSP_TIMEOUT_START) {
poll(&pfd, 1, 50);
if (pfd.revents & POLLIN)
break;
if (!running)
return;
waited += 50;
}
if (!(pfd.revents & POLLIN)) {
exited = true;
return;
}
json response = *read_lsp_message();
if (response.contains("result") &&
response["result"].contains("capabilities")) {
auto &caps = response["result"]["capabilities"];
// if (caps.contains("positionEncoding")) {
// std::string s = caps["positionEncoding"].get<std::string>();
// if (s == "utf-8")
// is_utf8 = true;
// log("Lsp name: %s, supports: %s", lsp->command.c_str(),
// s.c_str());
// }
if (caps.contains("textDocumentSync")) {
auto &sync = caps["textDocumentSync"];
if (sync.is_number()) {
int change_type = sync.get<int>();
incremental_sync = (change_type == 2);
} else if (sync.is_object() && sync.contains("change")) {
int change_type = sync["change"].get<int>();
incremental_sync = (change_type == 2);
}
}
allow_formatting = caps.value("documentFormattingProvider", false);
if (caps.contains("documentOnTypeFormattingProvider")) {
auto &fmt = caps["documentOnTypeFormattingProvider"];
if (fmt.is_object()) {
if (fmt.contains("firstTriggerCharacter")) {
std::string s = fmt["firstTriggerCharacter"].get<std::string>();
if (s.size() == 1)
format_chars.push_back(s[0]);
}
if (fmt.contains("moreTriggerCharacter")) {
for (auto &c : fmt["moreTriggerCharacter"]) {
std::string s = c.get<std::string>();
if (s.size() == 1)
format_chars.push_back(s[0]);
}
}
allow_formatting_on_type = true;
} else if (fmt.is_boolean()) {
allow_formatting_on_type = fmt.get<bool>();
}
}
if (caps.contains("hoverProvider")) {
auto &hover = caps["hoverProvider"];
allow_hover =
hover.is_boolean() ? hover.get<bool>() : hover.is_object();
} else {
allow_hover = false;
}
if (caps.contains("completionProvider")) {
allow_completion = true;
if (caps["completionProvider"].contains("resolveProvider"))
allow_resolve =
caps["completionProvider"]["resolveProvider"].get<bool>();
if (caps["completionProvider"].contains("triggerCharacters")) {
auto &chars = caps["completionProvider"]["triggerCharacters"];
if (chars.is_array()) {
for (auto &c : chars) {
std::string str = c.get<std::string>();
if (str.size() != 1)
continue;
trigger_chars.push_back(str[0]);
}
}
}
if (caps["completionProvider"].contains("allCommitCharacters")) {
auto &chars = caps["completionProvider"]["allCommitCharacters"];
if (chars.is_array()) {
for (auto &c : chars) {
std::string str = c.get<std::string>();
if (str.size() != 1)
continue;
end_chars.push_back(str[0]);
}
}
}
}
}
initialized = true;
json initialized_message = {{"jsonrpc", "2.0"},
{"method", "initialized"},
{"params", json::object()}};
send_raw(initialized_message);
}
~LSPInstance() {
uint32_t timeout =
running ? LSP_TIMEOUT_QUIT_NORMAL : LSP_TIMEOUT_QUIT_FORCE;
for (auto &ed : editors)
ed->lsp.store(nullptr);
initialized = false;
exited = true;
if (pid == -1)
return;
json shutdown = {
{"jsonrpc", "2.0"}, {"id", ++last_id}, {"method", "shutdown"}};
send_raw(shutdown);
pollfd pfd{stdout_fd, POLLIN, 0};
poll(&pfd, 1, timeout);
if (pfd.revents & POLLIN) {
json exit_msg = {{"jsonrpc", "2.0"}, {"method", "exit"}};
send_raw(exit_msg);
int waited = 0;
while (waited < timeout) {
int status;
pid_t res = waitpid(pid, &status, WNOHANG);
if (res == pid)
break;
std::this_thread::sleep_for(10ms);
waited += 10;
}
}
close(stdin_fd);
close(stdout_fd);
if (kill(pid, 0) == 0) {
kill(pid, SIGKILL);
waitpid(pid, nullptr, 0);
}
pid = -1;
}
bool init_process() {
int in_pipe[2];
int out_pipe[2];
if (pipe(in_pipe) == -1 || pipe(out_pipe) == -1) {
perror("pipe");
return false;
}
pid_t pid_tmp = fork();
if (pid_tmp == -1) {
perror("fork");
return false;
}
if (pid_tmp == 0) {
dup2(in_pipe[0], STDIN_FILENO);
dup2(out_pipe[1], STDOUT_FILENO);
int devnull = open("/dev/null", O_WRONLY);
if (devnull >= 0) {
dup2(devnull, STDERR_FILENO);
close(devnull);
}
close(in_pipe[0]);
close(in_pipe[1]);
close(out_pipe[0]);
close(out_pipe[1]);
std::vector<char *> argv;
argv.push_back(const_cast<char *>(lsp_info->command.c_str()));
for (auto &arg : lsp_info->args)
argv.push_back(const_cast<char *>(arg.c_str()));
argv.push_back(nullptr);
execvp(lsp_info->command.c_str(), argv.data());
perror("execvp");
_exit(127);
}
pid = pid_tmp;
stdin_fd = in_pipe[1];
stdout_fd = out_pipe[0];
close(in_pipe[0]);
close(out_pipe[1]);
return true;
}
void add(Editor *ed) {
editors.push_back(ed);
ed->lsp.store(this);
char *buf = read(ed->root, 0, ed->root->char_count);
std::string text(buf);
free(buf);
json message = {{"jsonrpc", "2.0"},
{"method", "textDocument/didOpen"},
{"params",
{{"textDocument",
{{"uri", ed->uri},
{"languageId", ed->lang.name},
{"version", 1},
{"text", text}}}}}};
send_raw(message);
}
void remove(Editor *ed) {
std::unique_lock lock(lsp::lsp_mutex);
editors.erase(std::remove(editors.begin(), editors.end(), ed),
editors.end());
lock.unlock();
auto message = std::make_unique<LSPMessage>();
message->message = {{"method", "textDocument/didClose"},
{"params", {{"textDocument", {{"uri", ed->uri}}}}}};
send(std::move(message));
}
void work() {
if (exited)
return;
int status;
pid_t res = waitpid(pid, &status, WNOHANG);
if (res == pid) {
exited = true;
pid = -1;
return;
}
while (!outbox.empty()) {
json message = outbox.front();
std::string m = message.value("method", "");
outbox.pop();
send_raw(message);
}
pollfd pfd{stdout_fd, POLLIN | POLLHUP | POLLERR, 0};
int r = poll(&pfd, 1, 0);
if (r > 0 && pfd.revents & (POLLHUP | POLLERR)) {
exited = true;
pid = -1;
return;
}
while ((r = poll(&pfd, 1, 0)) > 0) {
if (pfd.revents & (POLLHUP | POLLERR)) {
exited = true;
pid = -1;
return;
}
auto msg = read_lsp_message();
if (!msg)
break;
if (msg->contains("id")) {
uint32_t id = msg->at("id").get<uint32_t>();
auto it = pending.find(id);
if (it != pending.end()) {
if (it->second->editor) {
it->second->message = *msg;
lsp::response_queue.push(std::move(it->second));
} else {
auto message = *std::move(it->second);
message.message = *msg;
message.callback(message);
}
pending.erase(it);
}
} else if (msg->contains("method")) {
std::string uri;
if (msg->contains("params")) {
auto &p = (*msg)["params"];
if (p.contains("textDocument") && p["textDocument"].contains("uri"))
uri = p["textDocument"]["uri"].get<std::string>();
else if (p.contains("uri"))
uri = p["uri"].get<std::string>();
}
Editor *ed = resolve_uri(uri);
auto response = std::make_unique<LSPMessage>();
response->editor = ed;
response->message = *msg;
response->callback = editor_handle_wrapper;
if (ed)
lsp::response_queue.push(std::move(response));
else
lsp_handle(*msg);
}
}
}
inline static void editor_handle_wrapper(const LSPMessage &message) {
message.editor->lsp_handle(message.message);
}
inline void send_raw(const json &msg) {
std::string payload = msg.dump();
std::string header =
"Content-Length: " + std::to_string(payload.size()) + "\r\n\r\n";
std::string out = header + payload;
const char *ptr = out.data();
size_t remaining = out.size();
while (remaining > 0) {
ssize_t n = write(stdin_fd, ptr, remaining);
if (n <= 0) {
if (errno == EINTR)
continue;
break;
}
ptr += n;
remaining -= n;
}
};
inline std::optional<json> read_lsp_message() {
std::string header;
char c;
while (true) {
ssize_t n = read(stdout_fd, &c, 1);
if (n <= 0)
return std::nullopt;
header.push_back(c);
if (header.size() >= 4 && header.substr(header.size() - 4) == "\r\n\r\n")
break;
}
size_t pos = header.find("Content-Length:");
if (pos == std::string::npos)
return std::nullopt;
pos += strlen("Content-Length:");
while (pos < header.size() && std::isspace(header[pos]))
pos++;
size_t end = pos;
while (end < header.size() && std::isdigit(header[end]))
end++;
size_t len = std::stoul(header.substr(pos, end - pos));
std::string body(len, '\0');
size_t got = 0;
while (got < len) {
ssize_t n = read(stdout_fd, &body[got], len - got);
if (n <= 0)
return std::nullopt;
got += n;
}
return json::parse(body);
}
inline Editor *resolve_uri(std::string uri) {
if (uri.empty())
return nullptr;
for (auto &editor : editors)
if (editor->uri == uri)
return editor;
return nullptr;
}
inline void lsp_handle(json &message) {
std::string method = message.value("method", "");
if (method == "window/showMessage") {
if (message.contains("params")) {
auto &p = message["params"];
if (p.contains("message"))
log("%s\n", p["message"].get<std::string>().c_str());
}
} else if (method == "window/logMessage") {
if (message.contains("params")) {
auto &p = message["params"];
if (p.contains("message"))
log("%s\n", p["message"].get<std::string>().c_str());
}
}
}
void send(std::unique_ptr<LSPMessage> message) {
if (pid == -1)
return;
message->message["jsonrpc"] = "2.0";
if (message->callback)
message->message["id"] = ++last_id;
outbox.push(message->message);
if (!message->callback)
return;
std::lock_guard lock(lsp::lsp_mutex);
pending[last_id] = std::move(message);
}
};
#endif

View File

@@ -1,7 +1,8 @@
#ifndef MAIN_H
#define MAIN_H
#include "./pch.h"
#include "pch.h"
#include "ui/bar.h"
#define NORMAL 0
#define INSERT 1
@@ -10,6 +11,11 @@
#define JUMPER 4
extern std::atomic<bool> running;
extern uint8_t mode;
extern std::atomic<uint8_t> mode;
extern fs::path pwd;
namespace ui {
extern Bar bar;
} // namespace ui
#endif

View File

@@ -1,134 +0,0 @@
#ifndef MAPS_H
#define MAPS_H
#include "./lsp.h"
#include "./pch.h"
#include "./ts_def.h"
static const std::unordered_map<uint8_t, LSP> kLsps = {
{1,
{"clangd",
{
"clangd",
"--background-index",
"--clang-tidy",
"--completion-style=detailed",
"--header-insertion=never",
"--pch-storage=memory",
"--limit-results=50",
"--log=error",
nullptr,
}}},
};
static const std::unordered_map<std::string, Language> kLanguages = {
{"bash", {"bash", LANG(bash)}},
{"c", {"c", LANG(c), 1}},
{"cpp", {"cpp", LANG(cpp), 1}},
{"h", {"h", LANG(cpp), 1}},
{"css", {"css", LANG(css)}},
{"fish", {"fish", LANG(fish)}},
{"go", {"go", LANG(go)}},
{"haskell", {"haskell", LANG(haskell)}},
{"html", {"html", LANG(html)}},
{"javascript", {"javascript", LANG(javascript)}},
{"json", {"json", LANG(json)}},
{"lua", {"lua", LANG(lua)}},
{"make", {"make", LANG(make)}},
{"python", {"python", LANG(python)}},
{"ruby", {"ruby", LANG(ruby)}},
{"diff", {"diff", LANG(diff)}},
{"embedded_template", {"embedded_template", LANG(embedded_template)}},
{"gdscript", {"gdscript", LANG(gdscript)}},
{"gitattributes", {"gitattributes", LANG(gitattributes)}},
{"gitignore", {"gitignore", LANG(gitignore)}},
{"gomod", {"gomod", LANG(gomod)}},
{"ini", {"ini", LANG(ini)}},
{"markdown", {"markdown", LANG(markdown)}},
{"nginx", {"nginx", LANG(nginx)}},
{"php", {"php", LANG(php)}},
{"query", {"query", LANG(query)}},
{"regex", {"regex", LANG(regex)}},
{"sql", {"sql", LANG(sql)}},
{"toml", {"toml", LANG(toml)}},
{"yaml", {"yaml", LANG(yaml)}},
{"cabal", {"cabal", LANG(cabal)}},
};
static const std::unordered_map<std::string, std::string> kExtToLang = {
{"sh", "bash"},
{"bash", "bash"},
{"c", "c"},
{"cpp", "cpp"},
{"cxx", "cpp"},
{"cc", "cpp"},
{"hpp", "h"},
{"hh", "h"},
{"hxx", "h"},
{"h", "h"},
{"css", "css"},
{"fish", "fish"},
{"go", "go"},
{"hs", "haskell"},
{"html", "html"},
{"htm", "html"},
{"js", "javascript"},
{"json", "json"},
{"lua", "lua"},
{"mk", "make"},
{"makefile", "make"},
{"py", "python"},
{"rb", "ruby"},
{"diff", "diff"},
{"erb", "embedded_template"},
{"etlua", "embedded_template"},
{"gd", "gdscript"},
{"gitattributes", "gitattributes"},
{"gitignore", "gitignore"},
{"mod", "gomod"},
{"ini", "ini"},
{"md", "markdown"},
{"markdown", "markdown"},
{"conf", "nginx"},
{"php", "php"},
{"scm", "query"},
{"regex", "regex"},
{"sql", "sql"},
{"toml", "toml"},
{"yaml", "yaml"},
{"yml", "yaml"},
{"cabal", "cabal"},
};
static const std::unordered_map<std::string, std::string> kMimeToLang = {
{"text/x-c", "c"},
{"text/x-c++", "cpp"},
{"text/x-shellscript", "bash"},
{"application/json", "json"},
{"text/javascript", "javascript"},
{"text/html", "html"},
{"text/css", "css"},
{"text/x-python", "python"},
{"text/x-ruby", "ruby"},
{"text/x-go", "go"},
{"text/x-haskell", "haskell"},
{"text/x-lua", "lua"},
{"text/x-diff", "diff"},
{"text/x-embedded-template", "embedded_template"},
{"text/x-gdscript", "gdscript"},
{"text/x-gitattributes", "gitattributes"},
{"text/x-gitignore", "gitignore"},
{"text/x-gomod", "gomod"},
{"text/x-ini", "ini"},
{"text/markdown", "markdown"},
{"text/x-nginx-conf", "nginx"},
{"application/x-php", "php"},
{"text/x-tree-sitter-query", "query"},
{"text/x-regex", "regex"},
{"text/x-sql", "sql"},
{"text/x-toml", "toml"},
{"text/x-yaml", "yaml"},
{"text/x-cabal", "cabal"},
};
#endif

View File

@@ -4,36 +4,53 @@
#define PCRE2_CODE_UNIT_WIDTH 8
#define PCRE_WORKSPACE_SIZE 512
#include "../libs/tree-sitter/lib/include/tree_sitter/api.h"
#include "mruby.h"
#include "mruby/array.h"
#include "mruby/compile.h"
#include "mruby/hash.h"
#include "mruby/irep.h"
#include "mruby/string.h"
#include <nlohmann/json.hpp>
#include <pcre2.h>
extern "C" {
#include "libgrapheme/grapheme.h"
#include "unicode_width/unicode_width.h"
}
#include <algorithm>
#include <atomic>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdarg>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fcntl.h>
#include <filesystem>
#include <fstream>
#include <functional>
#include <limits.h>
#include <magic.h>
#include <map>
#include <mutex>
#include <nlohmann/json.hpp>
#include <optional>
#include <pcre2.h>
#include <queue>
#include <set>
#include <shared_mutex>
#include <signal.h>
#include <stack>
#include <string.h>
#include <string>
#include <sys/ioctl.h>
#include <sys/poll.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <termios.h>
#include <thread>
#include <unistd.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using json = nlohmann::json;

52
include/ruby/decl.h Normal file
View File

@@ -0,0 +1,52 @@
#ifndef SCRIPTING_DECL_H
#define SCRIPTING_DECL_H
#include "syntax/decl.h"
#include "utils/utils.h"
#include "windows/decl.h"
namespace fs = std::filesystem;
extern std::unordered_map<std::string, std::pair<mrb_value, mrb_value>>
custom_highlighters;
extern mrb_state *mrb;
extern fs::path ruby_config_path;
struct BarLight {
uint32_t start;
uint32_t end;
Highlight highlight;
};
struct BarLine {
std::string line;
std::vector<BarLight> highlights;
Highlight get_highlight(uint32_t x) {
for (auto &hl : highlights) {
if (hl.start <= x && x <= hl.end)
return hl.highlight;
}
return {0xFFFFFF, 0, 0};
}
};
void setup_ruby_bindings(mrb_state *mrb, RClass *C_module);
void ruby_start();
void ruby_shutdown();
void ruby_copy(const char *text, size_t len);
std::string ruby_paste();
std::string ruby_file_detect(std::string filename);
void load_theme();
void load_languages_info();
uint8_t read_line_endings();
void load_custom_highlighters();
bool custom_compare(mrb_value match_block, std::string state1,
std::string state2);
std::string parse_custom(std::vector<Token> *tokens, mrb_value parser_block,
const char *line, uint32_t len, std::string state,
uint32_t c_line);
BarLine bar_contents(uint8_t mode, uint32_t width, std::string foldername,
Window *window);
#endif

500
include/ruby/libcrib.rb Normal file
View File

@@ -0,0 +1,500 @@
def command_exists?(cmd)
system("command -v #{cmd} > /dev/null 2>&1")
end
module Clipboard
@clip = ""
@os = :os_name_placed_here
class << self
def copy(text)
if @os == :windows
IO.popen("clip", "w") { |f| f.write(text) }
elsif @os == :mac
IO.popen("pbcopy", "w") { |f| f.write(text) }
elsif @os == :linux
if ENV["XDG_SESSION_TYPE"]&.downcase == "wayland" || ENV["WAYLAND_DISPLAY"]
if command_exists?("wl-copy")
IO.popen("wl-copy", "w") { |f| f.write(text) }
else
osc52_copy(text)
end
elsif ENV["XDG_SESSION_TYPE"]&.downcase == "x11" || ENV["DISPLAY"]
if command_exists?("xsel")
IO.popen("xsel --clipboard --input", "w") { |f| f.write(text) }
elsif command_exists?("xclip")
IO.popen("xclip -selection clipboard", "w") { |f| f.write(text) }
else
osc52_copy(text)
end
end
end
@clip = text
end
def paste
if @os == :windows
return `powershell -NoProfile -Command Get-Clipboard`
elsif @os == :mac
return `pbpaste`
elsif @os == :linux
if ENV["XDG_SESSION_TYPE"]&.downcase == "wayland" || ENV["WAYLAND_DISPLAY"]
if command_exists?("wl-copy")
return `wl-paste`
end
elsif ENV["XDG_SESSION_TYPE"]&.downcase == "x11" || ENV["DISPLAY"]
if command_exists?("xsel")
return `xsel --clipboard --output`
elsif command_exists?("xclip")
return `xclip -selection clipboard -o`
else
return @clip
end
end
end
return ""
end
def osc52_copy(text)
encoded = [text].pack("m0")
print "\e]52;c;#{encoded}\a"
text
end
end
end
module C
@lsp_config = {
"clangd" => [
"--background-index",
"--clang-tidy",
"--completion-style=detailed",
"--header-insertion=never",
"--pch-storage=memory",
"--limit-results=50",
"--log=error"
],
"ruby-lsp" => [],
"solargraph" => ["stdio"],
"bash-language-server" => ["start"],
"vscode-css-language-server" => ["--stdio"],
"vscode-json-language-server" => ["--stdio"],
"fish-lsp" => ["start"],
"gopls" => ["serve"],
"haskell-language-server" => ["lsp"],
"emmet-language-server" => ["--stdio"],
"typescript-language-server" => ["--stdio"],
"lua-language-server" => [],
"pyright-langserver" => ["--stdio"],
"rust-analyzer" => [],
"intelephense" => ["--stdio"],
"marksman" => ["server"],
"nginx-language-server" => [],
"taplo" => ["lsp", "stdio"],
"yaml-language-server" => ["--stdio"],
"sqls" => ["serve"],
"make-language-server" => [],
"sql-language-server" => ["up", "--method", "stdio"]
}
@languages = {
c: {
color: 0x555555,
symbol: "",
extensions: ["c"],
lsp: "clangd"
},
cpp: {
color: 0x00599C,
symbol: "",
extensions: ["cpp", "cc", "cxx"],
lsp: "clangd"
},
h: {
color: 0xA8B9CC,
symbol: "",
extensions: ["h", "hpp"],
lsp: "clangd"
},
css: {
color: 0x36a3d9,
symbol: "",
extensions: ["css"],
lsp: "vscode-css-language-server"
},
fish: {
color: 0x4d5a5e,
symbol: "",
extensions: ["fish"],
lsp: "fish-lsp"
},
go: {
color: 0x00add8,
symbol: "",
extensions: ["go"],
lsp: "gopls"
},
gomod: {
color: 0x00add8,
symbol: "",
extensions: ["mod"],
lsp: "gopls"
},
haskell: {
color: 0xa074c4,
symbol: "",
extensions: ["hs", "lhs"],
lsp: "haskell-language-server"
},
html: {
color: 0xef8a91,
symbol: "",
extensions: ["html", "htm"],
lsp: "emmet-language-server"
},
javascript: {
color: 0xf0df8a,
symbol: "",
extensions: ["js"],
lsp: "typescript-language-server"
},
typescript: {
color: 0x36a3d9,
symbol: "",
extensions: ["ts"],
lsp: "typescript-language-server"
},
json: {
color: 0xcbcb41,
symbol: "{}",
extensions: ["json"],
lsp: "vscode-json-language-server"
},
jsonc: {
color: 0xcbcb41,
symbol: "{}",
extensions: ["jsonc"],
lsp: "vscode-json-language-server"
},
erb: {
color: 0x6e1516,
symbol: "",
extensions: ["erb"],
lsp: "emmet-language-server"
},
lua: {
color: 0x36a3d9,
symbol: "󰢱 ",
extensions: ["lua"],
lsp: "lua-language-server"
},
python: {
color: 0x95e6cb,
symbol: "󰌠 ",
extensions: ["py"],
lsp: "pyright"
},
rust: {
color: 0xdea584,
symbol: "󱘗 ",
extensions: ["rs"],
lsp: "rust-analyzer"
},
php: {
color: 0xa074c4,
symbol: "󰌟 ",
extensions: ["php"],
lsp: "intelephense"
},
markdown: {
color: 0x36a3d9,
symbol: "",
extensions: ["md", "markdown"],
lsp: "marksman"
},
nginx: {
color: 0x6d8086,
symbol: "",
extensions: ["conf"],
lsp: "nginx-language-server"
},
toml: {
color: 0x36a3d9,
symbol: "",
extensions: ["toml"],
lsp: "taplo"
},
yaml: {
color: 0x6d8086,
symbol: "",
extensions: ["yml", "yaml"],
lsp: "yaml-language-server"
},
sql: {
color: 0xdad8d8,
symbol: "",
extensions: ["sql"],
lsp: "sqls"
},
make: {
color: 0x4e5c61,
symbol: "",
extensions: ["Makefile", "makefile"],
lsp: "make-language-server"
},
gdscript: {
color: 0x6d8086,
symbol: "",
extensions: ["gd"]
},
man: {
color: 0xdad8d8,
symbol: "",
extensions: ["man"]
},
diff: {
color: 0xDD4C35,
symbol: "",
extensions: ["diff", "patch"]
},
gitattributes: {
color: 0xF05032,
symbol: "",
extensions: ["gitattributes"]
},
gitignore: {
color: 0xF05032,
symbol: "",
extensions: ["gitignore"]
},
regex: {
color: 0x9E9E9E,
symbol: ".*",
extensions: ["regex"]
},
ini: {
color: 0x6d8086,
symbol: "",
extensions: ["ini"]
},
ruby: {
color: 0xff8087,
symbol: "󰴭 ",
extensions: ["rb"],
filenames: ["Gemfile"],
lsp: "solargraph"
},
bash: {
color: 0x4d5a5e,
symbol: "",
extensions: ["sh"],
filenames: ["bash_profile", "bashrc"],
lsp: "bash-language-server"
},
default: {
color: 0x6d8086,
symbol: "󰈚 ",
extensions: []
}
}
@theme = {
:default => { fg: 0xEEEEEE },
:shebang => { fg: 0x7DCFFF },
:error => { fg: 0xEF5168 },
:comment => { fg: 0xAAAAAA, italic: true },
:string => { fg: 0xAAD94C },
:escape => { fg: 0x7DCFFF },
:interpolation => { fg: 0x7DCFFF },
:regexp => { fg: 0xD2A6FF },
:number => { fg: 0xE6C08A },
:true => { fg: 0x7AE93C },
:false => { fg: 0xEF5168 },
:char => { fg: 0xFFAF70 },
:keyword => { fg: 0xFF8F40 },
:keywordoperator => { fg: 0xF07178 },
:operator => { fg: 0xFFFFFF, italic: true },
:function => { fg: 0xFFAF70 },
:type => { fg: 0xF07178 },
:constant => { fg: 0x7DCFFF },
:variableinstance => { fg: 0x95E6CB },
:variableglobal => { fg: 0xF07178 },
:annotation => { fg: 0x7DCFFF },
:directive => { fg: 0xFF8F40 },
:label => { fg: 0xD2A6FF },
:brace1 => { fg: 0xD2A6FF },
:brace2 => { fg: 0xFFAFAF },
:brace3 => { fg: 0xFFFF00 },
:brace4 => { fg: 0x0FFF0F },
:brace5 => { fg: 0xFF0F0F }
}
@line_endings = :auto_unix
@key_handlers = {}
@key_binds = {}
@highlighters = {}
@b_startup = nil
@b_shutdown = nil
@b_bar = proc do |info|
# mode, width, data[5] : strings (any data about the focused window)
# puts info.inspect
mode_color = 0x82AAFF
mode_symbol = " "
case info[:mode]
when :normal
mode_color = 0x82AAFF
mode_symbol = ""
when :insert
mode_color = 0xFF8F40
mode_symbol = "󱓧 "
when :select
mode_color = 0x9ADE7A
mode_symbol = "󱩧 "
when :runner
mode_color = 0xFFD700
mode_symbol = ""
when :jumper
mode_color = 0xF29CC3
mode_symbol = ""
end
lang_info = C.languages[:default]
filename = ""
if info[:data][0] == "editor"
lang_info = C.languages[info[:data][2]] if info[:data][2] != ""
if lang_info.nil?
lang_info = C.languages[:default]
end
filename = File.basename(info[:data][1]) if info[:data][1] != ""
end
starting = " #{mode_symbol} #{info[:mode].to_s.upcase}  #{lang_info[:symbol]} #{filename}"
highlights = []
highlights << { fg: 0x0b0e14, bg: mode_color, flags: 1 << 1, start: 0, length: 10 }
highlights << { fg: mode_color, bg: 0x33363c, start: 10, length: 1 }
highlights << { fg: 0x33363c, bg: 0x24272d, start: 11, length: 1 }
highlights << { fg: lang_info[:color], bg: 0x24272d, start: 13, length: 2 }
highlights << { fg: 0xced4df, bg: 0x24272d, start: 15, length: filename.length + 1 }
highlights << { fg: 0x24272d, bg: 0x000000, start: 15 + filename.length + 1, length: 1 }
next {
text: starting,
highlights: highlights
}
end
@b_copy = proc do |text|
Clipboard.copy(text)
end
@b_paste = proc do
next Clipboard.paste
end
@b_file_detect = proc do |filename|
type = :default
next type unless File.exist?(filename)
first_line = File.open(filename, &:readline).chomp
if first_line.start_with?("#!")
shebang = first_line[2..].downcase
type = case shebang
when /bash/, /sh/ then :bash
when /fish/ then :fish
when /python/ then :python
when /ruby/ then :ruby
when /lua/ then :lua
else :default
end
next type
end
next type if :os_name_placed_here != :linux || :os_name_placed_here != :mac
next type if !command_exists?("file")
mimetype = `file --mime-type -b #{filename}`.chomp
type = case mimetype
when /shellscript/ then :bash
when /ruby/ then :ruby
when /diff/ then :diff
when /html/ then :html
when /python/ then :python
when /javascript/ then :javascript
when /makefile/ then :makefile
when /-c$/ then :c
else :default
end
next type
end
class << self
attr_accessor :theme, :lsp_config, :languages,
:line_endings, :highlighters
attr_reader :b_startup, :b_shutdown, :b_extra_highlights,
:b_bar, :b_copy, :b_paste, :b_file_detect
def bar=(&block)
@b_bar = block
end
def startup(&block)
@b_startup = block
end
def shutdown(&block)
@b_shutdown = block
end
def copy(&block)
@b_copy = block
end
def paste(&block)
@b_paste = block
end
def file_detect(&block)
@b_file_detect = block
end
def extra_highlights(&block)
@b_extra_highlights = block
end
def bind(modes, keys = nil, action = nil, &block)
modes = [modes] unless modes.is_a?(Array)
if keys.nil?
app = self
dsl = Object.new
dsl.define_singleton_method(:set) do |k, act = nil, &blk|
app.bind(modes, k, act, &blk)
end
dsl.instance_exec(&block) if block_given?
elsif block_given?
keys = [keys] unless keys.is_a?(Array)
modes.each do |mode|
keys.each do |key|
@key_handlers[mode] ||= {}
@key_handlers[mode][key] ||= []
@key_handlers[mode][key] << block
end
end
elsif action.is_a?(String)
keys = [keys] unless keys.is_a?(Array)
modes.each do |mode|
keys.each do |key|
@key_binds[mode] ||= {}
@key_binds[mode][key] ||= []
@key_binds[mode][key] << action
end
end
end
end
end
end
$LOADED ||= []
$BIND_TOP = binding
module Kernel
def require_relative(path, bind = nil)
path += ".rb" unless path.end_with?(".rb")
path = File.expand_path(path, File.dirname(C.config_file))
return if $LOADED.include?(path)
$LOADED << path
code = File.read(path)
eval(code, bind || $BIND_TOP, path)
end
def load(path, bind = nil)
path += ".rb" unless path.end_with?(".rb")
path = File.expand_path(path, File.dirname(C.config_file))
$LOADED.delete(path)
require_relative(path, bind)
end
end

View File

@@ -0,0 +1,946 @@
#pragma once
constexpr unsigned char _tmp___crib_precompiled_mrb[] = {
0x52, 0x49, 0x54, 0x45, 0x30, 0x34, 0x30, 0x30, 0x00, 0x00, 0x2c, 0x1d,
0x4d, 0x41, 0x54, 0x5a, 0x30, 0x30, 0x30, 0x30, 0x49, 0x52, 0x45, 0x50,
0x00, 0x00, 0x2a, 0x89, 0x30, 0x34, 0x30, 0x30, 0x00, 0x00, 0x00, 0xa2,
0x00, 0x01, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a,
0x11, 0x01, 0x68, 0x01, 0x00, 0x69, 0x01, 0x00, 0x6b, 0x01, 0x01, 0x01,
0x11, 0x01, 0x68, 0x01, 0x02, 0x69, 0x01, 0x02, 0x11, 0x01, 0x68, 0x01,
0x03, 0x69, 0x01, 0x03, 0x15, 0x01, 0x04, 0x27, 0x01, 0x00, 0x06, 0x52,
0x01, 0x00, 0x16, 0x01, 0x04, 0x30, 0x01, 0x05, 0x16, 0x01, 0x06, 0x11,
0x01, 0x68, 0x01, 0x07, 0x69, 0x01, 0x04, 0x3d, 0x01, 0x76, 0x00, 0x00,
0x00, 0x08, 0x00, 0x06, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x00, 0x00,
0x0f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x5f, 0x65, 0x78, 0x69,
0x73, 0x74, 0x73, 0x3f, 0x00, 0x00, 0x09, 0x43, 0x6c, 0x69, 0x70, 0x62,
0x6f, 0x61, 0x72, 0x64, 0x00, 0x00, 0x01, 0x43, 0x00, 0x00, 0x07, 0x24,
0x4c, 0x4f, 0x41, 0x44, 0x45, 0x44, 0x00, 0x00, 0x07, 0x62, 0x69, 0x6e,
0x64, 0x69, 0x6e, 0x67, 0x00, 0x00, 0x09, 0x24, 0x42, 0x49, 0x4e, 0x44,
0x5f, 0x54, 0x4f, 0x50, 0x00, 0x00, 0x06, 0x4b, 0x65, 0x72, 0x6e, 0x65,
0x6c, 0x00, 0x00, 0x00, 0x03, 0xfc, 0x00, 0x01, 0x00, 0x03, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x3b, 0x06, 0x01, 0x1e, 0x01, 0x00, 0x07,
0x01, 0x1e, 0x01, 0x01, 0x08, 0x01, 0x1e, 0x01, 0x02, 0x09, 0x01, 0x1e,
0x01, 0x03, 0x0a, 0x01, 0x1e, 0x01, 0x04, 0x0b, 0x01, 0x1e, 0x01, 0x05,
0x0c, 0x01, 0x1e, 0x01, 0x06, 0x0d, 0x01, 0x1e, 0x01, 0x07, 0x03, 0x01,
0x08, 0x1e, 0x01, 0x08, 0x03, 0x01, 0x09, 0x1e, 0x01, 0x09, 0x03, 0x01,
0x0a, 0x1e, 0x01, 0x0a, 0x03, 0x01, 0x0b, 0x1e, 0x01, 0x0b, 0x03, 0x01,
0x0c, 0x1e, 0x01, 0x0c, 0x03, 0x01, 0x0d, 0x1e, 0x01, 0x0d, 0x03, 0x01,
0x0e, 0x1e, 0x01, 0x0e, 0x03, 0x01, 0x0f, 0x1e, 0x01, 0x0f, 0x03, 0x01,
0x10, 0x1e, 0x01, 0x10, 0x03, 0x01, 0x11, 0x1e, 0x01, 0x11, 0x03, 0x01,
0x12, 0x1e, 0x01, 0x12, 0x03, 0x01, 0x13, 0x1e, 0x01, 0x13, 0x03, 0x01,
0x14, 0x1e, 0x01, 0x14, 0x03, 0x01, 0x15, 0x1e, 0x01, 0x15, 0x03, 0x01,
0x16, 0x1e, 0x01, 0x16, 0x03, 0x01, 0x17, 0x1e, 0x01, 0x17, 0x03, 0x01,
0x18, 0x1e, 0x01, 0x18, 0x03, 0x01, 0x19, 0x1e, 0x01, 0x19, 0x03, 0x01,
0x1a, 0x1e, 0x01, 0x1a, 0x03, 0x01, 0x1b, 0x1e, 0x01, 0x1b, 0x03, 0x01,
0x1c, 0x1e, 0x01, 0x1c, 0x03, 0x01, 0x1d, 0x1e, 0x01, 0x1d, 0x03, 0x01,
0x1e, 0x1e, 0x01, 0x1e, 0x03, 0x01, 0x1f, 0x1e, 0x01, 0x1f, 0x03, 0x01,
0x20, 0x1e, 0x01, 0x20, 0x03, 0x01, 0x21, 0x1e, 0x01, 0x21, 0x03, 0x01,
0x22, 0x1e, 0x01, 0x22, 0x03, 0x01, 0x23, 0x1e, 0x01, 0x23, 0x03, 0x01,
0x24, 0x1e, 0x01, 0x24, 0x03, 0x01, 0x25, 0x1e, 0x01, 0x25, 0x03, 0x01,
0x26, 0x1e, 0x01, 0x26, 0x03, 0x01, 0x27, 0x1e, 0x01, 0x27, 0x03, 0x01,
0x28, 0x1e, 0x01, 0x28, 0x03, 0x01, 0x29, 0x1e, 0x01, 0x29, 0x03, 0x01,
0x2a, 0x1e, 0x01, 0x2a, 0x03, 0x01, 0x2b, 0x1e, 0x01, 0x2b, 0x03, 0x01,
0x2c, 0x1e, 0x01, 0x2c, 0x03, 0x01, 0x2d, 0x1e, 0x01, 0x2d, 0x03, 0x01,
0x2e, 0x1e, 0x01, 0x2e, 0x03, 0x01, 0x2f, 0x1e, 0x01, 0x2f, 0x03, 0x01,
0x30, 0x1e, 0x01, 0x30, 0x03, 0x01, 0x31, 0x1e, 0x01, 0x31, 0x03, 0x01,
0x32, 0x1e, 0x01, 0x32, 0x03, 0x01, 0x33, 0x1e, 0x01, 0x33, 0x03, 0x01,
0x34, 0x1e, 0x01, 0x34, 0x30, 0x01, 0x35, 0x3d, 0x00, 0x00, 0x00, 0x00,
0x36, 0x00, 0x06, 0x4b, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x00, 0x00, 0x09,
0x4b, 0x5f, 0x53, 0x48, 0x45, 0x42, 0x41, 0x4e, 0x47, 0x00, 0x00, 0x09,
0x4b, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x45, 0x4e, 0x54, 0x00, 0x00, 0x07,
0x4b, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x00, 0x00, 0x08, 0x4b, 0x5f,
0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x00, 0x00, 0x08, 0x4b, 0x5f, 0x45,
0x53, 0x43, 0x41, 0x50, 0x45, 0x00, 0x00, 0x0f, 0x4b, 0x5f, 0x49, 0x4e,
0x54, 0x45, 0x52, 0x50, 0x4f, 0x4c, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x00,
0x00, 0x08, 0x4b, 0x5f, 0x52, 0x45, 0x47, 0x45, 0x58, 0x50, 0x00, 0x00,
0x08, 0x4b, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x00, 0x00, 0x06,
0x4b, 0x5f, 0x54, 0x52, 0x55, 0x45, 0x00, 0x00, 0x07, 0x4b, 0x5f, 0x46,
0x41, 0x4c, 0x53, 0x45, 0x00, 0x00, 0x06, 0x4b, 0x5f, 0x43, 0x48, 0x41,
0x52, 0x00, 0x00, 0x09, 0x4b, 0x5f, 0x4b, 0x45, 0x59, 0x57, 0x4f, 0x52,
0x44, 0x00, 0x00, 0x11, 0x4b, 0x5f, 0x4b, 0x45, 0x59, 0x57, 0x4f, 0x52,
0x44, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, 0x00, 0x00, 0x0a,
0x4b, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, 0x00, 0x00,
0x0a, 0x4b, 0x5f, 0x46, 0x55, 0x4e, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x00,
0x00, 0x06, 0x4b, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x00, 0x00, 0x0a, 0x4b,
0x5f, 0x43, 0x4f, 0x4e, 0x53, 0x54, 0x41, 0x4e, 0x54, 0x00, 0x00, 0x12,
0x4b, 0x5f, 0x56, 0x41, 0x52, 0x49, 0x41, 0x42, 0x4c, 0x45, 0x49, 0x4e,
0x53, 0x54, 0x41, 0x4e, 0x43, 0x45, 0x00, 0x00, 0x10, 0x4b, 0x5f, 0x56,
0x41, 0x52, 0x49, 0x41, 0x42, 0x4c, 0x45, 0x47, 0x4c, 0x4f, 0x42, 0x41,
0x4c, 0x00, 0x00, 0x0c, 0x4b, 0x5f, 0x41, 0x4e, 0x4e, 0x4f, 0x54, 0x41,
0x54, 0x49, 0x4f, 0x4e, 0x00, 0x00, 0x0b, 0x4b, 0x5f, 0x44, 0x49, 0x52,
0x45, 0x43, 0x54, 0x49, 0x56, 0x45, 0x00, 0x00, 0x07, 0x4b, 0x5f, 0x4c,
0x41, 0x42, 0x45, 0x4c, 0x00, 0x00, 0x08, 0x4b, 0x5f, 0x42, 0x52, 0x41,
0x43, 0x45, 0x31, 0x00, 0x00, 0x08, 0x4b, 0x5f, 0x42, 0x52, 0x41, 0x43,
0x45, 0x32, 0x00, 0x00, 0x08, 0x4b, 0x5f, 0x42, 0x52, 0x41, 0x43, 0x45,
0x33, 0x00, 0x00, 0x08, 0x4b, 0x5f, 0x42, 0x52, 0x41, 0x43, 0x45, 0x34,
0x00, 0x00, 0x08, 0x4b, 0x5f, 0x42, 0x52, 0x41, 0x43, 0x45, 0x35, 0x00,
0x00, 0x0a, 0x4b, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x49, 0x4e, 0x47, 0x31,
0x00, 0x00, 0x0a, 0x4b, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x49, 0x4e, 0x47,
0x32, 0x00, 0x00, 0x0a, 0x4b, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x49, 0x4e,
0x47, 0x33, 0x00, 0x00, 0x0a, 0x4b, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x49,
0x4e, 0x47, 0x34, 0x00, 0x00, 0x0a, 0x4b, 0x5f, 0x48, 0x45, 0x41, 0x44,
0x49, 0x4e, 0x47, 0x35, 0x00, 0x00, 0x0a, 0x4b, 0x5f, 0x48, 0x45, 0x41,
0x44, 0x49, 0x4e, 0x47, 0x36, 0x00, 0x00, 0x0c, 0x4b, 0x5f, 0x42, 0x4c,
0x4f, 0x43, 0x4b, 0x51, 0x55, 0x4f, 0x54, 0x45, 0x00, 0x00, 0x06, 0x4b,
0x5f, 0x4c, 0x49, 0x53, 0x54, 0x00, 0x00, 0x0a, 0x4b, 0x5f, 0x4c, 0x49,
0x53, 0x54, 0x49, 0x54, 0x45, 0x4d, 0x00, 0x00, 0x06, 0x4b, 0x5f, 0x43,
0x4f, 0x44, 0x45, 0x00, 0x00, 0x0e, 0x4b, 0x5f, 0x4c, 0x41, 0x4e, 0x47,
0x55, 0x41, 0x47, 0x45, 0x4e, 0x41, 0x4d, 0x45, 0x00, 0x00, 0x0b, 0x4b,
0x5f, 0x4c, 0x49, 0x4e, 0x4b, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x00, 0x00,
0x0c, 0x4b, 0x5f, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x4c, 0x41, 0x42, 0x45,
0x4c, 0x00, 0x00, 0x06, 0x4b, 0x5f, 0x4c, 0x49, 0x4e, 0x4b, 0x00, 0x00,
0x07, 0x4b, 0x5f, 0x54, 0x41, 0x42, 0x4c, 0x45, 0x00, 0x00, 0x0d, 0x4b,
0x5f, 0x54, 0x41, 0x42, 0x4c, 0x45, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52,
0x00, 0x00, 0x08, 0x4b, 0x5f, 0x49, 0x54, 0x41, 0x4c, 0x49, 0x43, 0x00,
0x00, 0x06, 0x4b, 0x5f, 0x42, 0x4f, 0x4c, 0x44, 0x00, 0x00, 0x0b, 0x4b,
0x5f, 0x55, 0x4e, 0x44, 0x45, 0x52, 0x4c, 0x49, 0x4e, 0x45, 0x00, 0x00,
0x0f, 0x4b, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4b, 0x45, 0x54, 0x48, 0x52,
0x4f, 0x55, 0x47, 0x48, 0x00, 0x00, 0x10, 0x4b, 0x5f, 0x48, 0x4f, 0x52,
0x49, 0x58, 0x4f, 0x4e, 0x54, 0x41, 0x4c, 0x52, 0x55, 0x4c, 0x45, 0x00,
0x00, 0x05, 0x4b, 0x5f, 0x54, 0x41, 0x47, 0x00, 0x00, 0x0b, 0x4b, 0x5f,
0x41, 0x54, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x45, 0x00, 0x00, 0x0b,
0x4b, 0x5f, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x44, 0x4f, 0x4e, 0x45, 0x00,
0x00, 0x0e, 0x4b, 0x5f, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x4e, 0x4f, 0x54,
0x44, 0x4f, 0x4e, 0x45, 0x00, 0x00, 0x06, 0x66, 0x72, 0x65, 0x65, 0x7a,
0x65, 0x00, 0x00, 0x00, 0x00, 0x58, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x39, 0x04, 0x00, 0x00, 0x5c, 0x04,
0x00, 0x01, 0x05, 0x01, 0x5d, 0x04, 0x5c, 0x05, 0x01, 0x5d, 0x04, 0x2f,
0x03, 0x00, 0x01, 0x3d, 0x03, 0x00, 0x02, 0x00, 0x00, 0x0b, 0x63, 0x6f,
0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x20, 0x2d, 0x76, 0x20, 0x00, 0x00, 0x00,
0x11, 0x20, 0x3e, 0x20, 0x2f, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x75, 0x6c,
0x6c, 0x20, 0x32, 0x3e, 0x26, 0x31, 0x00, 0x00, 0x01, 0x00, 0x06, 0x73,
0x79, 0x73, 0x74, 0x65, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x43, 0x00, 0x01,
0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x5c, 0x01,
0x00, 0x1a, 0x01, 0x00, 0x10, 0x01, 0x01, 0x1a, 0x01, 0x02, 0x12, 0x01,
0x6f, 0x01, 0x69, 0x01, 0x00, 0x3d, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0x00, 0x05, 0x40, 0x63, 0x6c, 0x69, 0x70, 0x00, 0x00,
0x05, 0x6c, 0x69, 0x6e, 0x75, 0x78, 0x00, 0x00, 0x03, 0x40, 0x6f, 0x73,
0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x01, 0x00, 0x01, 0x00, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0e, 0x6b, 0x01, 0x00, 0x00, 0x6b, 0x01, 0x01,
0x01, 0x6b, 0x01, 0x02, 0x02, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
0x04, 0x63, 0x6f, 0x70, 0x79, 0x00, 0x00, 0x05, 0x70, 0x61, 0x73, 0x74,
0x65, 0x00, 0x00, 0x0a, 0x6f, 0x73, 0x63, 0x35, 0x32, 0x5f, 0x63, 0x6f,
0x70, 0x79, 0x00, 0x00, 0x00, 0x02, 0x37, 0x00, 0x03, 0x00, 0x07, 0x00,
0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0f, 0x39, 0x04, 0x00, 0x00, 0x19,
0x03, 0x00, 0x10, 0x04, 0x01, 0x4d, 0x03, 0x28, 0x03, 0x00, 0x13, 0x1d,
0x03, 0x02, 0x5c, 0x04, 0x00, 0x5c, 0x05, 0x01, 0x62, 0x06, 0x00, 0x34,
0x03, 0x03, 0x02, 0x26, 0x00, 0xe4, 0x19, 0x03, 0x00, 0x10, 0x04, 0x04,
0x4d, 0x03, 0x28, 0x03, 0x00, 0x13, 0x1d, 0x03, 0x02, 0x5c, 0x04, 0x02,
0x5c, 0x05, 0x01, 0x62, 0x06, 0x01, 0x34, 0x03, 0x03, 0x02, 0x26, 0x00,
0xc5, 0x19, 0x03, 0x00, 0x10, 0x04, 0x05, 0x4d, 0x03, 0x28, 0x03, 0x00,
0xb9, 0x1d, 0x03, 0x06, 0x5c, 0x04, 0x03, 0x23, 0x03, 0x01, 0x04, 0x03,
0x29, 0x04, 0x00, 0x03, 0x33, 0x03, 0x07, 0x5c, 0x04, 0x04, 0x4d, 0x03,
0x27, 0x03, 0x00, 0x08, 0x1d, 0x03, 0x06, 0x5c, 0x04, 0x05, 0x23, 0x03,
0x28, 0x03, 0x00, 0x28, 0x5c, 0x04, 0x06, 0x2f, 0x03, 0x08, 0x01, 0x28,
0x03, 0x00, 0x13, 0x1d, 0x03, 0x02, 0x5c, 0x04, 0x06, 0x5c, 0x05, 0x01,
0x62, 0x06, 0x02, 0x34, 0x03, 0x03, 0x02, 0x26, 0x00, 0x07, 0x01, 0x04,
0x01, 0x2f, 0x03, 0x09, 0x01, 0x26, 0x00, 0x6a, 0x1d, 0x03, 0x06, 0x5c,
0x04, 0x03, 0x23, 0x03, 0x01, 0x04, 0x03, 0x29, 0x04, 0x00, 0x03, 0x33,
0x03, 0x07, 0x5c, 0x04, 0x07, 0x4d, 0x03, 0x27, 0x03, 0x00, 0x08, 0x1d,
0x03, 0x06, 0x5c, 0x04, 0x08, 0x23, 0x03, 0x28, 0x03, 0x00, 0x43, 0x5c,
0x04, 0x09, 0x2f, 0x03, 0x08, 0x01, 0x28, 0x03, 0x00, 0x13, 0x1d, 0x03,
0x02, 0x5c, 0x04, 0x0a, 0x5c, 0x05, 0x01, 0x62, 0x06, 0x03, 0x34, 0x03,
0x03, 0x02, 0x26, 0x00, 0x25, 0x5c, 0x04, 0x0b, 0x2f, 0x03, 0x08, 0x01,
0x28, 0x03, 0x00, 0x13, 0x1d, 0x03, 0x02, 0x5c, 0x04, 0x0c, 0x5c, 0x05,
0x01, 0x62, 0x06, 0x04, 0x34, 0x03, 0x03, 0x02, 0x26, 0x00, 0x07, 0x01,
0x04, 0x01, 0x2f, 0x03, 0x09, 0x01, 0x01, 0x03, 0x01, 0x1a, 0x03, 0x0a,
0x3d, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x04, 0x63, 0x6c, 0x69, 0x70, 0x00,
0x00, 0x00, 0x01, 0x77, 0x00, 0x00, 0x00, 0x06, 0x70, 0x62, 0x63, 0x6f,
0x70, 0x79, 0x00, 0x00, 0x00, 0x10, 0x58, 0x44, 0x47, 0x5f, 0x53, 0x45,
0x53, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x00, 0x00,
0x00, 0x07, 0x77, 0x61, 0x79, 0x6c, 0x61, 0x6e, 0x64, 0x00, 0x00, 0x00,
0x0f, 0x57, 0x41, 0x59, 0x4c, 0x41, 0x4e, 0x44, 0x5f, 0x44, 0x49, 0x53,
0x50, 0x4c, 0x41, 0x59, 0x00, 0x00, 0x00, 0x07, 0x77, 0x6c, 0x2d, 0x63,
0x6f, 0x70, 0x79, 0x00, 0x00, 0x00, 0x03, 0x78, 0x31, 0x31, 0x00, 0x00,
0x00, 0x07, 0x44, 0x49, 0x53, 0x50, 0x4c, 0x41, 0x59, 0x00, 0x00, 0x00,
0x04, 0x78, 0x73, 0x65, 0x6c, 0x00, 0x00, 0x00, 0x18, 0x78, 0x73, 0x65,
0x6c, 0x20, 0x2d, 0x2d, 0x63, 0x6c, 0x69, 0x70, 0x62, 0x6f, 0x61, 0x72,
0x64, 0x20, 0x2d, 0x2d, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x00, 0x00, 0x00,
0x05, 0x78, 0x63, 0x6c, 0x69, 0x70, 0x00, 0x00, 0x00, 0x1a, 0x78, 0x63,
0x6c, 0x69, 0x70, 0x20, 0x2d, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x20, 0x63, 0x6c, 0x69, 0x70, 0x62, 0x6f, 0x61, 0x72, 0x64,
0x00, 0x00, 0x0b, 0x00, 0x03, 0x40, 0x6f, 0x73, 0x00, 0x00, 0x07, 0x77,
0x69, 0x6e, 0x64, 0x6f, 0x77, 0x73, 0x00, 0x00, 0x02, 0x49, 0x4f, 0x00,
0x00, 0x05, 0x70, 0x6f, 0x70, 0x65, 0x6e, 0x00, 0x00, 0x03, 0x6d, 0x61,
0x63, 0x00, 0x00, 0x05, 0x6c, 0x69, 0x6e, 0x75, 0x78, 0x00, 0x00, 0x03,
0x45, 0x4e, 0x56, 0x00, 0x00, 0x08, 0x64, 0x6f, 0x77, 0x6e, 0x63, 0x61,
0x73, 0x65, 0x00, 0x00, 0x0f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64,
0x5f, 0x65, 0x78, 0x69, 0x73, 0x74, 0x73, 0x3f, 0x00, 0x00, 0x0a, 0x6f,
0x73, 0x63, 0x35, 0x32, 0x5f, 0x63, 0x6f, 0x70, 0x79, 0x00, 0x00, 0x05,
0x40, 0x63, 0x6c, 0x69, 0x70, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x03,
0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x39, 0x04,
0x00, 0x00, 0x01, 0x03, 0x01, 0x21, 0x04, 0x01, 0x00, 0x32, 0x03, 0x00,
0x01, 0x3d, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x77, 0x72, 0x69,
0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x03, 0x00, 0x06, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x39, 0x04, 0x00, 0x00, 0x01,
0x03, 0x01, 0x21, 0x04, 0x01, 0x00, 0x32, 0x03, 0x00, 0x01, 0x3d, 0x03,
0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x77, 0x72, 0x69, 0x74, 0x65, 0x00,
0x00, 0x00, 0x00, 0x2d, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x11, 0x39, 0x04, 0x00, 0x00, 0x01, 0x03, 0x01, 0x21,
0x04, 0x01, 0x00, 0x32, 0x03, 0x00, 0x01, 0x3d, 0x03, 0x00, 0x00, 0x00,
0x01, 0x00, 0x05, 0x77, 0x72, 0x69, 0x74, 0x65, 0x00, 0x00, 0x00, 0x00,
0x2d, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x11, 0x39, 0x04, 0x00, 0x00, 0x01, 0x03, 0x01, 0x21, 0x04, 0x01, 0x00,
0x32, 0x03, 0x00, 0x01, 0x3d, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05,
0x77, 0x72, 0x69, 0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x03,
0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x39, 0x04,
0x00, 0x00, 0x01, 0x03, 0x01, 0x21, 0x04, 0x01, 0x00, 0x32, 0x03, 0x00,
0x01, 0x3d, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x77, 0x72, 0x69,
0x74, 0x65, 0x00, 0x00, 0x00, 0x02, 0x27, 0x00, 0x02, 0x00, 0x05, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdd, 0x39, 0x00, 0x00, 0x00, 0x19,
0x02, 0x00, 0x10, 0x03, 0x01, 0x4d, 0x02, 0x28, 0x02, 0x00, 0x0c, 0x5c,
0x03, 0x00, 0x2f, 0x02, 0x02, 0x01, 0x3d, 0x02, 0x26, 0x00, 0xbc, 0x19,
0x02, 0x00, 0x10, 0x03, 0x03, 0x4d, 0x02, 0x28, 0x02, 0x00, 0x0c, 0x5c,
0x03, 0x01, 0x2f, 0x02, 0x02, 0x01, 0x3d, 0x02, 0x26, 0x00, 0xa4, 0x19,
0x02, 0x00, 0x10, 0x03, 0x04, 0x4d, 0x02, 0x28, 0x02, 0x00, 0x98, 0x1d,
0x02, 0x05, 0x5c, 0x03, 0x02, 0x23, 0x02, 0x01, 0x03, 0x02, 0x29, 0x03,
0x00, 0x03, 0x33, 0x02, 0x06, 0x5c, 0x03, 0x03, 0x4d, 0x02, 0x27, 0x02,
0x00, 0x08, 0x1d, 0x02, 0x05, 0x5c, 0x03, 0x04, 0x23, 0x02, 0x28, 0x02,
0x00, 0x17, 0x5c, 0x03, 0x05, 0x2f, 0x02, 0x07, 0x01, 0x28, 0x02, 0x00,
0x09, 0x5c, 0x03, 0x06, 0x2f, 0x02, 0x02, 0x01, 0x3d, 0x02, 0x26, 0x00,
0x5a, 0x1d, 0x02, 0x05, 0x5c, 0x03, 0x02, 0x23, 0x02, 0x01, 0x03, 0x02,
0x29, 0x03, 0x00, 0x03, 0x33, 0x02, 0x06, 0x5c, 0x03, 0x07, 0x4d, 0x02,
0x27, 0x02, 0x00, 0x08, 0x1d, 0x02, 0x05, 0x5c, 0x03, 0x08, 0x23, 0x02,
0x28, 0x02, 0x00, 0x33, 0x5c, 0x03, 0x09, 0x2f, 0x02, 0x07, 0x01, 0x28,
0x02, 0x00, 0x0c, 0x5c, 0x03, 0x0a, 0x2f, 0x02, 0x02, 0x01, 0x3d, 0x02,
0x26, 0x00, 0x1c, 0x5c, 0x03, 0x0b, 0x2f, 0x02, 0x07, 0x01, 0x28, 0x02,
0x00, 0x0c, 0x5c, 0x03, 0x0c, 0x2f, 0x02, 0x02, 0x01, 0x3d, 0x02, 0x26,
0x00, 0x05, 0x19, 0x02, 0x08, 0x3d, 0x02, 0x5c, 0x02, 0x0d, 0x3d, 0x02,
0x00, 0x0e, 0x00, 0x00, 0x2c, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x73, 0x68,
0x65, 0x6c, 0x6c, 0x20, 0x2d, 0x4e, 0x6f, 0x50, 0x72, 0x6f, 0x66, 0x69,
0x6c, 0x65, 0x20, 0x2d, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x20,
0x47, 0x65, 0x74, 0x2d, 0x43, 0x6c, 0x69, 0x70, 0x62, 0x6f, 0x61, 0x72,
0x64, 0x00, 0x00, 0x00, 0x07, 0x70, 0x62, 0x70, 0x61, 0x73, 0x74, 0x65,
0x00, 0x00, 0x00, 0x10, 0x58, 0x44, 0x47, 0x5f, 0x53, 0x45, 0x53, 0x53,
0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x00, 0x00, 0x00, 0x07,
0x77, 0x61, 0x79, 0x6c, 0x61, 0x6e, 0x64, 0x00, 0x00, 0x00, 0x0f, 0x57,
0x41, 0x59, 0x4c, 0x41, 0x4e, 0x44, 0x5f, 0x44, 0x49, 0x53, 0x50, 0x4c,
0x41, 0x59, 0x00, 0x00, 0x00, 0x07, 0x77, 0x6c, 0x2d, 0x63, 0x6f, 0x70,
0x79, 0x00, 0x00, 0x00, 0x08, 0x77, 0x6c, 0x2d, 0x70, 0x61, 0x73, 0x74,
0x65, 0x00, 0x00, 0x00, 0x03, 0x78, 0x31, 0x31, 0x00, 0x00, 0x00, 0x07,
0x44, 0x49, 0x53, 0x50, 0x4c, 0x41, 0x59, 0x00, 0x00, 0x00, 0x04, 0x78,
0x73, 0x65, 0x6c, 0x00, 0x00, 0x00, 0x19, 0x78, 0x73, 0x65, 0x6c, 0x20,
0x2d, 0x2d, 0x63, 0x6c, 0x69, 0x70, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x20,
0x2d, 0x2d, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x00, 0x05,
0x78, 0x63, 0x6c, 0x69, 0x70, 0x00, 0x00, 0x00, 0x1d, 0x78, 0x63, 0x6c,
0x69, 0x70, 0x20, 0x2d, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x20, 0x63, 0x6c, 0x69, 0x70, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x20,
0x2d, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x03, 0x40,
0x6f, 0x73, 0x00, 0x00, 0x07, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x73,
0x00, 0x00, 0x01, 0x60, 0x00, 0x00, 0x03, 0x6d, 0x61, 0x63, 0x00, 0x00,
0x05, 0x6c, 0x69, 0x6e, 0x75, 0x78, 0x00, 0x00, 0x03, 0x45, 0x4e, 0x56,
0x00, 0x00, 0x08, 0x64, 0x6f, 0x77, 0x6e, 0x63, 0x61, 0x73, 0x65, 0x00,
0x00, 0x0f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x5f, 0x65, 0x78,
0x69, 0x73, 0x74, 0x73, 0x3f, 0x00, 0x00, 0x05, 0x40, 0x63, 0x6c, 0x69,
0x70, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x27, 0x39, 0x04, 0x00, 0x00, 0x01, 0x04,
0x01, 0x52, 0x04, 0x01, 0x5c, 0x05, 0x00, 0x32, 0x04, 0x00, 0x01, 0x01,
0x03, 0x04, 0x5c, 0x05, 0x01, 0x01, 0x06, 0x03, 0x5d, 0x05, 0x5c, 0x06,
0x02, 0x5d, 0x05, 0x2f, 0x04, 0x01, 0x01, 0x3d, 0x01, 0x00, 0x03, 0x00,
0x00, 0x02, 0x6d, 0x30, 0x00, 0x00, 0x00, 0x07, 0x1b, 0x5d, 0x35, 0x32,
0x3b, 0x63, 0x3b, 0x00, 0x00, 0x00, 0x01, 0x07, 0x00, 0x00, 0x02, 0x00,
0x04, 0x70, 0x61, 0x63, 0x6b, 0x00, 0x00, 0x05, 0x70, 0x72, 0x69, 0x6e,
0x74, 0x00, 0x00, 0x00, 0x0f, 0xc7, 0x00, 0x01, 0x00, 0x4c, 0x00, 0x05,
0x00, 0x00, 0x00, 0x00, 0x07, 0xa8, 0x5c, 0x01, 0x00, 0x5c, 0x02, 0x01,
0x5c, 0x03, 0x02, 0x5c, 0x04, 0x03, 0x5c, 0x05, 0x04, 0x5c, 0x06, 0x05,
0x5c, 0x07, 0x06, 0x5c, 0x08, 0x07, 0x52, 0x02, 0x07, 0x5c, 0x03, 0x08,
0x52, 0x04, 0x00, 0x5c, 0x05, 0x09, 0x5c, 0x06, 0x0a, 0x52, 0x06, 0x01,
0x5c, 0x07, 0x0b, 0x5c, 0x08, 0x0c, 0x52, 0x08, 0x01, 0x5c, 0x09, 0x0d,
0x5c, 0x0a, 0x0e, 0x52, 0x0a, 0x01, 0x5c, 0x0b, 0x0f, 0x5c, 0x0c, 0x0e,
0x52, 0x0c, 0x01, 0x5c, 0x0d, 0x10, 0x5c, 0x0e, 0x0c, 0x52, 0x0e, 0x01,
0x5c, 0x0f, 0x11, 0x5c, 0x10, 0x12, 0x52, 0x10, 0x01, 0x5c, 0x11, 0x13,
0x5c, 0x12, 0x14, 0x52, 0x12, 0x01, 0x5c, 0x13, 0x15, 0x5c, 0x14, 0x0e,
0x52, 0x14, 0x01, 0x5c, 0x15, 0x16, 0x5c, 0x16, 0x0e, 0x52, 0x16, 0x01,
0x5c, 0x17, 0x17, 0x52, 0x18, 0x00, 0x5c, 0x19, 0x18, 0x5c, 0x1a, 0x0e,
0x52, 0x1a, 0x01, 0x5c, 0x1b, 0x19, 0x52, 0x1c, 0x00, 0x5c, 0x1d, 0x1a,
0x5c, 0x1e, 0x0e, 0x52, 0x1e, 0x01, 0x5c, 0x1f, 0x1b, 0x5c, 0x20, 0x1c,
0x52, 0x20, 0x01, 0x5c, 0x21, 0x1d, 0x52, 0x22, 0x00, 0x5c, 0x23, 0x1e,
0x5c, 0x24, 0x14, 0x5c, 0x25, 0x0a, 0x52, 0x24, 0x02, 0x5c, 0x25, 0x1f,
0x5c, 0x26, 0x0e, 0x52, 0x26, 0x01, 0x5c, 0x27, 0x20, 0x5c, 0x28, 0x12,
0x52, 0x28, 0x01, 0x5c, 0x29, 0x21, 0x52, 0x2a, 0x00, 0x5c, 0x2b, 0x22,
0x5c, 0x2c, 0x23, 0x5c, 0x2d, 0x24, 0x5c, 0x2e, 0x0a, 0x52, 0x2c, 0x03,
0x5e, 0x01, 0x16, 0x1a, 0x01, 0x00, 0x10, 0x01, 0x01, 0x10, 0x02, 0x02,
0x0f, 0x03, 0x00, 0x55, 0x55, 0x55, 0x10, 0x04, 0x03, 0x5c, 0x05, 0x25,
0x10, 0x06, 0x04, 0x5c, 0x07, 0x26, 0x52, 0x07, 0x01, 0x10, 0x08, 0x05,
0x5c, 0x09, 0x00, 0x5e, 0x02, 0x04, 0x10, 0x03, 0x06, 0x10, 0x04, 0x02,
0x0e, 0x05, 0x59, 0x9c, 0x10, 0x06, 0x03, 0x5c, 0x07, 0x27, 0x10, 0x08,
0x04, 0x5c, 0x09, 0x28, 0x5c, 0x0a, 0x29, 0x5c, 0x0b, 0x2a, 0x52, 0x09,
0x03, 0x10, 0x0a, 0x05, 0x5c, 0x0b, 0x00, 0x5e, 0x04, 0x04, 0x10, 0x05,
0x07, 0x10, 0x06, 0x02, 0x0f, 0x07, 0x00, 0xa8, 0xb9, 0xcc, 0x10, 0x08,
0x03, 0x5c, 0x09, 0x2b, 0x10, 0x0a, 0x04, 0x5c, 0x0b, 0x2c, 0x5c, 0x0c,
0x2d, 0x52, 0x0b, 0x02, 0x10, 0x0c, 0x05, 0x5c, 0x0d, 0x00, 0x5e, 0x06,
0x04, 0x10, 0x07, 0x08, 0x10, 0x08, 0x02, 0x0f, 0x09, 0x00, 0x36, 0xa3,
0xd9, 0x10, 0x0a, 0x03, 0x5c, 0x0b, 0x2e, 0x10, 0x0c, 0x04, 0x5c, 0x0d,
0x2f, 0x52, 0x0d, 0x01, 0x10, 0x0e, 0x05, 0x5c, 0x0f, 0x0d, 0x5e, 0x08,
0x04, 0x10, 0x09, 0x09, 0x10, 0x0a, 0x02, 0x0f, 0x0b, 0x00, 0x4d, 0x5a,
0x5e, 0x10, 0x0c, 0x03, 0x5c, 0x0d, 0x30, 0x10, 0x0e, 0x04, 0x5c, 0x0f,
0x31, 0x52, 0x0f, 0x01, 0x10, 0x10, 0x05, 0x5c, 0x11, 0x10, 0x5e, 0x0a,
0x04, 0x10, 0x0b, 0x0a, 0x10, 0x0c, 0x02, 0x0f, 0x0d, 0x00, 0x00, 0xad,
0xd8, 0x10, 0x0e, 0x03, 0x5c, 0x0f, 0x32, 0x10, 0x10, 0x04, 0x5c, 0x11,
0x33, 0x52, 0x11, 0x01, 0x10, 0x12, 0x05, 0x5c, 0x13, 0x11, 0x5e, 0x0c,
0x04, 0x10, 0x0d, 0x0b, 0x10, 0x0e, 0x02, 0x0f, 0x0f, 0x00, 0x00, 0xad,
0xd8, 0x10, 0x10, 0x03, 0x5c, 0x11, 0x32, 0x10, 0x12, 0x04, 0x5c, 0x13,
0x34, 0x52, 0x13, 0x01, 0x10, 0x14, 0x05, 0x5c, 0x15, 0x11, 0x5e, 0x0e,
0x04, 0x10, 0x0f, 0x0c, 0x10, 0x10, 0x02, 0x0f, 0x11, 0x00, 0xa0, 0x74,
0xc4, 0x10, 0x12, 0x03, 0x5c, 0x13, 0x35, 0x10, 0x14, 0x04, 0x5c, 0x15,
0x36, 0x5c, 0x16, 0x37, 0x52, 0x15, 0x02, 0x10, 0x16, 0x05, 0x5c, 0x17,
0x13, 0x5e, 0x10, 0x04, 0x10, 0x11, 0x0d, 0x10, 0x12, 0x02, 0x0f, 0x13,
0x00, 0xef, 0x8a, 0x91, 0x10, 0x14, 0x03, 0x5c, 0x15, 0x38, 0x10, 0x16,
0x04, 0x5c, 0x17, 0x39, 0x5c, 0x18, 0x3a, 0x52, 0x17, 0x02, 0x10, 0x18,
0x05, 0x5c, 0x19, 0x15, 0x5e, 0x12, 0x04, 0x10, 0x13, 0x0e, 0x10, 0x14,
0x02, 0x0f, 0x15, 0x00, 0xf0, 0xdf, 0x8a, 0x10, 0x16, 0x03, 0x5c, 0x17,
0x3b, 0x10, 0x18, 0x04, 0x5c, 0x19, 0x3c, 0x52, 0x19, 0x01, 0x10, 0x1a,
0x05, 0x5c, 0x1b, 0x16, 0x5e, 0x14, 0x04, 0x10, 0x15, 0x0f, 0x10, 0x16,
0x02, 0x0f, 0x17, 0x00, 0x36, 0xa3, 0xd9, 0x10, 0x18, 0x03, 0x5c, 0x19,
0x3d, 0x10, 0x1a, 0x04, 0x5c, 0x1b, 0x3e, 0x52, 0x1b, 0x01, 0x10, 0x1c,
0x05, 0x5c, 0x1d, 0x16, 0x5e, 0x16, 0x04, 0x10, 0x17, 0x10, 0x10, 0x18,
0x02, 0x0f, 0x19, 0x00, 0xcb, 0xcb, 0x41, 0x10, 0x1a, 0x03, 0x5c, 0x1b,
0x3f, 0x10, 0x1c, 0x04, 0x5c, 0x1d, 0x40, 0x52, 0x1d, 0x01, 0x10, 0x1e,
0x05, 0x5c, 0x1f, 0x0f, 0x5e, 0x18, 0x04, 0x10, 0x19, 0x11, 0x10, 0x1a,
0x02, 0x0f, 0x1b, 0x00, 0xcb, 0xcb, 0x41, 0x10, 0x1c, 0x03, 0x5c, 0x1d,
0x3f, 0x10, 0x1e, 0x04, 0x5c, 0x1f, 0x41, 0x52, 0x1f, 0x01, 0x10, 0x20,
0x05, 0x5c, 0x21, 0x0f, 0x5e, 0x1a, 0x04, 0x10, 0x1b, 0x12, 0x10, 0x1c,
0x02, 0x0f, 0x1d, 0x00, 0x6e, 0x15, 0x16, 0x10, 0x1e, 0x03, 0x5c, 0x1f,
0x38, 0x10, 0x20, 0x04, 0x5c, 0x21, 0x42, 0x52, 0x21, 0x01, 0x10, 0x22,
0x05, 0x5c, 0x23, 0x15, 0x5e, 0x1c, 0x04, 0x10, 0x1d, 0x13, 0x10, 0x1e,
0x02, 0x0f, 0x1f, 0x00, 0x36, 0xa3, 0xd9, 0x10, 0x20, 0x03, 0x5c, 0x21,
0x43, 0x10, 0x22, 0x04, 0x5c, 0x23, 0x44, 0x52, 0x23, 0x01, 0x10, 0x24,
0x05, 0x5c, 0x25, 0x17, 0x5e, 0x1e, 0x04, 0x10, 0x1f, 0x14, 0x10, 0x20,
0x02, 0x0f, 0x21, 0x00, 0x95, 0xe6, 0xcb, 0x10, 0x22, 0x03, 0x5c, 0x23,
0x45, 0x10, 0x24, 0x04, 0x5c, 0x25, 0x46, 0x52, 0x25, 0x01, 0x10, 0x26,
0x05, 0x5c, 0x27, 0x47, 0x5e, 0x20, 0x04, 0x10, 0x21, 0x15, 0x10, 0x22,
0x02, 0x0f, 0x23, 0x00, 0xde, 0xa5, 0x84, 0x10, 0x24, 0x03, 0x5c, 0x25,
0x48, 0x10, 0x26, 0x04, 0x5c, 0x27, 0x49, 0x52, 0x27, 0x01, 0x10, 0x28,
0x05, 0x5c, 0x29, 0x19, 0x5e, 0x22, 0x04, 0x10, 0x23, 0x16, 0x10, 0x24,
0x02, 0x0f, 0x25, 0x00, 0xa0, 0x74, 0xc4, 0x10, 0x26, 0x03, 0x5c, 0x27,
0x4a, 0x10, 0x28, 0x04, 0x5c, 0x29, 0x4b, 0x52, 0x29, 0x01, 0x10, 0x2a,
0x05, 0x5c, 0x2b, 0x1a, 0x5e, 0x24, 0x04, 0x10, 0x25, 0x17, 0x10, 0x26,
0x02, 0x0f, 0x27, 0x00, 0x36, 0xa3, 0xd9, 0x10, 0x28, 0x03, 0x5c, 0x29,
0x4c, 0x10, 0x2a, 0x04, 0x5c, 0x2b, 0x4d, 0x5c, 0x2c, 0x4e, 0x52, 0x2b,
0x02, 0x10, 0x2c, 0x05, 0x5c, 0x2d, 0x1b, 0x5e, 0x26, 0x04, 0x10, 0x27,
0x18, 0x10, 0x28, 0x02, 0x0f, 0x29, 0x00, 0x6d, 0x80, 0x86, 0x10, 0x2a,
0x03, 0x5c, 0x2b, 0x4f, 0x10, 0x2c, 0x04, 0x5c, 0x2d, 0x50, 0x52, 0x2d,
0x01, 0x10, 0x2e, 0x05, 0x5c, 0x2f, 0x1d, 0x5e, 0x28, 0x04, 0x10, 0x29,
0x19, 0x10, 0x2a, 0x02, 0x0f, 0x2b, 0x00, 0x36, 0xa3, 0xd9, 0x10, 0x2c,
0x03, 0x5c, 0x2d, 0x51, 0x10, 0x2e, 0x04, 0x5c, 0x2f, 0x52, 0x52, 0x2f,
0x01, 0x10, 0x30, 0x05, 0x5c, 0x31, 0x1e, 0x5e, 0x2a, 0x04, 0x10, 0x2b,
0x1a, 0x10, 0x2c, 0x02, 0x0f, 0x2d, 0x00, 0x6d, 0x80, 0x86, 0x10, 0x2e,
0x03, 0x5c, 0x2f, 0x4f, 0x10, 0x30, 0x04, 0x5c, 0x31, 0x53, 0x5c, 0x32,
0x54, 0x52, 0x31, 0x02, 0x10, 0x32, 0x05, 0x5c, 0x33, 0x1f, 0x5e, 0x2c,
0x04, 0x10, 0x2d, 0x1b, 0x10, 0x2e, 0x02, 0x0f, 0x2f, 0x00, 0xda, 0xd8,
0xd8, 0x10, 0x30, 0x03, 0x5c, 0x31, 0x55, 0x10, 0x32, 0x04, 0x5c, 0x33,
0x56, 0x52, 0x33, 0x01, 0x10, 0x34, 0x05, 0x5c, 0x35, 0x20, 0x5e, 0x2e,
0x04, 0x10, 0x2f, 0x1c, 0x10, 0x30, 0x02, 0x0f, 0x31, 0x00, 0x4e, 0x5c,
0x61, 0x10, 0x32, 0x03, 0x5c, 0x33, 0x57, 0x10, 0x34, 0x04, 0x5c, 0x35,
0x58, 0x5c, 0x36, 0x59, 0x52, 0x35, 0x02, 0x10, 0x36, 0x05, 0x5c, 0x37,
0x21, 0x5e, 0x30, 0x04, 0x10, 0x31, 0x1d, 0x10, 0x32, 0x02, 0x0f, 0x33,
0x00, 0x6d, 0x80, 0x86, 0x10, 0x34, 0x03, 0x5c, 0x35, 0x5a, 0x10, 0x36,
0x04, 0x5c, 0x37, 0x5b, 0x52, 0x37, 0x01, 0x5e, 0x32, 0x03, 0x10, 0x33,
0x1e, 0x10, 0x34, 0x02, 0x0f, 0x35, 0x00, 0xda, 0xd8, 0xd8, 0x10, 0x36,
0x03, 0x5c, 0x37, 0x5c, 0x10, 0x38, 0x04, 0x5c, 0x39, 0x5d, 0x52, 0x39,
0x01, 0x5e, 0x34, 0x03, 0x10, 0x35, 0x1f, 0x10, 0x36, 0x02, 0x0f, 0x37,
0x00, 0xdd, 0x4c, 0x35, 0x10, 0x38, 0x03, 0x5c, 0x39, 0x5e, 0x10, 0x3a,
0x04, 0x5c, 0x3b, 0x5f, 0x5c, 0x3c, 0x60, 0x52, 0x3b, 0x02, 0x5e, 0x36,
0x03, 0x10, 0x37, 0x20, 0x10, 0x38, 0x02, 0x0f, 0x39, 0x00, 0xf0, 0x50,
0x32, 0x10, 0x3a, 0x03, 0x5c, 0x3b, 0x61, 0x10, 0x3c, 0x04, 0x5c, 0x3d,
0x62, 0x52, 0x3d, 0x01, 0x5e, 0x38, 0x03, 0x10, 0x39, 0x21, 0x10, 0x3a,
0x02, 0x0f, 0x3b, 0x00, 0xf0, 0x50, 0x32, 0x10, 0x3c, 0x03, 0x5c, 0x3d,
0x61, 0x10, 0x3e, 0x04, 0x5c, 0x3f, 0x63, 0x52, 0x3f, 0x01, 0x5e, 0x3a,
0x03, 0x10, 0x3b, 0x22, 0x10, 0x3c, 0x02, 0x0f, 0x3d, 0x00, 0x9e, 0x9e,
0x9e, 0x10, 0x3e, 0x03, 0x5c, 0x3f, 0x64, 0x10, 0x40, 0x04, 0x5c, 0x41,
0x65, 0x52, 0x41, 0x01, 0x5e, 0x3c, 0x03, 0x10, 0x3d, 0x23, 0x10, 0x3e,
0x02, 0x0f, 0x3f, 0x00, 0x6d, 0x80, 0x86, 0x10, 0x40, 0x03, 0x5c, 0x41,
0x4f, 0x10, 0x42, 0x04, 0x5c, 0x43, 0x66, 0x52, 0x43, 0x01, 0x5e, 0x3e,
0x03, 0x10, 0x3f, 0x24, 0x10, 0x40, 0x02, 0x0f, 0x41, 0x00, 0xff, 0x80,
0x87, 0x10, 0x42, 0x03, 0x5c, 0x43, 0x67, 0x10, 0x44, 0x04, 0x5c, 0x45,
0x68, 0x52, 0x45, 0x01, 0x10, 0x46, 0x25, 0x5c, 0x47, 0x69, 0x52, 0x47,
0x01, 0x10, 0x48, 0x05, 0x5c, 0x49, 0x09, 0x5e, 0x40, 0x05, 0x10, 0x41,
0x26, 0x10, 0x42, 0x02, 0x0f, 0x43, 0x00, 0x4d, 0x5a, 0x5e, 0x10, 0x44,
0x03, 0x5c, 0x45, 0x6a, 0x10, 0x46, 0x04, 0x5c, 0x47, 0x6b, 0x52, 0x47,
0x01, 0x10, 0x48, 0x25, 0x5c, 0x49, 0x6c, 0x5c, 0x4a, 0x6d, 0x52, 0x49,
0x02, 0x10, 0x4a, 0x05, 0x5c, 0x4b, 0x0b, 0x5e, 0x42, 0x05, 0x10, 0x43,
0x27, 0x10, 0x44, 0x02, 0x0f, 0x45, 0x00, 0x6d, 0x80, 0x86, 0x10, 0x46,
0x03, 0x5c, 0x47, 0x6e, 0x10, 0x48, 0x04, 0x52, 0x49, 0x00, 0x5e, 0x44,
0x03, 0x5e, 0x01, 0x22, 0x1a, 0x01, 0x28, 0x10, 0x01, 0x27, 0x10, 0x02,
0x29, 0x0f, 0x03, 0x00, 0xee, 0xee, 0xee, 0x5e, 0x02, 0x01, 0x10, 0x03,
0x2a, 0x10, 0x04, 0x29, 0x0f, 0x05, 0x00, 0x7d, 0xcf, 0xff, 0x5e, 0x04,
0x01, 0x10, 0x05, 0x2b, 0x10, 0x06, 0x29, 0x0f, 0x07, 0x00, 0xef, 0x51,
0x68, 0x5e, 0x06, 0x01, 0x10, 0x07, 0x2c, 0x10, 0x08, 0x29, 0x0f, 0x09,
0x00, 0xaa, 0xaa, 0xaa, 0x10, 0x0a, 0x2d, 0x13, 0x0b, 0x5e, 0x08, 0x02,
0x10, 0x09, 0x2e, 0x10, 0x0a, 0x29, 0x0f, 0x0b, 0x00, 0xaa, 0xd9, 0x4c,
0x5e, 0x0a, 0x01, 0x10, 0x0b, 0x2f, 0x10, 0x0c, 0x29, 0x0f, 0x0d, 0x00,
0x7d, 0xcf, 0xff, 0x5e, 0x0c, 0x01, 0x10, 0x0d, 0x30, 0x10, 0x0e, 0x29,
0x0f, 0x0f, 0x00, 0x7d, 0xcf, 0xff, 0x5e, 0x0e, 0x01, 0x10, 0x0f, 0x31,
0x10, 0x10, 0x29, 0x0f, 0x11, 0x00, 0xd2, 0xa6, 0xff, 0x5e, 0x10, 0x01,
0x10, 0x11, 0x32, 0x10, 0x12, 0x29, 0x0f, 0x13, 0x00, 0xe6, 0xc0, 0x8a,
0x5e, 0x12, 0x01, 0x10, 0x13, 0x33, 0x10, 0x14, 0x29, 0x0f, 0x15, 0x00,
0x7a, 0xe9, 0x3c, 0x5e, 0x14, 0x01, 0x10, 0x15, 0x34, 0x10, 0x16, 0x29,
0x0f, 0x17, 0x00, 0xef, 0x51, 0x68, 0x5e, 0x16, 0x01, 0x10, 0x17, 0x35,
0x10, 0x18, 0x29, 0x0f, 0x19, 0x00, 0xff, 0xaf, 0x70, 0x5e, 0x18, 0x01,
0x10, 0x19, 0x36, 0x10, 0x1a, 0x29, 0x0f, 0x1b, 0x00, 0xff, 0x8f, 0x40,
0x5e, 0x1a, 0x01, 0x10, 0x1b, 0x37, 0x10, 0x1c, 0x29, 0x0f, 0x1d, 0x00,
0xf0, 0x71, 0x78, 0x5e, 0x1c, 0x01, 0x10, 0x1d, 0x38, 0x10, 0x1e, 0x29,
0x0f, 0x1f, 0x00, 0xff, 0xff, 0xff, 0x10, 0x20, 0x2d, 0x13, 0x21, 0x5e,
0x1e, 0x02, 0x10, 0x1f, 0x39, 0x10, 0x20, 0x29, 0x0f, 0x21, 0x00, 0xff,
0xaf, 0x70, 0x5e, 0x20, 0x01, 0x10, 0x21, 0x3a, 0x10, 0x22, 0x29, 0x0f,
0x23, 0x00, 0xf0, 0x71, 0x78, 0x5e, 0x22, 0x01, 0x10, 0x23, 0x3b, 0x10,
0x24, 0x29, 0x0f, 0x25, 0x00, 0x7d, 0xcf, 0xff, 0x5e, 0x24, 0x01, 0x10,
0x25, 0x3c, 0x10, 0x26, 0x29, 0x0f, 0x27, 0x00, 0x95, 0xe6, 0xcb, 0x5e,
0x26, 0x01, 0x10, 0x27, 0x3d, 0x10, 0x28, 0x29, 0x0f, 0x29, 0x00, 0xf0,
0x71, 0x78, 0x5e, 0x28, 0x01, 0x10, 0x29, 0x3e, 0x10, 0x2a, 0x29, 0x0f,
0x2b, 0x00, 0x7d, 0xcf, 0xff, 0x5e, 0x2a, 0x01, 0x10, 0x2b, 0x3f, 0x10,
0x2c, 0x29, 0x0f, 0x2d, 0x00, 0xff, 0x8f, 0x40, 0x5e, 0x2c, 0x01, 0x10,
0x2d, 0x40, 0x10, 0x2e, 0x29, 0x0f, 0x2f, 0x00, 0xd2, 0xa6, 0xff, 0x5e,
0x2e, 0x01, 0x10, 0x2f, 0x41, 0x10, 0x30, 0x29, 0x0f, 0x31, 0x00, 0xd2,
0xa6, 0xff, 0x5e, 0x30, 0x01, 0x10, 0x31, 0x42, 0x10, 0x32, 0x29, 0x0f,
0x33, 0x00, 0xff, 0xaf, 0xaf, 0x5e, 0x32, 0x01, 0x10, 0x33, 0x43, 0x10,
0x34, 0x29, 0x0f, 0x35, 0x00, 0xff, 0xff, 0x00, 0x5e, 0x34, 0x01, 0x10,
0x35, 0x44, 0x10, 0x36, 0x29, 0x0f, 0x37, 0x00, 0x0f, 0xff, 0x0f, 0x5e,
0x36, 0x01, 0x10, 0x37, 0x45, 0x10, 0x38, 0x29, 0x0f, 0x39, 0x00, 0xff,
0x0f, 0x0f, 0x5e, 0x38, 0x01, 0x5e, 0x01, 0x1c, 0x1a, 0x01, 0x46, 0x10,
0x01, 0x47, 0x1a, 0x01, 0x48, 0x5e, 0x01, 0x00, 0x1a, 0x01, 0x49, 0x5e,
0x01, 0x00, 0x1a, 0x01, 0x4a, 0x5e, 0x01, 0x00, 0x1a, 0x01, 0x4b, 0x11,
0x01, 0x1a, 0x01, 0x4c, 0x11, 0x01, 0x1a, 0x01, 0x4d, 0x62, 0x02, 0x00,
0x31, 0x01, 0x4e, 0x00, 0x1a, 0x01, 0x4f, 0x62, 0x02, 0x01, 0x31, 0x01,
0x4e, 0x00, 0x1a, 0x01, 0x50, 0x62, 0x02, 0x02, 0x31, 0x01, 0x4e, 0x00,
0x1a, 0x01, 0x51, 0x62, 0x02, 0x03, 0x31, 0x01, 0x4e, 0x00, 0x1a, 0x01,
0x52, 0x12, 0x01, 0x6f, 0x01, 0x69, 0x01, 0x04, 0x3d, 0x00, 0x00, 0x6f,
0x00, 0x00, 0x06, 0x63, 0x6c, 0x61, 0x6e, 0x67, 0x64, 0x00, 0x00, 0x00,
0x12, 0x2d, 0x2d, 0x62, 0x61, 0x63, 0x6b, 0x67, 0x72, 0x6f, 0x75, 0x6e,
0x64, 0x2d, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x00, 0x00, 0x00, 0x0c, 0x2d,
0x2d, 0x63, 0x6c, 0x61, 0x6e, 0x67, 0x2d, 0x74, 0x69, 0x64, 0x79, 0x00,
0x00, 0x00, 0x1b, 0x2d, 0x2d, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74,
0x69, 0x6f, 0x6e, 0x2d, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x3d, 0x64, 0x65,
0x74, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x00, 0x00, 0x00, 0x18, 0x2d, 0x2d,
0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2d, 0x69, 0x6e, 0x73, 0x65, 0x72,
0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x6e, 0x65, 0x76, 0x65, 0x72, 0x00, 0x00,
0x00, 0x14, 0x2d, 0x2d, 0x70, 0x63, 0x68, 0x2d, 0x73, 0x74, 0x6f, 0x72,
0x61, 0x67, 0x65, 0x3d, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x00, 0x00,
0x00, 0x12, 0x2d, 0x2d, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2d, 0x72, 0x65,
0x73, 0x75, 0x6c, 0x74, 0x73, 0x3d, 0x35, 0x30, 0x00, 0x00, 0x00, 0x0b,
0x2d, 0x2d, 0x6c, 0x6f, 0x67, 0x3d, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x00,
0x00, 0x00, 0x08, 0x72, 0x75, 0x62, 0x79, 0x2d, 0x6c, 0x73, 0x70, 0x00,
0x00, 0x00, 0x0a, 0x73, 0x6f, 0x6c, 0x61, 0x72, 0x67, 0x72, 0x61, 0x70,
0x68, 0x00, 0x00, 0x00, 0x05, 0x73, 0x74, 0x64, 0x69, 0x6f, 0x00, 0x00,
0x00, 0x14, 0x62, 0x61, 0x73, 0x68, 0x2d, 0x6c, 0x61, 0x6e, 0x67, 0x75,
0x61, 0x67, 0x65, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x00, 0x00,
0x00, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x00, 0x00, 0x00, 0x1a, 0x76,
0x73, 0x63, 0x6f, 0x64, 0x65, 0x2d, 0x63, 0x73, 0x73, 0x2d, 0x6c, 0x61,
0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65,
0x72, 0x00, 0x00, 0x00, 0x07, 0x2d, 0x2d, 0x73, 0x74, 0x64, 0x69, 0x6f,
0x00, 0x00, 0x00, 0x1b, 0x76, 0x73, 0x63, 0x6f, 0x64, 0x65, 0x2d, 0x6a,
0x73, 0x6f, 0x6e, 0x2d, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65,
0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x00, 0x00, 0x00, 0x08, 0x66,
0x69, 0x73, 0x68, 0x2d, 0x6c, 0x73, 0x70, 0x00, 0x00, 0x00, 0x05, 0x67,
0x6f, 0x70, 0x6c, 0x73, 0x00, 0x00, 0x00, 0x05, 0x73, 0x65, 0x72, 0x76,
0x65, 0x00, 0x00, 0x00, 0x17, 0x68, 0x61, 0x73, 0x6b, 0x65, 0x6c, 0x6c,
0x2d, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x2d, 0x73, 0x65,
0x72, 0x76, 0x65, 0x72, 0x00, 0x00, 0x00, 0x03, 0x6c, 0x73, 0x70, 0x00,
0x00, 0x00, 0x15, 0x65, 0x6d, 0x6d, 0x65, 0x74, 0x2d, 0x6c, 0x61, 0x6e,
0x67, 0x75, 0x61, 0x67, 0x65, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
0x00, 0x00, 0x00, 0x1a, 0x74, 0x79, 0x70, 0x65, 0x73, 0x63, 0x72, 0x69,
0x70, 0x74, 0x2d, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x2d,
0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x00, 0x00, 0x00, 0x13, 0x6c, 0x75,
0x61, 0x2d, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x2d, 0x73,
0x65, 0x72, 0x76, 0x65, 0x72, 0x00, 0x00, 0x00, 0x12, 0x70, 0x79, 0x72,
0x69, 0x67, 0x68, 0x74, 0x2d, 0x6c, 0x61, 0x6e, 0x67, 0x73, 0x65, 0x72,
0x76, 0x65, 0x72, 0x00, 0x00, 0x00, 0x0d, 0x72, 0x75, 0x73, 0x74, 0x2d,
0x61, 0x6e, 0x61, 0x6c, 0x79, 0x7a, 0x65, 0x72, 0x00, 0x00, 0x00, 0x0c,
0x69, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x68, 0x65, 0x6e, 0x73, 0x65,
0x00, 0x00, 0x00, 0x08, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x6d, 0x61, 0x6e,
0x00, 0x00, 0x00, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x00, 0x00,
0x00, 0x15, 0x6e, 0x67, 0x69, 0x6e, 0x78, 0x2d, 0x6c, 0x61, 0x6e, 0x67,
0x75, 0x61, 0x67, 0x65, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x00,
0x00, 0x00, 0x05, 0x74, 0x61, 0x70, 0x6c, 0x6f, 0x00, 0x00, 0x00, 0x14,
0x79, 0x61, 0x6d, 0x6c, 0x2d, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67,
0x65, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x00, 0x00, 0x00, 0x04,
0x73, 0x71, 0x6c, 0x73, 0x00, 0x00, 0x00, 0x14, 0x6d, 0x61, 0x6b, 0x65,
0x2d, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x2d, 0x73, 0x65,
0x72, 0x76, 0x65, 0x72, 0x00, 0x00, 0x00, 0x13, 0x73, 0x71, 0x6c, 0x2d,
0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x2d, 0x73, 0x65, 0x72,
0x76, 0x65, 0x72, 0x00, 0x00, 0x00, 0x02, 0x75, 0x70, 0x00, 0x00, 0x00,
0x08, 0x2d, 0x2d, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x00, 0x00, 0x00,
0x04, 0xee, 0x98, 0x9e, 0x20, 0x00, 0x00, 0x00, 0x01, 0x63, 0x00, 0x00,
0x00, 0x04, 0xee, 0x98, 0x9d, 0x20, 0x00, 0x00, 0x00, 0x03, 0x63, 0x70,
0x70, 0x00, 0x00, 0x00, 0x02, 0x63, 0x63, 0x00, 0x00, 0x00, 0x03, 0x63,
0x78, 0x78, 0x00, 0x00, 0x00, 0x04, 0xef, 0x83, 0xbd, 0x20, 0x00, 0x00,
0x00, 0x01, 0x68, 0x00, 0x00, 0x00, 0x03, 0x68, 0x70, 0x70, 0x00, 0x00,
0x00, 0x04, 0xee, 0x9a, 0xb8, 0x20, 0x00, 0x00, 0x00, 0x03, 0x63, 0x73,
0x73, 0x00, 0x00, 0x00, 0x04, 0xee, 0xb9, 0x81, 0x20, 0x00, 0x00, 0x00,
0x04, 0x66, 0x69, 0x73, 0x68, 0x00, 0x00, 0x00, 0x04, 0xee, 0x98, 0xa7,
0x20, 0x00, 0x00, 0x00, 0x02, 0x67, 0x6f, 0x00, 0x00, 0x00, 0x03, 0x6d,
0x6f, 0x64, 0x00, 0x00, 0x00, 0x04, 0xee, 0x9d, 0xb7, 0x20, 0x00, 0x00,
0x00, 0x02, 0x68, 0x73, 0x00, 0x00, 0x00, 0x03, 0x6c, 0x68, 0x73, 0x00,
0x00, 0x00, 0x04, 0xef, 0x84, 0xa1, 0x20, 0x00, 0x00, 0x00, 0x04, 0x68,
0x74, 0x6d, 0x6c, 0x00, 0x00, 0x00, 0x03, 0x68, 0x74, 0x6d, 0x00, 0x00,
0x00, 0x04, 0xef, 0x8b, 0xaf, 0x20, 0x00, 0x00, 0x00, 0x02, 0x6a, 0x73,
0x00, 0x00, 0x00, 0x04, 0xee, 0x9a, 0x9d, 0x20, 0x00, 0x00, 0x00, 0x02,
0x74, 0x73, 0x00, 0x00, 0x00, 0x02, 0x7b, 0x7d, 0x00, 0x00, 0x00, 0x04,
0x6a, 0x73, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x6a, 0x73, 0x6f, 0x6e,
0x63, 0x00, 0x00, 0x00, 0x03, 0x65, 0x72, 0x62, 0x00, 0x00, 0x00, 0x05,
0xf3, 0xb0, 0xa2, 0xb1, 0x20, 0x00, 0x00, 0x00, 0x03, 0x6c, 0x75, 0x61,
0x00, 0x00, 0x00, 0x05, 0xf3, 0xb0, 0x8c, 0xa0, 0x20, 0x00, 0x00, 0x00,
0x02, 0x70, 0x79, 0x00, 0x00, 0x00, 0x07, 0x70, 0x79, 0x72, 0x69, 0x67,
0x68, 0x74, 0x00, 0x00, 0x00, 0x05, 0xf3, 0xb1, 0x98, 0x97, 0x20, 0x00,
0x00, 0x00, 0x02, 0x72, 0x73, 0x00, 0x00, 0x00, 0x05, 0xf3, 0xb0, 0x8c,
0x9f, 0x20, 0x00, 0x00, 0x00, 0x03, 0x70, 0x68, 0x70, 0x00, 0x00, 0x00,
0x04, 0xee, 0xba, 0xab, 0x20, 0x00, 0x00, 0x00, 0x02, 0x6d, 0x64, 0x00,
0x00, 0x00, 0x08, 0x6d, 0x61, 0x72, 0x6b, 0x64, 0x6f, 0x77, 0x6e, 0x00,
0x00, 0x00, 0x04, 0xee, 0x98, 0x95, 0x20, 0x00, 0x00, 0x00, 0x04, 0x63,
0x6f, 0x6e, 0x66, 0x00, 0x00, 0x00, 0x04, 0xee, 0x9a, 0xb2, 0x20, 0x00,
0x00, 0x00, 0x04, 0x74, 0x6f, 0x6d, 0x6c, 0x00, 0x00, 0x00, 0x03, 0x79,
0x6d, 0x6c, 0x00, 0x00, 0x00, 0x04, 0x79, 0x61, 0x6d, 0x6c, 0x00, 0x00,
0x00, 0x04, 0xee, 0x99, 0x8d, 0x20, 0x00, 0x00, 0x00, 0x03, 0x73, 0x71,
0x6c, 0x00, 0x00, 0x00, 0x04, 0xee, 0x99, 0xb3, 0x20, 0x00, 0x00, 0x00,
0x08, 0x4d, 0x61, 0x6b, 0x65, 0x66, 0x69, 0x6c, 0x65, 0x00, 0x00, 0x00,
0x08, 0x6d, 0x61, 0x6b, 0x65, 0x66, 0x69, 0x6c, 0x65, 0x00, 0x00, 0x00,
0x04, 0xee, 0x99, 0x9f, 0x20, 0x00, 0x00, 0x00, 0x02, 0x67, 0x64, 0x00,
0x00, 0x00, 0x04, 0xef, 0x80, 0xad, 0x20, 0x00, 0x00, 0x00, 0x03, 0x6d,
0x61, 0x6e, 0x00, 0x00, 0x00, 0x04, 0xee, 0x9c, 0xa8, 0x20, 0x00, 0x00,
0x00, 0x04, 0x64, 0x69, 0x66, 0x66, 0x00, 0x00, 0x00, 0x05, 0x70, 0x61,
0x74, 0x63, 0x68, 0x00, 0x00, 0x00, 0x04, 0xee, 0x99, 0x9d, 0x20, 0x00,
0x00, 0x00, 0x0d, 0x67, 0x69, 0x74, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62,
0x75, 0x74, 0x65, 0x73, 0x00, 0x00, 0x00, 0x09, 0x67, 0x69, 0x74, 0x69,
0x67, 0x6e, 0x6f, 0x72, 0x65, 0x00, 0x00, 0x00, 0x02, 0x2e, 0x2a, 0x00,
0x00, 0x00, 0x05, 0x72, 0x65, 0x67, 0x65, 0x78, 0x00, 0x00, 0x00, 0x03,
0x69, 0x6e, 0x69, 0x00, 0x00, 0x00, 0x05, 0xf3, 0xb0, 0xb4, 0xad, 0x20,
0x00, 0x00, 0x00, 0x02, 0x72, 0x62, 0x00, 0x00, 0x00, 0x07, 0x47, 0x65,
0x6d, 0x66, 0x69, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x04, 0xee, 0xaf, 0x8a,
0x20, 0x00, 0x00, 0x00, 0x02, 0x73, 0x68, 0x00, 0x00, 0x00, 0x0c, 0x62,
0x61, 0x73, 0x68, 0x5f, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x00,
0x00, 0x00, 0x06, 0x62, 0x61, 0x73, 0x68, 0x72, 0x63, 0x00, 0x00, 0x00,
0x05, 0xf3, 0xb0, 0x88, 0x9a, 0x20, 0x00, 0x00, 0x53, 0x00, 0x0b, 0x40,
0x6c, 0x73, 0x70, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x00, 0x00,
0x01, 0x63, 0x00, 0x00, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00,
0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x00, 0x00, 0x0a, 0x65, 0x78,
0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x00, 0x00, 0x03, 0x6c,
0x73, 0x70, 0x00, 0x00, 0x03, 0x63, 0x70, 0x70, 0x00, 0x00, 0x01, 0x68,
0x00, 0x00, 0x03, 0x63, 0x73, 0x73, 0x00, 0x00, 0x04, 0x66, 0x69, 0x73,
0x68, 0x00, 0x00, 0x02, 0x67, 0x6f, 0x00, 0x00, 0x05, 0x67, 0x6f, 0x6d,
0x6f, 0x64, 0x00, 0x00, 0x07, 0x68, 0x61, 0x73, 0x6b, 0x65, 0x6c, 0x6c,
0x00, 0x00, 0x04, 0x68, 0x74, 0x6d, 0x6c, 0x00, 0x00, 0x0a, 0x6a, 0x61,
0x76, 0x61, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x00, 0x00, 0x0a, 0x74,
0x79, 0x70, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x00, 0x00, 0x04,
0x6a, 0x73, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x6a, 0x73, 0x6f, 0x6e, 0x63,
0x00, 0x00, 0x03, 0x65, 0x72, 0x62, 0x00, 0x00, 0x03, 0x6c, 0x75, 0x61,
0x00, 0x00, 0x06, 0x70, 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x00, 0x00, 0x04,
0x72, 0x75, 0x73, 0x74, 0x00, 0x00, 0x03, 0x70, 0x68, 0x70, 0x00, 0x00,
0x08, 0x6d, 0x61, 0x72, 0x6b, 0x64, 0x6f, 0x77, 0x6e, 0x00, 0x00, 0x05,
0x6e, 0x67, 0x69, 0x6e, 0x78, 0x00, 0x00, 0x04, 0x74, 0x6f, 0x6d, 0x6c,
0x00, 0x00, 0x04, 0x79, 0x61, 0x6d, 0x6c, 0x00, 0x00, 0x03, 0x73, 0x71,
0x6c, 0x00, 0x00, 0x04, 0x6d, 0x61, 0x6b, 0x65, 0x00, 0x00, 0x08, 0x67,
0x64, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x00, 0x00, 0x03, 0x6d, 0x61,
0x6e, 0x00, 0x00, 0x04, 0x64, 0x69, 0x66, 0x66, 0x00, 0x00, 0x0d, 0x67,
0x69, 0x74, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73,
0x00, 0x00, 0x09, 0x67, 0x69, 0x74, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65,
0x00, 0x00, 0x05, 0x72, 0x65, 0x67, 0x65, 0x78, 0x00, 0x00, 0x03, 0x69,
0x6e, 0x69, 0x00, 0x00, 0x04, 0x72, 0x75, 0x62, 0x79, 0x00, 0x00, 0x09,
0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x00, 0x00, 0x04,
0x62, 0x61, 0x73, 0x68, 0x00, 0x00, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75,
0x6c, 0x74, 0x00, 0x00, 0x0a, 0x40, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61,
0x67, 0x65, 0x73, 0x00, 0x00, 0x02, 0x66, 0x67, 0x00, 0x00, 0x07, 0x73,
0x68, 0x65, 0x62, 0x61, 0x6e, 0x67, 0x00, 0x00, 0x05, 0x65, 0x72, 0x72,
0x6f, 0x72, 0x00, 0x00, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74,
0x00, 0x00, 0x06, 0x69, 0x74, 0x61, 0x6c, 0x69, 0x63, 0x00, 0x00, 0x06,
0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x00, 0x00, 0x06, 0x65, 0x73, 0x63,
0x61, 0x70, 0x65, 0x00, 0x00, 0x0d, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70,
0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x06, 0x72, 0x65,
0x67, 0x65, 0x78, 0x70, 0x00, 0x00, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65,
0x72, 0x00, 0x00, 0x04, 0x74, 0x72, 0x75, 0x65, 0x00, 0x00, 0x05, 0x66,
0x61, 0x6c, 0x73, 0x65, 0x00, 0x00, 0x04, 0x63, 0x68, 0x61, 0x72, 0x00,
0x00, 0x07, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x00, 0x00, 0x0f,
0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x6f, 0x70, 0x65, 0x72, 0x61,
0x74, 0x6f, 0x72, 0x00, 0x00, 0x08, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74,
0x6f, 0x72, 0x00, 0x00, 0x08, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x00, 0x00, 0x04, 0x74, 0x79, 0x70, 0x65, 0x00, 0x00, 0x08, 0x63,
0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x00, 0x00, 0x10, 0x76, 0x61,
0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e,
0x63, 0x65, 0x00, 0x00, 0x0e, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c,
0x65, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x00, 0x0a, 0x61, 0x6e,
0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x09, 0x64,
0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x00, 0x00, 0x05, 0x6c,
0x61, 0x62, 0x65, 0x6c, 0x00, 0x00, 0x06, 0x62, 0x72, 0x61, 0x63, 0x65,
0x31, 0x00, 0x00, 0x06, 0x62, 0x72, 0x61, 0x63, 0x65, 0x32, 0x00, 0x00,
0x06, 0x62, 0x72, 0x61, 0x63, 0x65, 0x33, 0x00, 0x00, 0x06, 0x62, 0x72,
0x61, 0x63, 0x65, 0x34, 0x00, 0x00, 0x06, 0x62, 0x72, 0x61, 0x63, 0x65,
0x35, 0x00, 0x00, 0x06, 0x40, 0x74, 0x68, 0x65, 0x6d, 0x65, 0x00, 0x00,
0x09, 0x61, 0x75, 0x74, 0x6f, 0x5f, 0x75, 0x6e, 0x69, 0x78, 0x00, 0x00,
0x0d, 0x40, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x65, 0x6e, 0x64, 0x69, 0x6e,
0x67, 0x73, 0x00, 0x00, 0x0d, 0x40, 0x6b, 0x65, 0x79, 0x5f, 0x68, 0x61,
0x6e, 0x64, 0x6c, 0x65, 0x72, 0x73, 0x00, 0x00, 0x0a, 0x40, 0x6b, 0x65,
0x79, 0x5f, 0x62, 0x69, 0x6e, 0x64, 0x73, 0x00, 0x00, 0x0d, 0x40, 0x68,
0x69, 0x67, 0x68, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x65, 0x72, 0x73, 0x00,
0x00, 0x0a, 0x40, 0x62, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x75, 0x70,
0x00, 0x00, 0x0b, 0x40, 0x62, 0x5f, 0x73, 0x68, 0x75, 0x74, 0x64, 0x6f,
0x77, 0x6e, 0x00, 0x00, 0x04, 0x70, 0x72, 0x6f, 0x63, 0x00, 0x00, 0x06,
0x40, 0x62, 0x5f, 0x62, 0x61, 0x72, 0x00, 0x00, 0x07, 0x40, 0x62, 0x5f,
0x63, 0x6f, 0x70, 0x79, 0x00, 0x00, 0x08, 0x40, 0x62, 0x5f, 0x70, 0x61,
0x73, 0x74, 0x65, 0x00, 0x00, 0x0e, 0x40, 0x62, 0x5f, 0x66, 0x69, 0x6c,
0x65, 0x5f, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x00, 0x00, 0x00, 0x03,
0xb4, 0x00, 0x09, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x7b, 0x39, 0x04, 0x00, 0x00, 0x0f, 0x03, 0x00, 0x82, 0xaa, 0xff, 0x5c,
0x04, 0x00, 0x01, 0x09, 0x01, 0x10, 0x0a, 0x00, 0x23, 0x09, 0x10, 0x0a,
0x01, 0x01, 0x0b, 0x09, 0x32, 0x0a, 0x02, 0x01, 0x28, 0x0a, 0x00, 0x0c,
0x0f, 0x03, 0x00, 0x82, 0xaa, 0xff, 0x5c, 0x04, 0x01, 0x26, 0x00, 0x68,
0x10, 0x0a, 0x03, 0x01, 0x0b, 0x09, 0x32, 0x0a, 0x02, 0x01, 0x28, 0x0a,
0x00, 0x0c, 0x0f, 0x03, 0x00, 0xff, 0x8f, 0x40, 0x5c, 0x04, 0x02, 0x26,
0x00, 0x4e, 0x10, 0x0a, 0x04, 0x01, 0x0b, 0x09, 0x32, 0x0a, 0x02, 0x01,
0x28, 0x0a, 0x00, 0x0c, 0x0f, 0x03, 0x00, 0x9a, 0xde, 0x7a, 0x5c, 0x04,
0x03, 0x26, 0x00, 0x34, 0x10, 0x0a, 0x05, 0x01, 0x0b, 0x09, 0x32, 0x0a,
0x02, 0x01, 0x28, 0x0a, 0x00, 0x0c, 0x0f, 0x03, 0x00, 0xff, 0xd7, 0x00,
0x5c, 0x04, 0x04, 0x26, 0x00, 0x1a, 0x10, 0x0a, 0x06, 0x01, 0x0b, 0x09,
0x32, 0x0a, 0x02, 0x01, 0x28, 0x0a, 0x00, 0x0c, 0x0f, 0x03, 0x00, 0xf2,
0x9c, 0xc3, 0x5c, 0x04, 0x05, 0x26, 0x00, 0x00, 0x1d, 0x09, 0x07, 0x33,
0x09, 0x08, 0x10, 0x0a, 0x09, 0x23, 0x09, 0x01, 0x05, 0x09, 0x5c, 0x06,
0x06, 0x01, 0x09, 0x01, 0x10, 0x0a, 0x0a, 0x23, 0x09, 0x06, 0x0a, 0x23,
0x09, 0x5c, 0x0a, 0x07, 0x4d, 0x09, 0x28, 0x09, 0x00, 0x73, 0x01, 0x09,
0x01, 0x10, 0x0a, 0x0a, 0x23, 0x09, 0x08, 0x0a, 0x23, 0x09, 0x5c, 0x0a,
0x06, 0x32, 0x09, 0x0b, 0x01, 0x28, 0x09, 0x00, 0x17, 0x1d, 0x09, 0x07,
0x33, 0x09, 0x08, 0x01, 0x0a, 0x01, 0x10, 0x0b, 0x0a, 0x23, 0x0a, 0x08,
0x0b, 0x23, 0x0a, 0x23, 0x09, 0x01, 0x05, 0x09, 0x01, 0x09, 0x05, 0x29,
0x09, 0x00, 0x03, 0x26, 0x00, 0x0e, 0x1d, 0x09, 0x07, 0x33, 0x09, 0x08,
0x10, 0x0a, 0x09, 0x23, 0x09, 0x01, 0x05, 0x09, 0x01, 0x09, 0x01, 0x10,
0x0a, 0x0a, 0x23, 0x09, 0x07, 0x0a, 0x23, 0x09, 0x5c, 0x0a, 0x06, 0x32,
0x09, 0x0b, 0x01, 0x28, 0x09, 0x00, 0x16, 0x1d, 0x09, 0x0c, 0x01, 0x0a,
0x01, 0x10, 0x0b, 0x0a, 0x23, 0x0a, 0x07, 0x0b, 0x23, 0x0a, 0x32, 0x09,
0x0d, 0x01, 0x01, 0x06, 0x09, 0x5c, 0x09, 0x08, 0x01, 0x0a, 0x04, 0x5d,
0x09, 0x5c, 0x0a, 0x08, 0x5d, 0x09, 0x01, 0x0a, 0x01, 0x10, 0x0b, 0x00,
0x23, 0x0a, 0x33, 0x0a, 0x0e, 0x33, 0x0a, 0x0f, 0x5d, 0x09, 0x5c, 0x0a,
0x09, 0x5d, 0x09, 0x01, 0x0a, 0x05, 0x10, 0x0b, 0x10, 0x23, 0x0a, 0x5d,
0x09, 0x5c, 0x0a, 0x08, 0x5d, 0x09, 0x01, 0x0a, 0x06, 0x5d, 0x09, 0x5c,
0x0a, 0x0a, 0x5d, 0x09, 0x01, 0x07, 0x09, 0x52, 0x08, 0x00, 0x01, 0x09,
0x08, 0x10, 0x0a, 0x11, 0x0f, 0x0b, 0x00, 0x0b, 0x0e, 0x14, 0x10, 0x0c,
0x12, 0x01, 0x0d, 0x03, 0x10, 0x0e, 0x13, 0x08, 0x0f, 0x10, 0x10, 0x14,
0x06, 0x11, 0x10, 0x12, 0x15, 0x03, 0x13, 0x0a, 0x5e, 0x0a, 0x05, 0x32,
0x09, 0x16, 0x01, 0x01, 0x09, 0x08, 0x10, 0x0a, 0x11, 0x01, 0x0b, 0x03,
0x10, 0x0c, 0x12, 0x0f, 0x0d, 0x00, 0x33, 0x36, 0x3c, 0x10, 0x0e, 0x14,
0x03, 0x0f, 0x0a, 0x10, 0x10, 0x15, 0x07, 0x11, 0x5e, 0x0a, 0x04, 0x32,
0x09, 0x16, 0x01, 0x01, 0x09, 0x08, 0x10, 0x0a, 0x11, 0x0f, 0x0b, 0x00,
0x33, 0x36, 0x3c, 0x10, 0x0c, 0x12, 0x0f, 0x0d, 0x00, 0x24, 0x27, 0x2d,
0x10, 0x0e, 0x14, 0x03, 0x0f, 0x0b, 0x10, 0x10, 0x15, 0x07, 0x11, 0x5e,
0x0a, 0x04, 0x32, 0x09, 0x16, 0x01, 0x01, 0x09, 0x08, 0x10, 0x0a, 0x11,
0x01, 0x0b, 0x05, 0x10, 0x0c, 0x17, 0x23, 0x0b, 0x10, 0x0c, 0x12, 0x0f,
0x0d, 0x00, 0x24, 0x27, 0x2d, 0x10, 0x0e, 0x14, 0x03, 0x0f, 0x0d, 0x10,
0x10, 0x15, 0x08, 0x11, 0x5e, 0x0a, 0x04, 0x32, 0x09, 0x16, 0x01, 0x01,
0x09, 0x08, 0x10, 0x0a, 0x11, 0x0f, 0x0b, 0x00, 0xce, 0xd4, 0xdf, 0x10,
0x0c, 0x12, 0x0f, 0x0d, 0x00, 0x24, 0x27, 0x2d, 0x10, 0x0e, 0x14, 0x03,
0x0f, 0x0f, 0x10, 0x10, 0x15, 0x01, 0x11, 0x06, 0x33, 0x11, 0x15, 0x46,
0x11, 0x01, 0x5e, 0x0a, 0x04, 0x32, 0x09, 0x16, 0x01, 0x01, 0x09, 0x08,
0x10, 0x0a, 0x11, 0x0f, 0x0b, 0x00, 0x24, 0x27, 0x2d, 0x10, 0x0c, 0x12,
0x06, 0x0d, 0x10, 0x0e, 0x14, 0x03, 0x0f, 0x0f, 0x01, 0x10, 0x06, 0x33,
0x10, 0x15, 0x45, 0x0f, 0x46, 0x0f, 0x01, 0x10, 0x10, 0x15, 0x07, 0x11,
0x5e, 0x0a, 0x04, 0x32, 0x09, 0x16, 0x01, 0x10, 0x09, 0x18, 0x01, 0x0a,
0x07, 0x10, 0x0b, 0x19, 0x01, 0x0c, 0x08, 0x5e, 0x09, 0x02, 0x3d, 0x09,
0x00, 0x0b, 0x00, 0x00, 0x02, 0x20, 0x20, 0x00, 0x00, 0x00, 0x04, 0xee,
0x99, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x05, 0xf3, 0xb1, 0x93, 0xa7, 0x20,
0x00, 0x00, 0x00, 0x05, 0xf3, 0xb1, 0xa9, 0xa7, 0x20, 0x00, 0x00, 0x00,
0x04, 0xef, 0x84, 0xa0, 0x20, 0x00, 0x00, 0x00, 0x04, 0xee, 0xba, 0xa2,
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x65, 0x64, 0x69,
0x74, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x01, 0x20, 0x00, 0x00, 0x00, 0x08,
0x20, 0xee, 0x82, 0xb4, 0xee, 0x82, 0xb4, 0x20, 0x00, 0x00, 0x00, 0x03,
0xee, 0x82, 0xb4, 0x00, 0x00, 0x1a, 0x00, 0x04, 0x6d, 0x6f, 0x64, 0x65,
0x00, 0x00, 0x06, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x00, 0x00, 0x03,
0x3d, 0x3d, 0x3d, 0x00, 0x00, 0x06, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74,
0x00, 0x00, 0x06, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06,
0x72, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x00, 0x00, 0x06, 0x6a, 0x75, 0x6d,
0x70, 0x65, 0x72, 0x00, 0x00, 0x01, 0x43, 0x00, 0x00, 0x09, 0x6c, 0x61,
0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x73, 0x00, 0x00, 0x07, 0x64, 0x65,
0x66, 0x61, 0x75, 0x6c, 0x74, 0x00, 0x00, 0x04, 0x64, 0x61, 0x74, 0x61,
0x00, 0x00, 0x02, 0x21, 0x3d, 0x00, 0x00, 0x04, 0x46, 0x69, 0x6c, 0x65,
0x00, 0x00, 0x08, 0x62, 0x61, 0x73, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x00,
0x00, 0x04, 0x74, 0x6f, 0x5f, 0x73, 0x00, 0x00, 0x06, 0x75, 0x70, 0x63,
0x61, 0x73, 0x65, 0x00, 0x00, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c,
0x00, 0x00, 0x02, 0x66, 0x67, 0x00, 0x00, 0x02, 0x62, 0x67, 0x00, 0x00,
0x05, 0x66, 0x6c, 0x61, 0x67, 0x73, 0x00, 0x00, 0x05, 0x73, 0x74, 0x61,
0x72, 0x74, 0x00, 0x00, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x00,
0x00, 0x02, 0x3c, 0x3c, 0x00, 0x00, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72,
0x00, 0x00, 0x04, 0x74, 0x65, 0x78, 0x74, 0x00, 0x00, 0x0a, 0x68, 0x69,
0x67, 0x68, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x73, 0x00, 0x00, 0x00, 0x00,
0x37, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x39, 0x04, 0x00, 0x00, 0x1d, 0x03, 0x00, 0x01, 0x04, 0x01, 0x32,
0x03, 0x01, 0x01, 0x3d, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x09, 0x43,
0x6c, 0x69, 0x70, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x00, 0x00, 0x04, 0x63,
0x6f, 0x70, 0x79, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x02, 0x00, 0x04,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x39, 0x00, 0x00, 0x00,
0x1d, 0x02, 0x00, 0x33, 0x02, 0x01, 0x3d, 0x02, 0x00, 0x00, 0x00, 0x02,
0x00, 0x09, 0x43, 0x6c, 0x69, 0x70, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x00,
0x00, 0x05, 0x70, 0x61, 0x73, 0x74, 0x65, 0x00, 0x00, 0x00, 0x03, 0xc8,
0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x3a,
0x39, 0x04, 0x00, 0x00, 0x10, 0x03, 0x00, 0x1d, 0x07, 0x01, 0x01, 0x08,
0x01, 0x32, 0x07, 0x02, 0x01, 0x27, 0x07, 0x00, 0x02, 0x3d, 0x03, 0x1d,
0x07, 0x01, 0x01, 0x08, 0x01, 0x10, 0x09, 0x03, 0x34, 0x07, 0x04, 0x01,
0x33, 0x07, 0x05, 0x01, 0x04, 0x07, 0x01, 0x07, 0x04, 0x5c, 0x08, 0x00,
0x32, 0x07, 0x06, 0x01, 0x28, 0x07, 0x00, 0xc7, 0x01, 0x07, 0x04, 0x08,
0x08, 0x11, 0x09, 0x64, 0x08, 0x23, 0x07, 0x33, 0x07, 0x07, 0x01, 0x05,
0x07, 0x01, 0x07, 0x05, 0x66, 0x08, 0x1f, 0x08, 0x08, 0x5c, 0x09, 0x01,
0x32, 0x08, 0x09, 0x01, 0x01, 0x09, 0x07, 0x32, 0x08, 0x0a, 0x01, 0x27,
0x08, 0x00, 0x17, 0x66, 0x08, 0x1f, 0x08, 0x08, 0x5c, 0x09, 0x02, 0x32,
0x08, 0x09, 0x01, 0x01, 0x09, 0x07, 0x32, 0x08, 0x0a, 0x01, 0x28, 0x08,
0x00, 0x06, 0x10, 0x08, 0x0b, 0x26, 0x00, 0x7a, 0x66, 0x08, 0x1f, 0x08,
0x08, 0x5c, 0x09, 0x03, 0x32, 0x08, 0x09, 0x01, 0x01, 0x09, 0x07, 0x32,
0x08, 0x0a, 0x01, 0x28, 0x08, 0x00, 0x06, 0x10, 0x08, 0x0c, 0x26, 0x00,
0x5d, 0x66, 0x08, 0x1f, 0x08, 0x08, 0x5c, 0x09, 0x04, 0x32, 0x08, 0x09,
0x01, 0x01, 0x09, 0x07, 0x32, 0x08, 0x0a, 0x01, 0x28, 0x08, 0x00, 0x06,
0x10, 0x08, 0x0d, 0x26, 0x00, 0x40, 0x66, 0x08, 0x1f, 0x08, 0x08, 0x5c,
0x09, 0x05, 0x32, 0x08, 0x09, 0x01, 0x01, 0x09, 0x07, 0x32, 0x08, 0x0a,
0x01, 0x28, 0x08, 0x00, 0x06, 0x10, 0x08, 0x0e, 0x26, 0x00, 0x23, 0x66,
0x08, 0x1f, 0x08, 0x08, 0x5c, 0x09, 0x06, 0x32, 0x08, 0x09, 0x01, 0x01,
0x09, 0x07, 0x32, 0x08, 0x0a, 0x01, 0x28, 0x08, 0x00, 0x06, 0x10, 0x08,
0x0f, 0x26, 0x00, 0x06, 0x10, 0x08, 0x00, 0x26, 0x00, 0x00, 0x01, 0x03,
0x08, 0x3d, 0x03, 0x10, 0x07, 0x10, 0x10, 0x08, 0x10, 0x32, 0x07, 0x11,
0x01, 0x27, 0x07, 0x00, 0x0a, 0x10, 0x07, 0x10, 0x10, 0x08, 0x12, 0x32,
0x07, 0x11, 0x01, 0x28, 0x07, 0x00, 0x02, 0x3d, 0x03, 0x5c, 0x08, 0x07,
0x2f, 0x07, 0x13, 0x01, 0x33, 0x07, 0x14, 0x28, 0x07, 0x00, 0x02, 0x3d,
0x03, 0x5c, 0x08, 0x08, 0x01, 0x09, 0x01, 0x5d, 0x08, 0x5c, 0x09, 0x09,
0x5d, 0x08, 0x2f, 0x07, 0x15, 0x01, 0x33, 0x07, 0x05, 0x01, 0x06, 0x07,
0x01, 0x07, 0x06, 0x66, 0x08, 0x1f, 0x08, 0x08, 0x5c, 0x09, 0x0a, 0x32,
0x08, 0x09, 0x01, 0x01, 0x09, 0x07, 0x32, 0x08, 0x0a, 0x01, 0x28, 0x08,
0x00, 0x06, 0x10, 0x08, 0x0b, 0x26, 0x00, 0xd1, 0x66, 0x08, 0x1f, 0x08,
0x08, 0x5c, 0x09, 0x05, 0x32, 0x08, 0x09, 0x01, 0x01, 0x09, 0x07, 0x32,
0x08, 0x0a, 0x01, 0x28, 0x08, 0x00, 0x06, 0x10, 0x08, 0x0e, 0x26, 0x00,
0xb4, 0x66, 0x08, 0x1f, 0x08, 0x08, 0x5c, 0x09, 0x0b, 0x32, 0x08, 0x09,
0x01, 0x01, 0x09, 0x07, 0x32, 0x08, 0x0a, 0x01, 0x28, 0x08, 0x00, 0x06,
0x10, 0x08, 0x16, 0x26, 0x00, 0x97, 0x66, 0x08, 0x1f, 0x08, 0x08, 0x5c,
0x09, 0x0c, 0x32, 0x08, 0x09, 0x01, 0x01, 0x09, 0x07, 0x32, 0x08, 0x0a,
0x01, 0x28, 0x08, 0x00, 0x06, 0x10, 0x08, 0x17, 0x26, 0x00, 0x7a, 0x66,
0x08, 0x1f, 0x08, 0x08, 0x5c, 0x09, 0x04, 0x32, 0x08, 0x09, 0x01, 0x01,
0x09, 0x07, 0x32, 0x08, 0x0a, 0x01, 0x28, 0x08, 0x00, 0x06, 0x10, 0x08,
0x0d, 0x26, 0x00, 0x5d, 0x66, 0x08, 0x1f, 0x08, 0x08, 0x5c, 0x09, 0x0d,
0x32, 0x08, 0x09, 0x01, 0x01, 0x09, 0x07, 0x32, 0x08, 0x0a, 0x01, 0x28,
0x08, 0x00, 0x06, 0x10, 0x08, 0x18, 0x26, 0x00, 0x40, 0x66, 0x08, 0x1f,
0x08, 0x08, 0x5c, 0x09, 0x0e, 0x32, 0x08, 0x09, 0x01, 0x01, 0x09, 0x07,
0x32, 0x08, 0x0a, 0x01, 0x28, 0x08, 0x00, 0x06, 0x10, 0x08, 0x19, 0x26,
0x00, 0x23, 0x66, 0x08, 0x1f, 0x08, 0x08, 0x5c, 0x09, 0x0f, 0x32, 0x08,
0x09, 0x01, 0x01, 0x09, 0x07, 0x32, 0x08, 0x0a, 0x01, 0x28, 0x08, 0x00,
0x06, 0x10, 0x08, 0x1a, 0x26, 0x00, 0x06, 0x10, 0x08, 0x00, 0x26, 0x00,
0x00, 0x01, 0x03, 0x08, 0x3d, 0x03, 0x00, 0x10, 0x00, 0x00, 0x02, 0x23,
0x21, 0x00, 0x00, 0x00, 0x04, 0x62, 0x61, 0x73, 0x68, 0x00, 0x00, 0x00,
0x02, 0x73, 0x68, 0x00, 0x00, 0x00, 0x04, 0x66, 0x69, 0x73, 0x68, 0x00,
0x00, 0x00, 0x06, 0x70, 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x00, 0x00, 0x00,
0x04, 0x72, 0x75, 0x62, 0x79, 0x00, 0x00, 0x00, 0x03, 0x6c, 0x75, 0x61,
0x00, 0x00, 0x00, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x14,
0x66, 0x69, 0x6c, 0x65, 0x20, 0x2d, 0x2d, 0x6d, 0x69, 0x6d, 0x65, 0x2d,
0x74, 0x79, 0x70, 0x65, 0x20, 0x2d, 0x62, 0x20, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0b, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x73, 0x63, 0x72,
0x69, 0x70, 0x74, 0x00, 0x00, 0x00, 0x04, 0x64, 0x69, 0x66, 0x66, 0x00,
0x00, 0x00, 0x04, 0x68, 0x74, 0x6d, 0x6c, 0x00, 0x00, 0x00, 0x0a, 0x6a,
0x61, 0x76, 0x61, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x00, 0x00, 0x00,
0x08, 0x6d, 0x61, 0x6b, 0x65, 0x66, 0x69, 0x6c, 0x65, 0x00, 0x00, 0x00,
0x03, 0x2d, 0x63, 0x24, 0x00, 0x00, 0x1b, 0x00, 0x07, 0x64, 0x65, 0x66,
0x61, 0x75, 0x6c, 0x74, 0x00, 0x00, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x00,
0x00, 0x06, 0x65, 0x78, 0x69, 0x73, 0x74, 0x3f, 0x00, 0x00, 0x08, 0x72,
0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x00, 0x00, 0x04, 0x6f, 0x70,
0x65, 0x6e, 0x00, 0x00, 0x05, 0x63, 0x68, 0x6f, 0x6d, 0x70, 0x00, 0x00,
0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x3f,
0x00, 0x00, 0x08, 0x64, 0x6f, 0x77, 0x6e, 0x63, 0x61, 0x73, 0x65, 0x00,
0x00, 0x06, 0x52, 0x65, 0x67, 0x65, 0x78, 0x70, 0x00, 0x00, 0x07, 0x63,
0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x00, 0x00, 0x03, 0x3d, 0x3d, 0x3d,
0x00, 0x00, 0x04, 0x62, 0x61, 0x73, 0x68, 0x00, 0x00, 0x04, 0x66, 0x69,
0x73, 0x68, 0x00, 0x00, 0x06, 0x70, 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x00,
0x00, 0x04, 0x72, 0x75, 0x62, 0x79, 0x00, 0x00, 0x03, 0x6c, 0x75, 0x61,
0x00, 0x00, 0x05, 0x6c, 0x69, 0x6e, 0x75, 0x78, 0x00, 0x00, 0x02, 0x21,
0x3d, 0x00, 0x00, 0x03, 0x6d, 0x61, 0x63, 0x00, 0x00, 0x0f, 0x63, 0x6f,
0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x5f, 0x65, 0x78, 0x69, 0x73, 0x74, 0x73,
0x3f, 0x00, 0x00, 0x01, 0x21, 0x00, 0x00, 0x01, 0x60, 0x00, 0x00, 0x04,
0x64, 0x69, 0x66, 0x66, 0x00, 0x00, 0x04, 0x68, 0x74, 0x6d, 0x6c, 0x00,
0x00, 0x0a, 0x6a, 0x61, 0x76, 0x61, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
0x00, 0x00, 0x08, 0x6d, 0x61, 0x6b, 0x65, 0x66, 0x69, 0x6c, 0x65, 0x00,
0x00, 0x01, 0x63, 0x00, 0x00, 0x00, 0x01, 0x6b, 0x00, 0x01, 0x00, 0x0a,
0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x10, 0x02, 0x00, 0x10,
0x03, 0x01, 0x10, 0x04, 0x02, 0x10, 0x05, 0x03, 0x10, 0x06, 0x04, 0x2f,
0x01, 0x05, 0x05, 0x10, 0x02, 0x06, 0x10, 0x03, 0x07, 0x10, 0x04, 0x08,
0x10, 0x05, 0x09, 0x10, 0x06, 0x0a, 0x10, 0x07, 0x0b, 0x10, 0x08, 0x0c,
0x2f, 0x01, 0x0d, 0x07, 0x6b, 0x01, 0x0e, 0x00, 0x6b, 0x01, 0x0f, 0x01,
0x6b, 0x01, 0x10, 0x02, 0x6b, 0x01, 0x11, 0x03, 0x6b, 0x01, 0x12, 0x04,
0x6b, 0x01, 0x13, 0x05, 0x6b, 0x01, 0x14, 0x06, 0x6b, 0x01, 0x15, 0x07,
0x3d, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x05, 0x74, 0x68, 0x65, 0x6d,
0x65, 0x00, 0x00, 0x0a, 0x6c, 0x73, 0x70, 0x5f, 0x63, 0x6f, 0x6e, 0x66,
0x69, 0x67, 0x00, 0x00, 0x09, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67,
0x65, 0x73, 0x00, 0x00, 0x0c, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x65, 0x6e,
0x64, 0x69, 0x6e, 0x67, 0x73, 0x00, 0x00, 0x0c, 0x68, 0x69, 0x67, 0x68,
0x6c, 0x69, 0x67, 0x68, 0x74, 0x65, 0x72, 0x73, 0x00, 0x00, 0x0d, 0x61,
0x74, 0x74, 0x72, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72,
0x00, 0x00, 0x09, 0x62, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x75, 0x70,
0x00, 0x00, 0x0a, 0x62, 0x5f, 0x73, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77,
0x6e, 0x00, 0x00, 0x12, 0x62, 0x5f, 0x65, 0x78, 0x74, 0x72, 0x61, 0x5f,
0x68, 0x69, 0x67, 0x68, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x73, 0x00, 0x00,
0x05, 0x62, 0x5f, 0x62, 0x61, 0x72, 0x00, 0x00, 0x06, 0x62, 0x5f, 0x63,
0x6f, 0x70, 0x79, 0x00, 0x00, 0x07, 0x62, 0x5f, 0x70, 0x61, 0x73, 0x74,
0x65, 0x00, 0x00, 0x0d, 0x62, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x64,
0x65, 0x74, 0x65, 0x63, 0x74, 0x00, 0x00, 0x0b, 0x61, 0x74, 0x74, 0x72,
0x5f, 0x72, 0x65, 0x61, 0x64, 0x65, 0x72, 0x00, 0x00, 0x04, 0x62, 0x61,
0x72, 0x3d, 0x00, 0x00, 0x07, 0x73, 0x74, 0x61, 0x72, 0x74, 0x75, 0x70,
0x00, 0x00, 0x08, 0x73, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x00,
0x00, 0x04, 0x63, 0x6f, 0x70, 0x79, 0x00, 0x00, 0x05, 0x70, 0x61, 0x73,
0x74, 0x65, 0x00, 0x00, 0x0b, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x64, 0x65,
0x74, 0x65, 0x63, 0x74, 0x00, 0x00, 0x10, 0x65, 0x78, 0x74, 0x72, 0x61,
0x5f, 0x68, 0x69, 0x67, 0x68, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x73, 0x00,
0x00, 0x04, 0x62, 0x69, 0x6e, 0x64, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00,
0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x39,
0x00, 0x00, 0x01, 0x01, 0x02, 0x01, 0x01, 0x03, 0x02, 0x1a, 0x03, 0x00,
0x3d, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x40, 0x62, 0x5f, 0x62,
0x61, 0x72, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x03, 0x00, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x39, 0x00, 0x00, 0x01, 0x01,
0x02, 0x01, 0x01, 0x03, 0x02, 0x1a, 0x03, 0x00, 0x3d, 0x03, 0x00, 0x00,
0x00, 0x01, 0x00, 0x0a, 0x40, 0x62, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74,
0x75, 0x70, 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x03, 0x00, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x39, 0x00, 0x00, 0x01, 0x01,
0x02, 0x01, 0x01, 0x03, 0x02, 0x1a, 0x03, 0x00, 0x3d, 0x03, 0x00, 0x00,
0x00, 0x01, 0x00, 0x0b, 0x40, 0x62, 0x5f, 0x73, 0x68, 0x75, 0x74, 0x64,
0x6f, 0x77, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x03, 0x00, 0x04,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x39, 0x00, 0x00, 0x01,
0x01, 0x02, 0x01, 0x01, 0x03, 0x02, 0x1a, 0x03, 0x00, 0x3d, 0x03, 0x00,
0x00, 0x00, 0x01, 0x00, 0x07, 0x40, 0x62, 0x5f, 0x63, 0x6f, 0x70, 0x79,
0x00, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0f, 0x39, 0x00, 0x00, 0x01, 0x01, 0x02, 0x01,
0x01, 0x03, 0x02, 0x1a, 0x03, 0x00, 0x3d, 0x03, 0x00, 0x00, 0x00, 0x01,
0x00, 0x08, 0x40, 0x62, 0x5f, 0x70, 0x61, 0x73, 0x74, 0x65, 0x00, 0x00,
0x00, 0x00, 0x34, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0f, 0x39, 0x00, 0x00, 0x01, 0x01, 0x02, 0x01, 0x01, 0x03,
0x02, 0x1a, 0x03, 0x00, 0x3d, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0e,
0x40, 0x62, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x64, 0x65, 0x74, 0x65,
0x63, 0x74, 0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x03, 0x00, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x39, 0x00, 0x00, 0x01, 0x01,
0x02, 0x01, 0x01, 0x03, 0x02, 0x1a, 0x03, 0x00, 0x3d, 0x03, 0x00, 0x00,
0x00, 0x01, 0x00, 0x13, 0x40, 0x62, 0x5f, 0x65, 0x78, 0x74, 0x72, 0x61,
0x5f, 0x68, 0x69, 0x67, 0x68, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x73, 0x00,
0x00, 0x00, 0x01, 0x43, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x03, 0x00, 0x00,
0x00, 0x00, 0x00, 0xc1, 0x39, 0x04, 0x40, 0x01, 0x26, 0x00, 0x06, 0x26,
0x00, 0x05, 0x26, 0x00, 0x04, 0x11, 0x02, 0x11, 0x03, 0x01, 0x05, 0x04,
0x01, 0x08, 0x01, 0x1d, 0x09, 0x00, 0x32, 0x08, 0x01, 0x01, 0x27, 0x08,
0x00, 0x07, 0x01, 0x08, 0x01, 0x53, 0x01, 0x08, 0x01, 0x01, 0x08, 0x02,
0x29, 0x08, 0x00, 0x03, 0x26, 0x00, 0x31, 0x12, 0x06, 0x1d, 0x08, 0x02,
0x33, 0x08, 0x03, 0x01, 0x07, 0x08, 0x01, 0x08, 0x07, 0x10, 0x09, 0x04,
0x62, 0x0a, 0x00, 0x34, 0x08, 0x05, 0x01, 0x30, 0x08, 0x06, 0x28, 0x08,
0x00, 0x0d, 0x01, 0x08, 0x07, 0x01, 0x09, 0x05, 0x34, 0x08, 0x07, 0x00,
0x26, 0x00, 0x02, 0x11, 0x08, 0x26, 0x00, 0x5b, 0x30, 0x08, 0x06, 0x28,
0x08, 0x00, 0x22, 0x01, 0x08, 0x02, 0x1d, 0x09, 0x00, 0x32, 0x08, 0x01,
0x01, 0x27, 0x08, 0x00, 0x07, 0x01, 0x08, 0x02, 0x53, 0x02, 0x08, 0x01,
0x01, 0x08, 0x01, 0x62, 0x09, 0x01, 0x34, 0x08, 0x08, 0x00, 0x26, 0x00,
0x32, 0x01, 0x08, 0x03, 0x1d, 0x09, 0x09, 0x32, 0x08, 0x01, 0x01, 0x28,
0x08, 0x00, 0x22, 0x01, 0x08, 0x02, 0x1d, 0x09, 0x00, 0x32, 0x08, 0x01,
0x01, 0x27, 0x08, 0x00, 0x07, 0x01, 0x08, 0x02, 0x53, 0x02, 0x08, 0x01,
0x01, 0x08, 0x01, 0x62, 0x09, 0x02, 0x34, 0x08, 0x08, 0x00, 0x26, 0x00,
0x02, 0x11, 0x08, 0x3d, 0x08, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x05, 0x41,
0x72, 0x72, 0x61, 0x79, 0x00, 0x00, 0x05, 0x69, 0x73, 0x5f, 0x61, 0x3f,
0x00, 0x00, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x00, 0x00, 0x03,
0x6e, 0x65, 0x77, 0x00, 0x00, 0x03, 0x73, 0x65, 0x74, 0x00, 0x00, 0x17,
0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x5f, 0x73, 0x69, 0x6e, 0x67, 0x6c,
0x65, 0x74, 0x6f, 0x6e, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x00,
0x00, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x67, 0x69, 0x76, 0x65,
0x6e, 0x3f, 0x00, 0x00, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63,
0x65, 0x5f, 0x65, 0x78, 0x65, 0x63, 0x00, 0x00, 0x04, 0x65, 0x61, 0x63,
0x68, 0x00, 0x00, 0x06, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x00, 0x00,
0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x26, 0x39, 0x04, 0x20, 0x01, 0x26, 0x00, 0x03, 0x26, 0x00,
0x02, 0x11, 0x02, 0x01, 0x04, 0x03, 0x21, 0x05, 0x06, 0x00, 0x21, 0x06,
0x01, 0x00, 0x01, 0x07, 0x01, 0x01, 0x08, 0x02, 0x01, 0x09, 0x04, 0x34,
0x05, 0x00, 0x03, 0x3d, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x62,
0x69, 0x6e, 0x64, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x03, 0x00, 0x05,
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x39, 0x04, 0x00, 0x00,
0x21, 0x03, 0x02, 0x00, 0x62, 0x04, 0x00, 0x34, 0x03, 0x00, 0x00, 0x3d,
0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x65, 0x61, 0x63, 0x68, 0x00,
0x00, 0x00, 0x00, 0x87, 0x00, 0x03, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x5e, 0x39, 0x04, 0x00, 0x00, 0x19, 0x03, 0x00, 0x21,
0x04, 0x01, 0x00, 0x23, 0x03, 0x27, 0x03, 0x00, 0x0f, 0x5e, 0x03, 0x00,
0x19, 0x04, 0x00, 0x21, 0x05, 0x01, 0x00, 0x01, 0x06, 0x03, 0x25, 0x04,
0x19, 0x03, 0x00, 0x21, 0x04, 0x01, 0x00, 0x23, 0x03, 0x01, 0x04, 0x01,
0x23, 0x03, 0x27, 0x03, 0x00, 0x14, 0x52, 0x03, 0x00, 0x19, 0x04, 0x00,
0x21, 0x05, 0x01, 0x00, 0x23, 0x04, 0x01, 0x05, 0x01, 0x01, 0x06, 0x03,
0x25, 0x04, 0x19, 0x03, 0x00, 0x21, 0x04, 0x01, 0x00, 0x23, 0x03, 0x01,
0x04, 0x01, 0x23, 0x03, 0x21, 0x04, 0x05, 0x01, 0x32, 0x03, 0x01, 0x01,
0x3d, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0d, 0x40, 0x6b, 0x65, 0x79,
0x5f, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x73, 0x00, 0x00, 0x02,
0x3c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x03, 0x00, 0x05, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x39, 0x04, 0x00, 0x00, 0x21,
0x03, 0x02, 0x00, 0x62, 0x04, 0x00, 0x34, 0x03, 0x00, 0x00, 0x3d, 0x03,
0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x65, 0x61, 0x63, 0x68, 0x00, 0x00,
0x00, 0x00, 0x84, 0x00, 0x03, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x5e, 0x39, 0x04, 0x00, 0x00, 0x19, 0x03, 0x00, 0x21, 0x04,
0x01, 0x00, 0x23, 0x03, 0x27, 0x03, 0x00, 0x0f, 0x5e, 0x03, 0x00, 0x19,
0x04, 0x00, 0x21, 0x05, 0x01, 0x00, 0x01, 0x06, 0x03, 0x25, 0x04, 0x19,
0x03, 0x00, 0x21, 0x04, 0x01, 0x00, 0x23, 0x03, 0x01, 0x04, 0x01, 0x23,
0x03, 0x27, 0x03, 0x00, 0x14, 0x52, 0x03, 0x00, 0x19, 0x04, 0x00, 0x21,
0x05, 0x01, 0x00, 0x23, 0x04, 0x01, 0x05, 0x01, 0x01, 0x06, 0x03, 0x25,
0x04, 0x19, 0x03, 0x00, 0x21, 0x04, 0x01, 0x00, 0x23, 0x03, 0x01, 0x04,
0x01, 0x23, 0x03, 0x21, 0x04, 0x03, 0x01, 0x32, 0x03, 0x01, 0x01, 0x3d,
0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x40, 0x6b, 0x65, 0x79, 0x5f,
0x62, 0x69, 0x6e, 0x64, 0x73, 0x00, 0x00, 0x02, 0x3c, 0x3c, 0x00, 0x00,
0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0a, 0x6b, 0x01, 0x00, 0x00, 0x6b, 0x01, 0x01, 0x01, 0x3d,
0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x10, 0x72, 0x65, 0x71, 0x75, 0x69,
0x72, 0x65, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x00,
0x00, 0x04, 0x6c, 0x6f, 0x61, 0x64, 0x00, 0x00, 0x00, 0x01, 0x07, 0x00,
0x05, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7b, 0x39,
0x04, 0x20, 0x00, 0x26, 0x00, 0x03, 0x26, 0x00, 0x02, 0x11, 0x02, 0x01,
0x05, 0x01, 0x5c, 0x06, 0x00, 0x32, 0x05, 0x00, 0x01, 0x27, 0x05, 0x00,
0x0b, 0x01, 0x05, 0x01, 0x5c, 0x06, 0x00, 0x45, 0x05, 0x01, 0x01, 0x05,
0x1d, 0x05, 0x01, 0x01, 0x06, 0x01, 0x1d, 0x07, 0x01, 0x1d, 0x08, 0x02,
0x33, 0x08, 0x03, 0x32, 0x07, 0x04, 0x01, 0x32, 0x05, 0x05, 0x02, 0x01,
0x01, 0x05, 0x15, 0x05, 0x06, 0x01, 0x06, 0x01, 0x32, 0x05, 0x07, 0x01,
0x28, 0x05, 0x00, 0x01, 0x40, 0x15, 0x05, 0x06, 0x01, 0x06, 0x01, 0x32,
0x05, 0x08, 0x01, 0x1d, 0x05, 0x01, 0x01, 0x06, 0x01, 0x32, 0x05, 0x09,
0x01, 0x01, 0x04, 0x05, 0x01, 0x06, 0x04, 0x01, 0x07, 0x02, 0x27, 0x07,
0x00, 0x03, 0x15, 0x07, 0x0a, 0x01, 0x08, 0x01, 0x2f, 0x05, 0x0b, 0x03,
0x3d, 0x05, 0x00, 0x01, 0x00, 0x00, 0x03, 0x2e, 0x72, 0x62, 0x00, 0x00,
0x0c, 0x00, 0x09, 0x65, 0x6e, 0x64, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x3f,
0x00, 0x00, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x00, 0x00, 0x01, 0x43, 0x00,
0x00, 0x0b, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x66, 0x69, 0x6c,
0x65, 0x00, 0x00, 0x07, 0x64, 0x69, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x00,
0x00, 0x0b, 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x5f, 0x70, 0x61, 0x74,
0x68, 0x00, 0x00, 0x07, 0x24, 0x4c, 0x4f, 0x41, 0x44, 0x45, 0x44, 0x00,
0x00, 0x08, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x3f, 0x00, 0x00,
0x02, 0x3c, 0x3c, 0x00, 0x00, 0x04, 0x72, 0x65, 0x61, 0x64, 0x00, 0x00,
0x09, 0x24, 0x42, 0x49, 0x4e, 0x44, 0x5f, 0x54, 0x4f, 0x50, 0x00, 0x00,
0x04, 0x65, 0x76, 0x61, 0x6c, 0x00, 0x00, 0x00, 0x00, 0xd3, 0x00, 0x04,
0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x39, 0x04,
0x20, 0x00, 0x26, 0x00, 0x03, 0x26, 0x00, 0x02, 0x11, 0x02, 0x01, 0x04,
0x01, 0x5c, 0x05, 0x00, 0x32, 0x04, 0x00, 0x01, 0x27, 0x04, 0x00, 0x0b,
0x01, 0x04, 0x01, 0x5c, 0x05, 0x00, 0x45, 0x04, 0x01, 0x01, 0x04, 0x1d,
0x04, 0x01, 0x01, 0x05, 0x01, 0x1d, 0x06, 0x01, 0x1d, 0x07, 0x02, 0x33,
0x07, 0x03, 0x32, 0x06, 0x04, 0x01, 0x32, 0x04, 0x05, 0x02, 0x01, 0x01,
0x04, 0x15, 0x04, 0x06, 0x01, 0x05, 0x01, 0x32, 0x04, 0x07, 0x01, 0x01,
0x05, 0x01, 0x01, 0x06, 0x02, 0x2f, 0x04, 0x08, 0x02, 0x3d, 0x04, 0x00,
0x01, 0x00, 0x00, 0x03, 0x2e, 0x72, 0x62, 0x00, 0x00, 0x09, 0x00, 0x09,
0x65, 0x6e, 0x64, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x3f, 0x00, 0x00, 0x04,
0x46, 0x69, 0x6c, 0x65, 0x00, 0x00, 0x01, 0x43, 0x00, 0x00, 0x0b, 0x63,
0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x00, 0x00,
0x07, 0x64, 0x69, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x00, 0x00, 0x0b, 0x65,
0x78, 0x70, 0x61, 0x6e, 0x64, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x00, 0x00,
0x07, 0x24, 0x4c, 0x4f, 0x41, 0x44, 0x45, 0x44, 0x00, 0x00, 0x06, 0x64,
0x65, 0x6c, 0x65, 0x74, 0x65, 0x00, 0x00, 0x10, 0x72, 0x65, 0x71, 0x75,
0x69, 0x72, 0x65, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65,
0x00, 0x4c, 0x56, 0x41, 0x52, 0x00, 0x00, 0x01, 0x78, 0x00, 0x00, 0x00,
0x1d, 0x00, 0x03, 0x63, 0x6d, 0x64, 0x00, 0x04, 0x74, 0x65, 0x78, 0x74,
0x00, 0x01, 0x66, 0x00, 0x07, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64,
0x00, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x00, 0x0a, 0x6d, 0x6f, 0x64, 0x65,
0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x0b, 0x6d, 0x6f, 0x64, 0x65,
0x5f, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x00, 0x09, 0x6c, 0x61, 0x6e,
0x67, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x00, 0x08, 0x66, 0x69, 0x6c, 0x65,
0x6e, 0x61, 0x6d, 0x65, 0x00, 0x08, 0x73, 0x74, 0x61, 0x72, 0x74, 0x69,
0x6e, 0x67, 0x00, 0x0a, 0x68, 0x69, 0x67, 0x68, 0x6c, 0x69, 0x67, 0x68,
0x74, 0x73, 0x00, 0x04, 0x74, 0x79, 0x70, 0x65, 0x00, 0x0a, 0x66, 0x69,
0x72, 0x73, 0x74, 0x5f, 0x6c, 0x69, 0x6e, 0x65, 0x00, 0x07, 0x73, 0x68,
0x65, 0x62, 0x61, 0x6e, 0x67, 0x00, 0x08, 0x6d, 0x69, 0x6d, 0x65, 0x74,
0x79, 0x70, 0x65, 0x00, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x00, 0x05,
0x6d, 0x6f, 0x64, 0x65, 0x73, 0x00, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x00,
0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x03, 0x61, 0x70, 0x70,
0x00, 0x03, 0x64, 0x73, 0x6c, 0x00, 0x01, 0x6b, 0x00, 0x03, 0x61, 0x63,
0x74, 0x00, 0x03, 0x62, 0x6c, 0x6b, 0x00, 0x04, 0x6d, 0x6f, 0x64, 0x65,
0x00, 0x03, 0x6b, 0x65, 0x79, 0x00, 0x04, 0x70, 0x61, 0x74, 0x68, 0x00,
0x04, 0x62, 0x69, 0x6e, 0x64, 0x00, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x00,
0x00, 0xff, 0xff, 0x00, 0x01, 0xff, 0xff, 0x00, 0x02, 0xff, 0xff, 0x00,
0x02, 0xff, 0xff, 0x00, 0x02, 0xff, 0xff, 0x00, 0x02, 0xff, 0xff, 0x00,
0x02, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0xff, 0xff, 0x00, 0x03, 0x00,
0x04, 0xff, 0xff, 0x00, 0x05, 0x00, 0x06, 0x00, 0x07, 0x00, 0x08, 0x00,
0x09, 0x00, 0x0a, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0x00, 0x08, 0xff,
0xff, 0x00, 0x0b, 0x00, 0x0c, 0x00, 0x0d, 0x00, 0x0e, 0xff, 0xff, 0x00,
0x0f, 0xff, 0xff, 0x00, 0x0f, 0xff, 0xff, 0x00, 0x0f, 0xff, 0xff, 0x00,
0x0f, 0xff, 0xff, 0x00, 0x0f, 0xff, 0xff, 0x00, 0x0f, 0xff, 0xff, 0x00,
0x0f, 0x00, 0x10, 0x00, 0x11, 0x00, 0x12, 0xff, 0xff, 0x00, 0x0f, 0x00,
0x13, 0x00, 0x14, 0x00, 0x15, 0x00, 0x16, 0xff, 0xff, 0x00, 0x17, 0x00,
0x18, 0xff, 0xff, 0x00, 0x19, 0xff, 0xff, 0x00, 0x18, 0xff, 0xff, 0x00,
0x19, 0xff, 0xff, 0x00, 0x1a, 0x00, 0x1b, 0xff, 0xff, 0x00, 0x1c, 0x00,
0x1a, 0x00, 0x1b, 0xff, 0xff, 0x45, 0x4e, 0x44, 0x00, 0x00, 0x00, 0x00,
0x08
};
constexpr unsigned int _tmp___crib_precompiled_mrb_len = 11293;

59
include/syntax/decl.h Normal file
View File

@@ -0,0 +1,59 @@
#ifndef SYNTAX_DECL_H
#define SYNTAX_DECL_H
#include "io/knot.h"
#include "io/sysio.h"
#include "pch.h"
#include "syntax/trie.h"
#define MAX_LINES_LOOKAROUND 512
struct Highlight {
uint32_t fg{0xFFFFFF};
uint32_t bg{0x000000};
uint8_t flags{0};
};
enum struct TokenKind : uint8_t {
#define ADD(name) name,
#include "syntax/tokens.def"
#undef ADD
Count
};
constexpr size_t TOKEN_KIND_COUNT = static_cast<size_t>(TokenKind::Count);
const std::unordered_map<std::string, TokenKind> kind_map = {
#define ADD(name) {#name, TokenKind::name},
#include "syntax/tokens.def"
#undef ADD
};
extern std::array<Highlight, TOKEN_KIND_COUNT> highlights;
struct Token {
uint32_t start;
uint32_t end;
TokenKind type;
};
struct StateBase {
virtual ~StateBase() = default;
virtual std::unique_ptr<StateBase> clone() const = 0;
};
struct CustomState : StateBase {
std::string value;
explicit CustomState(std::string v) : value(std::move(v)) {}
std::unique_ptr<StateBase> clone() const override {
return std::make_unique<CustomState>(value);
}
};
struct LineData {
std::unique_ptr<StateBase> out_state;
std::vector<Token> tokens;
std::unique_ptr<StateBase> in_state;
};
#endif

490
include/syntax/extras.h Normal file
View File

@@ -0,0 +1,490 @@
#ifndef SYNTAX_EXTRAS_H
#define SYNTAX_EXTRAS_H
#include "io/knot.h"
#include "syntax/decl.h"
#include "utils/utils.h"
inline static const std::vector<std::pair<std::string, uint32_t>> color_map = {
{"AliceBlue", 0xF0F8FF},
{"AntiqueWhite", 0xFAEBD7},
{"Aqua", 0x00FFFF},
{"Aquamarine", 0x7FFFD4},
{"Azure", 0xF0FFFF},
{"Beige", 0xF5F5DC},
{"Bisque", 0xFFE4C4},
{"Black", 0x000000},
{"BlanchedAlmond", 0xFFEBCD},
{"Blue", 0x0000FF},
{"BlueViolet", 0x8A2BE2},
{"Brown", 0xA52A2A},
{"BurlyWood", 0xDEB887},
{"CadetBlue", 0x5F9EA0},
{"Chartreuse", 0x7FFF00},
{"Chocolate", 0xD2691E},
{"Coral", 0xFF7F50},
{"CornflowerBlue", 0x6495ED},
{"Cornsilk", 0xFFF8DC},
{"Crimson", 0xDC143C},
{"Cyan", 0x00FFFF},
{"DarkBlue", 0x00008B},
{"DarkCyan", 0x008B8B},
{"DarkGoldenRod", 0xB8860B},
{"DarkGray", 0xA9A9A9},
{"DarkGrey", 0xA9A9A9},
{"DarkGreen", 0x006400},
{"DarkKhaki", 0xBDB76B},
{"DarkMagenta", 0x8B008B},
{"DarkOliveGreen", 0x556B2F},
{"DarkOrange", 0xFF8C00},
{"DarkOrchid", 0x9932CC},
{"DarkRed", 0x8B0000},
{"DarkSalmon", 0xE9967A},
{"DarkSeaGreen", 0x8FBC8F},
{"DarkSlateBlue", 0x483D8B},
{"DarkSlateGray", 0x2F4F4F},
{"DarkSlateGrey", 0x2F4F4F},
{"DarkTurquoise", 0x00CED1},
{"DarkViolet", 0x9400D3},
{"DeepPink", 0xFF1493},
{"DeepSkyBlue", 0x00BFFF},
{"DimGray", 0x696969},
{"DimGrey", 0x696969},
{"DodgerBlue", 0x1E90FF},
{"FireBrick", 0xB22222},
{"FloralWhite", 0xFFFAF0},
{"ForestGreen", 0x228B22},
{"Fuchsia", 0xFF00FF},
{"Gainsboro", 0xDCDCDC},
{"GhostWhite", 0xF8F8FF},
{"Gold", 0xFFD700},
{"GoldenRod", 0xDAA520},
{"Gray", 0x808080},
{"Grey", 0x808080},
{"Green", 0x008000},
{"GreenYellow", 0xADFF2F},
{"HoneyDew", 0xF0FFF0},
{"HotPink", 0xFF69B4},
{"IndianRed", 0xCD5C5C},
{"Indigo", 0x4B0082},
{"Ivory", 0xFFFFF0},
{"Khaki", 0xF0E68C},
{"Lavender", 0xE6E6FA},
{"LavenderBlush", 0xFFF0F5},
{"LawnGreen", 0x7CFC00},
{"LemonChiffon", 0xFFFACD},
{"LightBlue", 0xADD8E6},
{"LightCoral", 0xF08080},
{"LightCyan", 0xE0FFFF},
{"LightGoldenRodYellow", 0xFAFAD2},
{"LightGray", 0xD3D3D3},
{"LightGrey", 0xD3D3D3},
{"LightGreen", 0x90EE90},
{"LightPink", 0xFFB6C1},
{"LightSalmon", 0xFFA07A},
{"LightSeaGreen", 0x20B2AA},
{"LightSkyBlue", 0x87CEFA},
{"LightSlateGray", 0x778899},
{"LightSlateGrey", 0x778899},
{"LightSteelBlue", 0xB0C4DE},
{"LightYellow", 0xFFFFE0},
{"Lime", 0x00FF00},
{"LimeGreen", 0x32CD32},
{"Linen", 0xFAF0E6},
{"Magenta", 0xFF00FF},
{"Maroon", 0x800000},
{"MediumAquaMarine", 0x66CDAA},
{"MediumBlue", 0x0000CD},
{"MediumOrchid", 0xBA55D3},
{"MediumPurple", 0x9370DB},
{"MediumSeaGreen", 0x3CB371},
{"MediumSlateBlue", 0x7B68EE},
{"MediumSpringGreen", 0x00FA9A},
{"MediumTurquoise", 0x48D1CC},
{"MediumVioletRed", 0xC71585},
{"MidnightBlue", 0x191970},
{"MintCream", 0xF5FFFA},
{"MistyRose", 0xFFE4E1},
{"Moccasin", 0xFFE4B5},
{"NavajoWhite", 0xFFDEAD},
{"Navy", 0x000080},
{"OldLace", 0xFDF5E6},
{"Olive", 0x808000},
{"OliveDrab", 0x6B8E23},
{"Orange", 0xFFA500},
{"OrangeRed", 0xFF4500},
{"Orchid", 0xDA70D6},
{"PaleGoldenRod", 0xEEE8AA},
{"PaleGreen", 0x98FB98},
{"PaleTurquoise", 0xAFEEEE},
{"PaleVioletRed", 0xDB7093},
{"PapayaWhip", 0xFFEFD5},
{"PeachPuff", 0xFFDAB9},
{"Peru", 0xCD853F},
{"Pink", 0xFFC0CB},
{"Plum", 0xDDA0DD},
{"PowderBlue", 0xB0E0E6},
{"Purple", 0x800080},
{"RebeccaPurple", 0x663399},
{"Red", 0xFF0000},
{"RosyBrown", 0xBC8F8F},
{"RoyalBlue", 0x4169E1},
{"SaddleBrown", 0x8B4513},
{"Salmon", 0xFA8072},
{"SandyBrown", 0xF4A460},
{"SeaGreen", 0x2E8B57},
{"SeaShell", 0xFFF5EE},
{"Sienna", 0xA0522D},
{"Silver", 0xC0C0C0},
{"SkyBlue", 0x87CEEB},
{"SlateBlue", 0x6A5ACD},
{"SlateGray", 0x708090},
{"SlateGrey", 0x708090},
{"Snow", 0xFFFAFA},
{"SpringGreen", 0x00FF7F},
{"SteelBlue", 0x4682B4},
{"Tan", 0xD2B48C},
{"Teal", 0x008080},
{"Thistle", 0xD8BFD8},
{"Tomato", 0xFF6347},
{"Turquoise", 0x40E0D0},
{"Violet", 0xEE82EE},
{"Wheat", 0xF5DEB3},
{"White", 0xFFFFFF},
{"WhiteSmoke", 0xF5F5F5},
{"Yellow", 0xFFFF00},
{"YellowGreen", 0x9ACD32},
};
// Add word under cursor to this
struct ExtraHighlighter {
std::vector<uint32_t> colors;
std::array<std::vector<uint32_t>, 50> lines;
Trie<uint32_t> css_colors = Trie<uint32_t>();
uint32_t start = 0;
ExtraHighlighter() { css_colors.build(color_map, false); }
void render(Knot *root, uint32_t n_start, std::string word, bool is_css) {
start = n_start;
for (auto &line : lines)
line.clear();
LineIterator *it = begin_l_iter(root, start);
if (!it)
return;
uint32_t idx = 0;
uint32_t len;
char *line;
while (idx < 50 && (line = next_line(it, &len))) {
lines[idx].assign(len, UINT32_MAX - 1);
uint32_t i = 0;
while (i < len) {
if (is_css) {
std::optional<uint32_t> color;
uint32_t color_len = css_colors.match(
line, i, len, [](char c) { return isalnum(c) || c == '_'; },
&color);
if (color) {
for (uint32_t j = 0; j < color_len; j++)
lines[idx][i + j] = *color;
i += color_len;
continue;
} else if (i + 5 < len && (line[i] == 'r' || line[i] == 'R') &&
(line[i + 1] == 'g' || line[i + 1] == 'G') &&
(line[i + 2] == 'b' || line[i + 2] == 'B')) {
uint32_t start = i;
i += 3;
if (line[i] == 'a' || line[i] == 'A')
i++;
if (line[i] == '(') {
i++;
bool is_percent = false;
std::string r = "";
while (i < len && line[i] >= '0' && line[i] <= '9')
r += line[i++];
if (r.empty())
continue;
while (i < len &&
(line[i] == '.' || (line[i] >= '0' && line[i] <= '9')))
i++;
if (line[i] == '%') {
is_percent = true;
i++;
}
while (i < len && (line[i] == ',' || line[i] == ' '))
i++;
std::string g = "";
while (i < len && line[i] >= '0' && line[i] <= '9')
g += line[i++];
if (g.empty())
continue;
while (i < len &&
(line[i] == '.' || (line[i] >= '0' && line[i] <= '9')))
i++;
while (i < len &&
(line[i] == ',' || line[i] == ' ' || line[i] == '%'))
i++;
std::string b = "";
while (i < len && line[i] >= '0' && line[i] <= '9')
b += line[i++];
if (b.empty())
continue;
while (i < len &&
(line[i] == ',' || line[i] == ' ' || line[i] == '.' ||
line[i] == '/' || line[i] == '%' ||
(line[i] >= '0' && line[i] <= '9')))
i++;
if (i < len && line[i] == ')')
i++;
else
continue;
uint32_t rr, gg, bb;
if (is_percent) {
rr = std::stoul(r) * 255 / 100;
gg = std::stoul(g) * 255 / 100;
bb = std::stoul(b) * 255 / 100;
} else {
rr = std::stoul(r);
gg = std::stoul(g);
bb = std::stoul(b);
}
rr = rr > 255 ? 255 : rr;
gg = gg > 255 ? 255 : gg;
bb = bb > 255 ? 255 : bb;
uint32_t color = (rr << 16) | (gg << 8) | bb;
for (uint32_t j = start; j < i; j++)
lines[idx][j] = color;
}
continue;
} else if (i + 5 < len && (line[i] == 'h' || line[i] == 'H') &&
(line[i + 1] == 's' || line[i + 1] == 'S') &&
(line[i + 2] == 'l' || line[i + 2] == 'L')) {
uint32_t start = i;
i += 3;
if (line[i] == 'a' || line[i] == 'A')
i++;
if (line[i] == '(') {
i++;
std::string h = "";
std::string h_unit = "";
enum unit : uint8_t { deg, grad, rad, turn };
unit u = deg;
bool negative = false;
if (i < len && (line[i] == '-' || line[i] == '+')) {
negative = line[i] == '-';
i++;
}
while (i < len && line[i] >= '0' && line[i] <= '9')
h += line[i++];
if (i < len && line[i] == '.') {
h += '.';
while (i < len && line[i] >= '0' && line[i] <= '9')
h += line[i++];
}
if (h.empty())
continue;
while (i < len && ((line[i] >= 'a' && line[i] <= 'z') ||
(line[i] >= 'A' && line[i] <= 'Z')))
h_unit += line[i++];
for (size_t x = 0; x < h_unit.size(); x++)
h_unit[x] = tolower(h_unit[x]);
if (h_unit.empty())
u = deg;
else if (h_unit == "deg")
u = deg;
else if (h_unit == "grad")
u = grad;
else if (h_unit == "rad")
u = rad;
else if (h_unit == "turn")
u = turn;
else
continue;
double hue = std::stod(h);
if (negative)
hue = -hue;
switch (u) {
case deg:
break;
case grad:
hue = hue * 360.0 / 400.0;
break;
case rad:
hue = hue * 180.0 / M_PI;
break;
case turn:
hue = hue * 360.0;
break;
}
hue = fmod(hue, 360.0);
if (hue < 0)
hue += 360.0;
double h_final = hue / 360.0;
while (i < len && (line[i] == ',' || line[i] == ' '))
i++;
std::string s = "";
while (i < len && line[i] >= '0' && line[i] <= '9')
s += line[i++];
if (s.empty())
continue;
if (i < len && line[i] == '%')
i++;
else
continue;
while (i < len && (line[i] == ',' || line[i] == ' '))
i++;
std::string l = "";
while (i < len && line[i] >= '0' && line[i] <= '9')
l += line[i++];
if (l.empty())
continue;
if (i < len && line[i] == '%')
i++;
else
continue;
while (i < len &&
(line[i] == ',' || line[i] == ' ' || line[i] == '.' ||
line[i] == '/' || line[i] == '%' ||
(line[i] >= '0' && line[i] <= '9')))
i++;
if (i < len && line[i] == ')')
i++;
double s_val = std::stod(s) / 100.0;
double l_val = std::stod(l) / 100.0;
uint32_t color = hslToRgb(h_final, s_val, l_val);
for (uint32_t j = start; j < i; j++)
lines[idx][j] = color;
}
continue;
}
}
if (i + 4 < len && line[i] == '#') {
i++;
uint32_t start = i;
while (i < len && isxdigit(line[i]))
i++;
uint32_t color = 0;
if (is_css && (i - start == 3 || i - start == 4)) {
uint32_t r =
std::stoul(std::string(line + start, 1), nullptr, 16) * 0x11;
uint32_t g =
std::stoul(std::string(line + start + 1, 1), nullptr, 16) *
0x11;
uint32_t b =
std::stoul(std::string(line + start + 2, 1), nullptr, 16) *
0x11;
color = (r << 16) | (g << 8) | b;
} else if ((is_css && (i - start == 8)) || i - start == 6) {
uint32_t r = std::stoul(std::string(line + start, 2), nullptr, 16);
uint32_t g =
std::stoul(std::string(line + start + 2, 2), nullptr, 16);
uint32_t b =
std::stoul(std::string(line + start + 4, 2), nullptr, 16);
color = (r << 16) | (g << 8) | b;
} else {
continue;
}
for (uint32_t j = start - 1; j < i; j++)
lines[idx][j] = color;
continue;
} else if (i + 5 < len && line[i] == '0' && line[i + 1] == 'x') {
i += 2;
uint32_t start = i;
while (i < len && isxdigit(line[i]))
i++;
uint32_t color = 0;
if (i - start == 6) {
uint32_t r = std::stoul(std::string(line + start, 2), nullptr, 16);
uint32_t g =
std::stoul(std::string(line + start + 2, 2), nullptr, 16);
uint32_t b =
std::stoul(std::string(line + start + 4, 2), nullptr, 16);
color = (r << 16) | (g << 8) | b;
} else {
continue;
}
if (color)
color--;
else
color++;
for (uint32_t j = start - 2; j < i; j++)
lines[idx][j] = color;
continue;
}
if (i < len && (isalnum(line[i]) || line[i] == '_')) {
uint32_t start = i;
uint32_t x = 0;
bool found = true;
while (i < len && (isalnum(line[i]) || line[i] == '_')) {
if (x < word.size() && line[i] == word[x]) {
i++;
x++;
} else {
found = false;
i++;
}
}
if (found && x == word.size())
for (uint32_t j = start; j < i; j++)
lines[idx][j] = UINT32_MAX;
} else {
i += utf8_codepoint_width(line[i]);
}
}
idx++;
}
free(it->buffer);
free(it);
}
std::optional<std::pair<uint32_t, uint32_t>> get(Coord pos) {
uint32_t val;
if (pos.row < start || pos.row >= start + 50 ||
pos.col >= lines[pos.row - start].size() ||
(val = lines[pos.row - start][pos.col]) == UINT32_MAX - 1)
return std::nullopt;
return (std::pair<uint32_t, uint32_t>){fg_for_bg(val), val};
}
private:
uint32_t fg_for_bg(uint32_t color) {
uint8_t r = (color >> 16) & 0xFF;
uint8_t g = (color >> 8) & 0xFF;
uint8_t b = color & 0xFF;
double luminance = 0.299 * r + 0.587 * g + 0.114 * b;
return (luminance > 128) ? 0x010101 : 0xFFFFFF;
}
uint32_t hslToRgb(double h, double s, double l) {
double r, g, b;
if (s == 0.0) {
r = g = b = l;
} else {
auto hue2rgb = [](double p, double q, double t) -> double {
if (t < 0)
t += 1;
if (t > 1)
t -= 1;
if (t < 1.0 / 6)
return p + (q - p) * 6 * t;
if (t < 1.0 / 2)
return q;
if (t < 2.0 / 3)
return p + (q - p) * (2.0 / 3 - t) * 6;
return p;
};
double q = l < 0.5 ? l * (1 + s) : l + s - l * s;
double p = 2 * l - q;
r = hue2rgb(p, q, h + 1.0 / 3);
g = hue2rgb(p, q, h);
b = hue2rgb(p, q, h - 1.0 / 3);
}
uint32_t R = static_cast<uint32_t>(std::clamp(r, 0.0, 1.0) * 255);
uint32_t G = static_cast<uint32_t>(std::clamp(g, 0.0, 1.0) * 255);
uint32_t B = static_cast<uint32_t>(std::clamp(b, 0.0, 1.0) * 255);
return (R << 16) | (G << 8) | B;
}
};
#endif

36
include/syntax/langs.h Normal file
View File

@@ -0,0 +1,36 @@
#ifndef SYNTAX_LANGS_H
#define SYNTAX_LANGS_H
#include "syntax/decl.h"
#define DEF_LANG(name) \
std::unique_ptr<StateBase> name##_parse( \
std::vector<Token> *tokens, StateBase *in_state, const char *text, \
uint32_t len, uint32_t line_num); \
bool name##_state_match(StateBase *state_1, StateBase *state_2);
#define LANG_A(name) \
{ \
#name, { name##_parse, name##_state_match } \
}
template <typename B, typename A>
std::unique_ptr<B> static_unique_ptr_cast(std::unique_ptr<A> &&p) {
return std::unique_ptr<B>(static_cast<B *>(p.release()));
}
DEF_LANG(ruby);
DEF_LANG(bash);
inline static const std::unordered_map<
std::string,
std::tuple<std::unique_ptr<StateBase> (*)(
std::vector<Token> *tokens, StateBase *in_state,
const char *text, uint32_t len, uint32_t line_num),
bool (*)(StateBase *state_1, StateBase *state_2)>>
parsers = {
LANG_A(ruby),
LANG_A(bash),
};
#endif

136
include/syntax/line_map.h Normal file
View File

@@ -0,0 +1,136 @@
#ifndef LINE_MAP_H
#define LINE_MAP_H
#include "syntax/decl.h"
struct LineKey {
uint32_t line;
uint32_t version;
bool operator==(const LineKey &other) const {
return line == other.line && version == other.version;
}
};
struct LineKeyHash {
size_t operator()(const LineKey &key) const {
uint64_t combined = (uint64_t(key.line) << 32) | key.version;
return std::hash<uint64_t>()(combined);
}
};
struct EditDelta {
uint32_t start_line;
int64_t delta;
};
struct LineMap {
LineMap() : current_version(0) { edit_log.push_back({0, 0}); }
LineData *at(uint32_t line) {
auto key_opt = resolve_line(line);
if (!key_opt)
return nullptr;
LineKey key = *key_opt;
if (key.version == current_version)
return lines[key].get();
auto data_ptr = std::move(lines[key]);
lines.erase(key);
key = {line, current_version};
lines[key] = std::move(data_ptr);
return lines[key].get();
}
LineData *create_at(uint32_t line) {
auto key_opt = resolve_line(line);
LineKey key;
std::unique_ptr<LineData> data_ptr;
if (key_opt) {
key = *key_opt;
if (key.version == current_version)
return lines[key].get();
data_ptr = std::move(lines[key]);
lines.erase(key);
} else {
data_ptr = std::make_unique<LineData>();
}
key = {line, current_version};
lines[key] = std::move(data_ptr);
return lines[key].get();
}
void apply_edit(uint32_t start, int64_t delta) {
if (delta < 0)
batch_remove(start, -delta);
current_version++;
edit_log.push_back({start, delta});
}
private:
std::unordered_map<LineKey, std::unique_ptr<LineData>, LineKeyHash> lines;
std::vector<EditDelta> edit_log;
uint32_t current_version;
void batch_remove(uint32_t line, uint32_t count) {
std::vector<uint32_t> lines_t;
lines_t.reserve(count);
for (uint32_t i = 0; i < count; i++)
lines_t.push_back(line + i);
for (int64_t v = current_version; v >= 0; v--) {
for (auto &l : lines_t) {
if (l == UINT32_MAX)
continue;
LineKey key = {l, (uint32_t)v};
if (lines.find(key) != lines.end()) {
lines.erase(key);
l = UINT32_MAX;
}
}
bool all_removed = true;
const auto &edit = edit_log[v];
for (auto &l : lines_t) {
if (l == UINT32_MAX)
continue;
all_removed = false;
if (edit.delta > 0) {
if (l >= edit.start_line) {
if (l < edit.start_line + edit.delta)
l = UINT32_MAX;
else
l -= edit.delta;
}
} else {
if (l >= edit.start_line)
l -= edit.delta;
}
}
if (all_removed)
break;
}
return;
}
std::optional<LineKey> resolve_line(uint32_t line) {
uint32_t current_line = line;
for (int64_t v = current_version; v >= 0; v--) {
LineKey key = {current_line, (uint32_t)v};
if (lines.find(key) != lines.end())
return key;
const auto &edit = edit_log[v];
if (edit.delta > 0) {
if (current_line >= edit.start_line) {
if (current_line < edit.start_line + edit.delta)
return std::nullopt;
current_line -= edit.delta;
}
} else {
if (current_line >= edit.start_line)
current_line -= edit.delta;
}
}
return std::nullopt;
}
};
#endif

29
include/syntax/parser.h Normal file
View File

@@ -0,0 +1,29 @@
#ifndef SYNTAX_PARSER_H
#define SYNTAX_PARSER_H
#include "ruby/decl.h"
#include "syntax/decl.h"
#include "syntax/line_map.h"
struct Parser {
struct Editor *editor = nullptr;
std::string lang;
std::unique_ptr<StateBase> (*parse_func)(std::vector<Token> *tokens,
StateBase *in_state,
const char *text, uint32_t len,
uint32_t line_num);
bool (*state_match_func)(StateBase *state_1, StateBase *state_2);
mrb_value parser_block = mrb_nil_value();
mrb_value match_block = mrb_nil_value();
bool is_custom{false};
std::atomic<uint32_t> scroll_max{0};
std::atomic<bool> scroll_dirty{false};
LineMap line_map = LineMap();
Parser(Editor *editor, std::string n_lang, uint32_t n_scroll_max);
void edit(uint32_t start_line, uint32_t removed_rows, uint32_t inserted_rows);
void work();
void scroll(uint32_t line);
};
#endif

53
include/syntax/tokens.def Normal file
View File

@@ -0,0 +1,53 @@
ADD(K_DATA)
ADD(K_SHEBANG)
ADD(K_COMMENT)
ADD(K_ERROR)
ADD(K_STRING)
ADD(K_ESCAPE)
ADD(K_INTERPOLATION)
ADD(K_REGEXP)
ADD(K_NUMBER)
ADD(K_TRUE)
ADD(K_FALSE)
ADD(K_CHAR)
ADD(K_KEYWORD)
ADD(K_KEYWORDOPERATOR)
ADD(K_OPERATOR)
ADD(K_FUNCTION)
ADD(K_TYPE)
ADD(K_CONSTANT)
ADD(K_VARIABLEINSTANCE)
ADD(K_VARIABLEGLOBAL)
ADD(K_ANNOTATION)
ADD(K_DIRECTIVE)
ADD(K_LABEL)
ADD(K_BRACE1)
ADD(K_BRACE2)
ADD(K_BRACE3)
ADD(K_BRACE4)
ADD(K_BRACE5)
ADD(K_HEADING1)
ADD(K_HEADING2)
ADD(K_HEADING3)
ADD(K_HEADING4)
ADD(K_HEADING5)
ADD(K_HEADING6)
ADD(K_BLOCKQUOTE)
ADD(K_LIST)
ADD(K_LISTITEM)
ADD(K_CODE)
ADD(K_LANGUAGENAME)
ADD(K_LINKLABEL)
ADD(K_IMAGELABEL)
ADD(K_LINK)
ADD(K_TABLE)
ADD(K_TABLEHEADER)
ADD(K_ITALIC)
ADD(K_BOLD)
ADD(K_UNDERLINE)
ADD(K_STRIKETHROUGH)
ADD(K_HORIXONTALRULE)
ADD(K_TAG)
ADD(K_ATTRIBUTE)
ADD(K_CHECKDONE)
ADD(K_CHECKNOTDONE)

140
include/syntax/trie.h Normal file
View File

@@ -0,0 +1,140 @@
#ifndef SYNTAX_TRIE_H
#define SYNTAX_TRIE_H
#include "utils/utils.h"
template <typename T> struct Trie {
struct TrieNode {
bool is_word = false;
std::array<TrieNode *, 128> children{};
std::conditional_t<std::is_void_v<T>, char, std::optional<T>> value;
TrieNode() { children.fill(nullptr); }
};
Trie() {}
~Trie() { clear_trie(root); }
void build(const std::vector<std::string> &words, bool cs = true) {
static_assert(std::is_void_v<T>, "This build() is for Trie<void> only");
case_sensitive = cs;
for (auto &w : words)
insert(w);
}
template <typename U = T>
std::enable_if_t<!std::is_void_v<U>>
build(const std::vector<std::pair<std::string, U>> &words, bool cs = true) {
static_assert(!std::is_void_v<T>, "This build() is for typed Trie only");
case_sensitive = cs;
for (auto &[w, v] : words)
insert(w, v);
}
uint32_t match(const char *text, uint32_t pos, uint32_t len,
bool (*is_word_char)(char c)) const {
const TrieNode *node = root;
uint32_t max_len = 0;
for (uint32_t i = pos; i < len; ++i) {
unsigned char uc = static_cast<unsigned char>(text[i]);
if (uc >= 128)
return 0;
if (!case_sensitive && uc >= 'A' && uc <= 'Z')
uc = uc - 'A' + 'a';
if (!node->children[uc]) {
if (node->is_word && !is_word_char(text[i]))
return i - pos;
break;
}
node = node->children[uc];
if (node->is_word)
max_len = i - pos + 1;
}
if (max_len > 0)
if (pos + max_len < len && is_word_char(text[pos + max_len]))
return 0;
return max_len;
}
template <typename U = T>
uint32_t
match(const char *text, uint32_t pos, uint32_t len,
bool (*is_word_char)(char c),
std::conditional_t<std::is_void_v<T>, void *, std::optional<T> *>
out_val = nullptr) const {
const TrieNode *node = root;
const TrieNode *last_word_node = nullptr;
uint32_t max_len = 0;
for (uint32_t i = pos; i < len; ++i) {
unsigned char uc = static_cast<unsigned char>(text[i]);
if (uc >= 128)
break;
if (!case_sensitive && uc >= 'A' && uc <= 'Z')
uc = uc - 'A' + 'a';
if (!node->children[uc])
break;
node = node->children[uc];
if (node->is_word) {
last_word_node = node;
max_len = i - pos + 1;
}
}
if (!last_word_node) {
if (out_val)
*out_val = std::nullopt;
return 0;
}
if (pos + max_len < len && is_word_char(text[pos + max_len])) {
if (out_val)
*out_val = std::nullopt;
return 0;
}
if (out_val)
*out_val = last_word_node->value;
return max_len;
}
private:
TrieNode *root = new TrieNode();
bool case_sensitive = true;
void insert(const std::string &word) {
TrieNode *node = root;
for (char c : word) {
unsigned char uc = static_cast<unsigned char>(c);
if (uc >= 128)
return;
if (!case_sensitive && uc >= 'A' && uc <= 'Z')
uc = uc - 'A' + 'a';
if (!node->children[uc])
node->children[uc] = new TrieNode();
node = node->children[uc];
}
node->is_word = true;
}
template <typename U = T>
std::enable_if_t<!std::is_void_v<U>> insert(const std::string &word,
const U &val) {
TrieNode *node = root;
for (char c : word) {
unsigned char uc = static_cast<unsigned char>(c);
if (!case_sensitive && uc >= 'A' && uc <= 'Z')
uc = uc - 'A' + 'a';
if (!node->children[uc])
node->children[uc] = new TrieNode();
node = node->children[uc];
}
node->is_word = true;
node->value = val;
}
void clear_trie(TrieNode *node) {
if (!node)
return;
for (auto *child : node->children)
clear_trie(child);
delete node;
}
};
#endif

View File

@@ -1,16 +0,0 @@
#ifndef TS_H
#define TS_H
#include "./editor.h"
#include "./pch.h"
#include "./utils.h"
#define HEX(s) (static_cast<uint32_t>(std::stoul(s, nullptr, 16)))
extern std::unordered_map<std::string, pcre2_code *> regex_cache;
TSQuery *load_query(const char *query_path, TSSetBase *set);
void ts_collect_spans(Editor *editor);
void clear_regex_cache();
#endif

View File

@@ -1,47 +0,0 @@
#ifndef TS_DEF_H
#define TS_DEF_H
#include "./pch.h"
#define LANG(name) tree_sitter_##name
#define TS_DEF(name) extern "C" const TSLanguage *LANG(name)()
struct Language {
std::string name;
const TSLanguage *(*fn)();
uint8_t lsp_id = 0;
};
TS_DEF(bash);
TS_DEF(c);
TS_DEF(cpp);
TS_DEF(css);
TS_DEF(fish);
TS_DEF(go);
TS_DEF(haskell);
TS_DEF(html);
TS_DEF(javascript);
TS_DEF(json);
TS_DEF(lua);
TS_DEF(make);
TS_DEF(python);
TS_DEF(ruby);
TS_DEF(rust);
TS_DEF(diff);
TS_DEF(embedded_template);
TS_DEF(gdscript);
TS_DEF(gitattributes);
TS_DEF(gitignore);
TS_DEF(gomod);
TS_DEF(ini);
TS_DEF(markdown);
TS_DEF(nginx);
TS_DEF(php);
TS_DEF(query);
TS_DEF(regex);
TS_DEF(sql);
TS_DEF(toml);
TS_DEF(yaml);
TS_DEF(cabal);
#endif

21
include/ui/bar.h Normal file
View File

@@ -0,0 +1,21 @@
#ifndef UI_BAR_H
#define UI_BAR_H
#include "editor/editor.h"
#include "io/sysio.h"
#include "utils/utils.h"
struct Bar {
Coord screen;
std::string command = "";
std::string log_line = "";
uint32_t cursor = 0;
void init(Coord screen) { this->screen = screen; }
void render(std::vector<ScreenCell> &buffer);
void handle_event(KeyEvent event);
void handle_command(std::string &command);
void log(std::string message);
};
#endif

View File

@@ -0,0 +1,21 @@
// #ifndef UI_COMPLETIONBOX_H
// #define UI_COMPLETIONBOX_H
//
// #include "io/sysio.h"
// #include "pch.h"
// #include "utils/utils.h"
//
// struct CompletionBox {
// std::shared_mutex mtx;
// struct CompletionSession *session;
// bool hidden = true;
// std::vector<ScreenCell> cells;
// Coord size;
// Coord position;
//
// CompletionBox(CompletionSession *s) : session(s) {}
// void render_update();
// void render(Coord pos);
// };
//
// #endif

View File

@@ -1,91 +0,0 @@
#ifndef UTILS_H
#define UTILS_H
#include "./pch.h"
#include "./ts_def.h"
template <typename T> struct Queue {
std::queue<T> q;
std::mutex m;
void push(T val) {
std::lock_guard<std::mutex> lock(m);
q.push(val);
}
T front() {
std::lock_guard<std::mutex> lock(m);
return q.front();
}
bool pop(T &val) {
std::lock_guard<std::mutex> lock(m);
if (q.empty())
return false;
val = q.front();
q.pop();
return true;
}
void pop() {
std::lock_guard<std::mutex> lock(m);
q.pop();
}
bool empty() {
std::lock_guard<std::mutex> lock(m);
return q.empty();
}
};
struct Coord {
uint32_t row;
uint32_t col;
bool operator<(const Coord &other) const {
return row < other.row || (row == other.row && col < other.col);
}
bool operator<=(const Coord &other) const {
return *this < other || *this == other;
}
bool operator==(const Coord &other) const {
return row == other.row && col == other.col;
}
bool operator!=(const Coord &other) const { return !(*this == other); }
bool operator>(const Coord &other) const { return other < *this; }
bool operator>=(const Coord &other) const { return !(*this < other); }
};
std::string path_abs(const std::string &path_str);
std::string path_to_file_uri(const std::string &path_str);
int display_width(const char *str, size_t len);
uint32_t get_visual_col_from_bytes(const char *line, uint32_t len,
uint32_t byte_limit);
uint32_t get_bytes_from_visual_col(const char *line, uint32_t len,
uint32_t target_visual_col);
void log(const char *fmt, ...);
std::string get_exe_dir();
char *load_file(const char *path, uint32_t *out_len);
char *detect_file_type(const char *filename);
int utf8_byte_offset_to_utf16(const char *s, size_t byte_pos);
Language language_for_file(const char *filename);
void copy_to_clipboard(const char *text, size_t len);
char *get_from_clipboard(uint32_t *out_len);
uint32_t count_clusters(const char *line, size_t len, size_t from, size_t to);
template <typename Func, typename... Args>
auto throttle(std::chrono::milliseconds min_duration, Func &&func,
Args &&...args) {
auto start = std::chrono::steady_clock::now();
if constexpr (std::is_void_v<std::invoke_result_t<Func, Args...>>) {
std::invoke(std::forward<Func>(func), std::forward<Args>(args)...);
} else {
auto result =
std::invoke(std::forward<Func>(func), std::forward<Args>(args)...);
auto elapsed = std::chrono::steady_clock::now() - start;
if (elapsed < min_duration)
std::this_thread::sleep_for(min_duration - elapsed);
return result;
}
auto elapsed = std::chrono::steady_clock::now() - start;
if (elapsed < min_duration)
std::this_thread::sleep_for(min_duration - elapsed);
}
#endif

191
include/utils/utils.h Normal file
View File

@@ -0,0 +1,191 @@
#ifndef UTILS_H
#define UTILS_H
#include "pch.h"
template <typename T> struct Queue {
void push(T val) {
std::lock_guard<std::mutex> lock(m);
q.push(std::move(val));
}
std::optional<T> front() {
std::lock_guard<std::mutex> lock(m);
if (q.empty())
return std::nullopt;
return std::move(q.front());
}
bool pop(T &val) {
std::lock_guard<std::mutex> lock(m);
if (q.empty())
return false;
val = std::move(q.front());
q.pop();
return true;
}
void pop() {
std::lock_guard<std::mutex> lock(m);
q.pop();
}
bool empty() {
std::lock_guard<std::mutex> lock(m);
return q.empty();
}
private:
std::queue<T> q;
std::mutex m;
};
template <typename T> struct UniqueQueue {
bool push(const T &value) {
std::lock_guard<std::mutex> lock(m);
if (set.contains(value))
return false;
dq.push_back(value);
set.insert(value);
return true;
}
bool pop(T &out) {
std::lock_guard<std::mutex> lock(m);
if (dq.empty())
return false;
out = dq.front();
dq.pop_front();
set.erase(out);
return true;
}
bool empty() const {
std::lock_guard<std::mutex> lock(m);
return dq.empty();
}
void clear() {
std::lock_guard<std::mutex> lock(m);
dq.clear();
set.clear();
}
size_t size() const {
std::lock_guard<std::mutex> lock(m);
return dq.size();
}
private:
std::deque<T> dq;
std::set<T> set;
mutable std::mutex m;
};
struct Coord {
uint32_t row;
uint32_t col;
bool operator<(const Coord &other) const {
return row < other.row || (row == other.row && col < other.col);
}
bool operator<=(const Coord &other) const {
return *this < other || *this == other;
}
bool operator==(const Coord &other) const {
return row == other.row && col == other.col;
}
bool operator!=(const Coord &other) const { return !(*this == other); }
bool operator>(const Coord &other) const { return other < *this; }
bool operator>=(const Coord &other) const { return !(*this < other); }
};
static inline bool inside(Coord c, Coord pos, Coord size) {
return c.row >= pos.row && c.col >= pos.col && c.row - pos.row < size.row &&
c.col - pos.col < size.col;
}
struct Match {
size_t start;
size_t end;
std::string text;
};
struct Language {
std::string name;
std::string lsp_name;
uint32_t color;
};
struct LSP {
std::string command;
std::vector<std::string> args;
};
extern std::unordered_map<std::string, Language> languages;
extern std::unordered_map<std::string, std::string> language_extensions;
extern std::unordered_map<std::string, LSP> lsps;
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(x) ((x) < 0 ? -(x) : (x))
#define UNUSED(x) (void)(x)
#define USING(x) UNUSED(sizeof(x))
inline uint32_t HEX(const std::string &s) {
if (s.empty())
return 0xFFFFFF;
size_t start = (s.front() == '#') ? 1 : 0;
return static_cast<uint32_t>(std::stoul(s.substr(start), nullptr, 16));
}
bool compare(const char *a, const char *b, size_t n);
std::string clean_text(const std::string &input);
std::string percent_encode(const std::string &s);
std::string percent_decode(const std::string &s);
uint32_t count_clusters(const char *line, size_t len, size_t from, size_t to);
std::string trim(const std::string &s);
std::string substitute_fence(const std::string &documentation,
const std::string &lang);
int display_width(const char *str, size_t len);
uint32_t get_visual_col_from_bytes(const char *line, uint32_t len,
uint32_t byte_limit);
uint32_t get_bytes_from_visual_col(const char *line, uint32_t len,
uint32_t target_visual_col);
size_t utf8_offset_to_utf16(const char *utf8, size_t utf8_len,
size_t byte_offset);
size_t utf16_offset_to_utf8(const char *utf8, size_t utf8_len,
size_t utf16_offset);
uint8_t utf8_codepoint_width(unsigned char c);
void log(const char *fmt, ...);
std::string path_abs(const std::string &path_str);
std::string path_to_file_uri(const std::string &path_str);
std::string filename_from_path(const std::string &path);
std::string get_exe_dir();
char *load_file(const char *path, uint32_t *out_len, bool *out_eol);
Language language_for_file(const char *filename);
template <typename T>
inline T *safe_get(std::map<uint16_t, T> &m, uint16_t key) {
auto it = m.find(key);
if (it == m.end())
return nullptr;
return &it->second;
}
template <typename Func, typename... Args>
auto throttle(std::chrono::milliseconds min_duration, Func &&func,
Args &&...args) {
auto start = std::chrono::steady_clock::now();
if constexpr (std::is_void_v<std::invoke_result_t<Func, Args...>>) {
std::invoke(std::forward<Func>(func), std::forward<Args>(args)...);
} else {
auto result =
std::invoke(std::forward<Func>(func), std::forward<Args>(args)...);
auto elapsed = std::chrono::steady_clock::now() - start;
if (elapsed < min_duration)
std::this_thread::sleep_for(min_duration - elapsed);
return result;
}
auto elapsed = std::chrono::steady_clock::now() - start;
if (elapsed < min_duration)
std::this_thread::sleep_for(min_duration - elapsed);
}
#endif

119
include/windows/decl.h Normal file
View File

@@ -0,0 +1,119 @@
#ifndef TILING_DECL_H
#define TILING_DECL_H
#include "io/sysio.h"
#include "utils/utils.h"
struct Tile {
bool hidden = false;
uint32_t weight = 100;
virtual void render(std::vector<ScreenCell> &buffer, Coord size,
Coord pos) = 0;
virtual void handle_click(KeyEvent event, Coord size) = 0;
virtual ~Tile() = default;
};
struct Window : Tile {
virtual ~Window() = default;
virtual void handle_event(KeyEvent){};
virtual void handle_command(std::string &) {};
virtual void work() {};
virtual std::array<std::string, 5> bar_info() { return {}; };
};
struct Popup : Window {
Coord pos;
Coord size;
virtual ~Popup() = default;
};
struct TileBlock : Tile {
bool vertical;
std::vector<std::unique_ptr<Tile>> tiles;
void render(std::vector<ScreenCell> &buffer, Coord size, Coord pos) override {
uint32_t total_weight = 0;
for (auto &t : tiles) {
if (!t->hidden)
total_weight += t->weight;
}
if (total_weight == 0)
return;
for (auto &t : tiles) {
if (t->hidden)
continue;
uint32_t proportion =
t->weight * (vertical ? size.row : size.col) / total_weight;
Coord tile_size = vertical ? Coord{.row = proportion, .col = size.col}
: Coord{.row = size.row, .col = proportion};
t->render(buffer, tile_size, pos);
if (vertical)
pos.row += tile_size.row;
else
pos.col += tile_size.col;
}
}
void handle_click(KeyEvent event, Coord size) override {
uint32_t total_weight = 0;
for (auto &t : tiles)
if (!t->hidden)
total_weight += t->weight;
if (total_weight == 0)
return;
uint32_t i = 0;
for (auto &t : tiles) {
if (t->hidden)
continue;
uint32_t proportion =
t->weight * (vertical ? size.row : size.col) / total_weight;
Coord tile_size = vertical ? Coord{.row = proportion, .col = size.col}
: Coord{.row = size.row, .col = proportion};
if (vertical) {
if (event.mouse_y < i + proportion) {
event.mouse_y -= i;
t->handle_click(event, tile_size);
return;
}
} else {
if (event.mouse_x < i + proportion) {
event.mouse_x -= i;
t->handle_click(event, tile_size);
return;
}
}
i += proportion;
}
}
};
struct TileBase {
std::unique_ptr<Tile> tile;
Coord pos;
Coord size;
inline bool hidden() { return this->tile->hidden; }
void render(std::vector<ScreenCell> &buffer) {
if (this->tile->hidden)
return;
this->tile->render(buffer, size, pos);
}
void handle_click(KeyEvent event) {
event.mouse_x -= this->pos.col;
event.mouse_y -= this->pos.row;
this->tile->handle_click(event, size);
}
};
namespace layout {
extern TileBase root_tile;
extern Window *focused_window;
extern std::vector<std::unique_ptr<Popup>> popups;
extern std::vector<std::unique_ptr<TileBase>> floating_tiles;
} // namespace layout
void render();
void handle_click(KeyEvent event);
#endif

39
installer.sh Normal file
View File

@@ -0,0 +1,39 @@
#!/usr/bin/env sh
set -eu
install() {
BINARY_NAME="crib"
BIN_URL="https://git.syedm.dev/SyedM/crib/releases/download/v0.0.5-alpha/crib"
echo "Install or update locally (~/.local/bin) or globally (/usr/bin)? [l/g]"
read -r choice </dev/tty
case "$choice" in
l | L)
INSTALL_DIR="$HOME/.local/bin"
SUDO=""
;;
g | G)
INSTALL_DIR="/usr/bin"
SUDO="sudo"
;;
*)
echo "Invalid choice"
exit 1
;;
esac
$SUDO mkdir -p "$INSTALL_DIR"
echo "Downloading binary..."
curl -L "$BIN_URL" -o /tmp/"$BINARY_NAME"
$SUDO install -m 755 /tmp/"$BINARY_NAME" "$INSTALL_DIR/$BINARY_NAME"
rm -f /tmp/"$BINARY_NAME"
echo
echo "✔ Crib installed to $INSTALL_DIR"
echo "Run with: $BINARY_NAME"
echo "Add $INSTALL_DIR to PATH if needed."
}
install "$@"

1
libs/mruby vendored Submodule

Submodule libs/mruby added at 7d08c6246d

1
libs/tree-sitter vendored

Submodule libs/tree-sitter deleted from 0ca8fe8c12

Submodule libs/tree-sitter-bash deleted from a06c2e4415

1
libs/tree-sitter-c vendored

Submodule libs/tree-sitter-c deleted from ae19b676b1

Submodule libs/tree-sitter-cabal deleted from d1105d9ed6

Submodule libs/tree-sitter-cpp deleted from 12bd6f7e96

Submodule libs/tree-sitter-css deleted from dda5cfc572

Submodule libs/tree-sitter-diff deleted from 2520c3f934

Submodule libs/tree-sitter-fish deleted from aa074a0bac

1
libs/tree-sitter-go vendored

Submodule libs/tree-sitter-go deleted from 2346a3ab1b

Submodule libs/tree-sitter-go-mod deleted from 2e88687057

Submodule libs/tree-sitter-html deleted from 73a3947324

Submodule libs/tree-sitter-ini deleted from e4018b5176

Submodule libs/tree-sitter-json deleted from 001c28d7a2

Submodule libs/tree-sitter-lua deleted from d76023017f

Submodule libs/tree-sitter-make deleted from 5e9e8f8ff3

Submodule libs/tree-sitter-nginx deleted from f6d13cf628

Submodule libs/tree-sitter-php deleted from 7d07b41ce2

Submodule libs/tree-sitter-python deleted from 26855eabcc

Submodule libs/tree-sitter-query deleted from a4e379d4a4

Submodule libs/tree-sitter-regex deleted from b2ac15e27f

Submodule libs/tree-sitter-ruby deleted from 89bd7a8e54

Submodule libs/tree-sitter-rust deleted from 261b20226c

Submodule libs/tree-sitter-sql deleted from 2d5dcd16f9

Submodule libs/tree-sitter-toml deleted from 64b56832c2

Submodule libs/tree-sitter-yaml deleted from 7708026449

119
samples/Makefile Normal file
View File

@@ -0,0 +1,119 @@
SRC_DIR := src
BIN_DIR := bin
OBJ_DIR := build
INCLUDE_DIR := include
TARGET_DEBUG := $(BIN_DIR)/crib-dbg
TARGET_RELEASE := $(BIN_DIR)/crib
PCH_DEBUG := $(OBJ_DIR)/debug/pch.h.gch
PCH_RELEASE := $(OBJ_DIR)/release/pch.h.gch
CCACHE := ccache
CXX_DEBUG := $(CCACHE) g++
CXX_RELEASE := $(CCACHE) clang++
CFLAGS_DEBUG := -std=c++20 -Wall -Wextra -O0 -fno-inline -gsplit-dwarf -g -fsanitize=address -fno-omit-frame-pointer
CFLAGS_RELEASE := -std=c++20 -O3 -march=native -flto=thin \
-fno-exceptions -fno-rtti -fstrict-aliasing \
-ffast-math -funroll-loops \
-fvisibility=hidden \
-fomit-frame-pointer -DNDEBUG -s \
-mllvm -vectorize-loops \
-fno-unwind-tables -fno-asynchronous-unwind-tables
PCH_CFLAGS_DEBUG := $(CFLAGS_DEBUG) -x c++-header
PCH_CFLAGS_RELEASE := $(CFLAGS_RELEASE) -x c++-header
UNICODE_SRC := $(wildcard libs/unicode_width/*.c)
UNICODE_OBJ_DEBUG := $(patsubst libs/unicode_width/%.c,$(OBJ_DIR)/debug/unicode_width/%.o,$(UNICODE_SRC))
UNICODE_OBJ_RELEASE := $(patsubst libs/unicode_width/%.c,$(OBJ_DIR)/release/unicode_width/%.o,$(UNICODE_SRC))
TREE_SITTER_LIBS := $(wildcard libs/tree-sitter-*/libtree-sitter*.a)
PHP_LIB := libs/tree-sitter-php/php/libtree-sitter-php.a
NGINX_OBJ_PARSER := libs/tree-sitter-nginx/build/Release/obj.target/tree_sitter_nginx_binding/src/parser.o
GITIGNORE_OBJ_PARSER := libs/tree-sitter-gitignore/build/Release/obj.target/tree_sitter_ignore_binding/src/parser.o
FISH_OBJ_PARSER := libs/tree-sitter-fish/build/Release/obj.target/tree_sitter_fish_binding/src/parser.o
FISH_OBJ_SCANNER := libs/tree-sitter-fish/build/Release/obj.target/tree_sitter_fish_binding/src/scanner.o
MD_OBJ_PARSER := libs/tree-sitter-markdown/build/Release/obj.target/tree_sitter_markdown_binding/tree-sitter-markdown/src/parser.o
MD_OBJ_SCANNER := libs/tree-sitter-markdown/build/Release/obj.target/tree_sitter_markdown_binding/tree-sitter-markdown/src/scanner.o
MD_I_OBJ_PARSER := libs/tree-sitter-markdown/build/Release/obj.target/tree_sitter_markdown_binding/tree-sitter-markdown-inline/src/parser.o
MD_I_OBJ_SCANNER := libs/tree-sitter-markdown/build/Release/obj.target/tree_sitter_markdown_binding/tree-sitter-markdown-inline/src/scanner.o
LIBS := \
libs/libgrapheme/libgrapheme.a \
libs/tree-sitter/libtree-sitter.a \
$(TREE_SITTER_LIBS) \
$(PHP_LIB) \
$(NGINX_OBJ_PARSER) \
$(GITIGNORE_OBJ_PARSER) \
$(FISH_OBJ_PARSER) \
$(FISH_OBJ_SCANNER) \
$(MD_OBJ_PARSER) \
$(MD_OBJ_SCANNER) \
$(MD_I_OBJ_PARSER) \
$(MD_I_OBJ_SCANNER) \
-lpcre2-8 -lmagic
SRC := $(wildcard $(SRC_DIR)/*.cc)
OBJ_DEBUG := $(patsubst $(SRC_DIR)/%.cc,$(OBJ_DIR)/debug/%.o,$(SRC))
OBJ_RELEASE := $(patsubst $(SRC_DIR)/%.cc,$(OBJ_DIR)/release/%.o,$(SRC))
DEP_DEBUG := $(OBJ_DEBUG:.o=.d)
DEP_RELEASE := $(OBJ_RELEASE:.o=.d)
.PHONY: all test release clean
all: debug
test: $(TARGET_DEBUG)
release: $(TARGET_RELEASE)
$(PCH_DEBUG): $(INCLUDE_DIR)/pch.h
mkdir -p $(dir $@)
$(CXX_DEBUG) $(PCH_CFLAGS_DEBUG) -o $@ $<
$(PCH_RELEASE): $(INCLUDE_DIR)/pch.h
mkdir -p $(dir $@)
$(CXX_RELEASE) $(PCH_CFLAGS_RELEASE) -o $@ $<
$(TARGET_DEBUG): $(PCH_DEBUG) $(OBJ_DEBUG) $(UNICODE_OBJ_DEBUG)
mkdir -p $(BIN_DIR)
$(CXX_DEBUG) $(CFLAGS_DEBUG) -o $@ $(OBJ_DEBUG) $(UNICODE_OBJ_DEBUG) $(LIBS)
$(TARGET_RELEASE): $(PCH_RELEASE) $(OBJ_RELEASE) $(UNICODE_OBJ_RELEASE)
mkdir -p $(BIN_DIR)
$(CXX_RELEASE) $(CFLAGS_RELEASE) -o $@ $(OBJ_RELEASE) $(UNICODE_OBJ_RELEASE) $(LIBS)
$(OBJ_DIR)/debug/%.o: $(SRC_DIR)/%.cc $(PCH_DEBUG)
mkdir -p $(dir $@)
$(CXX_DEBUG) $(CFLAGS_DEBUG) -include $(INCLUDE_DIR)/pch.h -MMD -MP -c $< -o $@
$(OBJ_DIR)/release/%.o: $(SRC_DIR)/%.cc $(PCH_RELEASE)
mkdir -p $(dir $@)
$(CXX_RELEASE) $(CFLAGS_RELEASE) -include $(INCLUDE_DIR)/pch.h -MMD -MP -c $< -o $@
$(OBJ_DIR)/debug/unicode_width/%.o: libs/unicode_width/%.c
mkdir -p $(dir $@)
$(CXX_DEBUG) $(CFLAGS_DEBUG) -MMD -MP -c $< -o $@
$(OBJ_DIR)/release/unicode_width/%.o: libs/unicode_width/%.c
mkdir -p $(dir $@)
$(CXX_RELEASE) $(CFLAGS_RELEASE) -MMD -MP -c $< -o $@
DEP_DEBUG += $(UNICODE_OBJ_DEBUG:.o=.d)
DEP_RELEASE += $(UNICODE_OBJ_RELEASE:.o=.d)
-include $(DEP_DEBUG)
-include $(DEP_RELEASE)
clean:
rm -rf $(OBJ_DIR) $(BIN_DIR)

View File

@@ -1,8 +1,8 @@
#!/usr/bin/env bash
# ---------------------------------------------
# ----------------------------------------------
# Bash Syntax Highlighter Test Specification
# ---------------------------------------------
# ----------------------------------------------
VERSION="1.0.0"
declare -a ITEMS=("alpha" "beta" "gamma" "delta")
@@ -25,15 +25,15 @@ colorize() {
handle_error() {
log ERROR "An error occurred on line $1"
}
trap 'handle_error $LINENO' ERR
trap 'handle_error $LINENO' ERR
# Multiline string test
read -r -d '' MULTI <<'EOF'
This is a multi-line
string used to test
syntax highlighting for
here-documents.
EOF
read -r -d '' MULTI <<'CPP'
int main() {
}
CPP
log INFO "Multi-line string loaded"
@@ -45,7 +45,7 @@ while ((counter < 5)); do
done
# Subshelled loops and alternating quoting
for item in "${ITEMS[@]}"; do
for item in "${ITEMS[@]}}"; do
(
msg="Processing $item"
echo "$(colorize blue "$msg")"
@@ -125,7 +125,7 @@ grep "world" <<<"$FOO" >/dev/null && log INFO "FOO contains world"
diff <(echo foo) <(echo foo) >/dev/null && log INFO "diff matched"
# Command substitution with pipeline
timestamp=$(date | sed 's/ /_/g')
timestamp=$(date | sed 's//_/g')
log INFO "Timestamp: $timestamp"
# Testing array slicing
@@ -139,3 +139,4 @@ log INFO "You typed: $user_input"
# End marker
log INFO "Script finished (version $VERSION)"

71
samples/css.css Normal file
View File

@@ -0,0 +1,71 @@
/* === Basic selectors === */
body {
margin: 0;
font-family: system-ui, sans-serif;
background: #121212;
color: #eee;
}
/* Class + ID + attribute */
#main.container[data-theme="dark"] {
padding: 1rem;
border: 1px solid rgba(255, 255, 255, 0.2);
}
/* Pseudo-classes & elements */
a:hover,
a:focus-visible {
color: hsl(210, 80%, 60%);
text-decoration: underline;
}
input::placeholder {
color: #999;
background-color: #523;
}
/* CSS variables */
:root {
--accent: #4fc3f7;
--spacing: 1rem;
}
.button {
background: var(--accent);
padding: calc(var(--spacing) * 1.5);
}
/* Media query */
@media (max-width: 768px) {
.container {
padding: 0.5rem;
}
}
/* Keyframes */
@keyframes fade-in {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* Animation usage */
.modal {
animation: fade-in 250ms ease-out;
}
/* Complex selector */
ul > li:not(:last-child)::after {
content: "•";
margin-left: 0.5em;
}
/* Edge cases */
[data-value^="test"]::before {
content: attr(data-value);
}

102
samples/diff.patch Normal file
View File

@@ -0,0 +1,102 @@
--- ./samples/toml.toml 2025-12-26 19:02:50.480936043 +0000
+++ ./samples/yaml.yml 2025-12-26 19:03:27.879765974 +0000
@@ -2,52 +2,65 @@
# Basic types
# ============================================================
-title = "Example TOML Configuration"
-enabled = true
-count = 42
-pi = 3.14159
-empty = ""
+title: "Example YAML Configuration"
+enabled: true
+count: 42
+pi: 3.14159
+empty: ""
# ============================================================
-# Arrays
+# Arrays / Lists
# ============================================================
-fruits = ["apple", "banana", "cherry"]
-numbers = [1, 2, 3, 4, 5]
+fruits:
+ - apple
+ - banana
+ - cherry
-# Nested array
-matrix = [[1, 2], [3, 4]]
+numbers:
+ - 1
+ - 2
+ - 3
+ - 4
+ - 5
+
+matrix:
+ - [1, 2]
+ - [3, 4]
# ============================================================
-# Tables
+# Nested objects / maps
# ============================================================
-[owner]
-name = "Alice"
-dob = 1979-05-27T07:32:00Z
-
-[database]
-server = "192.168.1.1"
-ports = [ 8001, 8001, 8002 ]
-connection_max = 5000
-enabled = true
+owner:
+ name: Alice
+ dob: 1979-05-27T07:32:00Z
-[servers.alpha]
-ip = "10.0.0.1"
-dc = "east"
+database:
+ server: 192.168.1.1
+ ports:
+ - 8001
+ - 8001
+ - 8002
+ connection_max: 5000
+ enabled: true
-[servers.beta]
-ip = "10.0.0.2"
-dc = "west"
+servers:
+ alpha:
+ ip: 10.0.0.1
+ dc: east
+ beta:
+ ip: 10.0.0.2
+ dc: west
# ============================================================
-# Inline tables
+# Multiline string
# ============================================================
-clients = { name = "Bob", age = 30, active = true }
+description: |
+ This is a YAML file
+ used for testing syntax highlighting.
+ It supports multiple lines.
# ============================================================
-# Multiline strings
+# Special characters
# ============================================================
-description = """
-This is a TOML file
-used for testing syntax highlighting.
-It supports multiple lines.
-"""
+regex_pattern: "^[A-Za-z0-9_]+$"
+path: "C:\\Users\\Alice\\Documents"

View File

@@ -0,0 +1,71 @@
<%# app/views/users/show.html.erb %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title><%= @user.name %> — Profile</title>
<%# Inline Ruby expression %>
<meta name="description" content="<%= @user.bio %>">
<% if @dark_mode %>
<style>
body {
background-color: #111;
color: #eee;
}
</style>
<% end %>
</head>
<body>
<!-- HTML comment -->
<header>
<h1>Welcome, <%= @user.name %></h1>
<p class="subtitle">
Member since <%= @user.created_at.strftime("%Y") %>
</p>
</header>
<% if @user.admin? %>
<section class="admin-panel">
<h2>Admin Tools</h2>
<ul>
<% @tools.each do |tool| %>
<li><%= tool.title %></li>
<% end %>
</ul>
</section>
<% else %>
<p>You do not have admin privileges.</p>
<% end %>
<section class="posts">
<% @posts.each do |post| %>
<article class="post">
<h3><%= post.title %></h3>
<p><%= truncate(post.body, length: 140) %></p>
<%# Conditional rendering %>
<% if post.published? %>
<span class="status published">Published</span>
<% else %>
<span class="status draft">Draft</span>
<% end %>
</article>
<% end %>
</section>
<footer>
<p>&copy; <%= Time.now.year %> Example Corp</p>
<%= link_to "Privacy Policy", "/privacy" %>
</footer>
<script>
// JavaScript inside ERB
const userName = "<%= j @user.name %>";
console.log(`Loaded profile for ${userName}`);
</script>
</body>
</html>

93
samples/fish.fish Normal file
View File

@@ -0,0 +1,93 @@
#!/usr/bin/env fish
# Fish highlighting torture test
# === Variables ===
set normal_var hello
set -l local_var 123
set -gx GLOBAL_VAR world
set PATH $PATH /usr/local/bin
set --erase OLD_VAR
# Builtin variables
echo $HOME $PWD $USER $FISH_VERSION
# === Strings ===
set single 'single quoted string'
set double "double quoted $normal_var"
set escaped "newline\n tab\t dollar\$"
# === Conditionals ===
if test $normal_var = hello
echo equal
else if test $normal_var != world
echo "not equal"
end
# === Logical operators ===
true and echo yes
false or echo fallback
not false
# === Arithmetic ===
set x 10
set y 20
math "$x + $y"
if test (math "$x * 2") -gt 15
echo "math works"
end
# === Loops ===
for i in 1 2 3
echo "loop $i"
end
while test $x -gt 0
set x (math "$x - 1")
end
# === Functions ===
function greet --argument name
echo "Hello $name"
end
greet world
# === Command substitution ===
set files (ls | grep ".fish")
# === Redirections ===
echo output >/tmp/fish_test.txt
cat </tmp/fish_test.txt >>/tmp/fish_log.txt
# === Process substitution ===
diff (ls /bin) (ls /usr/bin)
# === Case statement ===
switch $argv[1]
case start
echo Starting
case stop
echo Stopping
case '*'
echo Unknown
end
# === Subshell ===
begin
echo "inside begin/end"
end
# === Comments & operators ===
# && || | & ! should all highlight
true && echo ok || echo fail
# === Regex ===
string match -r '^[a-z]+$' hello
# === Test builtin ===
test -f /etc/passwd
test ! -d /does/not/exist
# === Exit ===
exit 0

81
samples/gdscript.gd Normal file
View File

@@ -0,0 +1,81 @@
# Sample GDScript for syntax highlighting
extends Node2D
# ============================================================
# Constants
# ============================================================
const MAX_HEALTH = 100
const PLAYER_SPEED = 200
const PI_APPROX = 3.14159
# ============================================================
# Exported variables
# ============================================================
@export var player_name: String = "Hero"
@export var is_alive: bool = true
# ============================================================
# Signals
# ============================================================
signal health_changed(new_health)
# ============================================================
# Member variables
# ============================================================
var health: int = MAX_HEALTH
var velocity: Vector2 = Vector2.ZERO
var inventory: Array = []
# ============================================================
# Functions
# ============================================================
func _ready() -> void:
print("Player ready:", player_name)
_initialize_inventory()
set_process(true)
func _process(delta: float) -> void:
if is_alive:
_handle_input(delta)
_check_health()
# Private functions
func _initialize_inventory() -> void:
inventory.append("Sword")
inventory.append("Shield")
func _handle_input(delta: float) -> void:
var direction: Vector2 = Vector2.ZERO
if Input.is_action_pressed("ui_right"):
direction.x += 1
if Input.is_action_pressed("ui_left"):
direction.x -= 1
if Input.is_action_pressed("ui_down"):
direction.y += 1
if Input.is_action_pressed("ui_up"):
direction.y -= 1
velocity = direction.normalized() * PLAYER_SPEED
position += velocity * delta
func _check_health() -> void:
if health <= 0:
is_alive = false
print("Player is dead!")
else:
emit_signal("health_changed", health)
# ============================================================
# Example of class definition inside another script
# ============================================================
class Weapon:
var name: String
var damage: int
func _init(name: String, damage: int):
self.name = name
self.damage = damage
func attack():
print(name, "attacks for", damage, "damage")

95
samples/go.go Normal file
View File

@@ -0,0 +1,95 @@
// file: go.go
package example_test
import (
"context"
"fmt"
"math"
"sync"
"testing"
"time"
)
// Simple interface
type Adder interface {
Add(a, b int) int
}
// Concrete implementation
type Calculator struct{}
func (Calculator) Add(a, b int) int {
return a + b
}
// Generic helper
func Max[T ~int | ~float64](a, b T) T {
if a > b {
return a
}
return b
}
// Table-driven test
func TestAdd(t *testing.T) {
tests := []struct {
name string
a, b int
expected int
}{
{"positive", 2, 3, 5},
{"negative", -2, -3, -5},
{"mixed", -2, 5, 3},
}
var calc Adder = Calculator{}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := calc.Add(tt.a, tt.b); got != tt.expected {
t.Fatalf("Add(%d, %d) = %d; want %d",
tt.a, tt.b, got, tt.expected)
}
})
}
}
// Concurrency + context test
func TestWorker(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)
defer cancel()
ch := make(chan int)
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
select {
case ch <- 42:
case <-ctx.Done():
}
}()
select {
case v := <-ch:
if v != 42 {
t.Errorf("unexpected value: %d", v)
}
case <-ctx.Done():
t.Fatal("timed out")
}
wg.Wait()
}
// Raw string + math edge case
func TestRawString(t *testing.T) {
raw := `line 1
line 2
\t not escaped
`
if len(raw) == 0 || math.IsNaN(float64(len(raw))) {
t.Fatal("impossible condition reached")
}
}

32
samples/go.mod Normal file
View File

@@ -0,0 +1,32 @@
module github.com/example/project
go 1.21
// ==============================
// Direct dependencies
// ==============================
require (
github.com/sirupsen/logrus v1.10.0
golang.org/x/net v0.10.0
github.com/pkg/errors v0.9.2 // indirect
)
// ==============================
// Replace dependencies
// ==============================
replace (
github.com/old/dependency v1.2.3 => github.com/new/dependency v1.2.4
golang.org/x/oldnet => golang.org/x/net v0.11.0
)
// ==============================
// Exclude dependencies
// ==============================
exclude github.com/bad/dependency v1.0.0
// ==============================
// Indirect dependencies
// ==============================
require (
github.com/another/pkg v1.3.0 // indirect
)

59
samples/haskell.hs Normal file
View File

@@ -0,0 +1,59 @@
-- File: haskell.hs
{-# LANGUAGE GADTs, TypeFamilies #-}
module SyntaxTest where
import Data.List (sort)
import qualified Data.Map as Map
-- Simple data type
data Person = Person
{ name :: String
, age :: Int
} deriving (Show, Eq)
-- GADT
data Expr a where
I :: Int -> Expr Int
B :: Bool -> Expr Bool
Add :: Expr Int -> Expr Int -> Expr Int
Eq :: Expr Int -> Expr Int -> Expr Bool
-- Type class
class Describable a where
describe :: a -> String
instance Describable Person where
describe (Person n a) = n ++ " is " ++ show a ++ " years old."
-- Function with pattern matching
sumList :: [Int] -> Int
sumList [] = 0
sumList (x:xs) = x + sumList xs
-- Lambda and higher-order functions
applyTwice :: (a -> a) -> a -> a
applyTwice f x = f (f x)
-- Infix operator
infixl 6 +++
(+++) :: Int -> Int -> Int
a +++ b = a + b
-- IO function
main :: IO ()
main = do
let people = [Person "Alice" 30, Person "Bob" 25]
mapM_ (putStrLn . describe) people
print $ sumList [1..10]
print $ applyTwice (+1) 5
print $ 3 +++ 4
print $ Eq (I 2) (Add (I 1) (I 1))
-- Quasi-quote example
someExpr :: Expr Int
someExpr = [| Add (I 5) (I 7) |]
-- Comments and Haddocks
-- | This is a Haddock comment
-- explaining the module and functions

87
samples/html.html Normal file
View File

@@ -0,0 +1,87 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Injection Test</title>
<!-- Comment -->
<!-- Another comment with spellcheck -->
<!-- CSS block -->
<style>
body {
background-color: #f0f0f0;
}
h1 {
color: blue;
}
.highlight {
font-weight: bold;
}
</style>
<!-- CSS block with type attribute -->
<style type="text/css">
p {
color: green;
}
</style>
<!-- Script block -->
<script>
console.log("Hello, world!");
function greet(name) {
alert(`Hello, ${name}`);
}
</script>
<!-- Script with type="module" -->
<script type="module">
import { something } from "./module.js";
something();
</script>
<!-- Script with type="importmap" -->
<script type="importmap">
{
"imports": {
"lodash": "/node_modules/lodash-es/lodash\n.js",
"key": 2
}
}
</script>
<!-- Script with type attribute custom -->
<script type="text/javascript">
console.log("Custom type");
</script>
</head>
<body>
<h1>Main Heading</h1>
<h2>Subheading H2</h2>
<p style="color: red; font-weight: bold">
This paragraph has an inline style
</p>
<p>
This is <strong>strong text</strong>, <b>bold also</b>,
<em>italic text</em>, <i>emphasized</i>, <u>underlined</u>,
<s>strikethrough</s>, <del>deleted text</del>, <code>inline code</code>,
<kbd>keyboard input</kbd>.
</p>
<a href="https://hello.world"></a>
<!-- Lit-html / template interpolation -->
<button @click="${e => console.log(e)}">Click me</button>
<button @click="${e => console.log(e)}">Click me too</button>
<!-- Input pattern (regex) -->
<input type="text" pattern="[0-9]{3}" placeholder="Enter 3 digits" />
<!-- Event handlers -->
<button onclick="alert('Clicked!')">Event Handler</button>
<input onchange="console.log(this.value)" />
</body>
</html>

41
samples/ini.ini Normal file
View File

@@ -0,0 +1,41 @@
; =====================================================
; Sample INI Configuration
; =====================================================
[general]
app_name = MyApp
version = 1.2.3
debug = true
max_users = 100
[database]
host = localhost
port = 5432
user = admin
password = secret
timeout = 30
[paths]
log_dir = /var/log/myapp
data_dir = ./data
cache_dir = ./cache
[features]
enable_feature_x = true
enable_feature_y = false
feature_list = item1, item2, item3
[servers]
server1 = 192.168.1.10
server2 = 192.168.1.11
server3 = 192.168.1.12
; Nested sections (some parsers support this)
[servers.backup]
server1 = 192.168.2.10
server2 = 192.168.2.11
; Comments and special characters
; This is a comment line
; Values can also contain special characters like !@#$%^&*()
special_value = !@#$%^&*()_+|~=

147
samples/javascript.js Normal file
View File

@@ -0,0 +1,147 @@
/* ===============================
* JavaScript Syntax Torture Test
* =============================== */
'use strict';
// === Imports ===
import fs, { readFileSync as rfs } from "fs";
import * as path from "path";
import defaultExport, { named as alias } from "./module.js";
// === Constants ===
const PI = 3.141592653589793;
const HEX = 0xff;
const BIN = 0b101010;
const OCT = 0o755;
const BIG = 123_456_789n;
// === Variables ===
let x = null;
var y = undefined;
let z = NaN;
// === Strings ===
const s1 = "double quotes";
const s2 = 'single quotes';
const s3 = `template literal ${1 + 2}`;
const s4 = `multi
line
template`;
const s5 = String.raw`raw \n string`;
// === Escapes ===
const esc = "\n\t\r\b\f\\\"\'\u00A9\x41";
// === Arrays & Objects ===
const arr = [1, , 3, ...[4, 5], { a: 1, b: { c: 2 } }];
const obj = {
key: "value",
"weird-key": 123,
['dyn' + 'amic']: true,
method() {},
async asyncMethod() {},
*generator() { yield 1; },
};
// === Destructuring ===
const { a, b: renamed, ...rest } = obj;
const [x1, , x3 = 42] = arr;
// === Functions ===
function normal(a, b = 1, ...rest) {
return a + b + rest.length;
}
const arrow = (x = 0) => x * x;
const asyncArrow = async () => await Promise.resolve(42);
// === Classes ===
class Example extends Array {
static staticField = 123;
#privateField = "secret";
constructor(...args) {
super(...args);
}
get value() {
return this.#privateField;
}
set value(v) {
this.#privateField = v;
}
}
// === Control Flow ===
if (true && !false || null ?? true) {
console.log("truthy");
} else if (false) {
console.warn("nope");
} else {
console.error("never");
}
for (let i = 0; i < 3; i++) {
continue;
}
for (const k in obj) {}
for (const v of arr) {}
while (false) {}
do {} while (false);
switch (Math.random()) {
case 0:
break;
default:
break;
}
// === Try / Catch ===
try {
throw new Error("boom");
} catch (e) {
console.error(e?.message ?? "unknown");
} finally {
// cleanup
}
// === Regex ===
const regex1 = /foo|bar/i;
const regex2 = /^<script\b(?![^>]*\btype\s*=\s*"(?!module|text\/javascript)[^"]*")[^>]*>$/;
// === Tagged template ===
function tag(strings, ...values) {
return strings.raw.join("|") + values.join(",");
}
tag`hello ${42} world`;
// === Optional chaining / nullish ===
const deep = obj?.a?.b ?? "fallback";
// === Bitwise ===
const mask = (1 << 4) | (1 << 8);
// === JSON ===
const json = JSON.stringify({ a: 1, b: [true, false] }, null, 2);
// === Top-level await (if supported) ===
await Promise.resolve("done");
// === JSX-like (should still highlight interestingly) ===
const jsx = (
<Component prop="value">
<Child />
</Component>
);
// === End ===
export default {
PI,
arr,
obj,
Example,
};

51
samples/json.jsonc Normal file
View File

@@ -0,0 +1,51 @@
/* Example configuration file (JSONC)
// Used to test syntax highlighting and comment support
mutiline comment
*/
{
// Application metadata
"name": "example-app",
"version": "1.2.3",
"debug": true,
// Paths and environment
"paths": {
"root": "/usr/local/example",
"cache": "/tmp/example-cache
asa
multiline string",
"logs": null, // optional
},
// Feature flags
"features": {
"experimental": false,
"hotReload": true,
"themes": [
"dark",
"light",
// "solarized" // not ready yet
],
},
// Network configuration
"server": {
"host": "127.0.0.1",
"port": 8080,
"ssl": {
"enabled": false,
"cert": "",
"key": "",
}
},
// Mixed value types
"timeouts": [100, 250, 500, null],
"retryCount": 3,
// Escapes and strings
"banner": "Welcome!\nThis supports \"escaped quotes\" and unicode → ✓",
// Trailing comma allowed in JSONC
}

119
samples/lua.lua Normal file
View File

@@ -0,0 +1,119 @@
#!/usr/bin/env lua
-- Lua syntax highlighting test file
-- Constants
PI = 3.14159
MAX_COUNT = 100
-- Variables
local counter = 0
local name = "Lua"
-- Built-in variable
print(self)
-- Functions
local function greet(user)
print("Hello, " .. user)
end
local function add(a, b)
return a + b
end
-- Method definitions
local obj = {}
function obj:sayHi()
print("Hi from method!")
end
obj.sayHello = function()
print("Hello from field function!")
end
-- Arrow-style anonymous function (LuaJIT/CFFI style)
local arrow = function(x)
return x * 2
end
-- Table constructors
local t = {
foo = 123,
bar = function()
return "bar"
end,
nested = {
a = 1,
b = 2,
},
}
-- Loops
for i = 1, MAX_COUNT do
counter = counter + i
end
while counter > 0 do
counter = counter - 1
end
repeat
counter = counter + 1
until counter == 10
-- Conditionals
if counter > 5 then
print("Big number")
elseif counter == 5 then
print("Exactly five")
else
print("Small number")
end
-- Operators
local x, y = 10, 20
local z = x + y * 2 - (x / y) ^ 2
local ok = x == y or x ~= y and not false
-- Function calls
greet("World")
obj:sayHi()
obj.sayHello()
add(5, 10)
-- Built-in function calls
assert(x > 0)
pcall(function()
print("safe")
end)
tonumber("123")
-- CFFI injection example
local ffi = require("ffi")
ffi.cdef([[
int printf(const char *fmt, ...);
typedef struct { int x; int y; } point;
]])
-- Boolean and nil
local flag = true
local nothing = nil
-- Comments
-- Single line
--[[
Multi-line
comment
]]
-- Strings
local s1 = "Hello\nWorld"
local s2 = [[Long
multi-line
string]]
-- Template strings (LuaJIT-style)
local tpl = `Value: ${counter}`
-- Regex-like string (for testing injection highlighting)
local re = "/^%a+$/"

45
samples/markdown.md Normal file
View File

@@ -0,0 +1,45 @@
# Heading 1
ones
content
# Heading 2
### Heading 3
This is a paragraph with **bold text**, *italic text*, ~~strikethrough~~, and `inline code`.
> This is a blockquote.
>
> - Nested list item 1
> - Nested list item 2
> - Sub-item
- Task list:
- [ ] Unchecked task
- [x] Checked task
1. Numbered list item
2. Another item
---
| Name | Age | City |
|------------|-----|---------------|
| Alice | 25 | London |
| Bob | 30 | New York |
| Charlie | 22 | San Francisco |
[Link to OpenAI](https://openai.com)
`Inline code` example and a fenced code block:
```lua
local s2 = [[Long
multi-line
string]]
```
![Image](https://example.com/image.jpg)
> "This is a quote with a link to [Top](#Heading%202)."

87
samples/nginx.conf Normal file
View File

@@ -0,0 +1,87 @@
# ============================================================
# Global Settings
# ============================================================
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
# ============================================================
# Events Block
# ============================================================
events {
worker_connections 1024;
use epoll;
multi_accept on;
}
# ============================================================
# HTTP Block
# ============================================================
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Logging
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log warn;
# Gzip Settings
gzip on;
gzip_disable "msie6";
# ========================================================
# Upstream Backend Servers
# ========================================================
upstream backend {
server 127.0.0.1:8080 weight=5;
server 127.0.0.1:8081;
keepalive 32;
}
# ========================================================
# Server Block
# ========================================================
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name example.com www.example.com;
root /var/www/html;
index index.html index.htm;
# ====================================================
# Location Blocks
# ====================================================
location / {
try_files $uri $uri/ =404;
}
location /api/ {
proxy_pass http://backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~* \.(gif|jpg|jpeg|png|css|js|ico|svg)$ {
expires 30d;
add_header Cache-Control "public, no-transform";
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/html;
}
}
}

136
samples/php.php Normal file
View File

@@ -0,0 +1,136 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>PHP Syntax Stress Test</title>
<style>
/* CSS section */
body {
font-family: Arial, sans-serif;
background: #1e1e1e;
color: #e0e0e0;
}
.box {
border: 1px solid #444;
padding: 10px;
margin: 10px;
}
</style>
<script>
// JS section
function greet(name) {
console.log("Hello " + name);
}
document.addEventListener("DOMContentLoaded", () => {
greet("World");
});
</script>
</head>
<body>
<?php
// Basic variables
$number = 42;
$text = "Hello PHP";
$truth = true;
$nothing = null;
// Constants
define("APP_NAME", "SyntaxTester");
// Arrays
$list = [1, 2, 3];
$assoc = [
"one" => 1,
"two" => 2
];
// Function
function add(int $a, int $b): int
{
return $a + $b;
}
// Class + methods
class User
{
private string $name;
public static int $count = 0;
public function __construct(string $name)
{
$this->name = $name;
self::$count++;
}
public function greet(): string
{
return "Hello {$this->name}";
}
}
// Object usage
$user = new User("Alice");
echo $user->greet();
// Control flow
if ($number > 10) {
echo "Big number";
} elseif ($number === 10) {
echo "Exactly ten";
} else {
echo "Small number";
}
// Loop
foreach ($list as $item) {
echo $item;
}
// Match expression
$result = match ($number) {
1 => "one",
2 => "two",
default => "many"
};
// Try / catch
try {
throw new Exception("Test exception");
} catch (Exception $e) {
echo $e->getMessage();
}
// Anonymous function
$double = fn($x) => $x * 2;
// Nullsafe operator
$len = $user?->name ? strlen($user->name) : 0;
// Ternary
$status = $truth ? "yes" : "no";
// Include / require
require_once "config.php";
// Output
echo "<div class='box'>";
echo htmlspecialchars($text);
echo "</div>";
?>
<script>
// JS interacting with PHP output
const phpValue = <?= json_encode($number) ?>;
console.log("Value from PHP:", phpValue);
</script>
</body>
</html>

163
samples/python.py Normal file
View File

@@ -0,0 +1,163 @@
from __future__ import annotations
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Test file for Python Tree-sitter highlighting."""
# ==============================
# Constants / Builtins
# ==============================
PI = 3.14159
MAX_SIZE = 100
NotImplemented
Ellipsis
__name__ # builtin constant
# ==============================
# Imports
# ==============================
import os
import sys as system
from re import compile as re_compile
from math import *
# ==============================
# Functions
# ==============================
def add(a: int, b: int = 5) -> int:
"""Simple add function"""
return a + b
def variadic(*args, **kwargs):
print(args, kwargs)
lambda_func = lambda x, y=2: x * y
def type_var_example(T: type):
pass
# ==============================
# Classes
# ==============================
class Base:
class_var = 10
def __init__(self, name: str):
self.name = name
self._private = 42
@classmethod
def cls_method(cls):
return cls.class_var
@staticmethod
def static_method():
return "static"
@property
def prop(self):
return self.name
class Derived(Base):
def __init__(self, name, extra):
super().__init__(name)
self.extra = extra
# ==============================
# Variables
# ==============================
normal_var = 1
_local_var = 2
GLOBAL_VAR = 3
# Builtin variable references
self = "something"
cls = "dj"
# ==============================
# Control flow
# ==============================
if True:
x = 10
elif False:
x = 20
else:
x = 0
for i in range(3):
print(i)
while x > 0:
x -= 1
if x == 1:
break
else:
continue
try:
1 / 0
except ZeroDivisionError as err:
raise
finally:
pass
# ==============================
# Operators
# ==============================
a, b = 5, 10
c = a + b * 2 // 3 % 4 ** 2
d = (a << 2) & b | c ^ ~a
ef = not a or b and c
# ==============================
# f-strings / interpolation
# ==============================
name = "Alice"
greeting = f"Hello {name.upper()}!"
formatted = f"{a + b} is sum"
# ==============================
# Regex
# ==============================
pattern1 = re_compile(r"\d+")
pattern2 = re_compile(r"\w{2,}")
# ==============================
# Decorators usage
# ==============================
@staticmethod
def static_func():
return True
@classmethod
def cls_func(cls):
return cls
# @custom_decorator
def decorated_func():
return None
# ==============================
# Misc / Type conversions / literals
# ==============================
flag: bool = True
nothing: None = None
num: float = float("3.14")
text: str = str(123)
lst = [1, 2, 3]
tpl = (4, 5)
dct = {"a": 1, "b": 2}
# ==============================
# Type hints / TypeVar / TypeAlias
# ==============================
from typing import TypeVar, NewType
T = TypeVar("T")
UserId = NewType("UserId", int)
TypeAliasExample: type = int
# ==============================
# Function calls / constructors
# ==============================
result = add(1, 2)
obj = Derived("Alice", "extra")
variadic(1, 2, 3, key="value")
instance_check = isinstance(obj, Base)

18
samples/regex.regex Normal file
View File

@@ -0,0 +1,18 @@
# Match email addresses with optional names
(?P<name>[a-zA-Z0-9._%+-]+)?\s*<(?P<email>[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})>
# Match dates in YYYY-MM-DD or DD/MM/YYYY
(\d{4}-\d{2}-\d{2})|(\d{2}/\d{2}/\d{4})
# Match hexadecimal colors
# e.g., #FFF, #FFFFFF
# Optional leading #
# Case-insensitive
# Flags inline
(?i)#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})
# Match words starting with vowels
\b[aeiouAEIOU]\w*\b
# Match simple URL
https?://(?:www\.)?\w+\.\w+(?:/\S*)?

View File

@@ -4,30 +4,48 @@
# Purpose: Test syntax highlighting + width calculation in your editor
# ---------------------------------------------------------------
# Basic output
def greet
puts "Hello, 世界! 👋🌏"
end
# Emoji-heavy strings
emojis = "👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏👋🌏"
# Mixed-width CJK blocks
# Mixed-width CJKssssssssssssssss LoadErssssssssssssssssssssssss
cjk_samples = [
"漢字テスト",
"測試中文字串",
"한국어 테스트",
"ひらがなカタカナ😀混合",
"大量の文字列🚀🚀🚀",
'漢字テスト',
'測試中文字串',
'한국어 테스트',
'ひらがなカタカナ混合'
]
# a hex color: #FFFFFF shouldn't hl here: hsl(147rad, 50%, 47%) as it is not css-style file
0x603010 # another hex color
# Ruby regex with unicode
unicode_regex = /[一-龯ぁ-んァ-ヶー々〆〤]/
$unicode_regex_multiline = /[一-龯ぁ-ん12288
\-ヶー
s wow
々〆〤]/
UNICORE = /
s
{#{ss}}
\C-s\u{10}
/
UNINITCORE = %(
{{#{}}}
test = "A:\x41 B:\101 C:\u0043 D:\u{44 45} NUL:\0 DEL:\c? CTRL_A:\cA META_X:\M-x CTRL_META_X:\C-\M-x MIX:\C-\M-z N:\N{UNICODE NAME}"
)
# Unicode identifiers (valid in Ruby)
= 123
π = 3.14159
= -> { "こんにちは" }
= 0x5_4eddaee
π = 0.314_159e+2, ?\u0234, "\,", ?\x0A, 's', true, false, 0
= -> { "こんに \n ちは" }
arr = []
not_arr = NotABuiltin.new
raise NameError or SystemExit or CustomError or Errno or ErrorNotAtAll
# Method using unicode variable names
def math_test
@@ -35,8 +53,12 @@ def math_test
end
# Iterate through CJK samples
cjk_samples.each_with_index do |str, idx|
puts "CJK[#{idx}] => #{str} (len=#{str.length})"
cjk_samples.each_with_index do |str, idx:|
puts %! CJK[#{idx}] => #{str} (len=#{str.length})\! !
symbol = :"
a
"
sym2 = :hello
end
# Test emoji width behaviors
@@ -44,31 +66,47 @@ puts "Emoji count: #{emojis.length}"
# Multi-line string with unicode
multi = <<~BASH
# Function recursion demo
factorial() {
local n="$1"
if ((n <= 1)); then
echo 1
else
local prev
prev=$(factorial $((n - 1)))
echo $((n * prev))
fi
}
log INFO "factorial(5) = $(factorial 5)"
# Function recursion demo
factorial() {
local n="$1"
if ((n <= 1)); then
echo 1
else\ns
local prev
prev=$(factorial $((n - 1)))
echo $((n * prev))
before #{ interpol
# {' '}
# comment should be fine heres s
$a / $-s + 0xFF
}s#{' '}
x
a after
fi
} #{s}
log INFO "factorial(5) = $(factorial 5)"
BASH
puts multi
# Arrays mixing everything
mixed = [
"🐍 Ruby + Python? sacrilege! 🐍",
"日本語とEnglishと🔧mix",
"Spacing test →→→→→→→",
"Zero-width joiner test: 👨‍👩‍👧‍👦 family emoji",
'🐍 Ruby + Python? sacrilege! 🐍',
'日本語とEnglishと🔧mix',
'Spacing test →→→→→→→',
'Zero-width joiner test: 👨‍👩‍👧‍👦 family emoji'
]
two_docs = <<~DOC1, <<~DOC2
stuff for doc2
rdvajehvbaejbfh
DOC1
stuff for doc 2 with #{!interpolation} and more
DOC2
p = 0 << 22 # not a heredoc
mixed.each { |m| puts m }
# Unicode in comments — highlight me!
@@ -84,37 +122,37 @@ end
escaped = "Line1\nLine2\tTabbed 😀"
puts escaped
p = 0 << 2
# Frozen string literal test
# frozen_string_literal: true
const_str = "定数文字列🔒".freeze
const_str = '定数文字列🔒'.freeze
puts const_str
# End marker
puts "--- END OF UNICODE TEST FILE ---"
puts '--- END OF UNICODE TEST FILE ---'
# Ruby syntax highlighting test
=begin
This is a multi-line comment.
It spans multiple lines.
Good for testing highlighting.
This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test,
=end
# This is a multi-line comment.
# It spans multiple lines.
# Good for testing highlighting.
#
# This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped line test, This is a wrapped linetest,
#
# Constants
PI = 3.14159
MAX_ITER = 5
# Module
module Utilities
def self.random_greeting
["Hello", "Hi", "Hey", "Hola", "Bonjour", "Merhaba"].sample
%w[Hello Hi Hey Hola Bonjour Merhaba].sample
end
def self.factorial(n)
return 1 if n <= 1
n * factorial(n - 1)
end
end
@@ -132,6 +170,8 @@ class TestObject
puts "#{@name}: #{@value}"
end
private
def double_value
@value * 2
end
@@ -173,11 +213,16 @@ end
# Method definition
def greet_person(name)
puts "#{Utilities.random_greeting}, #{name}!"
return true if name == 'harry'
's'
end
h = a / a
# Calling methods
greet_person("Alice")
greet_person("Bob")
greet_person('Alice')
greet_person('Bob')
# Loops
i = 0
@@ -197,7 +242,7 @@ begin
rescue ZeroDivisionError => e
puts "Caught an error: #{e}"
ensure
puts "This runs no matter what"
puts 'This runs no matter what'
end
# Arrays of objects
@@ -233,7 +278,7 @@ end
end
# Special objects
so = SpecialObject.new("Special", 10)
so = SpecialObject.new('Special', 10)
puts "Double: #{so.double_value}, Triple: #{so.triple_value}"
# String interpolation and formatting
@@ -241,16 +286,19 @@ puts "PI is approximately #{PI.round(2)}"
# Multi-line strings
multi_line = <<~TEXT
k kmW ;
This is a multi-line string.
It spans multiple lines.
Good for testing highlighting.
Gossn sssmss
ddsss
od for testing highlighting.
TEXT
puts multi_line
# Symbols and strings
sym = :my_symbol
str = "my string"
sym = :my_symbol == __dir__
str = 'my string'
puts "Symbol: #{sym}, String: #{str}"
# Random numbers
@@ -269,20 +317,27 @@ end
# Block with yield
def wrapper
puts "Before block"
puts 'Before block'
yield if block_given?
puts "After block"
puts 'After block'
end
wrapper { puts "Inside block" }
# ss
wrapper { puts 'Inside block' }
# Sorting
sorted = rand_nums.sort
puts "Sorted: #{sorted.join(', ')}"
# Regex
sample_text = "The quick brown fox jumps over the lazy dog"
sample_text = 'The quick brown fox jumps over the lazy dog'
puts "Match 'fox'?" if sample_text =~ /fox/
# End of test script
puts "Ruby syntax highlighting test complete."
puts 'Ruby syntax highlighting test complete.'
__END__
Anything here should be ignored >><<
{{{}}}[[[]]](((000)))

Some files were not shown because too many files have changed in this diff Show More