Skip to content

Commit f625f79

Browse files
committed
Add tests for match.cc.
1 parent c37371c commit f625f79

File tree

4 files changed

+321
-138
lines changed

4 files changed

+321
-138
lines changed

include/ds/rule.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ namespace ds {
113113
/// @param rule_1 待被apply的rule。
114114
/// @param rule_2 待作为fact的rule。
115115
/// @param check_tail 可选的尾指针检查。
116-
/// @return 自身,是一个rule_t对象的指针,如果尾指针检查失败则返回nullptr。
116+
/// @return 自身,如果匹配失败则返回nullptr,如果尾指针检查失败则返回nullptr,在尾指针检查正常时,匹配失败会将本对象设置为null
117117
rule_t* match(rule_t* rule_1, rule_t* rule_2, std::byte* check_tail = nullptr);
118118
};
119119
} // namespace ds

include/ds/term.hh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,14 @@ namespace ds {
146146
/// @note 如果dictionary格式不正确,则行为未定义。
147147
term_t* ground(term_t* term, term_t* dictionary, const char* scope, std::byte* check_tail = nullptr);
148148

149-
/// @brief 将term_1匹配term_2
149+
/// @brief 将term_1和term_2相互匹配,结果作为一个用于ground的dictionary被更新至本对象
150150
/// @param term_1 第一个term。
151151
/// @param term_2 第二个term。
152-
/// @param follow_first_for_double_variable 当两个term都是variable时, 是否使用第一个term的名字。
152+
/// @param scope_1 结果中用于标记给term_1使用的scope。
153+
/// @param scope_2 结果中用于标记给term_2使用的scope。
153154
/// @param check_tail 可选的尾指针检查。
154-
/// @return 自身,是一个用于第一个term ground的dictionary,如果匹配失败则返回nullptr。
155-
term_t* match(term_t* term_1, term_t* term_2, bool follow_first_for_double_variable, std::byte* check_tail = nullptr);
155+
/// @return 自身,如果匹配失败则返回nullptr,如果尾指针检查失败则返回nullptr,在尾指针检查正常时,匹配失败会将本对象设置为null
156+
term_t* match(term_t* term_1, term_t* term_2, const char* scope_1, const char* scope_2, std::byte* check_tail = nullptr);
156157
};
157158
} // namespace ds
158159

0 commit comments

Comments
 (0)