Changeset 329 for ruby/trunk/lib/adl_parser/lib/parser.y
- Timestamp:
- Nov 1, 2009, 10:15:02 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ruby/trunk/lib/adl_parser/lib/parser.y
r328 r329 149 149 | SYM_DESCRIPTION dadl_section 150 150 { 151 dadl_section = val[1] 151 152 args = Hash.new 152 val[1].each do |item| 153 @@logger.debug("#{__FILE__}:#{__LINE__}: arch_description: item = #{item.to_yaml} at #{@filename}:#{@lineno}") 154 case item 153 @@logger.debug("#{__FILE__}:#{__LINE__}: arch_description: val[1].class = \n#{val[1].class} at #{@filename}:#{@lineno}") 154 # val[1].each do |item| 155 # @@logger.debug("#{__FILE__}:#{__LINE__}: arch_description: item = \n#{item.to_yaml} at #{@filename}:#{@lineno}") 156 # case item[:attr_id] 157 case dadl_section[:attr_id] 155 158 when "original_author" 156 unless item[:object_block][:type_identifier] 157 args.merge!(Hash[:original_author => item[:untyped_multiple_attr_object_block]]) 159 # unless item[:object_block][:type_identifier] 160 unless dadl_section[:object_block][:type_identifier] 161 # args.merge!(Hash[:original_author => item[:untyped_multiple_attr_object_block]]) 162 args.merge!(Hash[:original_author => dadl_section[:untyped_multiple_attr_object_block]]) 158 163 else 159 164 raise OpenEhr::ADL::Exception::Parser::Error, "Needless type_identifier at #{@filename}:#{@lineno} " 160 165 end 161 166 when "details" 162 unless item[:type_identifier] 163 args.merge!(Hash[:details => item[:untyped_multiple_attr_object_block]]) 167 # unless item[:type_identifier] 168 unless dadl_section[:type_identifier] 169 # args.merge!(Hash[:details => item[:untyped_multiple_attr_object_block]]) 164 170 #args.merge!(Hash[:details => item[:object_block]]) 171 args.merge!(Hash[:details => dadl_section[:untyped_multiple_attr_object_block]]) 165 172 else 166 173 raise OpenEhr::ADL::Exception::Parser::Error, "Needless type_identifier at #{@filename}:#{@lineno} " 167 174 end 168 175 when "lifecycle_state" 169 unless item[:type_identifier] 170 args.merge!(Hash[:lifecycle_state => item[:untyped_primitive_object_block]]) 176 # unless item[:type_identifier] 177 unless dadl_section[:type_identifier] 178 # args.merge!(Hash[:lifecycle_state => item[:untyped_primitive_object_block]]) 179 args.merge!(Hash[:lifecycle_state => dadl_section[:untyped_primitive_object_block]]) 171 180 else 172 181 raise OpenEhr::ADL::Exception::Parser::Error, "Needless type_identifier at #{@filename}:#{@lineno} " 173 182 end 174 183 when "other_contributors" 175 unless item[:type_identifier] 176 args.merge!(Hash[:other_contributors => item[:untyped_multiple_attr_object_block]]) 184 # unless item[:type_identifier] 185 unless dadl_section[:type_identifier] 186 # args.merge!(Hash[:other_contributors => item[:untyped_multiple_attr_object_block]]) 187 args.merge!(Hash[:other_contributors => dadl_section[:untyped_multiple_attr_object_block]]) 177 188 else 178 189 raise OpenEhr::ADL::Exception::Parser::Error, "Needless type_identifier at #{@filename}:#{@lineno} " 179 190 end 180 191 when "other_details" 181 unless item[:type_identifier] 182 args.merge!(Hash[:other_contributors => item[:untyped_multiple_attr_object_block]]) 192 # unless item[:type_identifier] 193 unless dadl_section[:type_identifier] 194 # args.merge!(Hash[:other_contributors => item[:untyped_multiple_attr_object_block]]) 195 args.merge!(Hash[:other_contributors => dadl_section[:untyped_multiple_attr_object_block]]) 183 196 else 184 197 raise OpenEhr::ADL::Exception::Parser::Error, "Needless type_identifier at #{@filename}:#{@lineno} " 185 198 end 186 199 else 187 raise OpenEhr::ADL::Exception::Parser::Error, "Unknown case #{item} at #{@filename}:#{@lineno} " 200 # raise OpenEhr::ADL::Exception::Parser::Error, "Unknown case #{item} at #{@filename}:#{@lineno} " 201 raise OpenEhr::ADL::Exception::Parser::Error, "Unknown case #{dadl_section} at #{@filename}:#{@lineno} " 188 202 end 189 end203 # end 190 204 @@logger.debug("#{__FILE__}:#{__LINE__}: arch_description: args = \n#{args.to_yaml} at #{@filename}:#{@lineno}") 191 205 result = OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION.new(args) … … 542 556 { 543 557 dadl_section = val[1] 544 @@logger.debug("#{__FILE__}:#{__LINE__}: arch_ontology: dadl_section = #{val[1].to_yaml}")558 @@logger.debug("#{__FILE__}:#{__LINE__}: arch_ontology: dadl_section = \n#{dadl_section.to_yaml}") 545 559 args = Hash.new 546 dadl_section.each do |item| 547 @@logger.debug("#{__FILE__}:#{__LINE__}: arch_description: item[:object_block] = #{item[:object_block].to_yaml} at #{@filename}:#{@lineno}") 548 case item[:attr_id] 549 when "terminologies_available" 550 unless item[:object_block][:type_identifier] 551 args.merge!(Hash[:terminologies_available => item[:object_block][:untyped_primitive_object_block]]) 552 #args.merge!(Hash[:terminologies_available => item[:object_block]]) 553 else 554 raise OpenEhr::ADL::Exception::Parser::Error, "Needless type_identifier at #{@filename}:#{@lineno} " 555 end 556 when "term_definitions" 557 unless item[:object_block][:type_identifier] 558 args.merge!(Hash[:term_definitions => item[:object_block][:untyped_multiple_attr_object_block]]) 559 #args.merge!(Hash[:term_definitions => item[:object_block]]) 560 else 561 raise OpenEhr::ADL::Exception::Parser::Error, "Needless type_identifier at #{@filename}:#{@lineno} " 562 end 563 when "term_binding" 564 unless item[:object_block][:type_identifier] 565 args.merge!(Hash[:term_binding => item[:object_block][:untyped_multiple_attr_object_block]]) 566 #args.merge!(Hash[:term_binding => item[:object_block]]) 567 else 568 raise OpenEhr::ADL::Exception::Parser::Error, "Needless type_identifier at #{@filename}:#{@lineno} " 569 end 560 case dadl_section[:attr_id] 561 when "terminologies_available" 562 unless dadl_section[:object_block][:type_identifier] 563 args.merge!(Hash[:terminologies_available => dadl_section[:object_block][:untyped_primitive_object_block]]) 570 564 else 571 raise OpenEhr::ADL::Exception::Parser::Error, " Unknown case #{item[:attr_id]}at #{@filename}:#{@lineno} "565 raise OpenEhr::ADL::Exception::Parser::Error, "Needless type_identifier at #{@filename}:#{@lineno} " 572 566 end 573 end 567 when "term_definitions" 568 unless dadl_section[:object_block][:type_identifier] 569 args.merge!(Hash[:term_definitions => dadl_section[:object_block][:untyped_multiple_attr_object_block]]) 570 else 571 raise OpenEhr::ADL::Exception::Parser::Error, "Needless type_identifier at #{@filename}:#{@lineno} " 572 end 573 when "term_binding" 574 unless dadl_section[:object_block][:type_identifier] 575 args.merge!(Hash[:term_binding => dadl_section[:object_block][:untyped_multiple_attr_object_block]]) 576 else 577 raise OpenEhr::ADL::Exception::Parser::Error, "Needless type_identifier at #{@filename}:#{@lineno} " 578 end 579 else 580 raise OpenEhr::ADL::Exception::Parser::Error, "Unknown case #{dadl_section[:attr_id]} at #{@filename}:#{@lineno} " 581 end 582 ### dadl_section.each do |item| 583 ### @@logger.debug("#{__FILE__}:#{__LINE__}: arch_description: item[:object_block] = #{item[:object_block].to_yaml} at #{@filename}:#{@lineno}") 584 ### case item[:attr_id] 585 ### when "terminologies_available" 586 ### unless item[:object_block][:type_identifier] 587 ### args.merge!(Hash[:terminologies_available => item[:object_block][:untyped_primitive_object_block]]) 588 ### else 589 ### raise OpenEhr::ADL::Exception::Parser::Error, "Needless type_identifier at #{@filename}:#{@lineno} " 590 ### end 591 ### when "term_definitions" 592 ### unless item[:object_block][:type_identifier] 593 ### args.merge!(Hash[:term_definitions => item[:object_block][:untyped_multiple_attr_object_block]]) 594 ### else 595 ### raise OpenEhr::ADL::Exception::Parser::Error, "Needless type_identifier at #{@filename}:#{@lineno} " 596 ### end 597 ### when "term_binding" 598 ### unless item[:object_block][:type_identifier] 599 ### args.merge!(Hash[:term_binding => item[:object_block][:untyped_multiple_attr_object_block]]) 600 ### else 601 ### raise OpenEhr::ADL::Exception::Parser::Error, "Needless type_identifier at #{@filename}:#{@lineno} " 602 ### end 603 ### else 604 ### raise OpenEhr::ADL::Exception::Parser::Error, "Unknown case #{item[:attr_id]} at #{@filename}:#{@lineno} " 605 ### end 606 ### end 574 607 575 608 result = OpenEhr::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY.new(args)
Note:
See TracChangeset
for help on using the changeset viewer.