csharpfritz / TAML

Defining the coolest and simplest markup language delimited ONLY by tabs
MIT License
23 stars 11 forks source link

Discussion: Escape characters? #23

Open csharpfritz opened 4 years ago

csharpfritz commented 4 years ago

How do we escape special characters like \t \n?

heidarj commented 4 years ago

Could be done with backticks, like how powershell does escape characters: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_special_characters?view=powershell-7

Stelzi79 commented 4 years ago

The issue I have with the backtick is that on a non English keyboard layouts it is a bit cumbersome to type because for example French (Roman languages in general) and all Slavic languages use such characters like à á è and the backtick is typed with another character to form these type of characters.

To get a single backtick I have to type < Shift > + < Key with Backtick as a "capitalization" >, < spacebar > on my German QWERTZ Keyboard.

Stelzi79 commented 3 years ago

I had some thoughts about that.

I would argue to not allow any escape characters in a key.

How about if we allow only TamlValues to have escape character with a special notation of that value.

I would suggest that when a TamlValue includes special characters we start it with something like \t@ or \t" and everything till there is something like @\n or "\n.

This would look like that in a document:

something
    myCrazyThing    @   line1
        "line2"
        line3@
key2    value2

or

something
    myCrazyThing    "   line1
        line2
        line3"
key2    value2

With this syntax the only thing not allowed to be in such a value would be the end syntax like @\n or "\n. The "\n for ending that could be a possible thing that could be reasonable thing in such a value as in my first example.

If we adopt such an approach to escaping special things would be a very simple approach to that problem.