udoprog / genco

A whitespace-aware quasiquoter for beautiful code generation.
Apache License 2.0
181 stars 11 forks source link

Move parser to solely use $ for variables for 2021 edition support #27

Closed udoprog closed 2 years ago

udoprog commented 2 years ago

We have to stop using # as a delimiter, because the 2021 edition reserved any identifier-prefixed # tokens making expressions like these no longer be legal:

quote!(hello#world);

This would be seen as the hello#world token by Rust 2021, and since the hello prefix is not recognized by the Rust compiler and would not compile. See https://doc.rust-lang.org/edition-guide/rust-2021/reserving-syntax.html for more.

$ does not suffer from this (and is more in the spirit of macros) so we're now moving all syntax to use it even if that means it's a bit more verbose.

This implements the following parser changes:

The following control sequences are changed:

This change will be part of the genco 0.17 release.

udoprog commented 2 years ago

This is being tested in https://github.com/reproto/reproto/tree/genco-2021