Skip to content

Commit

Permalink
Allow escaped single quote in SEN strings
Browse files Browse the repository at this point in the history
  • Loading branch information
ohler55 committed Oct 13, 2023
1 parent f010b72 commit e822529
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ The structure and content of this file follows [Keep a Changelog](https://keepac
## [1.20.0] - unreleased
### Added
- Added ojg.Options.FloatFormat to allow float output format to be specified.
### Fixed
- A single quote character can now be escaped in strings when using SEN for parsing.

## [1.19.4] - 2023-10-03
### Added
Expand Down
4 changes: 2 additions & 2 deletions sen/maps.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ const (
// 0123456789abcdef0123456789abcdef
escMap = "" +
"................................" + // 0x00
"..B............B................" + // 0x20
"..B....B.......B................" + // 0x20
"............................B..." + // 0x40
"..B...B.......B...B.BU.........." + // 0x60
"................................" + // 0x80
Expand All @@ -176,7 +176,7 @@ const (
// 0123456789abcdef0123456789abcdef
escByteMap = "" +
"................................" + // 0x00
"..\"............/................" + // 0x20
"..\"....'......./................" + // 0x20
"............................\\..." + // 0x40
"..\b...\f.......\n...\r.\t.........." + // 0x60
"................................" + // 0x80
Expand Down
1 change: 1 addition & 0 deletions sen/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func TestParserParseString(t *testing.T) {
{src: `"hello"`, value: "hello"},
{src: `'ab"cd'`, value: `ab"cd`},
{src: `"ab'cd"`, value: `ab'cd`},
{src: `'ab\'cd'`, value: `ab'cd`},
{src: "[one two]", value: []any{"one", "two"}},
{src: "123", value: 123},
{src: "-12.3", value: -12.3},
Expand Down

0 comments on commit e822529

Please sign in to comment.