aboutsummaryrefslogtreecommitdiff
path: root/include/lang_analysis/symbol_property.h
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-09-21 04:50:06 +0000
committer_ov4 <ov4@ov4.org>2026-09-21 04:50:06 +0000
commit1c630655b2beb0f4b84fb7e1bc034ba62520be37 (patch)
treee90e70c425813df29c8bbd5c1e84ef22f4e4a176 /include/lang_analysis/symbol_property.h
parent9f5936bf64deb625a27259d778937e281ca19cea (diff)
fix name typo, and remove outdated parse
Diffstat (limited to 'include/lang_analysis/symbol_property.h')
-rw-r--r--include/lang_analysis/symbol_property.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/include/lang_analysis/symbol_property.h b/include/lang_analysis/symbol_property.h
new file mode 100644
index 0000000..f21b145
--- /dev/null
+++ b/include/lang_analysis/symbol_property.h
@@ -0,0 +1,48 @@
+#pragma once
+
+#include <unordered_map>
+#include <string>
+
+#include "lang_analysis/enum_type.h"
+
+using namespace std;
+
+namespace ov4
+{
+
+class T_property
+{
+public:
+ bool continuable = true;
+
+ // -1 means it's NOT operator
+ // any positive values mean it's operator
+ int pivot_priority = -1;
+
+ // require: MUST
+ // accept: optional, but if it doesn't accept, but there is indeed a child, then error
+ child_existence_type left;
+ child_existence_type right;
+
+ enum_token_type enum_type = TEXT;
+};
+
+inline const unordered_map<string, T_property> symbol_property = {
+
+ // bracket
+ {"(", {.continuable = false, .enum_type = LEFT_BRACKET}},
+ {")", {.continuable = false, .enum_type = RIGHT_BRACKET}},
+
+ // operator
+ {"&", {.continuable = true, .pivot_priority = 2000, .left = child_existence_type::EXIST, .right = child_existence_type::NOT_EXIST, .enum_type = ASYNC}},
+ {"|", {.continuable = true, .pivot_priority = 100, .left = child_existence_type::EXIST, .right = child_existence_type::EXIST, .enum_type = PIPE}},
+ {"&&", {.continuable = true, .pivot_priority = 1000, .left = child_existence_type::EXIST, .right = child_existence_type::EXIST, .enum_type = LOGIC_AND}},
+ {"||", {.continuable = true, .pivot_priority = 1000, .left = child_existence_type::EXIST, .right = child_existence_type::EXIST, .enum_type = LOGIC_OR}},
+
+};
+
+string symbol_enum2string(enum_token_type e);
+
+bool symbol_contains_enum_type(enum_token_type e);
+
+}