Ignore:
Timestamp:
May 6, 2008, 12:18:06 AM (16 years ago)
Author:
Tatsukawa, Akimichi
Message:

fixed Archetype::Constraint_Model and Primitive classes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ruby/trunk/adl_parser/lib/parser.y

    r26 r32  
    160160
    161161#c_complex_object: c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body SYM_END_CBLOCK
    162 c_complex_object: c_complex_object_head SYM_MATCHES START_REGEXP_BLOCK REGEXP_BODY END_REGEXP_BLOCK # added by akimichi
     162c_complex_object: c_complx_object_head SYM_MATCHES START_REGEXP_BLOCK REGEXP_BODY END_REGEXP_BLOCK # added by akimichi
    163163  {
    164164    result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.create(:attributes => val[3]) do |c_complex_object|
     
    203203
    204204c_object: v_c_domain_type
    205   { 
     205  {
    206206    result = val[0]
    207207  }
    208208  | c_complex_object
    209   {
    210     result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new
     209  {
     210    @@log.info("#{__FILE__}:#{__LINE__}: c_complex_object = #{val[0].inspect} at #{@filename}:#{@lineno}")
     211    result = val[0]
    211212  }
    212213  | archetype_internal_ref
    213   {
    214     result = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF.new
     214  {
     215    result = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF.create do |archetype_internal_ref|
     216      archetype_internal_ref.target_path = val[0][:absolute_path]
     217      archetype_internal_ref.rm_type_name = val[0][:type_identifier]
     218      archetype_internal_ref.occurrences = val[0][:c_occurrences]
     219    end
    215220  }
    216221  | archetype_slot
    217   { 
    218     result = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT.new
     222  {
     223    result = val[0]
    219224  }
    220225  | constraint_ref
    221   {
    222     result = OpenEHR::AM::Archetype::Constraint_Model::CONSTRAINT_REF.new
     226  {
     227    result = OpenEHR::AM::Archetype::Constraint_Model::CONSTRAINT_REF.create do |constraint_ref|
     228      constraint_ref.reference = val[0]
     229    end
    223230  }
    224231  | c_code_phrase
    225   { 
     232  {
    226233    result = val[0]
    227234  }
    228235  | c_ordinal
    229   { 
     236  {
    230237    result = val[0]
    231238  }
    232239  | c_primitive_object
    233   { 
     240  {
    234241    result = val[0]
    235242  }
     
    252259# 'archetype_internal_ref' is a node that refers to a previously defined object node in the same archetype.
    253260archetype_internal_ref: SYM_USE_NODE type_identifier c_occurrences absolute_path
     261  {
     262    result = {:type_identifier => val[1], :c_occurrences => val[2], :absolute_path => val[3] }
     263  }
    254264  | SYM_USE_NODE type_identifier error
    255265
    256266# 'archetype_slot' is a node whose statements define a constraint that determines which other archetypes may appear at that point in the current archetype.
    257267archetype_slot: c_archetype_slot_head SYM_MATCHES SYM_START_CBLOCK c_includes c_excludes SYM_END_CBLOCK
    258 
     268  {
     269    result = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT.create do |archetype_slot|
     270      archetype_slot.includes = val[3]
     271      archetype_slot.excludes = val[4]
     272      archetype_slot.rm_type_name = val[0][:c_archetype_slot_id]
     273      archetype_slot.occurrences = val[0][:c_occurrences]
     274    end
     275  }
    259276c_archetype_slot_head: c_archetype_slot_id c_occurrences
     277  {
     278    result = {:c_archetype_slot_id => val[0],:c_occurrences => val[1]}
     279  }
    260280
    261281c_archetype_slot_id: SYM_ALLOW_ARCHETYPE type_identifier
     282  {
     283    result = val[1]
     284  }
    262285  | SYM_ALLOW_ARCHETYPE type_identifier V_LOCAL_TERM_CODE_REF
    263286  | SYM_ALLOW_ARCHETYPE error
     
    267290  {
    268291    assert_at(__FILE__,__LINE__){val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_PRIMITIVE)}
    269     result = OpenEHR::AM::Archetype::Constraint_Model::C_PRIMITIVE_OBJECT.new(:item => val[0])
     292    result = OpenEHR::AM::Archetype::Constraint_Model::C_PRIMITIVE_OBJECT.create do |c_primitive_object|
     293      c_primitive_object.item = val[0]
     294    end
    270295  }
    271296
     
    273298  {
    274299    @@log.info("#{__FILE__}:#{__LINE__}: c_integer = #{val[0]} at #{@filename}:#{@lineno}")
    275     result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_INTEGER.new
     300    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_INTEGER.create do |c_integer|
     301      c_integer.list
     302      c_integer.range
     303      c_integer.assumed_value
     304    end
    276305  }
    277306  | c_real
     
    383412c_includes: #-- Empty
    384413    | SYM_INCLUDE invariants
     414{
     415    result = val[1]
     416}
    385417
    386418### c_excludes: #-- Empty
     
    388420c_excludes: #-- Empty
    389421    | SYM_EXCLUDE invariants
     422{
     423    result = val[1]
     424}
    390425
    391426invariants: invariant
     
    10801115#c_code_phrase: V_TERM_CODE_CONSTRAINT #-- e.g. "[local::at0040, at0041; at0040]"
    10811116c_code_phrase: term_code_constraint_section #-- e.g. "[local::at0040, at0041; at0040]"
     1117  {
     1118      result = val[0]
     1119  }
    10821120  | V_QUALIFIED_TERM_CODE_REF
     1121  {
     1122      result = val[0]
     1123  }
    10831124
    10841125#term_code_constraint_section: START_TERM_CODE_CONSTRAINT term_code_body Right_bracket_code
     
    10931134# A Constraint_Ref is a proxy for a set of constraints on an object.
    10941135constraint_ref: V_LOCAL_TERM_CODE_REF #-- e.g. "ac0003"
     1136  {
     1137      result = val[0]
     1138  }
    10951139
    10961140any_identifier: type_identifier
     1141  {
     1142      result = val[0]
     1143  }
    10971144  | V_ATTRIBUTE_IDENTIFIER
    10981145  {
    10991146    @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{word} at #{@filename}")
     1147      result = val[0]
    11001148  }
    11011149
Note: See TracChangeset for help on using the changeset viewer.