Menu

#597 Add support for multi-line literals

None
unread
nobody
None
none
1
2014-06-17
2014-06-14
No

It would be extremely useful to create strings from literal data that might span multiple lines and/or contain characters that would require escaping within Rexx literals (for example, XML data, which typically includes quoted strings itself. It would be nice if ooRexx contained some sort of syntax that allows this such as is done with other languages:

https://en.wikipedia.org/wiki/Here_document

Using << as a starting delimiter obviously does not work with ooRexx, but perhaps this might be a good use for the {} characters finally.

Discussion

  • Anonymous

    Anonymous - 2014-06-16

    Would the way line breaks vary from platform to platform need to be taken into account? (I am not sure about Linux.) IIRC, Unix and Windows use slightly different line break sequences. More significantly, record aware operating systems (e.g. z/OS, z/VM, z/VSE, TPF) don't routinely have line break character sequences. (AFAIK, USS is not record aware.)

    What if the data included the bit sequence for CR-LF, but which happened to be a binary value of the same bit configuration. These issues would complicate portability if the interpreter needs to recognize these cases.

     
  • Gil Barmwater

    Gil Barmwater - 2014-06-17

    An alternate syntax described in the earlier link might be appropriate for ooRexx. This is used in the D language and Windows Power Shell and consists of a prefix character before the starting ' or ". Power Shell terminates with the same character after the closing ' or ". In D, the terminator is an "end string" followed by " on a line by itself (the "end string" having been specified following the prefix and " at the start). Choice of a prefix character for ooRexx is open but should be something that is not valid current syntax. Possibilities that come to mind are ^ or :

     

Anonymous
Anonymous

Add attachments
Cancel