Blob Blame History Raw
/**************************************************************/
/*  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