from babregen.spec import skip_string
text = "a = ['x]', 1] # [b]"
end, backslashes = skip_string(text, 5)
print(repr(text[5:end]), backslashes)"'x]'" []
The end of the TOML string that opens at text[i], and its line-end backslashes.
A basic string (") honours escapes; a literal string (') does not. Either is multi-line when it opens with three quotes, and then up to two more quotes before the closing three belong to the value. A single-line string ends at its closing quote or before the line break.
| Name | Type | Description | Default |
|---|---|---|---|
| text | str | The TOML text. | required |
| i | int | The offset of the opening quote. | required |
| Name | Type | Description |
|---|---|---|
| tuple[int, list[int]] | tuple[int, list[int]]: The offset after the string, and the offsets of the backslashes that end a line inside a multi-line basic string. |