Merge pull request #3635 from rtfeldman/joshuawarner32/multiline

Strip indents and the first/last newline from multiline strings
This commit is contained in:
Richard Feldman 2022-07-26 22:09:58 -04:00 committed by GitHub
commit fa5bd442f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 284 additions and 44 deletions

View file

@ -0,0 +1,114 @@
Defs(
Defs {
tags: [
Index(2147483648),
Index(2147483649),
Index(2147483650),
],
regions: [
@0-22,
@23-49,
@50-92,
],
space_before: [
Slice(start = 0, length = 0),
Slice(start = 0, length = 1),
Slice(start = 1, length = 1),
],
space_after: [
Slice(start = 0, length = 0),
Slice(start = 1, length = 0),
Slice(start = 2, length = 0),
],
spaces: [
Newline,
Newline,
],
type_defs: [],
value_defs: [
Body(
@0-1 Identifier(
"a",
),
@4-22 Str(
Line(
[
Plaintext(
"Hello,",
),
EscapedChar(
Newline,
),
EscapedChar(
Newline,
),
Plaintext(
"World!",
),
],
),
),
),
Body(
@23-24 Identifier(
"b",
),
@27-49 Str(
Block(
[
[
Plaintext(
"Hello,",
),
EscapedChar(
Newline,
),
EscapedChar(
Newline,
),
Plaintext(
"World!",
),
],
],
),
),
),
Body(
@50-51 Identifier(
"c",
),
@58-92 SpaceBefore(
Str(
Block(
[
[
Plaintext(
"Hello,\n",
),
Plaintext(
"\n",
),
Plaintext(
"World!",
),
],
],
),
),
[
Newline,
],
),
),
],
},
@93-95 SpaceBefore(
Num(
"42",
),
[
Newline,
],
),
)

View file

@ -0,0 +1,9 @@
a = "Hello,\n\nWorld!"
b = """Hello,\n\nWorld!"""
c =
"""
Hello,
World!
"""
42