summaryrefslogtreecommitdiff
path: root/src/regex/tbnf_regex_defs.h
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-05-15 20:40:33 +0000
committermidipix <writeonce@midipix.org>2024-05-15 20:40:33 +0000
commitc257188cd912503371db1c2b7b2c59b4fd53df1c (patch)
tree8077d9f09fa85521f53a94f3fa33d17a7975a11c /src/regex/tbnf_regex_defs.h
parentae7810f56e1daa1d2e35c06969c26835c1ed7800 (diff)
downloadtreebnf-c257188cd912503371db1c2b7b2c59b4fd53df1c.tar.bz2
treebnf-c257188cd912503371db1c2b7b2c59b4fd53df1c.tar.xz
regex module: implemented token scanners, added definitions and scan table.
Diffstat (limited to 'src/regex/tbnf_regex_defs.h')
-rw-r--r--src/regex/tbnf_regex_defs.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/regex/tbnf_regex_defs.h b/src/regex/tbnf_regex_defs.h
new file mode 100644
index 0000000..9276ae0
--- /dev/null
+++ b/src/regex/tbnf_regex_defs.h
@@ -0,0 +1,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