Ignore:
Timestamp:
Oct 18, 2009, 12:06:41 AM (15 years ago)
Author:
Tatsukawa, Akimichi
Message:

commit from Pittsburgh

File:
1 edited

Legend:

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

    r320 r321  
    164164#  | error
    165165
    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
     168c_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}")
    170171    result = OpenEhr::AM::Archetype::ConstraintModel::C_COMPLEX_OBJECT.create(:attributes => val[3]) do |c_complex_object|
    171172      c_complex_object.node_id = val[0][:c_complex_object_id][:local_term_code_ref]
     
    174175    end
    175176  }
    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
    177179  {
    178180    result = OpenEhr::AM::Archetype::ConstraintModel::C_COMPLEX_OBJECT.create(:attributes => val[3]) do |c_complex_object|
     
    182184    end
    183185  }
     186
    184187#    | c_complex_object_head error SYM_END_CBLOCK
    185188#    | c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body c_invariants SYM_END_CBLOCK
     
    187190c_complex_object_head: c_complex_object_id c_occurrences
    188191  {
     192    @@logger.debug("#{__FILE__}:#{__LINE__}: c_complex_object_head: c_complex_object_id => #{val[0]}, c_occurrences => #{val[1]}")
    189193    result = {:c_complex_object_id => val[0], :c_occurrences => val[1]}
    190194  }
     
    392396c_attribute: c_attr_head SYM_MATCHES SYM_START_CBLOCK c_attr_values SYM_END_CBLOCK
    393397  {
     398    @@logger.debug("#{__FILE__}:#{__LINE__}:c_attribute: #{val[0]} matches #{val[3]}")
    394399    assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEhr::AM::Archetype::ConstraintModel::C_ATTRIBUTE)}
    395400    c_attribute = val[0]
     
    397402    result = c_attribute
    398403  }
    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]}}")
    402414    assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEhr::AM::Archetype::ConstraintModel::C_ATTRIBUTE)}
    403415    result = val[0]
     
    443455  }
    444456
    445 ### c_includes: #-- Empty
    446 ###     | SYM_INCLUDE assertions
    447457c_includes: #-- Empty
    448     | SYM_INCLUDE invariants
     458    | SYM_INCLUDE assertions
    449459{
     460    @@logger.debug("#{__FILE__}:#{__LINE__}: c_includes: assertions = #{val[1]}")
    450461    result = val[1]
    451462}
    452 
     463### c_includes: #-- Empty
     464###     | SYM_INCLUDE invariants
     465
     466c_excludes: #-- Empty
     467    | SYM_EXCLUDE assertions
     468  {
     469    @@logger.debug("#{__FILE__}:#{__LINE__}: c_excludes: assertions = #{val[1]}")
     470    result = val[1]
     471  }
    453472### 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
    460474
    461475invariants: invariant
    462476  | invariants invariant
    463477
    464 invariant: any_identifier ':' boolean_expression
     478invariant: any_identifier Colon_code boolean_expression
    465479  | boolean_expression
    466   | any_identifier ':' error
     480  | any_identifier Colon_code error
    467481
    468482arch_invariant: #-- no invariant ok
     
    964978  | assertions assertion
    965979
    966 assertion: any_identifier ':' boolean_expression
     980assertion: any_identifier Colon_code boolean_expression
    967981  | boolean_expression
    968   | any_identifier ':' error
     982  | any_identifier Colon_code error
    969983
    970984#---------------------- expressions ---------------------
     
    974988
    975989boolean_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  }
    978996  | 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
    981998  | SYM_NOT boolean_leaf
    982   | arithmetic_expression '=' arithmetic_expression
     999  | arithmetic_expression Equal_code arithmetic_expression
    9831000  | arithmetic_expression SYM_NE arithmetic_expression
    9841001  | arithmetic_expression SYM_LT arithmetic_expression
     
    9951012  | SYM_FALSE
    9961013
    997 arithmetic_expression: arithmetic_leaf
    998   | arithmetic_node
    999 
    10001014arithmetic_node: arithmetic_expression '+' arithmetic_leaf
    1001   | arithmetic_expression '-' arithmetic_leaf
     1015  | arithmetic_expression Minus_code arithmetic_leaf
    10021016  | arithmetic_expression Star_code arithmetic_leaf
    10031017  | arithmetic_expression Slash_code arithmetic_leaf
    1004   | arithmetic_expression '^' arithmetic_leaf
     1018  | arithmetic_expression Caret_code arithmetic_leaf
    10051019
    10061020arithmetic_leaf:  Left_parenthesis_code arithmetic_expression Right_parenthesis_code
     
    10091023  | absolute_path
    10101024
     1025arithmetic_expression: arithmetic_leaf
     1026  | arithmetic_node
    10111027
    10121028#--------------- THE FOLLOWING SOURCE TAKEN FROM OG_PATH_VALIDATOR.Y -------------
     
    10211037
    10221038relative_path: path_segment
     1039  {
     1040    @@logger.debug("#{__FILE__}:#{__LINE__}, relative_path = #{val[0]}")
     1041    result = val[0]
     1042  }
    10231043  | 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  }
    10241048
    10251049path_segment: V_ATTRIBUTE_IDENTIFIER V_LOCAL_TERM_CODE_REF
    10261050  {
    10271051    @@logger.debug("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}")
     1052    result = [val[0],val[1]]
    10281053  }
    10291054  | V_ATTRIBUTE_IDENTIFIER
    10301055  {
    10311056    @@logger.debug("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}")
     1057    result = val[0]
    10321058  }
    10331059
     
    11961222  | c_boolean_spec Semicolon_code boolean_value
    11971223  {
    1198     raise 'Not implemented yet'
     1224    result = val[0]
     1225    #raise 'Not implemented yet'
    11991226  }
    12001227  | c_boolean_spec Semicolon_code error
Note: See TracChangeset for help on using the changeset viewer.