githwxi / ATS-Postiats

ATS2: Unleashing the Potentials of Types and Templates
www.ats-lang.org
Other
354 stars 54 forks source link

`\0` in strings. #192

Closed steinwaywhw closed 6 years ago

steinwaywhw commented 6 years ago

https://github.com/githwxi/ATS-Postiats/blob/4fc41735fbca13b31868a6e13c10ba64a9387230/src/pats_lexing.dats#L1988-L1994

Is there a particular reason \n gets treated differently? I was hit by this while testing the simple dynamic string library wrapper in ATS, source code. The literal string emitted by ATS is incorrect.

githwxi commented 6 years ago

It is for handling multi-line strings. What literal string emitted by ATS is incorrect?

steinwaywhw commented 6 years ago

Oh my bad. It is \0 that is treated incorrectly. "\a\n\0foo\r" is emitted as ATSPMVstring("\007\n")

githwxi commented 6 years ago

A string in ATS cannot contain '\0' in the middle.

steinwaywhw commented 6 years ago

Ok, I see. Maybe in the future we can add support for \0. Low priority.