syntax: ignore first '\n' in triple-quoted strings
authorJean Privat <jean@pryen.org>
Fri, 7 Mar 2014 20:33:28 +0000 (15:33 -0500)
committerJean Privat <jean@pryen.org>
Sat, 8 Mar 2014 02:12:40 +0000 (21:12 -0500)
commit913a97e4162c3df213ed9c2ccded0bd45f2bca03
treea28893426a0bd20f28ffa8306f4926e53bd9cadd
parent29542ad0abefd3da2727bf5898a4e9ca66425891
syntax: ignore first '\n' in triple-quoted strings

This detail of the specification makes triple-quoted strings more
readable and usable in code.

Before, programmer was required to starts content just after the """
thus writing unaligned piece of text

~~~
var x = """Roses are red,
Violets are blue,
Triple-quoted strings,
Are easier to write.
"""
~~~

This patch ignore the end of line iff it just follows the """,
thus programmer can write

~~~
var x = """
Roses are red,
Violets are blue,
Triple-quoted strings,
Are easier to write.
"""
~~~

This commit will improve the usability of the new/future template library.

Signed-off-by: Jean Privat <jean@pryen.org>
src/literal.nit
tests/sav/test_string_triple.res
tests/sav/test_string_triple3.res [new file with mode: 0644]
tests/test_string_triple3.nit [new file with mode: 0644]