Replies: 1 comment
-
Why are we bothering with capturing comments in this type? Can we not pre-process and exclude the comments? But then how will we handle We have another option of creating a more low level type, or keeping Other option is to keep all comments in a separate data structure, so our parse returns |
Beta Was this translation helpful? Give feedback.
-
So I just started work on 0.5. As discussed in the past, this is almost going to be a complete rewrite.
The first bit we are going to handle is the
fastn-p1::Section
stuff. The earlier version wasfastn/ftd-p1/src/section.rs
Lines 21 to 31 in f72afd6
And I have created:
fastn/v0.5/p1/src/lib.rs
Lines 3 to 11 in 971294b
Important thing to note is that we are going to use
std::borrow::Cow
, instead of cloning. Till now we cloned every string, but this time we are going to keep references. Things that will not be modified, e.g., thename
of aSection
, can be just a slice into the original source string. But things that can be modified, e.g. the caption where we handle escaped{}
etc, will have to be Copied:Should be:
Note that p1 parse does not know about
$x
yet, so it was not extracted, but it understands the{}
, so\{ yo \}
was converted to{ yo }
.The main problem I see here is the handling of comments. I considered adding these:
This has some problems. One is pre_comment for only the first section would be populated, for every other second the post_body_comment will eat up the comments till next section. We can not drop post_body_comment, as what will happen to the comment after the body of the last section?
Also how will we store per comment, eg comment in each header etc?
Also currently we have only two forms of comment, entire line is comment, or part of line after the
;;
is comment. We do not have inline comment, eg-- {- this is comment -} foo: {- some more comment -} the real caption
. We do not yet have such inline comment in the spec, and not sure if we should add them. They do help, most languages have them, so saying we will not have them is not great long term solution.Beta Was this translation helpful? Give feedback.
All reactions