diff options
-rw-r--r-- | compiler/lexer.nim | 4 | ||||
-rw-r--r-- | doc/manual.txt | 13 |
2 files changed, 11 insertions, 6 deletions
diff --git a/compiler/lexer.nim b/compiler/lexer.nim index 2bfd8d1eb..0b4e4348d 100644 --- a/compiler/lexer.nim +++ b/compiler/lexer.nim @@ -537,6 +537,10 @@ proc getString(L: var TLexer, tok: var TToken, rawMode: bool) = tok.tokType = tkTripleStrLit # long string literal: inc(pos, 2) # skip "" # skip leading newline: + if buf[pos] in {' ', '\t'}: + var newpos = pos+1 + while buf[newpos] in {' ', '\t'}: inc newpos + if buf[newpos] in {CR, LF}: pos = newpos pos = handleCRLF(L, pos) buf = L.buf while true: diff --git a/doc/manual.txt b/doc/manual.txt index b39efb740..e34e1b164 100644 --- a/doc/manual.txt +++ b/doc/manual.txt @@ -263,15 +263,16 @@ String literals can also be delimited by three double quotes ``"""`` ... ``"""``. Literals in this form may run for several lines, may contain ``"`` and do not interpret any escape sequences. -For convenience, when the opening ``"""`` is immediately followed by a newline, -the newline is not included in the string. The ending of the string literal is -defined by the pattern ``"""[^"]``, so this: - +For convenience, when the opening ``"""`` is followed by a newline (there may +be whitespace between the opening ``"""`` and the newline), +the newline (and the preceding whitespace) is not included in the string. The +ending of the string literal is defined by the pattern ``"""[^"]``, so this: + .. code-block:: nimrod """"long string within quotes"""" - + Produces:: - + "long string within quotes" |