Skip to content

Commit

Permalink
Merge pull request #1 from pigeonlaser/main
Browse files Browse the repository at this point in the history
Allow for forward slashes to be present in strings without the escape character preceding it
  • Loading branch information
karminski authored Sep 20, 2024
2 parents 0f6896b + f66bba8 commit ce076a7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,7 @@ func (lexer *Lexer) appendString(str string) error {
lexer.popTokenStack()
continue
} else if lexer.streamStoppedInAString() {
// in a string, and the preceding token isn't an escape character, write current token symbol to JSON content
lexer.JSONContent.WriteByte(tokenSymbol)
continue
}
Expand Down
1 change: 1 addition & 0 deletions lexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ func TestCompleteJSON_base(t *testing.T) {
`{"a":"\"\""}`: `{"a":"\"\""}`,
`{"\\`: `{"\\":null}`,
`{"\/`: `{"\/":null}`,
`{"/`: `{"/":null}`,
`{"\b`: `{"\b":null}`,
`{"\f`: `{"\f":null}`,
`{"\n`: `{"\n":null}`,
Expand Down

0 comments on commit ce076a7

Please sign in to comment.