Index: ruby/trunk/lib/adl_parser/lib/parser.y
===================================================================
--- ruby/trunk/lib/adl_parser/lib/parser.y	(revision 323)
+++ ruby/trunk/lib/adl_parser/lib/parser.y	(revision 326)
@@ -123,9 +123,13 @@
 arch_language: #-- empty is ok for ADL 1.4 tools
   {
-    result = {:arch_language => nil}
+    result = {:arch_language => ""}
   }
     | SYM_LANGUAGE dadl_section
   {
-    result = {:arch_language => val[1]}
+    if val[1][0][:attr_id] == "original_language"
+      result = {:arch_language => val[1][0][:object_block][:untyped_primitive_object_block]}
+    else
+      raise OpenEhr::ADL::Exception::Parser::Error, "It should be 'original_language' at #{@filename}:#{@lineno} "
+    end
   }
   | SYM_LANGUAGE error
@@ -138,5 +142,44 @@
     | SYM_DESCRIPTION dadl_section
   { 
-    result = OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION.new(:details => val[1])
+    args = Hash.new
+    val[1].each do |item|
+      @@logger.debug("#{__FILE__}:#{__LINE__}: arch_description: item[:object_block] = #{item[:object_block].to_yaml} at #{@filename}:#{@lineno}")
+      case item[:attr_id]
+      when "original_author"
+        unless item[:object_block][:type_identifier]
+          args.merge!(Hash[:original_author => item[:object_block][:untyped_multiple_attr_object_block]])
+        else
+          raise OpenEhr::ADL::Exception::Parser::Error, "Needless type_identifier at #{@filename}:#{@lineno} "
+        end
+      when "details"
+        unless item[:object_block][:type_identifier]
+          args.merge!(Hash[:details => item[:object_block][:untyped_multiple_attr_object_block]])
+        else
+          raise OpenEhr::ADL::Exception::Parser::Error, "Needless type_identifier at #{@filename}:#{@lineno} "
+        end
+      when "lifecycle_state"
+        unless item[:object_block][:type_identifier]
+          args.merge!(Hash[:lifecycle_state => item[:object_block][:untyped_primitive_object_block]])
+        else
+          raise OpenEhr::ADL::Exception::Parser::Error, "Needless type_identifier at #{@filename}:#{@lineno} "
+        end
+      when "other_contributors"
+        unless item[:object_block][:type_identifier]
+          args.merge!(Hash[:other_contributors => item[:object_block][:untyped_multiple_attr_object_block]])
+        else
+          raise OpenEhr::ADL::Exception::Parser::Error, "Needless type_identifier at #{@filename}:#{@lineno} "
+        end
+      when "other_details"
+        unless item[:object_block][:type_identifier]
+          args.merge!(Hash[:other_contributors => item[:object_block][:untyped_multiple_attr_object_block]])
+        else
+          raise OpenEhr::ADL::Exception::Parser::Error, "Needless type_identifier at #{@filename}:#{@lineno} "
+        end
+      else
+        raise OpenEhr::ADL::Exception::Parser::Error, "Unknown case #{item[:attr_id]} at #{@filename}:#{@lineno} "
+      end
+    end
+    @@logger.debug("#{__FILE__}:#{__LINE__}: arch_description: args  = \n#{args.to_yaml} at #{@filename}:#{@lineno}")
+    result = OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION.new(args)
   }
   | SYM_DESCRIPTION error
@@ -500,10 +543,10 @@
     |  attr_vals
   {
-    @@logger.debug("#{__FILE__}:#{__LINE__}:dadl_section attr_vals = \n#{val[0].to_yaml}")
+    #@@logger.debug("#{__FILE__}:#{__LINE__}:dadl_section attr_vals = \n#{val[0].to_yaml}")
     result = val[0]
   }
   | complex_object_block
   {
-    @@logger.debug("#{__FILE__}:#{__LINE__}:dadl_section complex_object_block = \n#{val[0].to_yaml}")
+    #@@logger.debug("#{__FILE__}:#{__LINE__}:dadl_section complex_object_block = \n#{val[0].to_yaml}")
     result = val[0]
   }
@@ -565,5 +608,5 @@
 untyped_multiple_attr_object_block: multiple_attr_object_block_head keyed_objects SYM_END_DBLOCK
   { 
-    result = {:multiple_attr_object_block_head => val[0], :keyed_objects => val[1]}
+    result = val[1]
   }
 
@@ -584,6 +627,11 @@
 keyed_object: object_key SYM_EQ object_block
   {
-    @@logger.debug("#{__FILE__}:#{__LINE__}: keyed_object = #{val[0]} at #{@filename}:#{@lineno}")
-    result = {:object_key => val[0], :object_block => val[2]}
+    #@@logger.debug("#{__FILE__}:#{__LINE__}: keyed_object = #{val[0]} at #{@filename}:#{@lineno}")
+    #result = {:object_key => val[0], :object_block => val[2]}
+    unless val[2][:type_identifier]
+      result = Hash[val[0] => val[2][:untyped_primitive_object_block]]
+    else
+      raise OpenEhr::ADL::Exception::Parser::Error, "Missing type_identifier at #{@filename}:#{@lineno} "
+    end
   }
 
@@ -606,10 +654,12 @@
   {
     @@logger.debug("#{__FILE__}:#{__LINE__}: single_attr_object_complex_head = #{val[0]} at #{@filename}:#{@lineno}")
-    result = {:single_attr_object_complex_head => val[0]}
+    #result = {:single_attr_object_complex_head => val[0]}
+    result = []
   }
   | single_attr_object_complex_head attr_vals SYM_END_DBLOCK
   {
     @@logger.debug("#{__FILE__}:#{__LINE__}: attr_vals = #{val[1]} at #{@filename}:#{@lineno}")
-    result = {:single_attr_object_complex_head => val[0], :attr_vals => val[1]}
+    #result = {:single_attr_object_complex_head => val[0], :attr_vals => val[1]}
+    result = val[1]
   }
 single_attr_object_complex_head: SYM_START_DBLOCK
@@ -626,5 +676,5 @@
 untyped_primitive_object_block: SYM_START_DBLOCK primitive_object_value SYM_END_DBLOCK
   {
-    @@logger.debug("#{__FILE__}:#{__LINE__}: primitive_object_block = <#{val[1]}> at #{@filename}:#{@lineno}")
+    #@@logger.debug("#{__FILE__}:#{__LINE__}: primitive_object_block = <#{val[1]}> at #{@filename}:#{@lineno}")
     result = val[1]
   }
