Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions jsonc.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ func stripComments(data []byte) []byte {
OUTSIDE = iota
SINGLE_LINE
MULTI_LINE
MULTI_LINE_ENDING
IN_STRING
)

Expand Down Expand Up @@ -48,15 +47,13 @@ func stripComments(data []byte) []byte {
}
case MULTI_LINE:
if data[i] == '*' && i+1 < len(result) && data[i+1] == '/' {
state = MULTI_LINE_ENDING
state = OUTSIDE
result[i] = ' '
result[i+1] = ' '
i++
} else if result[i] != '\n' {
result[i] = ' '
}
case MULTI_LINE_ENDING:
state = OUTSIDE
case IN_STRING:
if data[i] == '\\' && i+1 < len(data) {
i++
Expand Down
5 changes: 1 addition & 4 deletions v2/jsonc.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ func stripComments(data []byte) []byte {
OUTSIDE = iota
SINGLE_LINE
MULTI_LINE
MULTI_LINE_ENDING
IN_STRING
)

Expand Down Expand Up @@ -46,15 +45,13 @@ func stripComments(data []byte) []byte {
}
case MULTI_LINE:
if data[i] == '*' && i+1 < len(result) && data[i+1] == '/' {
state = MULTI_LINE_ENDING
state = OUTSIDE
result[i] = ' '
result[i+1] = ' '
i++
} else if result[i] != '\n' {
result[i] = ' '
}
case MULTI_LINE_ENDING:
state = OUTSIDE
case IN_STRING:
if data[i] == '\\' && i+1 < len(data) {
i++
Expand Down