stevedlawrence commented on code in PR #799:
URL: https://github.com/apache/daffodil/pull/799#discussion_r889190804
##########
daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tdml/TDMLRunner.scala:
##########
@@ -2364,6 +2358,35 @@ sealed abstract class DocumentPart(part: Node, parent:
Document) {
}
}.trim.toUpperCase()
+ /*
+ * Allow "//" and "/* */" (inline) to act as comments.
+ * Any characters not explicitly allowed are also considered comments and are
removed.
+ */
+ def removeComments(validCharactersSet : String, userData : String ) : String
= {
+ lazy val doubleForwardPattern = "//.*".r
+ lazy val openClosePattern = "/[*].*[*]/".r
Review Comment:
I think we need to make the `.*` non-greedy? Image we had something like
this:
```xml
<documentPart type="bits">
01010101 /* something */ 01010101 /* something else */
</documentPart>
```
If it's a greedy match, everything will be considered a comment except for
the first set of binary numbers. We should add a test with something like this.
Another related thought, do we want to allow that syntax to work with
multiple lines, e.g.:
```xml
<documentPart type="bits">
01010101 /* something that spans
across multiple lines */
10101010 /* something else that
spans multiple lines */
</documentPart>
```
That seems pretty reasonable to me, in which case the dot need to match
newlines. Note that the dot in the double-slash comment doesn't need to match
newlines, since by default it ends at a newline.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]