Skip to content

Commit c87bd7d

Browse files
committed
Fix ASN.1 parser to handle module definitions properly
- Fix parsing error: 'Failed to parse type definition FixExtensions DEFINITIONS ::= BEGIN: Unsupported type: BEGIN' - Add logic to skip ASN.1 module definition lines (MODULE DEFINITIONS ::= BEGIN) - Prevent parser from trying to parse 'BEGIN' as a type definition - Module definitions are now properly recognized and skipped during parsing - Build now completes successfully without ASN.1 parsing errors The parser was incorrectly trying to parse module definition syntax as type definitions. Added a check to skip lines containing 'DEFINITIONS ::= BEGIN' before type parsing.
1 parent e84382b commit c87bd7d

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

crates/rustyasn/build.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ fn main() -> Result<()> {
101101

102102
// Check available features dynamically
103103
let enabled_features = get_enabled_fix_features();
104-
println!("cargo:warning=Detected FIX features: {enabled_features:?}");
104+
// println!("cargo:warning=Detected FIX features: {enabled_features:?}");
105105

106106
// Generate ASN.1 definitions from FIX dictionaries
107107
// This creates type-safe ASN.1 representations of FIX message structures
@@ -960,6 +960,12 @@ fn parse_asn1_schema(content: &str) -> Result<Asn1Schema> {
960960
continue;
961961
}
962962

963+
// Skip ASN.1 module definition lines (MODULE DEFINITIONS ::= BEGIN)
964+
if line.contains("DEFINITIONS ::= BEGIN") {
965+
i += 1;
966+
continue;
967+
}
968+
963969
// Parse type definitions
964970
if line.contains("::=") {
965971
match parse_type_definition(line, &lines, &mut i) {

0 commit comments

Comments
 (0)