blob: 8ce623eb4f1209e61b22dadf1d9bf22bd13ba78e (
plain) (
blame)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#ifndef SYNTAX_H
#define SYNTAX_H
#include <regex.h>
typedef struct {
char *rule; /* regex to search for */
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;
int style;
} SyntaxSymbol;
enum {
SYNTAX_SYMBOL_SPACE,
SYNTAX_SYMBOL_TAB,
SYNTAX_SYMBOL_TAB_FILL,
SYNTAX_SYMBOL_EOL,
SYNTAX_SYMBOL_EOF,
SYNTAX_SYMBOL_LAST,
};
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 */
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 */
};
#endif
|