3 ms·
Rust has a nice solution to this. r"foo" == "foo" // r" means the literal ends at " r#""foo""# == "\"foo\"" // r#" means the literal ends at "# r##
by Arnavion 9y ago
Rust has a nice solution to this.
r"foo" == "foo" // r" means the literal ends at "
r#""foo""# == "\"foo\"" // r#" means the literal ends at "#
r##"r#""foo""#"## == "r#\"\"foo\"\"#" // r##" means the literal ends at "##
and so on.
Basically you add as many # outside as necessary to distinguish the end of the literal (double-quote followed by some #) from any such sequence in the middle of the literal.
- analogic 9y agojust blue my mind. is there a babel plugin that will let me do this?