summaryrefslogtreecommitdiff
path: root/src/regex/tbnf_regex_defs.h
blob: 9276ae02a3b9792e06cc340f37e1a8a2525017de (plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**************************************************************/
/*  treebnf: a tree oriented bnf library                      */
/*  Copyright (C) 2024  SysDeer Technologies, LLC             */
/*  Released under GPLv2 and GPLv3; see COPYING.TREEBNF.      */
/**************************************************************/

#ifndef TBNF_REGEX_DEFS_H
#define TBNF_REGEX_DEFS_H

enum tbnf_regex_scan_state {
	TBNF_REGEX_STATE_INIT,
	TBNF_REGEX_STATE_BRACE,
	TBNF_REGEX_STATE_BRACKET,
	TBNF_REGEX_STATE_CAP,
};

enum tbnf_regex_token_type {
	TBNF_REGEX_TOK_NONE,

	/* in-brace tokens */
	TBNF_REGEX_TOK_BRACE_RBRACE,
	TBNF_REGEX_TOK_BRACE_DIGIT,
	TBNF_REGEX_TOK_BRACE_COMMA,

	/* in-bracket tokens */
	TBNF_REGEX_TOK_BRACKET_ESCAPED_CHAR,
	TBNF_REGEX_TOK_BRACKET_CHARACTER_CLASS,
	TBNF_REGEX_TOK_BRACKET_COLLATION_SYMBOL,
	TBNF_REGEX_TOK_BRACKET_EQUIVALENCE_CLASS,
	TBNF_REGEX_TOK_BRACKET_RBRACKET,
	TBNF_REGEX_TOK_BRACKET_HYPHEN,
	TBNF_REGEX_TOK_BRACKET_ERROR,
	TBNF_REGEX_TOK_BRACKET_CHAR,

	/* brace state initializer token */
	TBNF_REGEX_TOK_LBRACE,

	/* bracket state initializer tokens */
	TBNF_REGEX_TOK_LBRACKET_CIRCUMFLEX_RBRACKET,
	TBNF_REGEX_TOK_LBRACKET_CIRCUMFLEX,
	TBNF_REGEX_TOK_LBRACKET_RBRACKET,
	TBNF_REGEX_TOK_LBRACKET,

	/* init state tokens */
	TBNF_REGEX_TOK_ESCAPED_CHAR,

	TBNF_REGEX_TOK_CIRCUMFLEX_ASTERISK,
	TBNF_REGEX_TOK_CIRCUMFLEX,

	TBNF_REGEX_TOK_LPAREN,
	TBNF_REGEX_TOK_RPAREN,

	TBNF_REGEX_TOK_ASTERISK,
	TBNF_REGEX_TOK_PERIOD,
	TBNF_REGEX_TOK_DOLLAR,
	TBNF_REGEX_TOK_VLINE,
	TBNF_REGEX_TOK_QMARK,
	TBNF_REGEX_TOK_PLUS,
	TBNF_REGEX_TOK_CHAR,

	TBNF_REGEX_TOK_CAP,
};

#endif