Giter VIP home page Giter VIP logo

Comments (6)

aholtzma avatar aholtzma commented on August 28, 2024

FWIW the size constaint makes it into the parse tree:

  ModuleDefinition:
    ModuleReference:
      Class-definitions
    DefinitiveIdentifier:
    AUTOMATIC TAGS
    None
    ModuleBody:
      Exports:
      Imports:
      AssignmentList:
        TypeAssignment:
          MultiplePLMN-List-r6
          ::=
          Type:
            SequenceType:
              SEQUENCE
               ComponentType:
                 NamedType:
                   Identifier:
                     mibPLMN-Identity
                   Type:
                     SimpleType:
                       BOOLEAN
               ComponentType:
                 NamedType:
                   Identifier:
                     multiplePLMNs
                   Type:
                     SequenceOfType:
                       SizeConstraint:
                         ValueRangeConstraint:
                           1
                           5
                       Type:
                         DefinedType:
                           None
                           PLMN-IdentityWithOptionalMCC-r6
                           None

However dumping the semantic tree seems be broken:

aaron:asn1ate aholtzma$ python asn1ate/test.py --sema ./missing_size.asn1
Traceback (most recent call last):
  File "asn1ate/test.py", line 73, in <module>
    sys.exit(main())
  File "asn1ate/test.py", line 61, in main
    print(module)
  File "build/bdist.macosx-10.11-intel/egg/asn1ate/sema.py", line 350, in __str__
    + 'END\n'
  File "build/bdist.macosx-10.11-intel/egg/asn1ate/sema.py", line 379, in __str__
    return '%s ::= %s' % (self.type_name, self.type_decl)
  File "build/bdist.macosx-10.11-intel/egg/asn1ate/sema.py", line 420, in __str__
    component_type_list = ', '.join(map(str, self.components))
  File "build/bdist.macosx-10.11-intel/egg/asn1ate/sema.py", line 669, in __str__
    result = '%s %s' % (self.identifier, self.type_decl)
  File "build/bdist.macosx-10.11-intel/egg/asn1ate/sema.py", line 505, in __str__
    result = '[%s] ' % ' '.join(class_spec)
TypeError: sequence item 0: expected string, int found

from asn1ate.

kimgr avatar kimgr commented on August 28, 2024

Thanks! I didn't know SIZE constraints were allowed on SEQUENCE OF, so this is probably just an oversight. I'll try to take a look, but my asn1ate bandwidth is limited these days, so if you feel comfortable with contributing a patch that might go faster.

from asn1ate.

aholtzma avatar aholtzma commented on August 28, 2024

Okay I'll take a look. First thing is to fix the sema dump. Any ideas what is up there? It also fails with non-problematic ASN input.

from asn1ate.

kimgr avatar kimgr commented on August 28, 2024

I took a quick look and it appears the class_number is an integer when using automatic tagging. This bug crept in here:
https://github.com/kimgr/asn1ate/pull/29/files#diff-6d613dac67af772711af50dfafa21774R396

I think the right thing to do is change sema.py, line 416 like so:

-                tagged_type = TaggedType((None, tag_number, None, element))
+                tagged_type = TaggedType((None, str(tag_number), None, element))

I'll try to make that change later today and push.

from asn1ate.

kimgr avatar kimgr commented on August 28, 2024

Done, please resync to master.

from asn1ate.

aholtzma avatar aholtzma commented on August 28, 2024

Great, thanks. Now we can see that the semantic tree is fine:

Class-definitions DEFINITIONS ::=
BEGIN
MultiplePLMN-List-r6 ::= SEQUENCE { mibPLMN-Identity [0] BOOLEAN, multiplePLMNs [1] SEQUENCE SIZE(1..5) OF PLMN-IdentityWithOptionalMCC-r6 }
END

Will poke around in the pyasn1 back end now to see where the constraints get spit out.

from asn1ate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.