Inline any_defined_by clause and trim whitespace in test data.
authorKim Grasman <kim.grasman@gmail.com>
Sat, 1 Nov 2014 14:46:23 +0000 (15:46 +0100)
committerKim Grasman <kim.grasman@gmail.com>
Sat, 1 Nov 2014 14:46:23 +0000 (15:46 +0100)
asn1ate/parser.py
testdata/builtin_types.asn

index 0171056..5a98552 100644 (file)
@@ -288,8 +288,7 @@ def _build_asn1_grammar():
     useful_type = GeneralizedTime | UTCTime | ObjectDescriptor
 
     # ANY type
-    any_defined_by = Suppress(DEFINED_BY) + Suppress(identifier)
-    any_type = ANY + Optional(any_defined_by)
+    any_type = ANY + Optional(Suppress(DEFINED_BY + identifier))
 
     # todo: consider other builtins from 16.2
     simple_type = (any_type | boolean_type | null_type | octetstring_type | characterstring_type | real_type | plain_integer_type | object_identifier_type | useful_type) + Optional(value_range_constraint | single_value_constraint)
index c5ea5d4..d601c2b 100644 (file)
@@ -50,12 +50,11 @@ BEGIN
     a a < Choice,
     b b < Choice
   }
-  
-  -- ANY type
 
+  -- ANY type
   AnyType ::= ANY
   AnySeq ::= SEQUENCE {
-     a  INTEGER,
+     a INTEGER,
      b ANY DEFINED BY a
   }
 END