On Sun, Dec 16, 2018 at 11:31 PM Michael Powell
Hello,
I am turning a corner in my Protocol Buffers grammar, and it is now time for me to consider how best to approach parsing comments.
Chiefly, I am weighing two options, I think:
1) A white-space, comments skipper; if memory serves there has been discussion about such a thing on either here, Boost mailing list, or other forums.
Is there a Confix parser for Spirit Qi? I see there is possible a utility there for Classic, but I'm not sure I see one for Qi?
2) Or, as with some compiler environments, I'm thinking .NET Roslyn/C#, in particular, where "comment" elements are first class members of the grammar/tokens, quite literally, I think.
I'm not quite sure how that would be expressed in terms of synthesized AST, when you could literally have a comment appearing virtually anywhere between tokens, especially of the C variety, i.e. /* this is a comment which may appear virtually anywhere between tokens, potentially */.
Or the single line C++ variety, for example, // this is a comment through the rest of this line. // Yet, there could be multiple lines of these... optional myVar = true; // And can appear at the end of a line
Thoughts? Suggestions?
My first approach I think would be for (1) the skipper; however, for what I am wanting to accomplish, I can see there potentially being some value in capturing the comments and carrying them forward with the target language adapter.
Best regards,
Michael Powell