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

Compile errors #9

Closed de-vri-es closed 5 years ago

de-vri-es commented 5 years ago

This PR turns all compile-time panics into compilation errors. It also sets the span for python syntax errors to the matching tokens (currently the whole line causing the syntax error).

For example:

python! {
  def foo:
    return 5
}

Now generates this:

error: python: invalid syntax
 --> inline-python-example/src/main.rs:8:3
  |
8 |         def foo:
  |         ^^^^^^^^