aboutsummaryrefslogtreecommitdiff
path: root/encoder.l
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2017-02-19 12:08:10 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2017-02-19 12:08:10 +0100
commit0dca8bf47f83cbe07dbe899acf01d1b9c75c95c5 (patch)
treecc20499d1cc4fd729b8d99ce5b416a47e0131a99 /encoder.l
parent345db0ecf42ec9866a562572b8a9222e85a6c4ed (diff)
downloadsherlock.lv2-0dca8bf47f83cbe07dbe899acf01d1b9c75c95c5.tar.xz
nk: fix lexer color theme, support sratom pretty.
Diffstat (limited to 'encoder.l')
-rw-r--r--encoder.l34
1 files changed, 27 insertions, 7 deletions
diff --git a/encoder.l b/encoder.l
index 50ac8b3..d576fb4 100644
--- a/encoder.l
+++ b/encoder.l
@@ -21,11 +21,26 @@
#include <encoder.h>
+#define ful 0xff
+#define one 0xbb
+#define two 0x66
+#define non 0x0
+const struct nk_color white = {.r = one, .g = one, .b = one, .a = ful};
+const struct nk_color gray = {.r = two, .g = two, .b = two, .a = ful};
+const struct nk_color yellow = {.r = one, .g = one, .b = non, .a = ful};
+const struct nk_color magenta = {.r = one, .g = two, .b = one, .a = ful};
+const struct nk_color green = {.r = non, .g = one, .b = non, .a = ful};
+const struct nk_color blue = {.r = non, .g = one, .b = one, .a = ful};
+const struct nk_color orange = {.r = one, .g = two, .b = non, .a = ful};
+const struct nk_color violet = {.r = two, .g = two, .b = one, .a = ful};
+const struct nk_color red = {.r = one, .g = non, .b = non, .a = ful};
+
enum {
TK_NONE,
TK_PREFIX,
TK_SUBJECT,
TK_PREDICATE,
+ TK_BOOL,
TK_NUMBER,
TK_URI_IN,
TK_URI_OUT,
@@ -64,6 +79,8 @@ eol [\n\r]
{name}: return TK_SUBJECT;
"@prefix" return TK_PREFIX;
"a" return TK_PREFIX;
+true return TK_BOOL;
+false return TK_BOOL;
{name} return TK_PREDICATE;
{number} return TK_NUMBER;
. return TK_RAW;
@@ -127,21 +144,24 @@ ttl_lex(void *data, const char *utf8, int len)
switch(tok)
{
case TK_PREFIX:
- col1 = (struct nk_color){0xff, 0x00, 0x00, 0xff};
+ col1 = blue;
break;
case TK_SUBJECT:
- col1 = (struct nk_color){0x00, 0xff, 0x00, 0xff};
+ col1 = magenta;
break;
case TK_PREDICATE:
- col1 = (struct nk_color){0x00, 0x00, 0xff, 0xff};
+ col1 = orange;
+ break;
+ case TK_BOOL:
+ col1 = violet;
break;
case TK_NUMBER:
- col1 = (struct nk_color){0xff, 0xff, 0x00, 0xff};
+ col1 = green;
break;
case TK_URI_IN:
case TK_URI_OUT:
case TK_URI_ERR:
- col1 = (struct nk_color){0xff, 0x00, 0xff, 0xff};
+ col1 = yellow;
break;
case TK_STRING_IN:
@@ -149,12 +169,12 @@ ttl_lex(void *data, const char *utf8, int len)
case TK_STRING_ERR:
case TK_LONG_STRING_IN:
case TK_LONG_STRING_OUT:
- col1 = (struct nk_color){0x00, 0xff, 0xff, 0xff};
+ col1 = red;
break;
case TK_NONE:
case TK_WHITESPACE:
- col1 = (struct nk_color){0xff, 0xff, 0xff, 0xff};
+ col1 = white;
break;
case TK_RAW: