[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
Sat Jul 6 16:42:20 CEST 2019


On Sat, Jul 6, 2019 at 10:34 AM Ben Grasset <operator97 at gmail.com> wrote:

> No spaces or tabs are implicitly inserted or removed by the compiler at
> any time. Line endings are handled via the directive syntax suggested by
> Michael.
>
> If you wish to test the feature yourself, Florian, currently I have the
> branch available here. <https://github.com/Akira13641/freepascal>
>
> Note that it *does* now also include the requested {$modeswitch
> MultiLineStrings}, which must be set (in all language modes) in order to
> use multi-line strings anywhere.
>

To be extra clear, also, for example, in the case of that code posted by
Ryan the output looks like this:

  #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;
      }
    }

    // TODO: testing
    fragColor = vec4(1,0,0,1);
  }

Which is to say, two spaces are present at the start of each line because
they were present in the string as Ryan typed it.

On Sat, Jul 6, 2019 at 10:34 AM Ben Grasset <operator97 at gmail.com> wrote:

> On Sat, Jul 6, 2019 at 10:25 AM Florian Klämpfl <florian at freepascal.org>
> wrote:
>
>> 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.
>>
>
> No spaces or tabs are implicitly inserted or removed by the compiler at
> any time. Line endings are handled via the directive syntax suggested by
> Michael.
>
> If you wish to test the feature yourself, Florian, currently I have the
> branch available here. <https://github.com/Akira13641/freepascal>
>
> Note that it *does* now also include the requested {$modeswitch
> MultiLineStrings}, which must be set (in all language modes) in order to
> use multi-line strings anywhere.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190706/cde7b5e8/attachment.html>


More information about the fpc-devel mailing list