Comments (6)
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.
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.
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.
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.
Done, please resync to master.
from asn1ate.
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)
- Fail to parse Kerberos ASN.1 HOT 17
- multi-module asn files don't work HOT 8
- default vales for enums need to be strings HOT 4
- Support for CLASS ... WITH SYNTAX ... HOT 6
- to support Brace value notation assignment HOT 4
- Emits invalid python for `BOOLEAN true` HOT 1
- Failure parsing minimal example with VisibleString HOT 3
- restricted_integer_type range constraint HOT 2
- Parsing Error: pyparsing.ParseException: Expected "DEFINITIONS" HOT 5
- resolve imported type declarations HOT 1
- KeyError: if the type is in another module. HOT 2
- single value and range constraint with both '..' and '|' HOT 3
- KeyError EXTERNAL HOT 6
- asn1ate generates incorrect code for DefaultedNamedType
- Feauture Request for 0.6.1: Parsing DEFAULT with structure HOT 1
- interdependent asn1 files to py files HOT 2
- asn1ate needs wheels HOT 9
- PyParsing issue (and work-around) HOT 4
- ParseException: Expected Keyword 'DEFINITIONS', found 'AUTOMATIC' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asn1ate.