aboutsummaryrefslogtreecommitdiff
path: root/include/lexer
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-09-09 12:45:08 +0000
committer_ov4 <ov4@ov4.org>2026-09-09 12:45:08 +0000
commit66fd6696283507643c4b08d3bd91480ae2971e73 (patch)
tree01fbfaa4c6621b3616888a6ca146e1c283ff7231 /include/lexer
parentda12cca68e56a8e75103a7a12b6cdb4299517b4e (diff)
make symbol_property const, and fix typo
Diffstat (limited to 'include/lexer')
-rw-r--r--include/lexer/symbol_property.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/include/lexer/symbol_property.h b/include/lexer/symbol_property.h
index a69d665..8b05c14 100644
--- a/include/lexer/symbol_property.h
+++ b/include/lexer/symbol_property.h
@@ -13,8 +13,10 @@ namespace ov4
class T_property
{
public:
- int operand_number = 0;
bool continuable = true;
+
+ // -1 means it's NOT operator
+ // any positive values mean it's operator
int pivot_priority = -1;
// require: MUST
@@ -25,7 +27,7 @@ public:
enum_token_type enum_type = TEXT;
};
-inline unordered_map<string, T_property> symbol_property = {
+inline const unordered_map<string, T_property> symbol_property = {
// non-operator
{"\'", {.enum_type = SINGLE_QUOTATION}},
{"\"", {.enum_type = SINGLE_QUOTATION}},
@@ -35,10 +37,10 @@ inline unordered_map<string, T_property> symbol_property = {
{")", {.continuable = false, .enum_type = RIGHT_BRACKET}},
// operator
- {"&", {.operand_number = 1, .continuable = true, .pivot_priority = 2000, .left = child_existence_type::EXIST, .right = child_existence_type::NOT_EXIST, .enum_type = ASYNC}},
- {"|", {.operand_number = 1, .continuable = true, .pivot_priority = 100, .left = child_existence_type::EXIST, .right = child_existence_type::EXIST, .enum_type = PIPE}},
- {"&&", {.operand_number = 1, .continuable = true, .pivot_priority = 1000, .left = child_existence_type::EXIST, .right = child_existence_type::EXIST, .enum_type = LOGIC_AND}},
- {"||", {.operand_number = 1, .continuable = true, .pivot_priority = 1000, .left = child_existence_type::EXIST, .right = child_existence_type::EXIST, .enum_type = LOGIC_OR}},
+ {"&", {.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}},
};