Giter Club home page Giter Club logo

Comments (5)

superatomic avatar superatomic commented on August 21, 2024

It looks like we need to escape character's ourselves. Instead of worrying about "undoing" the escaping of characters written in a TOML string, we can just use raw TOML strings, which are strings with single quotes (') instead of double quotes (").

We can then write a program to recognize \) as escaping a closing bracket, because \ doesn't escape anything in the TOML representation.

This is a breaking change. We can't really do that much about this. We could try to detect the type of quotations that are used, but that would involve parsing the file and might trigger some false positives (this might be worth it though, if we state that these false positives can happen). Otherwise, the documentation should be changed to use single quotes, and it should be directly stated that using double quotes requires double escaping.

from xshe.

superatomic avatar superatomic commented on August 21, 2024

However, this finally allows us to implement this feature! When this is completed, we can also easily finish the rest of #38.

from xshe.

superatomic avatar superatomic commented on August 21, 2024

To be able to issue warnings, we can read through each line of the file and scan for any line that matches /^[A-Za-z0-9\._]+\s*=\s*\[?\s*"/m. If we find any, we will display a warning that recommends switching to single quotes.

from xshe.

superatomic avatar superatomic commented on August 21, 2024

Also note that the use of double quotes with never be removed, just discouraged for most use cases. This is because after this issue is implemented and merged the new behavior will normally result in having to double escape backslashes while using double quotes.

The warning will either be downgraded it severity or removed in a future version a significant amount of time after the changes in this issue are made. This will probably happen in v1.0.0.

from xshe.

superatomic avatar superatomic commented on August 21, 2024

Update: Warnings will not be issued as that could affect actual use cases.

from xshe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.