Skip to content

Commit 74e3841

Browse files
authored
fix(lanzou): correct comment parsing logic in lanzou driver (#9278)
- Adjusted logic to skip incrementing index when exiting comments. - Added checks to continue loop if inside a single-line or block comment. - Prevents erroneous parsing and retains intended comment exclusion.
1 parent eca5008 commit 74e3841

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/lanzou/help.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ func RemoveJSComment(data string) string {
9494
}
9595
if inComment && v == '*' && i+1 < len(data) && data[i+1] == '/' {
9696
inComment = false
97+
i++
9798
continue
9899
}
99100
if v == '/' && i+1 < len(data) {
@@ -108,6 +109,9 @@ func RemoveJSComment(data string) string {
108109
continue
109110
}
110111
}
112+
if inComment || inSingleLineComment {
113+
continue
114+
}
111115
result.WriteByte(v)
112116
}
113117

0 commit comments

Comments
 (0)