trailofbits / pasta

Peter's Amazing Syntax Tree Analyzer
Apache License 2.0
123 stars 9 forks source link

Make Token optional in Python bindings #100

Open pgoodman opened 1 year ago

pgoodman commented 1 year ago

Some APIs return std::optional<Token> and others return Token knowing that they will be nullable-ish. In the Python bindings, we should specialize nanobind::type_caster<std::optional<::pasta::Token>> and nanobind::type_caster<::pasta::Token> to present both as Optional[Token].