mystor / rust-cpp

Embed C++ directly inside your rust code!
Apache License 2.0
807 stars 44 forks source link

LexError on vertical tab \v #74

Closed sthiele closed 4 years ago

sthiele commented 4 years ago

Parsing some C++ that uses '\v' I get the following error.

warning: -- rust-cpp parse error --
warning: There was an error parsing the crate for the rust-cpp build script:
warning: Parsing crate:``:
warning: Error("LexError")
warning: In order to provide a better error message, the build script will exit successfully, such that rustc can provide an error message.
error: unknown character escape: v
  --> src/lib.rs:60:27
   |
60 |     static const char = '\v';
   |                           ^ unknown character escape
ogoffart commented 4 years ago

Right, that's an expected limitation: The code within the macro still need to be valid rust tokens. I added a notice in the documentation about that in commit a9af87b0666d47846630dad262e87eb2fbdd3ba8

So you must change your code to use the ascii escape sequence (i believe that would be \x0b )

sthiele commented 4 years ago

Thanks