You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Comments can be added to the TatSu grammar for rule and option. The corresponding classes in grammars would have a comment field for the pretty-printer to use.
Some tweaks may be needed for comments right before a rule definition, and right after, before the first element.
PEG allows for this.
Complications would be on the pretty printer (most important), though the code generator could also try to do its part.
I dealt with this issue when parsing COBOL and NATURAL. I'm closing to think about it when I need to do something alike again. Not all grammars are easy when comment recovery is attempted.
I'd take a look at the new PEG Python grammar for Python.
My subconscious says that this would be manageable with tokenization, as was used in the PEG Python grammar, more so when now in TatSu Buffer is one implementation of Tokenizer.
This issue will come back. I just don't want to leave it open without a design, strategy, or pull request.
#
comments retain the#
and are output as(* *)
comments.Prettification of comments is not well defined.
It's best to stick to Python-style (#) comments.
The text was updated successfully, but these errors were encountered: