aboutsummaryrefslogtreecommitdiff
path: root/syntax.h
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-10-09 10:31:25 +0200
committerMarc André Tanner <mat@brain-dump.org>2015-10-14 10:33:26 +0200
commit9e391f5e3b2baaee0bf73e5273daf84be8a76ce2 (patch)
treee15479ec06d6b8c2eb83a2cd8fd1dd0125eabb00 /syntax.h
parentd05b8805325c2d1836c1a60280bb097340bbd03f (diff)
downloadvis-9e391f5e3b2baaee0bf73e5273daf84be8a76ce2.tar.gz
vis-9e391f5e3b2baaee0bf73e5273daf84be8a76ce2.tar.xz
ui: refactor syntax style definitions
Styles can now be specified as strings which will make them easier to specify from outside the editor. The following style attributes can be given in a comma separated list: bold italics underlined fore:color back:color where color is either a hex value of the form #aabbcc or one of the predefined colors: black red green yellow blue magenta cyan white
Diffstat (limited to 'syntax.h')
-rw-r--r--syntax.h10
1 files changed, 3 insertions, 7 deletions
diff --git a/syntax.h b/syntax.h
index c28a7ea..8ce623e 100644
--- a/syntax.h
+++ b/syntax.h
@@ -4,20 +4,15 @@
#include <regex.h>
typedef struct {
- short fg, bg; /* fore and background color */
- int attr; /* curses attributes */
-} Color;
-
-typedef struct {
char *rule; /* regex to search for */
- Color *color; /* settings to apply in case of a match */
+ int style; /* settings to apply in case of a match */
bool multiline; /* whether . should match new lines */
regex_t regex; /* compiled form of the above rule */
} SyntaxRule;
typedef struct {
char *symbol;
- Color *color;
+ int style;
} SyntaxSymbol;
enum {
@@ -35,6 +30,7 @@ struct Syntax { /* a syntax definition */
char *file; /* apply to files matching this regex */
regex_t file_regex; /* compiled file name regex */
const char **settings;/* settings associated with this file type */
+ const char **styles; /* settings associated with this file type */
SyntaxSymbol symbols[SYNTAX_SYMBOL_LAST]; /* symbols for white space handling */
SyntaxRule rules[24]; /* all rules for this file type */
};