fixes #1264
This commit is contained in:
parent
e5f2a8ade4
commit
4860b46c7f
2 changed files with 11 additions and 6 deletions
|
|
@ -537,6 +537,10 @@ proc getString(L: var TLexer, tok: var TToken, rawMode: bool) =
|
||||||
tok.tokType = tkTripleStrLit # long string literal:
|
tok.tokType = tkTripleStrLit # long string literal:
|
||||||
inc(pos, 2) # skip ""
|
inc(pos, 2) # skip ""
|
||||||
# skip leading newline:
|
# 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)
|
pos = handleCRLF(L, pos)
|
||||||
buf = L.buf
|
buf = L.buf
|
||||||
while true:
|
while true:
|
||||||
|
|
|
||||||
|
|
@ -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
|
Literals in this form may run for several lines, may contain ``"`` and do not
|
||||||
interpret any escape sequences.
|
interpret any escape sequences.
|
||||||
For convenience, when the opening ``"""`` is immediately followed by a newline,
|
For convenience, when the opening ``"""`` is followed by a newline (there may
|
||||||
the newline is not included in the string. The ending of the string literal is
|
be whitespace between the opening ``"""`` and the newline),
|
||||||
defined by the pattern ``"""[^"]``, so this:
|
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
|
.. code-block:: nimrod
|
||||||
""""long string within quotes""""
|
""""long string within quotes""""
|
||||||
|
|
||||||
Produces::
|
Produces::
|
||||||
|
|
||||||
"long string within quotes"
|
"long string within quotes"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue