Skip to content

Commit a9120ed

Browse files
committed
Comments.
1 parent 558946d commit a9120ed

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

core/src/main/kotlin/org/evomaster/core/parser/RegexHandler.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,19 +130,20 @@ object RegexHandler {
130130
result.append(c); i++
131131
}
132132

133-
// comment
133+
// comment (when COMMENTS flag is on)
134134
c == '#' && currentFlags.comments -> {
135135
i++
136+
// advance index until line terminator (eg: "#...\n") without copying
136137
while (i < regex.length && !currentFlags.isLineTerminator(regex[i])) i++
137-
// consume line terminator
138+
// consume line terminator too:
138139
if (i < regex.length) {
139140
// \r\n is a 2-character line terminator
140141
if (regex[i] == '\r' && i+1 < regex.length && regex[i+1] == '\n') i += 2
141142
else i++
142143
}
143144
}
144145

145-
// whitespace, skip when comments flag is on
146+
// whitespace, skip copying when comments flag is on
146147
c.isWhitespace() && currentFlags.comments -> i++
147148

148149
// else copy

0 commit comments

Comments
 (0)