Changeset 321 for ruby/trunk/lib/adl_parser/lib/parser.y
- Timestamp:
- Oct 18, 2009, 12:06:41 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ruby/trunk/lib/adl_parser/lib/parser.y
r320 r321 164 164 # | error 165 165 166 #c_complex_object: c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body SYM_END_CBLOCK 167 #c_complex_object: c_complx_object_head SYM_MATCHES START_REGEXP_BLOCK REGEXP_BODY END_REGEXP_BLOCK # added by akimichi 168 c_complex_object: c_complx_object_head SYM_MATCHES Slash_code REGEXP_BODY Slash_code # added by akimichi 169 { 166 ### c_complex_object: c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body SYM_END_CBLOCK 167 # | c_complx_object_head SYM_MATCHES Slash_code REGEXP_BODY Slash_code # added by akimichi 168 c_complex_object: c_complx_object_head SYM_MATCHES REGEXP_HEAD REGEXP_BODY # added by akimichi 169 { 170 @@logger.debug("#{__FILE__}:#{__LINE__}:c_complx_object = \n c_complx_object_head = #{val[0].to_yaml}") 170 171 result = OpenEhr::AM::Archetype::ConstraintModel::C_COMPLEX_OBJECT.create(:attributes => val[3]) do |c_complex_object| 171 172 c_complex_object.node_id = val[0][:c_complex_object_id][:local_term_code_ref] … … 174 175 end 175 176 } 176 | c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body SYM_END_CBLOCK 177 #c_complex_object: c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body SYM_END_CBLOCK 178 | c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body SYM_END_CBLOCK 177 179 { 178 180 result = OpenEhr::AM::Archetype::ConstraintModel::C_COMPLEX_OBJECT.create(:attributes => val[3]) do |c_complex_object| … … 182 184 end 183 185 } 186 184 187 # | c_complex_object_head error SYM_END_CBLOCK 185 188 # | c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body c_invariants SYM_END_CBLOCK … … 187 190 c_complex_object_head: c_complex_object_id c_occurrences 188 191 { 192 @@logger.debug("#{__FILE__}:#{__LINE__}: c_complex_object_head: c_complex_object_id => #{val[0]}, c_occurrences => #{val[1]}") 189 193 result = {:c_complex_object_id => val[0], :c_occurrences => val[1]} 190 194 } … … 392 396 c_attribute: c_attr_head SYM_MATCHES SYM_START_CBLOCK c_attr_values SYM_END_CBLOCK 393 397 { 398 @@logger.debug("#{__FILE__}:#{__LINE__}:c_attribute: #{val[0]} matches #{val[3]}") 394 399 assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEhr::AM::Archetype::ConstraintModel::C_ATTRIBUTE)} 395 400 c_attribute = val[0] … … 397 402 result = c_attribute 398 403 } 399 # | c_attr_head SYM_MATCHES START_REGEXP_BLOCK REGEXP_BODY END_REGEXP_BLOCK # added by akimichi 400 | c_attr_head SYM_MATCHES Slash_code REGEXP_BODY Slash_code # added by akimichi 401 { 404 | c_attr_head SYM_MATCHES REGEXP_HEAD REGEXP_BODY SYM_END_CBLOCK # added by akimichi 405 { 406 @@logger.debug("c_attribute: #{val[0]} matches #{val[3]}}") 407 assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEhr::AM::Archetype::ConstraintModel::C_ATTRIBUTE)} 408 result = val[0] 409 } 410 | c_attr_head SYM_MATCHES REGEXP_HEAD REGEXP_BODY Semicolon_code string_value SYM_END_CBLOCK # added by akimichi 411 412 { 413 @@logger.debug("c_attribute: #{val[0]} matches #{val[5]}}") 402 414 assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEhr::AM::Archetype::ConstraintModel::C_ATTRIBUTE)} 403 415 result = val[0] … … 443 455 } 444 456 445 ### c_includes: #-- Empty446 ### | SYM_INCLUDE assertions447 457 c_includes: #-- Empty 448 | SYM_INCLUDE invariants458 | SYM_INCLUDE assertions 449 459 { 460 @@logger.debug("#{__FILE__}:#{__LINE__}: c_includes: assertions = #{val[1]}") 450 461 result = val[1] 451 462 } 452 463 ### c_includes: #-- Empty 464 ### | SYM_INCLUDE invariants 465 466 c_excludes: #-- Empty 467 | SYM_EXCLUDE assertions 468 { 469 @@logger.debug("#{__FILE__}:#{__LINE__}: c_excludes: assertions = #{val[1]}") 470 result = val[1] 471 } 453 472 ### c_excludes: #-- Empty 454 ### | SYM_EXCLUDE assertions 455 c_excludes: #-- Empty 456 | SYM_EXCLUDE invariants 457 { 458 result = val[1] 459 } 473 ### | SYM_EXCLUDE invariants 460 474 461 475 invariants: invariant 462 476 | invariants invariant 463 477 464 invariant: any_identifier ':'boolean_expression478 invariant: any_identifier Colon_code boolean_expression 465 479 | boolean_expression 466 | any_identifier ':'error480 | any_identifier Colon_code error 467 481 468 482 arch_invariant: #-- no invariant ok … … 964 978 | assertions assertion 965 979 966 assertion: any_identifier ':'boolean_expression980 assertion: any_identifier Colon_code boolean_expression 967 981 | boolean_expression 968 | any_identifier ':'error982 | any_identifier Colon_code error 969 983 970 984 #---------------------- expressions --------------------- … … 974 988 975 989 boolean_node: SYM_EXISTS absolute_path 976 # | absolute_path 977 | SYM_EXISTS error 990 # | SYM_EXISTS error 991 | relative_path SYM_MATCHES REGEXP_HEAD REGEXP_BODY SYM_END_CBLOCK# added by akimichi 992 { 993 @@logger.debug("#{__FILE__}:#{__LINE__}, boolean_node: relative_path = #{val[0]}, regexp_body => #{val[3]} at #{@filename}") 994 result = {:relative_path => val[0], :regexp_body => val[3]} 995 } 978 996 | relative_path SYM_MATCHES SYM_START_CBLOCK c_primitive SYM_END_CBLOCK 979 # | relative_path SYM_MATCHES START_REGEXP_BLOCK REGEXP_BODY END_REGEXP_BLOCK # added by akimichi 980 | relative_path SYM_MATCHES Slash_code REGEXP_BODY Slash_code # added by akimichi 997 # | relative_path SYM_MATCHES SYM_START_CBLOCK Slash_code REGEXP_BODY Slash_code SYM_END_CBLOCK# added by akimichi 981 998 | SYM_NOT boolean_leaf 982 | arithmetic_expression '='arithmetic_expression999 | arithmetic_expression Equal_code arithmetic_expression 983 1000 | arithmetic_expression SYM_NE arithmetic_expression 984 1001 | arithmetic_expression SYM_LT arithmetic_expression … … 995 1012 | SYM_FALSE 996 1013 997 arithmetic_expression: arithmetic_leaf998 | arithmetic_node999 1000 1014 arithmetic_node: arithmetic_expression '+' arithmetic_leaf 1001 | arithmetic_expression '-'arithmetic_leaf1015 | arithmetic_expression Minus_code arithmetic_leaf 1002 1016 | arithmetic_expression Star_code arithmetic_leaf 1003 1017 | arithmetic_expression Slash_code arithmetic_leaf 1004 | arithmetic_expression '^'arithmetic_leaf1018 | arithmetic_expression Caret_code arithmetic_leaf 1005 1019 1006 1020 arithmetic_leaf: Left_parenthesis_code arithmetic_expression Right_parenthesis_code … … 1009 1023 | absolute_path 1010 1024 1025 arithmetic_expression: arithmetic_leaf 1026 | arithmetic_node 1011 1027 1012 1028 #--------------- THE FOLLOWING SOURCE TAKEN FROM OG_PATH_VALIDATOR.Y ------------- … … 1021 1037 1022 1038 relative_path: path_segment 1039 { 1040 @@logger.debug("#{__FILE__}:#{__LINE__}, relative_path = #{val[0]}") 1041 result = val[0] 1042 } 1023 1043 | relative_path Slash_code path_segment 1044 { 1045 @@logger.debug("#{__FILE__}:#{__LINE__}, relative_path = #{val[0]}/#{val[2]}") 1046 result = [val[0],val[2]] 1047 } 1024 1048 1025 1049 path_segment: V_ATTRIBUTE_IDENTIFIER V_LOCAL_TERM_CODE_REF 1026 1050 { 1027 1051 @@logger.debug("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}") 1052 result = [val[0],val[1]] 1028 1053 } 1029 1054 | V_ATTRIBUTE_IDENTIFIER 1030 1055 { 1031 1056 @@logger.debug("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}") 1057 result = val[0] 1032 1058 } 1033 1059 … … 1196 1222 | c_boolean_spec Semicolon_code boolean_value 1197 1223 { 1198 raise 'Not implemented yet' 1224 result = val[0] 1225 #raise 'Not implemented yet' 1199 1226 } 1200 1227 | c_boolean_spec Semicolon_code error
Note:
See TracChangeset
for help on using the changeset viewer.