View Source LogicalFile.Macros.LineComment (LogicalFile v1.0.4)

A sample implementation of a macro that supports single-line comments where a comment expression is recognised at the beginning of a line and it transforms the entire content of that line into whitespace. Note that this does not allow a line comment to appear at the end of an expression!

While a regular expression could be specified to recognise whitespace as part of the comment marker a more sophisticated implementation would allow the comment marker to appear after an expression. It is also left as an exercise to implement multi-line comments (a la C /.../)

Link to this section Summary

Functions

The general strategy is to process sections in order. For each section find any line matching the expression and transform the entire contents of the line into whitespace.

Link to this section Functions

Link to this function

process_comments(file, expr)

View Source

The general strategy is to process sections in order. For each section find any line matching the expression and transform the entire contents of the line into whitespace.