rhaiscript / rhai

Rhai - An embedded scripting language for Rust.
https://crates.io/crates/rhai
Apache License 2.0
3.77k stars 178 forks source link

Support single-quoted strings as alias for double-quoted strings in Rhai language parser #912

Open shah opened 3 weeks ago

shah commented 3 weeks ago

Per our discussion in #911 there is a desire to treat single-quotes like ' the same as double-quotes like " (the same way JavaScript handles strings flexibly). This feature would allow non-technical users of scripting language to have three quotation modes - non-interpolated via " and ' and interpolated via back-tick.

schungx commented 2 weeks ago

Yes, let me ponder whether this would be simple to add... probably so as the literal string parsing function is quite flexible.

schungx commented 1 week ago

There will still be differences regarding how SQL treat strings and how C-style languages treat strings, e.g. wrt escaping etc.

And one problem is the inability to differentiate a character from a string. All characters will be one-character strings like JavaScript.