hadronized / glsl

GLSL parser for Rust
191 stars 27 forks source link

quasiquote doesn't agree on block definition #82

Closed swiftcoder closed 4 years ago

swiftcoder commented 5 years ago

quasiquote's tokenize_block produces a block containing a fields: glsl::syntax::NonEmpty(vec![fields]), where the base glsl crate expects just fields: vec![fields], resulting in an error:

    | |_________expected struct `std::vec::Vec`, found struct `glsl::syntax::NonEmpty`
    |           in this macro invocation
    |
    = note: expected type `std::vec::Vec<glsl::syntax::StructFieldSpecifier>`
               found type `glsl::syntax::NonEmpty<glsl::syntax::StructFieldSpecifier>`

Happy to send a patch to correct this, but I'm not clear which is the desired structure - should we be adding a NonEmpty node to quasiquote, or removing it from glsl?

hadronized commented 5 years ago

Nice catch. It should be glsl::syntax::NonEmpty(..). However, changing this will make a breaking change. I think we should make it NonEmpty but I’m also torn because NonEmpty is a pretty simple type that should live / be taken from another crate.