From deca6f4d03d36e4980715ae6709f244f381b1175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Tue, 9 Sep 2014 21:50:38 +0200 Subject: Cleanup header files --- syntax.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 syntax.h (limited to 'syntax.h') diff --git a/syntax.h b/syntax.h new file mode 100644 index 0000000..a945389 --- /dev/null +++ b/syntax.h @@ -0,0 +1,28 @@ +#ifndef SYNTAX_H +#define SYNTAX_H + +#include + +#define SYNTAX_REGEX_RULES 10 + +typedef struct { + short fg, bg; /* fore and background color */ + int attr; /* curses attributes */ +} Color; + +typedef struct { + char *rule; /* regex to search for */ + int cflags; /* compilation flags (REG_*) used when compiling */ + Color color; /* settings to apply in case of a match */ + regex_t regex; /* compiled form of the above rule */ +} SyntaxRule; + +typedef struct Syntax Syntax; +struct Syntax { /* a syntax definition */ + char *name; /* syntax name */ + char *file; /* apply to files matching this regex */ + regex_t file_regex; /* compiled file name regex */ + SyntaxRule rules[SYNTAX_REGEX_RULES]; /* all rules for this file type */ +}; + +#endif -- cgit v1.2.3