kimgr / asn1ate

A Python library for translating ASN.1 into other forms.
Other
69 stars 41 forks source link

Parsing issue in ASN file. #10

Closed sagarchalise closed 9 years ago

sagarchalise commented 9 years ago

Hello, I am quite new to ASN and parsing and this may be naive problem. I am trying to use your library to generate pyasn1 file from this ASN

http://jayu.googlecode.com/svn-history/r3/trunk/jayu/src/test/testdata/Huawie.txt

But I am getting exception.

pyparsing.ParseException: Expected "END" (at char 97715), (line:1110, col:32)

Could you help me with this issue ?

kimgr commented 9 years ago

Thanks for the report!

The problem is the constraint on:

AddressString ::= OCTET STRING (SIZE (1..maxAddressLength))

We don't yet handle that correctly.

I have a few local branches with constraint implementations, but none of them are really finished/working

I can see if I can come up with an intermediary solution that swallows your constrained OCTET STRING, but I can't promise when.

kimgr commented 9 years ago

Actually, which version are you running? When I run asn1ate from trunk, it instead fails on line 1850 in that file:

IMEI ::= TBCD-STRING (SIZE (8))

Are you running the latest released version?

kimgr commented 9 years ago

Try the latest master, I just pushed some fixes that at least allow me to parse Huawie.txt.

sagarchalise commented 9 years ago

Thanks. Actually I am just beginning this and have yet to understand everything. May be I can contribute as well once I understand some aspects. Also, I had an issue with proprietary data where I was getting the following traceback.

File "asn1ate/asn1ate/pyasn1gen.py", line 158, in generate_expr
    generator = self.inline_generators[type(t)]
KeyError: <class 'asn1ate.sema.BitStringType'>

I just appended

BitStringType: self.inline_simple_type,

on line 119 without any understanding.

Furthermore, It would be nice if you could document on how to use the generated file. I have a file that needs decoding, but I am not getting anywhere with generated file as there are no documentation on how to use it to decode.

kimgr commented 9 years ago

Duplicate of issue #15, fixed in 861f49d5b84470ba351c84d501e1a0fa3cd4d400