Ignore:
File:
1 edited

Legend:

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

    r26 r20  
    2828
    2929input: archetype EOF
    30   {
    31     result = val[0]
    32   }
    3330  | error
    3431
    35 archetype: arch_identification arch_specialisation arch_concept arch_language arch_description arch_definition arch_invariant arch_ontology
    36   {
    37     assert_at(__FILE__,__LINE__) do
    38       val[4].instance_of?(OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION) and val[5].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT) and val[7].instance_of?(OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY)
    39     end
    40    
    41     archetype_id = val[0][:archetype_id]
    42     adl_version = val[0][:arch_head][:arch_meta_data][:adl_version]
    43     concept = val[2]
    44     language = val[3][:arch_language]
    45     archetype = OpenEHR::AM::Archetype::ARCHETYPE.create(
    46                                                          :archetype_id => archetype_id,
    47                                                          :adl_version => adl_version,
    48                                                          :concept => concept,
    49                                                          :description => val[4],
    50                                                          :definition => val[5],
    51                                                          :ontology => val[7]
    52                                                          ) do |archetype|
    53       archetype.original_language = language
    54     end
    55     @@log.info("#{__FILE__}:#{__LINE__}: archetype = #{archetype} at #{@filename}:#{@lineno}")
    56     result = archetype
    57   }
     32archetype: arch_identification
     33  arch_specialisation
     34  arch_concept
     35  arch_language
     36  arch_description
     37  arch_definition
     38  arch_invariant
     39  arch_ontology
    5840
    5941
    6042arch_identification: arch_head V_ARCHETYPE_ID
    61   {
    62     result = {:arch_head => val[0], :archetype_id => val[1] }
    63   }
    6443  | SYM_ARCHETYPE error
    65   {
    66     raise
    67   }
    6844
    6945arch_head: SYM_ARCHETYPE
    70   {
    71     result = {:arch_meta_data => nil }
    72   }
    7346  | SYM_ARCHETYPE arch_meta_data
    74   {
    75     result = val[1]
    76   }
    7747
    7848arch_meta_data: Left_parenthesis_code arch_meta_data_items Right_parenthesis_code
    79   {
    80     result = {:arch_meta_data => val[1] }
    81   }
    8249
    8350arch_meta_data_items: arch_meta_data_item
    84   {
    85     result = val[0]
    86   }
    8751  | arch_meta_data_items Semicolon_code arch_meta_data_item
    88   {
    89     result = val[0].merge(val[2])
    90   }
    91 
     52#  | arch_meta_data_items ';' arch_meta_data_item
    9253
    9354arch_meta_data_item: SYM_ADL_VERSION SYM_EQ V_VERSION_STRING
    94   {
    95     result = {:adl_version => val[2], :is_controlled => false }
    96   }
    9755  | SYM_IS_CONTROLLED
    98   {
    99     result = {:is_controlled => true }
    100   }
    10156
    10257# Define specialization in which its constraints are narrower than those of the parent.
     
    10762
    10863arch_concept: SYM_CONCEPT V_LOCAL_TERM_CODE_REF
    109   {
    110     result = {:arch_concept => val[1] }
    111   }
    11264  | SYM_CONCEPT error
    11365
     
    11769
    11870arch_language: #-- empty is ok for ADL 1.4 tools
    119   {
    120     result = {:arch_language => nil}
    121   }
    12271    | SYM_LANGUAGE dadl_section
    12372  {
    124     result = {:arch_language => val[1]}
     73    result = {:language => val[1]}
    12574  }
    12675  | SYM_LANGUAGE error
     
    13281arch_description: #-- no meta-data ok
    13382    | SYM_DESCRIPTION dadl_section
    134   {
    135     result = OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION.new(:details => val[1])
    136   }
    137   | SYM_DESCRIPTION error
    138  
     83    | SYM_DESCRIPTION error
     84
    13985#arch_definition: SYM_DEFINITION V_CADL_TEXT
    14086#  | SYM_DEFINITION error
    14187arch_definition: SYM_DEFINITION cadl_section
    142   {
    143     result = val[1]
    144   }
    14588  | SYM_DEFINITION error
    14689
     
    14891### cADL section
    14992cadl_section: c_complex_object
    150   {
    151     assert_at(__FILE__,__LINE__){val[0].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT)}
    152     @@log.info("#{__FILE__}:#{__LINE__}: c_complex_object = #{val[0]} at #{@filename}:#{@lineno}")
    153     result = val[0]
    154   }
    15593  | assertions
    156   {
    157     result = val[0]
    158   }
    15994#  | error
    16095
    16196#c_complex_object: c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body SYM_END_CBLOCK
    16297c_complex_object: c_complex_object_head SYM_MATCHES START_REGEXP_BLOCK REGEXP_BODY END_REGEXP_BLOCK # added by akimichi
    163   {
    164     result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.create(:attributes => val[3]) do |c_complex_object|
    165       c_complex_object.node_id = val[0][:c_complex_object_id][:local_term_code_ref]
    166       c_complex_object.rm_type_name = val[0][:c_complex_object_id][:type_identifier]
    167       c_complex_object.occurrences = val[0][:c_occurrences]
    168     end
    169   }
    17098    | c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body SYM_END_CBLOCK
    171   {
    172     result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.create(:attributes => val[3]) do |c_complex_object|
    173       c_complex_object.node_id = val[0][:c_complex_object_id][:local_term_code_ref]
    174       c_complex_object.rm_type_name = val[0][:c_complex_object_id][:type_identifier]
    175       c_complex_object.occurrences = val[0][:c_occurrences]
    176     end
    177   }
    178 #    | c_complex_object_head error SYM_END_CBLOCK
     99#     | c_complex_object_head error SYM_END_CBLOCK
     100#   {
     101#     @adl_type.push(:cadl)
     102#     yyerror
     103#   }
    179104#    | c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body c_invariants SYM_END_CBLOCK
    180105
    181106c_complex_object_head: c_complex_object_id c_occurrences
    182   {
    183     result = {:c_complex_object_id => val[0], :c_occurrences => val[1]}
    184   }
    185107
    186108c_complex_object_id: type_identifier
    187109  {
    188     result = {:type_identifier => val[0]}
     110    result = {:c_complex_object_id => {:type_identifier => val[0]}}
    189111  }
    190112  | type_identifier V_LOCAL_TERM_CODE_REF
    191113  {
    192     result = {:type_identifier => val[0], :local_term_code_ref => val[1]}
     114    result = {:c_complex_object_id => {:type_identifier => val[0], :V_LOCAL_TERM_CODE_REF => val[1]}}
    193115  }
    194116
    195117c_complex_object_body: c_any #-- used to indicate that any value of a type is ok
    196118  | c_attributes
    197   {
    198     result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new(:attributes => val[0])
    199   }
    200119
    201120
     
    203122
    204123c_object: v_c_domain_type
    205   {
    206     result = val[0]
    207   }
    208124  | c_complex_object
    209   {
    210     result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new
    211   }
    212125  | archetype_internal_ref
    213   {
    214     result = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF.new
    215   }
    216126  | archetype_slot
    217   {
    218     result = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT.new
    219   }
    220127  | constraint_ref
    221   {
    222     result = OpenEHR::AM::Archetype::Constraint_Model::CONSTRAINT_REF.new
    223   }
    224128  | c_code_phrase
    225   {
    226     result = val[0]
    227   }
    228129  | c_ordinal
    229   {
    230     result = val[0]
    231   }
    232130  | c_primitive_object
    233   {
    234     result = val[0]
    235   }
    236131#  | v_c_domain_type
    237132#  | V_C_DOMAIN_TYPE
     
    246141
    247142v_c_domain_type: START_V_C_DOMAIN_TYPE_BLOCK dadl_section END_V_C_DOMAIN_TYPE_BLOCK
    248   {
    249     result = val[1]
    250   }
    251143
    252144# 'archetype_internal_ref' is a node that refers to a previously defined object node in the same archetype.
     
    265157# 'c_primitive_object' is an node representing a constraint on a primitive object type.
    266158c_primitive_object: c_primitive
    267   {
    268     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])
    270   }
    271159
    272160c_primitive: c_integer
    273   {
    274     @@log.info("#{__FILE__}:#{__LINE__}: c_integer = #{val[0]} at #{@filename}:#{@lineno}")
    275     result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_INTEGER.new
    276   }
    277161  | c_real
    278   {
    279     @@log.info("#{__FILE__}:#{__LINE__}: c_real = #{val[0]} at #{@filename}:#{@lineno}")
    280     result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_REAL.new
    281   }
    282162  | c_date
    283   {
    284     @@log.info("#{__FILE__}:#{__LINE__}: c_date = #{val[0]} at #{@filename}:#{@lineno}")
    285     result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE.new
    286   }
    287163  | c_time
    288   {
    289     @@log.info("#{__FILE__}:#{__LINE__}: c_time = #{val[0]} at #{@filename}:#{@lineno}")
    290     result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_TIME.new
    291   }
    292164  | c_date_time
    293   {
    294     @@log.info("#{__FILE__}:#{__LINE__}: c_date_time = #{val[0]} at #{@filename}:#{@lineno}")
    295     result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME.new
    296   }
    297165  | c_duration
    298   {
    299     @@log.info("#{__FILE__}:#{__LINE__}: c_duration = #{val[0]} at #{@filename}:#{@lineno}")
    300     result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DURATION.new
    301   }
    302166  | c_string
    303   {
    304     @@log.info("#{__FILE__}:#{__LINE__}: c_string = #{val[0]} at #{@filename}:#{@lineno}")
    305     result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_STRING.new
    306   }
    307167  | c_boolean
    308   {
    309     assert_at(__FILE__,__LINE__){val[0].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN)}
    310     @@log.info("#{__FILE__}:#{__LINE__}: c_boolean = #{val[0]} at #{@filename}:#{@lineno}")
    311     result = val[0]
    312   }
    313168
    314169c_any: Star_code
     
    318173
    319174c_attributes: c_attribute
    320   {
    321     result = [val[0]]
    322   }
    323175  | c_attributes c_attribute
    324   {
    325     result = (val[0] << val[1])
    326   }
    327176
    328177# 'c_attribute' is a node representing a constraint on an attribute in an object model.
    329178c_attribute: c_attr_head SYM_MATCHES SYM_START_CBLOCK c_attr_values SYM_END_CBLOCK
    330   {
    331     assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
    332     c_attribute = val[0]
    333     c_attribute.children = val[3]
    334     result = c_attribute
    335   }
    336179  | c_attr_head SYM_MATCHES START_REGEXP_BLOCK REGEXP_BODY END_REGEXP_BLOCK # added by akimichi
    337   {
    338     assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
    339     result = val[0]
    340   }
    341180  | c_attr_head SYM_MATCHES SYM_START_CBLOCK error SYM_END_CBLOCK
    342   {
    343     assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
    344     result = val[0]
    345   }
    346181
    347182
     
    349184  {
    350185    @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]}, c_existence = #{val[1]} at #{@filename}")
    351     result = OpenEHR::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE.new(
    352                                                                               :rm_attribute_name => val[0],
    353                                                                               :existence => val[1]
    354                                                                               )
    355 
    356186  }
    357187  | V_ATTRIBUTE_IDENTIFIER c_existence c_cardinality
    358188  {
    359     assert_at(__FILE__,__LINE__){ val[2].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY) }
    360189    @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER: #{val[0]}, c_existence = #{val[1]}, c_cardinality = #{val[2]} at #{@filename}")
    361     result = OpenEHR::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE.new(
    362                                                                                 :rm_attribute_name => val[0],
    363                                                                                 :existence => val[1],
    364                                                                                 :cardinality => val[2]
    365                                                                                 )
    366190  }
    367191
    368192c_attr_values: c_object
    369   {
    370     result = Array[val[0]]
    371   }
    372193  | c_attr_values c_object
    373   {
    374     result = (val[0] << val[1])
    375   }
    376194  | c_any # -- to allow a property to have any value
    377   {
    378     result = Array[val[0]]
    379   }
    380195
    381196### c_includes: #-- Empty
     
    405220
    406221arch_ontology: SYM_ONTOLOGY dadl_section
    407   {
    408     dadl_section = val[1]
    409     result = OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY.new
    410   }
    411222  | SYM_ONTOLOGY error
    412223
     
    420231
    421232attr_vals: attr_val
    422   {
    423     result = Array[val[0]]
    424   }
    425233  | attr_vals attr_val
    426   {
    427     result = (val[0] << val[1])
    428   }
    429234  | attr_vals Semicolon_code attr_val
    430   {
    431     result = (val[0] << val[2])
    432   }
     235#  | attr_vals ';' attr_val
    433236
    434237attr_val: attr_id SYM_EQ object_block
    435238  {
    436239    @@log.info("#{__FILE__}:#{__LINE__}: attr_id = #{val[0]}, object_block = #{val[2]} at #{@filename}:#{@lineno}")
    437     result = {:attr_id => val[0], :object_block => val[2]}
    438240  }
    439241
     
    441243  {
    442244    @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}:#{@lineno}")
    443     result = val[0]
    444245  }
    445246  | V_ATTRIBUTE_IDENTIFIER error
    446247
    447248object_block: complex_object_block
    448   {
    449     result = val[0]
    450   }
    451249  | primitive_object_block
    452   {
    453     result = val[0]
    454   }
    455250
    456251complex_object_block: single_attr_object_block
    457   {
    458     result = val[0]
    459   }
    460252  | multiple_attr_object_block
    461   {
    462     result = val[0]
    463   }
    464253
    465254multiple_attr_object_block: untyped_multiple_attr_object_block
    466   {
    467     result = {:untyped_multiple_attr_object_block => val[0]}
    468   }
    469255  | type_identifier untyped_multiple_attr_object_block
    470   {
    471     result = {:type_identifier => val[0], :untyped_multiple_attr_object_block => val[1]}
    472   }
    473256
    474257untyped_multiple_attr_object_block: multiple_attr_object_block_head keyed_objects SYM_END_DBLOCK
    475   {
    476     result = {:multiple_attr_object_block_head => val[0], :keyed_objects => val[1]}
    477   }
    478258
    479259multiple_attr_object_block_head: SYM_START_DBLOCK
    480   { 
     260  {
    481261    @@log.info("SYM_START_DBLOCK: #{val[0]} at #{@filename}:#{@lineno}")
    482     result = val[0]
    483262  }
    484263
    485264keyed_objects: keyed_object
    486   {
    487     result = Array[val[0]]
    488   }
    489265  | keyed_objects keyed_object
    490   {
    491     result = (val[0] << val[1])
    492   }
    493266
    494267keyed_object: object_key SYM_EQ object_block
    495268  {
    496269    @@log.info("#{__FILE__}:#{__LINE__}: keyed_object = #{val[0]}, object_block = #{val[2]} at #{@filename}:#{@lineno}")
    497     result = {:object_key => val[0], :object_block => val[1]}
    498270  }
    499271
     
    501273  {
    502274    @@log.info("object_key: [#{val[1]}] at #{@filename}:#{@lineno}")
    503     result = val[1]
    504275  }
    505276
    506277single_attr_object_block: untyped_single_attr_object_block
    507   {
    508     result = {:untyped_single_attr_object_block => val[0]}
    509   }
    510278  | type_identifier untyped_single_attr_object_block
    511   {
    512     result = {:type_identifier => val[0], :untyped_single_attr_object_block => val[1]}
    513   }
    514 
    515279untyped_single_attr_object_block: single_attr_object_complex_head SYM_END_DBLOCK # <>
    516   {
    517     @@log.info("#{__FILE__}:#{__LINE__}: single_attr_object_complex_head = #{val[0]} at #{@filename}:#{@lineno}")
    518     result = {:single_attr_object_complex_head => val[0]}
    519   }
    520280  | single_attr_object_complex_head attr_vals SYM_END_DBLOCK
    521   {
    522     @@log.info("#{__FILE__}:#{__LINE__}: single_attr_object_complex_head = #{val[0]}, attr_vals = #{val[1]} at #{@filename}:#{@lineno}")
    523     result = {:single_attr_object_complex_head => val[0], :attr_vals => val[1]}
    524   }
    525281single_attr_object_complex_head: SYM_START_DBLOCK
    526282primitive_object_block: untyped_primitive_object_block
    527   {
    528     @@log.info("#{__FILE__}:#{__LINE__}: untyped_primitive_object_block = #{val[0]} at #{@filename}:#{@lineno}")
    529     result = {:untyped_primitive_object_block => val[0]}
    530   }
    531283  | type_identifier untyped_primitive_object_block
    532   {
    533     @@log.info("#{__FILE__}:#{__LINE__}: type_identifier = #{val[0]}, untyped_primitive_object_block = #{val[1]} at #{@filename}:#{@lineno}")
    534     result = {:type_identifier => val[0], :untyped_primitive_object_block => val[1]}
    535   }
    536284untyped_primitive_object_block: SYM_START_DBLOCK primitive_object_value SYM_END_DBLOCK
    537285  {
    538     @@log.info("#{__FILE__}:#{__LINE__}: primitive_object_block = <#{val[1]}> at #{@filename}:#{@lineno}")
    539     result = val[1]
     286    @@log.info("#{__FILE__}:#{__LINE__}: primitive_object_block = <#{val[2]}> at #{@filename}:#{@lineno}")
    540287  }
    541288primitive_object_value: simple_value
    542   {
    543     result = val[0]
    544   }
    545289  | simple_list_value
    546   {
    547     result = val[0]
    548   }
    549290  | simple_interval_value
    550   {
    551     result = val[0]
    552   }
    553291  | term_code
    554   {
    555     result = val[0]
    556   }
    557292  | term_code_list_value
    558   {
    559     result = val[0]
    560   }
    561293simple_value: string_value
    562294  {
    563295    @@log.info("string_value: #{val[0]} at #{@filename}:#{@lineno}")
    564     result = val[0]
    565296  }
    566297  | integer_value
    567298  {
    568299    @@log.info("integer_value: #{val[0]} at #{@filename}:#{@lineno}")
    569     result = val[0]
    570300  }
    571301  | real_value
    572302  {
    573303    @@log.info("real_value: #{val[0]} at #{@filename}:#{@lineno}")
    574     result = val[0]
    575304  }
    576305  | boolean_value
    577306  {
    578307    @@log.info("boolean_value: #{val[0]} at #{@filename}:#{@lineno}")
    579     result = val[0]
    580308  }
    581309  | character_value
    582310  {
    583311    @@log.info("character_value: #{val[0]} at #{@filename}:#{@lineno}")
    584     result = val[0]
    585312  }
    586313  | date_value
    587314  {
    588315    @@log.info("date_value: #{val[0]} at #{@filename}:#{@lineno}")
    589     result = val[0]
    590316  }
    591317  | time_value
    592318  {
    593319    @@log.info("time_value: #{val[0]} at #{@filename}:#{@lineno}")
    594     result = val[0]
    595320  }
    596321  | date_time_value
    597322  {
    598323    @@log.info("date_time_value: #{val[0]} at #{@filename}:#{@lineno}")
    599     result = val[0]
    600324  }
    601325  | duration_value
    602326  {
    603327    @@log.info("duration_value: #{val[0]} at #{@filename}:#{@lineno}")
    604     result = val[0]
    605328  }
    606329  | uri_value
    607330  {
    608331    @@log.info("uri_value: #{val[0]} at #{@filename}:#{@lineno}")
    609     result = val[0]
    610   }
    611 
     332  }
    612333simple_list_value: string_list_value
    613334  | integer_list_value
     
    630351  {
    631352    @@log.info("V_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
    632     result = val[0]
    633353  }
    634354  | V_GENERIC_TYPE_IDENTIFIER
    635355  {
    636356    @@log.info("V_GENERIC_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
    637     result = val[0]
    638357  }
    639358
     
    641360  {
    642361    @@log.info("V_STRING: #{val[0]} at #{@filename}:#{@lineno}")
    643     result = val[0]
    644362  }
    645363
     
    649367
    650368integer_value: V_INTEGER
    651   {
    652     begin
    653       integer = Integer(val[0])
    654     rescue
    655       raise
    656     end
    657     result = integer
    658   }
    659369  | Plus_code V_INTEGER
    660   {
    661     begin
    662       integer = Integer(val[0])
    663     rescue
    664       raise
    665     end
    666     result = integer
    667   }
    668370  | Minus_code V_INTEGER
    669   {
    670     begin
    671       integer = Integer(val[0])
    672     rescue
    673       raise
    674     end
    675     result = - integer
    676   }
    677371###   | '+' V_INTEGER
    678372###   | '-' V_INTEGER
     
    693387
    694388real_value: V_REAL
    695   {
    696     begin
    697       real = Float(val[0])
    698     rescue
    699       raise
    700     end
    701     result = real
    702   }
    703389  | Plus_code V_REAL
    704   {
    705     begin
    706       real = Float(val[1])
    707     rescue
    708       raise
    709     end
    710     result = real
    711   }
    712390  | Minus_code V_REAL
    713   {
    714     begin
    715       real = Float(val[1])
    716     rescue
    717       raise
    718     end
    719     result = - real
    720   }
     391#  | '+' V_REAL
     392#  | '-' V_REAL
    721393
    722394real_list_value: real_value Comma_code real_value
     
    736408
    737409boolean_value: SYM_TRUE
    738   {
    739     result = true
    740   }
    741410  | SYM_FALSE
    742   {
    743     result = false
    744   }
    745411
    746412boolean_list_value: boolean_value Comma_code boolean_value
     
    805471  {
    806472    @@log.info("V_ISO8601_DURATION: #{val[0]} at #{@filename}:#{@lineno}")
    807     result = val[0]
    808473  }
    809474
     
    825490  {
    826491    @@log.info("#{__FILE__}:#{__LINE__}: V_QUALIFIED_TERM_CODE_REF = #{val[0]} at #{@filename}:#{@lineno}")
    827     result = val[0]
    828492  }
    829493
     
    835499  {
    836500    @@log.info("#{__FILE__}:#{__LINE__}: V_URI = #{val[0]} at #{@filename}:#{@lineno}")
    837     result = val[0]
    838501  }
    839502
     
    918581
    919582c_existence: #-- default to 1..1
    920     {
    921     result = Range.new(1,1)
    922   }
    923   | SYM_EXISTENCE SYM_MATCHES SYM_START_CBLOCK existence_spec SYM_END_CBLOCK
    924   {
    925     result = val[3]
    926   }
     583    | SYM_EXISTENCE SYM_MATCHES SYM_START_CBLOCK existence_spec SYM_END_CBLOCK
    927584
    928585existence_spec:  V_INTEGER #-- can only be 0 or 1
    929   {
    930     begin
    931       integer = Integer(val[0])
    932     rescue
    933       raise
    934     end
    935     result = integer
    936   }
    937586  | V_INTEGER SYM_ELLIPSIS V_INTEGER #-- can only be 0..0, 0..1, 1..1
    938   {
    939     begin
    940       from_integer = Integer(val[0])
    941       to_integer = Integer(val[2])
    942     rescue
    943       raise
    944     end
    945     result = Range.new(from_integer,to_integer)
    946   }
    947587
    948588c_cardinality: SYM_CARDINALITY SYM_MATCHES SYM_START_CBLOCK cardinality_spec SYM_END_CBLOCK
    949   {
    950     result = OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY.new
    951   }
    952589
    953590cardinality_spec: occurrence_spec
     
    966603c_occurrences:  #-- default to 1..1
    967604  | SYM_OCCURRENCES SYM_MATCHES SYM_START_CBLOCK occurrence_spec SYM_END_CBLOCK
    968   {
    969     result = val[3]
    970   }
    971605  | SYM_OCCURRENCES error
    972606
     
    1036670
    1037671c_boolean_spec: SYM_TRUE
    1038   {
    1039     result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true)
    1040   }
    1041672  | SYM_FALSE
    1042   {
    1043     result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => false)
    1044   }
    1045673  | SYM_TRUE Comma_code SYM_FALSE
    1046   {
    1047     result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true,:false_valid => false)
    1048   }
    1049674  | SYM_FALSE Comma_code SYM_TRUE
    1050   {
    1051     result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => false,:false_valid => true)
    1052   }
    1053675
    1054676c_boolean: c_boolean_spec
    1055   {
    1056     result = val[0]
    1057   }
    1058677  | c_boolean_spec Semicolon_code boolean_value
    1059   {
    1060     raise 'Not implemented yet'
    1061   }
    1062678  | c_boolean_spec Semicolon_code error
    1063   {
    1064     raise 'Not implemented yet'
    1065   }
     679#  | c_boolean_spec ';' error
    1066680
    1067681c_ordinal: c_ordinal_spec
    1068682  | c_ordinal_spec Semicolon_code integer_value
    1069683  | c_ordinal_spec Semicolon_code error
     684#  | c_ordinal_spec ';' error
    1070685
    1071686c_ordinal_spec: ordinal
    1072687  | c_ordinal_spec Comma_code ordinal
     688#  | c_ordinal_spec ',' ordinal
    1073689
    1074690ordinal: integer_value SYM_INTERVAL_DELIM V_QUALIFIED_TERM_CODE_REF
     
    1106722
    1107723duration_pattern: V_ISO8601_DURATION_CONSTRAINT_PATTERN
    1108   {
    1109     result = val[0]
    1110   }
    1111724
    1112725
     
    1118731require 'lib/util.rb'
    1119732require 'lib/scanner.rb'
    1120 require 'rubygems'
    1121 require 'am.rb'
     733require 'lib/model.rb'
    1122734$DEBUG = true
    1123735
     
    1125737
    1126738---- inner
    1127 
    1128 def assert_at(file,line, message = "")
    1129   unless yield
    1130     raise "Assertion failed !: #{file}, #{line}: #{message}"
    1131   end
    1132 end
    1133739
    1134740@@log = Logger.new('log/parser.log','daily')
Note: See TracChangeset for help on using the changeset viewer.