Skip to content

Conversation

@MaxGyver83
Copy link
Contributor

@MaxGyver83 MaxGyver83 commented Feb 25, 2024

Support Janet's backtick strings. This fixes #47 (together with #49).

I think the difficult part is that strings may be wrapped in any number of backticks:

For long-strings where you don't want to type a lot of escape characters,
you can use 1 or more backticks (`) to delimit a string.
To close this string, simply repeat the opening sequence of backticks.

Janet Documentation: Strings, Keywords, and Symbols

This pull request handles strings wrapped in up to three backticks (on each side). For testing, delete the second line in this example code with dd:

(print
  (string/replace-all ``"`` `\"` ```"1"```))

Out of scope

Multiline strings are not handled in this pull request.

Deleting the first or the last line with dd fails in both of these forms, no matter if double quote or backtick strings are used:

(print (string ```
               A ``test`` case
               ``` ``!``))

(print (string "hello
               world
               !"))

@MaxGyver83 MaxGyver83 changed the title [WIP] Support Janet's backtick strings Support Janet's backtick strings Feb 26, 2024
@MaxGyver83 MaxGyver83 marked this pull request as ready for review February 26, 2024 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Strange behavior in Janet files

1 participant