synta 0.2.5

ASN.1 parser, decoder, and encoder library with DER/BER support and C FFI
Documentation
# Known Limitations

This page lists ASN.1 features that are parsed by synta-codegen but not fully
supported, and constructs that cause parse errors.

## Parser limitations (produce a parse error)

### Multiple modules per file

`synta-codegen`'s `parse()` function accepts exactly one module.  A file
containing two or more `MODULE DEFINITIONS ... END` blocks will fail to parse
after the first `END` is encountered.

**Workaround**: split multi-module files into one file per module before
passing them to the tool.

### Parameterized types

```asn1
Container { T } ::= SEQUENCE { item T }
```

Type parameters in braces are not parsed.

**Workaround**: instantiate the parameterized type manually for each concrete
type parameter.

### INSTANCE OF

```asn1
Value ::= INSTANCE OF CONTENT-TYPE
```

Not parsed; causes a parse error.

## Parsed but not code-generated

### Information object classes (CLASS)

```asn1
CONTENT-TYPE ::= CLASS {
    &id   OBJECT IDENTIFIER UNIQUE,
    &Type
} WITH SYNTAX { &Type IDENTIFIED BY &id }
```

CLASS bodies are parsed.  A documentation comment is emitted, but no
DER-encodable Rust type is generated.

### Object sets / IOC value assignments

```asn1
SupportedTypes CONTENT-TYPE ::= { ... }
```

Parsed and silently discarded.  No code is generated, no error.

### ABSTRACT-SYNTAX and TYPE-IDENTIFIER

Not recognized as keywords.  Treated as an unresolved TypeRef if the name is a
bare identifier, or causes a parse error if the surrounding syntax is invalid.

### Table constraints (ComponentRelation)

```asn1
ValueSet ::= SEQUENCE {
    id    OBJECT IDENTIFIER,
    value OPEN.&Value({ValueSet}{@id})
}
```

Parsed into `GeneralConstraint::ComponentRelation`.  Not emitted in generated
code.  The surrounding type structure is still generated.

### User-defined constraints

```asn1
Checked ::= INTEGER (CONSTRAINED BY { -- some comment -- })
```

Parsed into `GeneralConstraint::UserDefined`.  Not emitted in generated code.

### PermittedAlphabet (FROM) — code generation

Parsed and recorded.  The code generator does not emit alphabet validation
unless the `validate_containing` feature is enabled.

### Pattern constraint — code generation

Parsed and recorded.  Validation code requires the `regex` feature; without
it, a TODO comment is emitted.

### ContainedSubtype (CONTAINING) — code generation

Parsed and recorded.  Automatic nested decoding requires `validate_containing`
feature; without it, the outer type is treated as opaque bytes.

## C backend only: EXPLICIT tag on anonymous inline type

An anonymous SEQUENCE, SET, or CHOICE written inline inside an EXPLICIT tag,
without a preceding named type definition, is not supported by the **C** code
generator.  The **Rust** backend is unaffected.

```asn1
-- Not supported in C output:
Wrapper ::= SEQUENCE {
    item  [0] EXPLICIT SEQUENCE { a INTEGER, b INTEGER }
}

-- Workaround: define the inner type by name
Inner ::= SEQUENCE { a INTEGER, b INTEGER }
Wrapper ::= SEQUENCE {
    item  [0] EXPLICIT Inner
}
```

## Summary table

| Feature | Parsed | Rust code gen | C code gen |
|---|---|---|---|
| SEQUENCE, SET, CHOICE | yes | yes | yes |
| SEQUENCE OF, SET OF | yes | yes | yes |
| INTEGER, BOOLEAN, NULL, REAL | yes | yes | yes |
| OCTET STRING, BIT STRING | yes | yes | yes |
| OBJECT IDENTIFIER | yes | yes | yes |
| ENUMERATED | yes | yes | yes |
| Named bit list | yes | yes | yes |
| Named INTEGER values | yes | yes | yes |
| UTF8String, PrintableString, IA5String | yes | yes | yes |
| UTCTime, GeneralizedTime | yes | yes | yes |
| Other string types | yes | raw bytes | raw bytes |
| OPTIONAL fields | yes | yes | yes |
| DEFAULT values | yes | yes | yes |
| IMPLICIT tag on TypeRef field | yes | yes | yes |
| EXPLICIT tag on TypeRef field | yes | yes | yes |
| EXPLICIT tag on anonymous inline type | yes | yes | no |
| Module tagging mode | yes | yes | yes |
| IMPORTS / EXPORTS | yes | recorded | recorded |
| Module OID | yes | discarded | discarded |
| Value range constraint (INTEGER) | yes | yes | yes |
| SIZE constraint | yes | yes | yes |
| PermittedAlphabet (FROM) | yes | no | no |
| Pattern constraint | yes | no | no |
| ContainedSubtype (CONTAINING) | yes | no | no |
| UNION / INTERSECTION constraints | yes | partial | partial |
| ALL EXCEPT (complement) | yes | no | no |
| Table constraints (ComponentRelation) | yes | no | no |
| User-defined constraints | yes | no | no |
| ANY / ANY DEFINED BY | yes | Element or RawDer | partial |
| Parameterized types | no | no | no |
| Information object CLASS (body) | yes | doc only | doc only |
| Object sets / IOC value assignments | yes | no | no |
| INSTANCE OF | no | no | no |
| WITH SYNTAX | yes | discarded | discarded |
| Multiple modules per file | no | no | no |