diff options
Diffstat (limited to 'include/lexer/symbol_property.h')
| -rw-r--r-- | include/lexer/symbol_property.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/include/lexer/symbol_property.h b/include/lexer/symbol_property.h index 3d85623..2e94cf7 100644 --- a/include/lexer/symbol_property.h +++ b/include/lexer/symbol_property.h @@ -15,6 +15,12 @@ public: int operand_number = 0; bool continuable = true; int pivot_priority = -1; + + // require: MUST + // accept: optional, but if it doesn't accept, but there is indeed a child, then error + child_existance_type left; + child_existance_type right; + enum_token_type enum_type = TEXT; }; @@ -28,10 +34,11 @@ unordered_map<string, T_property> symbol_property = { {")", {.continuable = false, .enum_type = RIGHT_BRACKET}}, // operator - {"&", {.operand_number = 1, .continuable = true, .pivot_priority = 1000, .enum_type = ASYNC}}, - {"|", {.operand_number = 1, .continuable = true, .pivot_priority = 100, .enum_type = PIPE}}, - {"&&", {.operand_number = 1, .continuable = true, .pivot_priority = 1000, .enum_type = LOGIC_AND}}, - {"||", {.operand_number = 1, .continuable = true, .pivot_priority = 1000, .enum_type = LOGIC_OR}}, + {"&", {.operand_number = 1, .continuable = true, .pivot_priority = 1000, .left = EXIST, .right = NOT_EXIST, .enum_type = ASYNC}}, + {"|", {.operand_number = 1, .continuable = true, .pivot_priority = 100, .left = EXIST, .right = EXIST, .enum_type = PIPE}}, + {"&&", {.operand_number = 1, .continuable = true, .pivot_priority = 1000, .left = EXIST, .right = EXIST, .enum_type = LOGIC_AND}}, + {"||", {.operand_number = 1, .continuable = true, .pivot_priority = 1000, .left = EXIST, .right = EXIST, .enum_type = LOGIC_OR}}, + }; } |
