[fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

Sven Barth pascaldragon at googlemail.com
Sat Jul 6 17:38:49 CEST 2019


Am 06.07.2019 um 16:25 schrieb Florian Klämpfl:
> Am 05.07.2019 um 17:29 schrieb Ryan Joseph:
>> This may not be related but why does "l: string = lines;” work, shouldn’t that be an error or at least get clipped? I’m seeing writeln prints out the entire string as if it was an ansistring.
>>
>> {$mode objfpc}
>> {$multilinestringlineending crlf}
>> {$h+}
>>
>> program test;
>>
>> const lines = `
>>    #version 150
>>
>>    uniform sampler2D textures[8];
>>    in vec2 vertexTexCoord;
>>    in vec4 vertexColor;
>>    in float vertexUVMap;
>>    out vec4 fragColor;
>>
>>    void main()
>>    {
>>      if (vertexUVMap == 255) {
>>        fragColor = vertexColor;
>>      } else {
>>        fragColor = texture(textures[int(vertexUVMap)], vertexTexCoord.st);
>>        if (vertexColor.a < fragColor.a) {
>>          fragColor.a = vertexColor.a;
>>        }
>>      }
>>    }`;
> I tried to follow the thread, but one think I miss is: what are the rules for indention? Does the lines string contain
> spaces at the beginning of every line or not? Are they removed? How many are removed? What about tabs? Actually, this is
> my main concern with such multiline strings: spaces/tabs at the beginning of a line cannot be handled in an intuitive way.
I've also complained about that point here: 
https://lists.freepascal.org/pipermail/fpc-devel/2019-July/041453.html

Regards,
Sven


More information about the fpc-devel mailing list