From e82252938c351a0adeae41555ce1086fad3df679 Mon Sep 17 00:00:00 2001 From: Peter Ohler Date: Fri, 13 Oct 2023 17:33:22 -0400 Subject: [PATCH] Allow escaped single quote in SEN strings --- CHANGELOG.md | 2 ++ sen/maps.go | 4 ++-- sen/parser_test.go | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a0bb740..77bb2bc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/sen/maps.go b/sen/maps.go index 188962d6..ee089a5e 100644 --- a/sen/maps.go +++ b/sen/maps.go @@ -166,7 +166,7 @@ const ( // 0123456789abcdef0123456789abcdef escMap = "" + "................................" + // 0x00 - "..B............B................" + // 0x20 + "..B....B.......B................" + // 0x20 "............................B..." + // 0x40 "..B...B.......B...B.BU.........." + // 0x60 "................................" + // 0x80 @@ -176,7 +176,7 @@ const ( // 0123456789abcdef0123456789abcdef escByteMap = "" + "................................" + // 0x00 - "..\"............/................" + // 0x20 + "..\"....'......./................" + // 0x20 "............................\\..." + // 0x40 "..\b...\f.......\n...\r.\t.........." + // 0x60 "................................" + // 0x80 diff --git a/sen/parser_test.go b/sen/parser_test.go index a1504d81..828de09a 100644 --- a/sen/parser_test.go +++ b/sen/parser_test.go @@ -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},