Fix restricted integer type. Now works all the way through codegen.
authorKim Grasman <kim.grasman@gmail.com>
Sun, 25 Aug 2013 19:21:46 +0000 (21:21 +0200)
committerKim Grasman <kim.grasman@gmail.com>
Sun, 25 Aug 2013 19:21:46 +0000 (21:21 +0200)
asn1ate/parser.py
testdata/builtin_types.asn

index 9c58c8c..f5db90f 100644 (file)
@@ -266,7 +266,7 @@ def _build_asn1_grammar():
     simple_type = (boolean_type | null_type | octetstring_type | characterstring_type | real_type | plain_integer_type | object_identifier_type)
     value_list_type = restricted_integer_type | enumerated_type
 
-    builtin_type = tagged_type | simple_type | choice_type | sequence_type | set_type | sequenceof_type | setof_type | value_list_type | bitstring_type
+    builtin_type = value_list_type | tagged_type | simple_type | choice_type | sequence_type | set_type | sequenceof_type | setof_type | bitstring_type
     referenced_type = Unique(defined_type)  # todo: consider other ref:d types from 16.3
 
     type_ << ((builtin_type | referenced_type) + Optional(constraint))
index 305cb3b..b5b5a51 100644 (file)
@@ -6,6 +6,11 @@ BEGIN
   Int ::= INTEGER
   Real ::= REAL
 
+  RestrictedInteger ::= INTEGER {
+    v1(1),
+    v2(2)
+  }
+
   -- Enumerated types
   BitString ::= BIT STRING {
     a(1),