Closed charliethomson closed 4 years ago
We can also keep a reference to the original str
, as part of the struct
definition (e.g., struct Deroffer<'a> { output: Vec<Cow<'a, str>> /* Cow so that we can own if we need to */, s: &'a str, ... }
). Not something we
need to do now, though.
On Tue, Dec 10, 2019 at 10:06 AM Ivan Tham notifications@github.com wrote:
@pickfire commented on this pull request.
In src/deroff.rs https://github.com/rust-dc/fish-manpage-completions/pull/68#discussion_r356090053 :
- "\" => {
- // if self.str_at(1) == Some('"') {
- if Self::str_at(&self.s, 1) == "\"" {
- // self.condputs("\n");
- return true;
- }
- }
- "[" => {
- self.refer = true;
- // self.condputs("\n");
- return true;
- }
- "]" => {
- self.refer = false;
- // self.skip_char();
- self.s = self.skip_char(&self.s, None).to_owned();
Yeah, if any I believe we can still discuss on the design of parsing later on. A rough idea is to just keep the original String or &str and use an index to iterate through it.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rust-dc/fish-manpage-completions/pull/68?email_source=notifications&email_token=AAHEGM4NYXG5XP55MURJOT3QX6V6FA5CNFSM4JS2DCLKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCOU7CAA#discussion_r356090053, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHEGMYUMIPJDEZQLSFYR6LQX6V6FANCNFSM4JS2DCLA .
Is there anything I need to change on this PR?
I think we can just take in this first? By the way, I feel like refactoring how string parsing current works.
I feel like refactoring how string parsing current works.
I definitely agree, most of the code is kinda begging for a reformat.
Why is the original python code for this not removed? Is this still work in progress?
@pickfire I literally never look at the source in the file I'm editing, so I didn't even know it was there, they're removed now
@charliethomson Can you please help to take a look at the rest of the comments?
EDIT: #75 is merged
@charliethomson, there are conflicts with master. Can you resolve?
@charliethomson Please help to put the pull request as a draft, once you are done can ping me or make this a normal pull request so I can review one off. Thanks a lot.
@pickfire I fixed most things. There are a few I'm unsure about, I've replied to everything afaik. I'm not sure I understand the thing you pinged me in, can I get some clarification?
I also had to add stubs for
comment
,prch
,text_arg
,digit
,condputs
, andspec
. I gaveDeroffer::reg_table
a type (HashMap<String, String>
) based on the context it was used in. I think that's about it.edit: v this is talking about #69 v Oh, I left commented out cleaner versions of a few lines that could be fixed with to change the interface of
str_at
andskip_char
and probably alsois_white
, so yeah. Sorry for the PR spam Scott :P