Changes in ruby/trunk/adl_parser/lib/parser.y [26:20]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ruby/trunk/adl_parser/lib/parser.y
r26 r20 28 28 29 29 input: archetype EOF 30 {31 result = val[0]32 }33 30 | error 34 31 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 } 32 archetype: arch_identification 33 arch_specialisation 34 arch_concept 35 arch_language 36 arch_description 37 arch_definition 38 arch_invariant 39 arch_ontology 58 40 59 41 60 42 arch_identification: arch_head V_ARCHETYPE_ID 61 {62 result = {:arch_head => val[0], :archetype_id => val[1] }63 }64 43 | SYM_ARCHETYPE error 65 {66 raise67 }68 44 69 45 arch_head: SYM_ARCHETYPE 70 {71 result = {:arch_meta_data => nil }72 }73 46 | SYM_ARCHETYPE arch_meta_data 74 {75 result = val[1]76 }77 47 78 48 arch_meta_data: Left_parenthesis_code arch_meta_data_items Right_parenthesis_code 79 {80 result = {:arch_meta_data => val[1] }81 }82 49 83 50 arch_meta_data_items: arch_meta_data_item 84 {85 result = val[0]86 }87 51 | 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 92 53 93 54 arch_meta_data_item: SYM_ADL_VERSION SYM_EQ V_VERSION_STRING 94 {95 result = {:adl_version => val[2], :is_controlled => false }96 }97 55 | SYM_IS_CONTROLLED 98 {99 result = {:is_controlled => true }100 }101 56 102 57 # Define specialization in which its constraints are narrower than those of the parent. … … 107 62 108 63 arch_concept: SYM_CONCEPT V_LOCAL_TERM_CODE_REF 109 {110 result = {:arch_concept => val[1] }111 }112 64 | SYM_CONCEPT error 113 65 … … 117 69 118 70 arch_language: #-- empty is ok for ADL 1.4 tools 119 {120 result = {:arch_language => nil}121 }122 71 | SYM_LANGUAGE dadl_section 123 72 { 124 result = {: arch_language => val[1]}73 result = {:language => val[1]} 125 74 } 126 75 | SYM_LANGUAGE error … … 132 81 arch_description: #-- no meta-data ok 133 82 | 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 139 85 #arch_definition: SYM_DEFINITION V_CADL_TEXT 140 86 # | SYM_DEFINITION error 141 87 arch_definition: SYM_DEFINITION cadl_section 142 {143 result = val[1]144 }145 88 | SYM_DEFINITION error 146 89 … … 148 91 ### cADL section 149 92 cadl_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 }155 93 | assertions 156 {157 result = val[0]158 }159 94 # | error 160 95 161 96 #c_complex_object: c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body SYM_END_CBLOCK 162 97 c_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 end169 }170 98 | 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 # } 179 104 # | c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body c_invariants SYM_END_CBLOCK 180 105 181 106 c_complex_object_head: c_complex_object_id c_occurrences 182 {183 result = {:c_complex_object_id => val[0], :c_occurrences => val[1]}184 }185 107 186 108 c_complex_object_id: type_identifier 187 109 { 188 result = {: type_identifier => val[0]}110 result = {:c_complex_object_id => {:type_identifier => val[0]}} 189 111 } 190 112 | type_identifier V_LOCAL_TERM_CODE_REF 191 113 { 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]}} 193 115 } 194 116 195 117 c_complex_object_body: c_any #-- used to indicate that any value of a type is ok 196 118 | c_attributes 197 {198 result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new(:attributes => val[0])199 }200 119 201 120 … … 203 122 204 123 c_object: v_c_domain_type 205 {206 result = val[0]207 }208 124 | c_complex_object 209 {210 result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new211 }212 125 | archetype_internal_ref 213 {214 result = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF.new215 }216 126 | archetype_slot 217 {218 result = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT.new219 }220 127 | constraint_ref 221 {222 result = OpenEHR::AM::Archetype::Constraint_Model::CONSTRAINT_REF.new223 }224 128 | c_code_phrase 225 {226 result = val[0]227 }228 129 | c_ordinal 229 {230 result = val[0]231 }232 130 | c_primitive_object 233 {234 result = val[0]235 }236 131 # | v_c_domain_type 237 132 # | V_C_DOMAIN_TYPE … … 246 141 247 142 v_c_domain_type: START_V_C_DOMAIN_TYPE_BLOCK dadl_section END_V_C_DOMAIN_TYPE_BLOCK 248 {249 result = val[1]250 }251 143 252 144 # 'archetype_internal_ref' is a node that refers to a previously defined object node in the same archetype. … … 265 157 # 'c_primitive_object' is an node representing a constraint on a primitive object type. 266 158 c_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 }271 159 272 160 c_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.new276 }277 161 | 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.new281 }282 162 | 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.new286 }287 163 | 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.new291 }292 164 | 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.new296 }297 165 | 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.new301 }302 166 | 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.new306 }307 167 | 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 }313 168 314 169 c_any: Star_code … … 318 173 319 174 c_attributes: c_attribute 320 {321 result = [val[0]]322 }323 175 | c_attributes c_attribute 324 {325 result = (val[0] << val[1])326 }327 176 328 177 # 'c_attribute' is a node representing a constraint on an attribute in an object model. 329 178 c_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_attribute335 }336 179 | 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 }341 180 | 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 }346 181 347 182 … … 349 184 { 350 185 @@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 356 186 } 357 187 | V_ATTRIBUTE_IDENTIFIER c_existence c_cardinality 358 188 { 359 assert_at(__FILE__,__LINE__){ val[2].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY) }360 189 @@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 )366 190 } 367 191 368 192 c_attr_values: c_object 369 {370 result = Array[val[0]]371 }372 193 | c_attr_values c_object 373 {374 result = (val[0] << val[1])375 }376 194 | c_any # -- to allow a property to have any value 377 {378 result = Array[val[0]]379 }380 195 381 196 ### c_includes: #-- Empty … … 405 220 406 221 arch_ontology: SYM_ONTOLOGY dadl_section 407 {408 dadl_section = val[1]409 result = OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY.new410 }411 222 | SYM_ONTOLOGY error 412 223 … … 420 231 421 232 attr_vals: attr_val 422 {423 result = Array[val[0]]424 }425 233 | attr_vals attr_val 426 {427 result = (val[0] << val[1])428 }429 234 | attr_vals Semicolon_code attr_val 430 { 431 result = (val[0] << val[2]) 432 } 235 # | attr_vals ';' attr_val 433 236 434 237 attr_val: attr_id SYM_EQ object_block 435 238 { 436 239 @@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]}438 240 } 439 241 … … 441 243 { 442 244 @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}:#{@lineno}") 443 result = val[0]444 245 } 445 246 | V_ATTRIBUTE_IDENTIFIER error 446 247 447 248 object_block: complex_object_block 448 {449 result = val[0]450 }451 249 | primitive_object_block 452 {453 result = val[0]454 }455 250 456 251 complex_object_block: single_attr_object_block 457 {458 result = val[0]459 }460 252 | multiple_attr_object_block 461 {462 result = val[0]463 }464 253 465 254 multiple_attr_object_block: untyped_multiple_attr_object_block 466 {467 result = {:untyped_multiple_attr_object_block => val[0]}468 }469 255 | type_identifier untyped_multiple_attr_object_block 470 {471 result = {:type_identifier => val[0], :untyped_multiple_attr_object_block => val[1]}472 }473 256 474 257 untyped_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 }478 258 479 259 multiple_attr_object_block_head: SYM_START_DBLOCK 480 { 260 { 481 261 @@log.info("SYM_START_DBLOCK: #{val[0]} at #{@filename}:#{@lineno}") 482 result = val[0]483 262 } 484 263 485 264 keyed_objects: keyed_object 486 {487 result = Array[val[0]]488 }489 265 | keyed_objects keyed_object 490 {491 result = (val[0] << val[1])492 }493 266 494 267 keyed_object: object_key SYM_EQ object_block 495 268 { 496 269 @@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]}498 270 } 499 271 … … 501 273 { 502 274 @@log.info("object_key: [#{val[1]}] at #{@filename}:#{@lineno}") 503 result = val[1]504 275 } 505 276 506 277 single_attr_object_block: untyped_single_attr_object_block 507 {508 result = {:untyped_single_attr_object_block => val[0]}509 }510 278 | type_identifier untyped_single_attr_object_block 511 {512 result = {:type_identifier => val[0], :untyped_single_attr_object_block => val[1]}513 }514 515 279 untyped_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 }520 280 | 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 }525 281 single_attr_object_complex_head: SYM_START_DBLOCK 526 282 primitive_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 }531 283 | 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 }536 284 untyped_primitive_object_block: SYM_START_DBLOCK primitive_object_value SYM_END_DBLOCK 537 285 { 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}") 540 287 } 541 288 primitive_object_value: simple_value 542 {543 result = val[0]544 }545 289 | simple_list_value 546 {547 result = val[0]548 }549 290 | simple_interval_value 550 {551 result = val[0]552 }553 291 | term_code 554 {555 result = val[0]556 }557 292 | term_code_list_value 558 {559 result = val[0]560 }561 293 simple_value: string_value 562 294 { 563 295 @@log.info("string_value: #{val[0]} at #{@filename}:#{@lineno}") 564 result = val[0]565 296 } 566 297 | integer_value 567 298 { 568 299 @@log.info("integer_value: #{val[0]} at #{@filename}:#{@lineno}") 569 result = val[0]570 300 } 571 301 | real_value 572 302 { 573 303 @@log.info("real_value: #{val[0]} at #{@filename}:#{@lineno}") 574 result = val[0]575 304 } 576 305 | boolean_value 577 306 { 578 307 @@log.info("boolean_value: #{val[0]} at #{@filename}:#{@lineno}") 579 result = val[0]580 308 } 581 309 | character_value 582 310 { 583 311 @@log.info("character_value: #{val[0]} at #{@filename}:#{@lineno}") 584 result = val[0]585 312 } 586 313 | date_value 587 314 { 588 315 @@log.info("date_value: #{val[0]} at #{@filename}:#{@lineno}") 589 result = val[0]590 316 } 591 317 | time_value 592 318 { 593 319 @@log.info("time_value: #{val[0]} at #{@filename}:#{@lineno}") 594 result = val[0]595 320 } 596 321 | date_time_value 597 322 { 598 323 @@log.info("date_time_value: #{val[0]} at #{@filename}:#{@lineno}") 599 result = val[0]600 324 } 601 325 | duration_value 602 326 { 603 327 @@log.info("duration_value: #{val[0]} at #{@filename}:#{@lineno}") 604 result = val[0]605 328 } 606 329 | uri_value 607 330 { 608 331 @@log.info("uri_value: #{val[0]} at #{@filename}:#{@lineno}") 609 result = val[0] 610 } 611 332 } 612 333 simple_list_value: string_list_value 613 334 | integer_list_value … … 630 351 { 631 352 @@log.info("V_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}") 632 result = val[0]633 353 } 634 354 | V_GENERIC_TYPE_IDENTIFIER 635 355 { 636 356 @@log.info("V_GENERIC_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}") 637 result = val[0]638 357 } 639 358 … … 641 360 { 642 361 @@log.info("V_STRING: #{val[0]} at #{@filename}:#{@lineno}") 643 result = val[0]644 362 } 645 363 … … 649 367 650 368 integer_value: V_INTEGER 651 {652 begin653 integer = Integer(val[0])654 rescue655 raise656 end657 result = integer658 }659 369 | Plus_code V_INTEGER 660 {661 begin662 integer = Integer(val[0])663 rescue664 raise665 end666 result = integer667 }668 370 | Minus_code V_INTEGER 669 {670 begin671 integer = Integer(val[0])672 rescue673 raise674 end675 result = - integer676 }677 371 ### | '+' V_INTEGER 678 372 ### | '-' V_INTEGER … … 693 387 694 388 real_value: V_REAL 695 {696 begin697 real = Float(val[0])698 rescue699 raise700 end701 result = real702 }703 389 | Plus_code V_REAL 704 {705 begin706 real = Float(val[1])707 rescue708 raise709 end710 result = real711 }712 390 | 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 721 393 722 394 real_list_value: real_value Comma_code real_value … … 736 408 737 409 boolean_value: SYM_TRUE 738 {739 result = true740 }741 410 | SYM_FALSE 742 {743 result = false744 }745 411 746 412 boolean_list_value: boolean_value Comma_code boolean_value … … 805 471 { 806 472 @@log.info("V_ISO8601_DURATION: #{val[0]} at #{@filename}:#{@lineno}") 807 result = val[0]808 473 } 809 474 … … 825 490 { 826 491 @@log.info("#{__FILE__}:#{__LINE__}: V_QUALIFIED_TERM_CODE_REF = #{val[0]} at #{@filename}:#{@lineno}") 827 result = val[0]828 492 } 829 493 … … 835 499 { 836 500 @@log.info("#{__FILE__}:#{__LINE__}: V_URI = #{val[0]} at #{@filename}:#{@lineno}") 837 result = val[0]838 501 } 839 502 … … 918 581 919 582 c_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 927 584 928 585 existence_spec: V_INTEGER #-- can only be 0 or 1 929 {930 begin931 integer = Integer(val[0])932 rescue933 raise934 end935 result = integer936 }937 586 | V_INTEGER SYM_ELLIPSIS V_INTEGER #-- can only be 0..0, 0..1, 1..1 938 {939 begin940 from_integer = Integer(val[0])941 to_integer = Integer(val[2])942 rescue943 raise944 end945 result = Range.new(from_integer,to_integer)946 }947 587 948 588 c_cardinality: SYM_CARDINALITY SYM_MATCHES SYM_START_CBLOCK cardinality_spec SYM_END_CBLOCK 949 {950 result = OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY.new951 }952 589 953 590 cardinality_spec: occurrence_spec … … 966 603 c_occurrences: #-- default to 1..1 967 604 | SYM_OCCURRENCES SYM_MATCHES SYM_START_CBLOCK occurrence_spec SYM_END_CBLOCK 968 {969 result = val[3]970 }971 605 | SYM_OCCURRENCES error 972 606 … … 1036 670 1037 671 c_boolean_spec: SYM_TRUE 1038 {1039 result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true)1040 }1041 672 | SYM_FALSE 1042 {1043 result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => false)1044 }1045 673 | 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 }1049 674 | 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 }1053 675 1054 676 c_boolean: c_boolean_spec 1055 {1056 result = val[0]1057 }1058 677 | c_boolean_spec Semicolon_code boolean_value 1059 {1060 raise 'Not implemented yet'1061 }1062 678 | c_boolean_spec Semicolon_code error 1063 { 1064 raise 'Not implemented yet' 1065 } 679 # | c_boolean_spec ';' error 1066 680 1067 681 c_ordinal: c_ordinal_spec 1068 682 | c_ordinal_spec Semicolon_code integer_value 1069 683 | c_ordinal_spec Semicolon_code error 684 # | c_ordinal_spec ';' error 1070 685 1071 686 c_ordinal_spec: ordinal 1072 687 | c_ordinal_spec Comma_code ordinal 688 # | c_ordinal_spec ',' ordinal 1073 689 1074 690 ordinal: integer_value SYM_INTERVAL_DELIM V_QUALIFIED_TERM_CODE_REF … … 1106 722 1107 723 duration_pattern: V_ISO8601_DURATION_CONSTRAINT_PATTERN 1108 {1109 result = val[0]1110 }1111 724 1112 725 … … 1118 731 require 'lib/util.rb' 1119 732 require 'lib/scanner.rb' 1120 require 'rubygems' 1121 require 'am.rb' 733 require 'lib/model.rb' 1122 734 $DEBUG = true 1123 735 … … 1125 737 1126 738 ---- inner 1127 1128 def assert_at(file,line, message = "")1129 unless yield1130 raise "Assertion failed !: #{file}, #{line}: #{message}"1131 end1132 end1133 739 1134 740 @@log = Logger.new('log/parser.log','daily')
Note:
See TracChangeset
for help on using the changeset viewer.