PROPOSAL: Multiline strings

rssh at gradsoft.com.ua rssh at gradsoft.com.ua
Tue Mar 3 02:11:01 PST 2009


> Ruslan,
>
> This proposal is missing many important details.
>
 ....
 Thanks, I prepared reviewed proposal


>>  ALTERNATIVES:
  understand, thanks for clafifying.

>
> What are the grammar changes?
>

Originally idea was:

MultilineStringLiteral:
        """ MultilineStringCharacters/opt """

MultilineStringCharacters:
        MultilineStringCharacter
        MultilineStringCharacters  MultilineStringCharacter but not "
        (MultilineStringCharacters but not "") ""

MultilineStringCharacter:
        InputCharacter but not \
        EscapeSequence
        LineTermination

But now if we want keep type of LineTermination and unescaped sequence,
this will be .. as in next version which I will send by next letter.

> Is are three consecutive quote characters escaped in a multi-line string?
>

 \""" will be as (\")""", where \" is EscapeSequence, therefore be escaped.


> As has been mentioned in earlier responses, how is whitespace handed?
>

 First idea was does not handle ones at all, now I think that best is adopt
proposition by Reinier Zwitserloot (which is the same as in proposal in
project koin [http://docs.google.com/View?docid=d36kv8n_32g9zj7pdd]
 by Jacek Furmankiewicz

>> COMPILATION:
>>  Multiline strings created and used in .class files exactly as ordinary
>> strings.
>>
>
> What is the desugaring?
>
Ok, detailed description is added.

Text withing """ brackets processed in next way:

1. splitted to sequence of lines by line termination symbols.
2. escape sequences in each line are processed exactly as in ordinary Java
strings.
3. elimination of leading whitespaces are processed in next way:
- at first determinated sequence of whitespace symbols (exclude
LineTermination, i.e. ST, HP, FF) at first nonempty line in sequence.
let's call it 'leading whitespace sequence'
- all next lines must start with same leading whitespace sequence,
otherwise compile-time error is thrown.
- whitespace processing erase such leading sequence from resulting lines
4. set of lines after erasing of leading whitespace sequence is
concatenated, with line-termination sequences between two neighbour lines.
Inserted linetermination sequence is depend from LineTerminationSuffix,
and is
- value of systen property 'line.separator' is LineTerminationSuffix is empty
- LF (i. e. '\n') when LineTerminationSuffix is 'U' or 'u'
- CR LF (i. e. '\r''\n') when LineTerminationSuffix is 'W' or 'w'




> Regards,
>
> -Joe
>
>> TESTING:
>>  Nothing special. add multiline strings to test-cases.
>>
>> LIBRARY SUPPORT:
>>  None.
>>  (May be exists sence add simple template processing to standard
>> library, but
>>   I think this is goal of next janguage iteration. Now exists many good
>> external
>>   frameworks, such as velocity: better wait and standartize support of
>> winner)
>>
>> REFLECTIVE APIS: None
>>
>> OTHER CHANGES: None
>>
>> MIGRATION: None
>>
>> COMPABILITY
>>  None
>>
>> REFERENCES
>>
>>  http://bugs.sun.com/view_bug.do?bug_id=4165111
>>
>>
>>
>>
>>
>>
>>
>>
>
>





More information about the coin-dev mailing list