srcweave icon indicating copy to clipboard operation
srcweave copied to clipboard

Way to comment out all lines of an include?

Open eihli opened this issue 3 years ago • 0 comments

I've got some code like below and I'd like to comment out all of the 64 bit test loop with a single // line. But right now it only prefixes the first line of the inclusion.

--- /pagecount32vs64.c
@{Includes, initializations, and external function declarations}
int main(int argc, char** argv) {
    @{Initializations32}
    @{Baseline32}

    @{32 bit test loop}
    // @{64 bit test loop}
    @{Results output}
}
---

I see how this behavior is useful because it lets you do things like:

someArray.@{filter and map chain}

Where filter and map chain is something like:

--- filter and map chain
map(double)
.filter(even)
.reduce(add)
---

You don't want someArray to be prefixed to each line there, and srcweave doesn't know there's a difference between // and someArray. It doesn't know that one's a comment prefix and one's not.

So... I'm happy to work on the implementation. But what's the best way to go about this?

Maybe something like a "comment directive"? Something scoped project-wide? Or scoped per file? Or scoped per code-block?

Maybe something like

--- /pagecount32vs64.c --- comment: //
foo
// bar
baz
---

eihli avatar Aug 21 '22 23:08 eihli