Ignore:
Timestamp:
May 2, 2008, 1:47:51 AM (16 years ago)
Author:
Tatsukawa, Akimichi
Message:

fixed parser.y

File:
1 edited

Legend:

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

    r25 r26  
    3939    end
    4040   
    41     result = OpenEHR::AM::Archetype::ARCHETYPE.new(
    42                                                    :description => val[4],
    43                                                    :definition => val[5],
    44                                                    :ontology => val[7]
    45                                                    )
     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
    4657  }
    4758
     
    6273  | SYM_ARCHETYPE arch_meta_data
    6374  {
     75    result = val[1]
     76  }
     77
     78arch_meta_data: Left_parenthesis_code arch_meta_data_items Right_parenthesis_code
     79  {
    6480    result = {:arch_meta_data => val[1] }
    6581  }
    6682
    67 arch_meta_data: Left_parenthesis_code arch_meta_data_items Right_parenthesis_code
    68   {
    69     result = {:arch_meta_data_items => val[1] }
    70   }
    71 
    7283arch_meta_data_items: arch_meta_data_item
    7384  {
    74     result = Array[val[0]]
     85    result = val[0]
    7586  }
    7687  | arch_meta_data_items Semicolon_code arch_meta_data_item
    7788  {
    78     result = (val[0] << val[2])
     89    result = val[0].merge(val[2])
    7990  }
    8091
     
    8293arch_meta_data_item: SYM_ADL_VERSION SYM_EQ V_VERSION_STRING
    8394  {
    84     result = {:adl_version => val[2] }
     95    result = {:adl_version => val[2], :is_controlled => false }
    8596  }
    8697  | SYM_IS_CONTROLLED
    8798  {
    88     result = val[0]
     99    result = {:is_controlled => true }
    89100  }
    90101
     
    96107
    97108arch_concept: SYM_CONCEPT V_LOCAL_TERM_CODE_REF
     109  {
     110    result = {:arch_concept => val[1] }
     111  }
    98112  | SYM_CONCEPT error
    99113
     
    103117
    104118arch_language: #-- empty is ok for ADL 1.4 tools
     119  {
     120    result = {:arch_language => nil}
     121  }
    105122    | SYM_LANGUAGE dadl_section
    106123  {
    107     result = {:language => val[1]}
     124    result = {:arch_language => val[1]}
    108125  }
    109126  | SYM_LANGUAGE error
     
    389406arch_ontology: SYM_ONTOLOGY dadl_section
    390407  {
    391     dadl_sections = val[1]
     408    dadl_section = val[1]
    392409    result = OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY.new
    393410  }
     
    808825  {
    809826    @@log.info("#{__FILE__}:#{__LINE__}: V_QUALIFIED_TERM_CODE_REF = #{val[0]} at #{@filename}:#{@lineno}")
     827    result = val[0]
    810828  }
    811829
     
    817835  {
    818836    @@log.info("#{__FILE__}:#{__LINE__}: V_URI = #{val[0]} at #{@filename}:#{@lineno}")
     837    result = val[0]
    819838  }
    820839
     
    10871106
    10881107duration_pattern: V_ISO8601_DURATION_CONSTRAINT_PATTERN
     1108  {
     1109    result = val[0]
     1110  }
    10891111
    10901112
     
    10961118require 'lib/util.rb'
    10971119require 'lib/scanner.rb'
    1098 #require 'lib/model.rb'
    10991120require 'rubygems'
    11001121require 'am.rb'
Note: See TracChangeset for help on using the changeset viewer.