Add rename function for term_t and rule_t to add prefix/suffix to variables - #29
Conversation
…iables Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com>
Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com>
hzhangxyz
left a comment
There was a problem hiding this comment.
突然发现目前这个接口无法实现只添加suffix或者只添加prefix, 所以这个长度为2的pair中, 应该允许出现空的情况, 但是我的item类型并不支持空字符串, 所以使用 "((prefix_) (suffix))" 这样的接口吧, 只有前缀就是 "((prefix) ())" ,只有后缀就是 "(() (_suffix))" .
…ffix)) Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com>
Updated the interface to use
Commit: 558c653 Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
hzhangxyz
left a comment
There was a problem hiding this comment.
从prefix_and_suffix中抽取 prefix_str和suffix_str的工作可以在开头做一次就行了, 不用每次递归的时候都重新做一次, 为此, 你应该需要实现几个辅助函数. 另外, rename.cc这个文件中的注释使用中文.
…unctions, use Chinese comments Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com>
已重构为使用辅助函数 Commit: dc1a9e1 |
hzhangxyz
left a comment
There was a problem hiding this comment.
- 俩辅助函数应该模仿match.cc那样使用匿名namespace
strlen可以被 string_t 的 get_length 替代, 这个不需要数数, 而是直接存的, 需要注意get_length和是strlen的结果+1, 因为他算进去了末尾的\0.
…e.cc Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com>
Commit: ee94086 |
hzhangxyz
left a comment
There was a problem hiding this comment.
请把
@param prefix_str 输出参数,prefix字符串指针,如果prefix为空则为nullptr。
@param prefix_len 输出参数,prefix字符串长度。
@param suffix_str 输出参数,suffix字符串指针,如果suffix为空则为nullptr。
@param suffix_len 输出参数,suffix字符串长度。
这四个参数放在一个struct里, 参考 match.cc 中, 我就是把一些相关的量放一起了.
另外, 请把 dst[new_len - 1] = '\0'; 换成 dst[new_len - 1] = 0; 没有为啥, 只是这个仓库的习惯.
Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com>
已将四个参数放入 Commit: 821cf76 |
groundfunction insrc/ground.ccrenamefunction declaration toinclude/ds/term.hhforterm_trenamefunction declaration toinclude/ds/rule.hhforrule_trenamefunction forterm_tin a new source file (followingground.ccpattern)renamefunction forrule_tin the same source filerenamefunctionality((prefix) (suffix))formatOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.