Usually comments are managed by a :discard rule, for example: :discard ~ <Cplusplus style comment> :discard ~ <C style comment>
########################## # Discard of a C++ comment ########################## <Cplusplus style comment> ~ '//' <Cplusplus comment interior> <Cplusplus comment interior> ~ [^\n]* ############################################################################ # Discard of a C comment, c.f. https://gist.github.com/jeffreykegler/5015057 ############################################################################ <C style comment> ~ '/*' <comment interior> '*/' <comment interior> ~ <optional non stars> <optional star prefixed segments> <optional pre final stars> <optional non stars> ~ [^*]* <optional star prefixed segments> ~ <star prefixed segment>* <star prefixed segment> ~ <stars> [^/*] <optional star free text> <stars> ~ [*]+ <optional star free text> ~ [^*]* <optional pre final stars> ~ [*]* Regards, Jean-Damien Le dimanche 17 avril 2016 07:12:06 UTC+2, [email protected] a écrit : > > hi, i'd like to write a parser to a DSL in which I have a lot of code > written. There are comments, as usual. I believe the comments are a > constituent part of the operational body. Should I put the comments > nonterminal in each G1 rule , so that I can do things with them as I do > things with the DSL lines ? Or should I parse twice , one with the > comments, and one with the code, and then link them back somehow? > > thanks! > Haroldo > -- You received this message because you are subscribed to the Google Groups "marpa parser" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
