[fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.
Ben Grasset
operator97 at gmail.com
Fri Jul 5 06:31:35 CEST 2019
Ok, here's a link to my github fork
<https://github.com/Akira13641/freepascal> implementing the multi-line
string functionality.
It now includes complete support for user-selected line ending settings,
using the directive syntax suggested by Michael.
So, for example, if you view the output of the following program in an
editor that can display the line endings directly:
program Example;
{$H+}
{$MULTILINESTRINGLINEENDING CR}
const A =
`
😊
😊
😊
😊
😊
`;
{$MULTILINESTRINGLINEENDING CRLF}
const B =
`
😊
😊
😊
😊
😊
`;
{$MULTILINESTRINGLINEENDING LF}
const C =
`
😊
😊
😊
😊
😊
`;
{$MULTILINESTRINGLINEENDING PLATFORM}
const D =
`
😊
😊
😊
😊
😊
`;
{$MULTILINESTRINGLINEENDING RAW}
const E =
`
😊
😊
😊
😊
😊
`;
begin
Write(A);
Write(B);
Write(C);
Write(D);
Write(E);
end.
you'll see that each string adheres to the setting above it. Note that
"platform" means whatever line ending your operating system uses, and "raw"
means whatever the line endings in the source file itself are. Currently
"raw" is the default.
Once I have a set of proper tests written, I suppose I'll submit a formal
patch to the FPC bugtracker.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190705/2f114198/attachment.html>
More information about the fpc-devel
mailing list