m-ou-se / inline-python

Inline Python code directly in your Rust code
https://docs.rs/inline-python
BSD 2-Clause "Simplified" License
1.16k stars 40 forks source link

Use a different token other than `'` for referencing rust values #4

Closed ColonelThirtyTwo closed 5 years ago

ColonelThirtyTwo commented 5 years ago

Currently the crate uses ' to denote rust variables, which conflicts with single quoted strings. To be more compatible, the crate should use a token that Python does not use to denote rust variables, such as !.

m-ou-se commented 5 years ago

Not supporting single quoted strings has nothing to do with using 'var as placeholders. The crate doesn't support single quoted strings of multiple characters, simply because the Rust tokenizer considers 'a' a character literal, and will therefore reject 'abc'. 'a' works fine, and is parsed very differently from 'a.