librasn / compiler

An ASN1 compiler producing Rust bindings for the rasn framework
Other
13 stars 7 forks source link

fix: Parse value assignment with constraint #26

Closed v0-e closed 4 months ago

v0-e commented 4 months ago

Fixes the parsing of value assignments with a constraint, e.g.: test-int INTEGER(0..255) = 4. Constraints are ignored as I'm not sure if they are really required for anything.

Relevant standard/sections: X.680 2021 16, 17, 49 Example (at the ~end of file): https://standards.iso.org/iso/14816/ISO14816%20ASN.1%20repository/ISO14816_AVIAEINumberingAndDataStructures.asn

Probably the compiler/derive crate version should also be bumped.

v0-e commented 4 months ago

we should refactor, so that top_level_value_declaration parses an instance of ASN1Type instead of a mere string reference to a type

I can try to implement this.

v0-e commented 4 months ago

@6d7a ASN1Value's associated_type is now a ASN1Type instead of a string. I've also modified the Rust backend accordingly. I'm guessing there can also be enhancements to the validator/linker module, though I didn't got into the code there yet.