Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SExp: parsing the output of the printer produces a different SExp #66

Closed
1 of 5 tasks
JohnReppy opened this issue Jul 15, 2022 · 0 comments
Closed
1 of 5 tasks
Assignees
Labels
bug Something isn't working fixed-in-110.99.3 issues that will be fixed in the 110.99.3 version gforge bug (or feature request) ported from smlnj-gforge repository smlnj-lib General issue with the SML/NJ Library or the Util component

Comments

@JohnReppy
Copy link
Contributor

JohnReppy commented Jul 15, 2022

Version

No response

Operating System

  • All
  • Linux
  • macOS
  • Windows
  • Other Unix

OS Version

No response

Processor

Any

Component

SML/NJ Library

Severity

Major

Description of the problem

"SExpParser.parse" from the SML/NJ library does not produce the same
s-expression that was written using "SExpPrinter.print" when strings
containing multibyte characters are involved. How to reproduce:

(* 1. Print str. )
val str = "∞"; (
Infinity character. *)
print str;

(* 2. Write str to a file as an s-expression. *)
val out = TextIO.openOut "infinity.txt";
SExpPrinter.print (out, SExp.STRING str);
TextIO.closeOut out;

(* 3. Attempt to read back str from the file. *)
case SExpParser.parseFile "infinity.txt" of
[SExp.STRING str'] => print str'
| _ => ();

In step 1, "∞" is displayed, but in step 3, "\226\136\158" is displayed.

This problem occurs because "SExpPrinter.print" escapes all strings
using "String.toString" but "SExpParser.parseFile" does not unescape
strings using "String.fromString".

Transcript

No response

Expected Behavior

No response

Steps to Reproduce

No response

Additional Information

No response

Email address

No response

Comments from smlnj-gforge

Original smlnj-gforge bug number 309

Submitted on 2022-05-17 at 06:03:00

comment by @JohnReppy on 2022-05-31 14:28:00 +000 UTC

Fixed for 110.99.3 and 2022.1. The SExp library now uses Scheme syntax for string values.

@JohnReppy JohnReppy added bug Something isn't working gforge bug (or feature request) ported from smlnj-gforge repository smlnj-lib General issue with the SML/NJ Library or the Util component labels Jul 15, 2022
@JohnReppy JohnReppy self-assigned this Jul 15, 2022
@JohnReppy JohnReppy added the fixed-in-110.99.3 issues that will be fixed in the 110.99.3 version label Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed-in-110.99.3 issues that will be fixed in the 110.99.3 version gforge bug (or feature request) ported from smlnj-gforge repository smlnj-lib General issue with the SML/NJ Library or the Util component
Projects
None yet
Development

No branches or pull requests

1 participant