Changeset 290


Ignore:
Timestamp:
Sep 24, 2009, 9:51:27 AM (10 years ago)
Author:
KOBAYASHI, Shinji
Message:

merged latest trunc change to branches/0.5

Location:
ruby/branches/0.5
Files:
1 deleted
13 edited
5 copied

Legend:

Unmodified
Added
Removed
  • ruby/branches/0.5

  • ruby/branches/0.5/lib/adl_parser/Rakefile

    r164 r290  
    11require 'rubygems'
    2 #Gem::manage_gems
    32require 'rake'
    43require 'rake/testtask'
     
    2625  end
    2726end
    28 
    29 
    3027
    3128desc "Generate TAGS by rtags."
     
    7976  s.name = 'adl_parser'
    8077  s.author = 'Akimichi Tatsukawa'
    81   s.version = '0.0.3'
     78  s.version = '0.0.4'
    8279  s.summary = 'ADL parser'
    8380  s.email = 'akimichi.tatsukawa@gmail.com'
     
    8582  candidates = Dir.glob("{bin,docs,lib,test,ext}/**/*")
    8683  s.files = candidates.delete_if do |item|
    87     item.include?(".svn") || item.include?("rdoc")
     84    item.include?(".svn") || item.include?("rdoc") || item.include?("log")
    8885  end
    8986  s.files = FileList['README', 'COPYING', 'Rakefile']
     
    9188  s.has_rdoc = true
    9289  s.extra_rdoc_files = ["README"]
    93   s.add_dependency("yaparc", ">= 0.2.3")
    94   s.add_dependency("openehr_models", ">= 0.0.1")
     90#  s.add_dependency("yaparc", ">= 0.2.3")
     91  s.add_dependency("openehr_models", ">= 0.0.3")
    9592end
    9693
     
    105102
    106103
    107 
    108 
    109104### Local Variables:
    110105### mode:ruby
  • ruby/branches/0.5/lib/adl_parser/lib/adl_parser.rb

    r167 r290  
    88$:.unshift File.join(File.dirname(__FILE__))
    99require 'logger'
     10require 'adl_scanner.rb'
     11require 'adl_exception.rb'
    1012
    1113module OpenEhr
     
    1820    LOG.level = Logger::WARN
    1921  end
    20  
    21  
    2222
    2323
     
    2525    autoload :Parser, "parser.rb"
    2626    autoload :Validator, "validator.rb"
    27    
     27
    2828    module Scanner
    2929      module DADL
    30         autoload :RootScanner, "scanner.rb"
     30        autoload :RootScanner, "adl_scanner.rb"
     31      end
     32      module CADL
     33        autoload :RootScanner, "adl_scanner.rb"
    3134      end
    3235    end
  • ruby/branches/0.5/lib/adl_parser/lib/adl_scanner.rb

  • ruby/branches/0.5/lib/adl_parser/lib/parser.rb

    r167 r290  
    1111$:.unshift File.join(File.dirname(__FILE__))
    1212require 'logger'
    13 #require 'lib/util.rb'
    14 #require 'lib/scanner.rb'
    15 require 'lib/adl_parser.rb'
     13require 'yaml'
    1614require 'rubygems'
     15require 'adl_parser.rb'
    1716require 'am.rb'
     17require 'rm.rb'
    1818$DEBUG = false
    1919
     
    2424    class Parser < Racc::Parser
    2525
    26 module_eval(<<'...end parser.y/module_eval...', 'parser.y', 1183)
     26module_eval(<<'...end parser.y/module_eval...', 'parser.y', 1208)
    2727
    2828def assert_at(file,line, message = "")
     
    3333
    3434if $DEBUG
    35   @@log = Logger.new('log/parser.log','daily')
    36   @@log.level = Logger::INFO
     35  @@logger = Logger.new('log/parser.log','daily')
     36  @@logger.level = Logger::DEBUG
    3737else
    38   @@log = Logger.new(STDOUT)
    39   @@log.level = Logger::WARN
     38  @@logger = Logger.new(STDOUT)
     39  @@logger.level = Logger::WARN
    4040end
    4141
    42 @@dadl_scanner = OpenEHR::ADL::Scanner::DADL::RootScanner.new
    43 @@cadl_scanner = OpenEHR::ADL::Scanner::CADL::RootScanner.new
    4442
    4543###----------/* keywords */ ---------------------------------------------
     
    10199###----------/* Scanner */ -----------------------------------------------
    102100
     101
    103102def scan
     103  @@logger.debug("#{__FILE__}:#{__LINE__}: Entering scan at #{@filename}:#{@lineno}:")
     104  scanner = OpenEHR::ADL::Scanner::ADLScanner.new(@adl_type, @filename)
     105
    104106  until @data.nil?  do
    105     case @adl_type.last
    106     when :adl
    107       @data = scan_adl(@data) do |sym, val|
     107    @data = scanner.scan(@data) do |sym, val|
    108108        yield sym, val
    109       end
    110     when :dadl
    111       @data = scan_dadl(@data) do |sym, val|
    112         yield sym, val
    113       end
    114     when :cadl
    115       @data = scan_cadl(@data) do |sym, val|
    116         yield sym, val
    117       end
    118     when :regexp
    119       @data = scan_regexp(@data) do |sym, val|
    120         yield sym, val
    121       end
    122     else
    123       raise
    124109    end
    125110    @data = $' # variable $' receives the string after the match
     
    128113  yield false, '$'
    129114end # of scan
    130 
    131 def scan_adl(data)
    132   until data.nil?  do
    133     case @adl_type.last
    134     when :adl
    135 #      puts "Entering scan_adl"
    136       case data
    137       when /\A\n/ # carriage return
    138         @lineno += 1
    139         ;
    140       when /\A[ \t\r\f]+/ #just drop it
    141         ;
    142       when /\A--.*\n/ # single line comment
    143         @lineno += 1
    144         @@log.info("#{__FILE__}:#{__LINE__}: scan_adl: COMMENT = #{$&} at #{@filename}:#{@lineno}")
    145         ;
    146       when /\Adescription/   # description
    147         yield :SYM_DESCRIPTION, :SYM_DESCRIPTION
    148       when /\Adefinition/   # definition
    149         yield :SYM_DEFINITION, :SYM_DEFINITION
    150 #        @adl_type.push(:cadl)
    151         ###----------/* symbols */ -------------------------------------------------
    152       when /\A[A-Z][a-zA-Z0-9_]*/
    153         yield :V_TYPE_IDENTIFIER, $&
    154       when /\A[a-zA-Z][a-zA-Z0-9_-]+\.[a-zA-Z][a-zA-Z0-9_-]+\.[a-zA-Z0-9]+/   #V_ARCHETYPE_ID
    155         yield :V_ARCHETYPE_ID, $&
    156       when /\A[a-z][a-zA-Z0-9_]*/
    157 #        word = $&.downcase
    158         word = $&
    159         if @@adl_reserved[word]
    160           @@log.info("#{__FILE__}:#{__LINE__}: scan_adl: @@adl_reserved = #{@@adl_reserved[word]} at #{@filename}:#{@lineno}")
    161           yield @@adl_reserved[word], @@adl_reserved[word]
    162         elsif #/\A[A-Z][a-zA-Z0-9_]*/
    163           @@log.info("#{__FILE__}:#{__LINE__}: scan_adl: V_ATTRIBUTE_IDENTIFIER = #{$&} at #{@filename}:#{@lineno}")
    164           yield :V_ATTRIBUTE_IDENTIFIER, $&
    165         end
    166       when /\A\=/   # =
    167         yield :SYM_EQ, :SYM_EQ
    168       when /\A\>=/   # >=
    169         yield :SYM_GE, :SYM_GE
    170       when /\A\<=/   # <=
    171         yield :SYM_LE, :SYM_LE
    172       when /\A\</   # <
    173         if @in_interval
    174 #          @start_block_received = false
    175           yield :SYM_LT, :SYM_LT
    176         else
    177 #          @start_block_received = true
    178           @adl_type.push(:dadl)
    179           yield :SYM_START_DBLOCK,  $&
    180         end
    181       when /\A\>/   # >
    182         if @in_interval
    183           yield :SYM_GT, :SYM_GT
    184         else
    185           adl_type = @adl_type.pop
    186 #          puts "Escaping #{adl_type}"
    187           assert_at(__FILE__,__LINE__){adl_type == :dadl}
    188           yield :SYM_END_DBLOCK, :SYM_END_DBLOCK
    189         end
    190       when /\A\{/   # {
    191         @adl_type.push(:cadl)
    192         @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: entering cADL at #{@filename}:#{@lineno}")
    193         yield :SYM_START_CBLOCK, :SYM_START_CBLOCK
    194       when /\A\}/   # }
    195         adl_type = @adl_type.pop
    196 #        puts "Escaping #{adl_type}"
    197         assert_at(__FILE__,__LINE__){adl_type == :cadl}
    198         @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: exiting cADL at #{@filename}:#{@lineno}")
    199         yield :SYM_END_CBLOCK, $&
    200       when /\A\-/   # -
    201         yield :Minus_code, :Minus_code
    202       when /\A\+/   # +
    203         yield :Plus_code, :Plus_code
    204       when /\A\*/   # *
    205         yield :Star_code, :Star_code
    206       when /\A\//   # /
    207         yield :Slash_code, :Slash_code
    208       when /\A\^/   # ^
    209         yield :Caret_code, :Caret_code
    210       when /\A\=/   # =
    211         yield :Equal_code, :Equal_code
    212       when /\A\.\.\./   # ...
    213         yield :SYM_LIST_CONTINUE, :SYM_LIST_CONTINUE
    214       when /\A\.\./   # ..
    215         yield :SYM_ELLIPSIS, :SYM_ELLIPSIS
    216       when /\A\./   # .
    217         yield :Dot_code, :Dot_code
    218       when /\A\;/   # ;
    219         yield :Semicolon_code, :Semicolon_code
    220       when /\A\,/   # ,
    221         yield :Comma_code, :Comma_code
    222       when /\A\:/   # :
    223         yield :Colon_code, :Colon_code
    224       when /\A\!/   # !
    225         yield :Exclamation_code, :Exclamation_code
    226       when /\A\(/   # (
    227         yield :Left_parenthesis_code, :Left_parenthesis_code
    228       when /\A\)/   # )
    229         yield :Right_parenthesis_code, :Right_parenthesis_code
    230       when /\A\$/   # $
    231         yield :Dollar_code, :Dollar_code
    232       when /\A\?\?/   # ??
    233         yield :SYM_DT_UNKNOWN, :SYM_DT_UNKNOWN
    234       when /\A\?/   # ?
    235         yield :Question_mark_code, :Question_mark_code
    236       when /\A[0-9]+\.[0-9]+(\.[0-9]+)*/   # ?
    237         yield :V_VERSION_STRING, :V_VERSION_STRING
    238       when /\A\|/   # |
    239         if @in_interval
    240           @in_interval = false
    241         else
    242           @in_interval = true
    243         end
    244         yield :SYM_INTERVAL_DELIM, :SYM_INTERVAL_DELIM
    245       when /\A\[[a-zA-Z0-9()\._-]+::[a-zA-Z0-9\._-]+\]/
    246 #      when /\A\[[a-zA-Z0-9()\._-]+\:\:[a-zA-Z0-9\._-]+\]/   #V_QUALIFIED_TERM_CODE_REF form [ICD10AM(1998)::F23]
    247         yield :V_QUALIFIED_TERM_CODE_REF, $&
    248       when /\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/   #V_LOCAL_TERM_CODE_REF
    249         yield :V_LOCAL_TERM_CODE_REF, $&
    250       when /\A\[/   # [
    251         yield :Left_bracket_code, :Left_bracket_code
    252       when /\A\]/   # ]
    253         yield :Right_bracket_code, :Right_bracket_code
    254 
    255       when /\A\[[a-zA-Z0-9._\- ]+::[a-zA-Z0-9._\- ]+\]/   #ERR_V_QUALIFIED_TERM_CODE_REF
    256         yield :ERR_V_QUALIFIED_TERM_CODE_REF, $&
    257       when /\Aa[ct][0-9.]+/   #V_LOCAL_CODE
    258         yield :V_LOCAL_CODE, $&
    259       when /\A[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9]:[0-6][0-9](,[0-9]+)?(Z|[+-][0-9]{4})?|[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9](Z|[+-][0-9]{4})?|[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9](Z|[+-][0-9]{4})?/   #V_ISO8601_EXTENDED_DATE_TIME YYYY-MM-DDThh:mm:ss[,sss][Z|+/- -n-n-n-n-]-
    260         yield :V_ISO8601_EXTENDED_DATE_TIME, $&
    261       when /\A[0-2][0-9]:[0-6][0-9]:[0-6][0-9](,[0-9]+)?(Z|[+-][0-9]{4})?|[0-2][0-9]:[0-6][0-9](Z|[+-][0-9]{4})? /   #V_ISO8601_EXTENDED_TIME hh:mm:ss[,sss][Z|+/-nnnn]
    262         yield :V_ISO8601_EXTENDED_TIME, $&
    263       when /\A[0-9]{4}-[0-1][0-9]-[0-3][0-9]|[0-9]{4}-[0-1][0-9]/   #V_ISO8601_EXTENDED_DATE YYYY-MM-DD
    264         yield :V_ISO8601_EXTENDED_DATE, $&
    265       when /\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/   #V_GENERIC_TYPE_IDENTIFIER
    266         yield :V_GENERIC_TYPE_IDENTIFIER, $&
    267       when /\A[0-9]+|[0-9]+[eE][+-]?[0-9]+/   #V_INTEGER
    268         yield :V_INTEGER, $&
    269       when /\A[0-9]+\.[0-9]+|[0-9]+\.[0-9]+[eE][+-]?[0-9]+ /   #V_REAL
    270         yield :V_REAL, $&
    271         #    when /\A"((?:[^"\\]+|\\.)*)"/ #V_STRING
    272       when /\A"([^"]*)"/m #V_STRING
    273         yield :V_STRING, $1
    274       when /\A[a-z]+:\/\/[^<>|\\{}^~"\[\] ]*/ #V_URI
    275         yield :V_URI, $&
    276       when /\AP([0-9]+[yY])?([0-9]+[mM])?([0-9]+[wW])?([0-9]+[dD])?T([0-9]+[hH])?([0-9]+[mM])?([0-9]+[sS])?|P([0-9]+[yY])?([0-9]+[mM])?([0-9]+[wW])?([0-9]+[dD])?/   #V_ISO8601_DURATION PnYnMnWnDTnnHnnMnnS
    277         yield :V_ISO8601_DURATION, $&
    278       when /\A\S/ #UTF8CHAR
    279         yield :UTF8CHAR, $&
    280       end
    281       data = $' # variable $' receives the string after the match
    282     when :dadl
    283 #      puts "Entering scan_dadl"
    284       data = scan_dadl(data) do |sym, val|
    285         yield sym, val
    286       end
    287     when :cadl
    288 #      puts "Entering scan_cadl"
    289       data = scan_cadl(data) do |sym, val|
    290         yield sym, val
    291       end
    292     when :regexp
    293 #      puts "Entering scan_regexp"
    294       data = scan_regexp(data) do |sym, val|
    295         yield sym, val
    296       end
    297     when :term_constraint
    298 #      puts "Entering scan_term_constraint"
    299       data = scan_term_constraint(data) do |sym, val|
    300         yield sym, val
    301       end
    302     else
    303       raise
    304     end
    305   end
    306 end # scan_adl
    307 
    308 
    309 def scan_cadl(data)
    310   until data.nil?  do
    311     case @adl_type.last
    312     when :cadl
    313 #      puts "Entering scan_cadl"
    314       case scanned = @@cadl_scanner.parse(data)
    315       when Yaparc::Result::OK
    316         if scanned.value[0] == :START_V_C_DOMAIN_TYPE_BLOCK
    317           @in_c_domain_type = true
    318           @adl_type.push(:dadl)
    319           yield scanned.value
    320         else
    321           yield scanned.value
    322         end
    323         data = scanned.input
    324       end
    325 
    326       case data
    327       when /\A\n/ # carriage return
    328         @lineno += 1
    329         ;
    330       when /\A[ \t\r\f]+/ #just drop it
    331         ;
    332       when /\A--.*\n/ # single line comment
    333         @lineno += 1
    334         @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: COMMENT = #{$&} at #{@filename}:#{@lineno}")
    335         ;
    336         ###----------/* symbols */ -------------------------------------------------
    337       when /\A\=/   # =
    338         yield :SYM_EQ, :SYM_EQ
    339       when /\A\>=/   # >=
    340         yield :SYM_GE, :SYM_GE
    341       when /\A\<=/   # <=
    342         yield :SYM_LE, :SYM_LE
    343 ###       when /\A[A-Z][a-zA-Z0-9_]*[ \n]*\</   # V_C_DOMAIN_TYPE
    344 ###         @in_c_domain_type = true
    345 ###         @adl_type.push(:dadl)
    346 ###         yield :START_V_C_DOMAIN_TYPE_BLOCK, $&
    347       when /\A\</   # <
    348         if @in_interval
    349           yield :SYM_LT, :SYM_LT
    350         else
    351           @adl_type.push(:dadl)
    352           yield :SYM_START_DBLOCK,  $&
    353         end
    354       when /\A\>/   # >
    355         if @in_interval
    356           yield :SYM_GT, :SYM_GT
    357         else
    358           adl_type = @adl_type.pop
    359 #          puts "Escaping #{adl_type}"
    360           assert_at(__FILE__,__LINE__){adl_type == :dadl}
    361           yield :SYM_END_DBLOCK, :SYM_END_DBLOCK
    362         end
    363       when /\A\-/   # -
    364         yield :Minus_code, :Minus_code
    365       when /\A\+/   # +
    366         yield :Plus_code, :Plus_code
    367       when /\A\*/   # *
    368         yield :Star_code, :Star_code
    369       when /\A\//   # /
    370         yield :Slash_code, :Slash_code
    371       when /\A\^/   # ^
    372         yield :Caret_code, :Caret_code
    373       when /\A\.\.\./   # ...
    374         yield :SYM_LIST_CONTINUE, :SYM_LIST_CONTINUE
    375       when /\A\.\./   # ..
    376         yield :SYM_ELLIPSIS, :SYM_ELLIPSIS
    377       when /\A\./   # .
    378         yield :Dot_code, :Dot_code
    379       when /\A\;/   # ;
    380         yield :Semicolon_code, :Semicolon_code
    381       when /\A\,/   # ,
    382         yield :Comma_code, :Comma_code
    383       when /\A\:/   # :
    384         yield :Colon_code, :Colon_code
    385       when /\A\!/   # !
    386         yield :Exclamation_code, :Exclamation_code
    387       when /\A\(/   # (
    388         yield :Left_parenthesis_code, :Left_parenthesis_code
    389       when /\A\)/   # )
    390         yield :Right_parenthesis_code, :Right_parenthesis_code
    391       when /\A\{\// #V_REGEXP
    392         if @adl_type.last != :regexp
    393           @in_regexp = true
    394           @adl_type.push(:regexp)
    395           yield :START_REGEXP_BLOCK, :START_REGEXP_BLOCK
    396         else
    397           raise
    398         end
    399 #        yield :V_REGEXP, :V_REGEXP
    400       when /\A\{/   # {
    401         @adl_type.push(:cadl)
    402         @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: entering cADL at #{@filename}:#{@lineno}")
    403         yield :SYM_START_CBLOCK, :SYM_START_CBLOCK
    404       when /\A\}/   # }
    405         adl_type = @adl_type.pop
    406 #        puts "Escaping #{adl_type}"
    407         assert_at(__FILE__,__LINE__){adl_type == :cadl}
    408         @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: exiting cADL at #{@filename}:#{@lineno}")
    409         yield :SYM_END_CBLOCK, :SYM_END_CBLOCK
    410       when /\A\$/   # $
    411         yield :Dollar_code, :Dollar_code
    412       when /\A\?\?/   # ??
    413         yield :SYM_DT_UNKNOWN, :SYM_DT_UNKNOWN
    414       when /\A\?/   # ?
    415         yield :Question_mark_code, :Question_mark_code
    416       when /\A\|/   # |
    417         @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: @in_interval = #{@in_interval} at #{@filename}:#{@lineno}")
    418         if @in_interval
    419           @in_interval = false
    420         else
    421 #          @in_interval = false
    422           @in_interval = true
    423         end
    424         @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: SYM_INTERVAL_DELIM at #{@filename}:#{@lineno}")
    425         yield :SYM_INTERVAL_DELIM, :SYM_INTERVAL_DELIM
    426 
    427       when /\A\[[a-zA-Z0-9._\-]+::[a-zA-Z0-9._\-]+\]/   #V_QUALIFIED_TERM_CODE_REF form [ICD10AM(1998)::F23]
    428         yield :V_QUALIFIED_TERM_CODE_REF, $&
    429       when /\A\[[a-zA-Z0-9._\- ]+::[a-zA-Z0-9._\- ]+\]/   #ERR_V_QUALIFIED_TERM_CODE_REF
    430         yield :ERR_V_QUALIFIED_TERM_CODE_REF, $&
    431       when /\A\[([a-zA-Z0-9()._\-]+::[a-zA-Z0-9._\_-]+)\]/
    432         yield :V_TERM_CODE_CONSTRAINT, :V_TERM_CODE_CONSTRAINT
    433       when /\A\[[a-zA-Z0-9\(\)\._\-]+::[ \t\n]*/
    434         @adl_type.push(:term_constraint)
    435         yield :START_TERM_CODE_CONSTRAINT, $&
    436       when /\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/   #V_LOCAL_TERM_CODE_REF
    437         yield :V_LOCAL_TERM_CODE_REF, $&
    438       when /\A\[/   # [
    439         yield :Left_bracket_code, :Left_bracket_code
    440       when /\A\]/   # ]
    441         yield :Right_bracket_code, :Right_bracket_code
    442       when /\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/   #V_GENERIC_TYPE_IDENTIFIER
    443         yield :V_GENERIC_TYPE_IDENTIFIER, $&
    444       when /\A[yY][yY][yY][yY]-[mM?X][mM?X]-[dD?X][dD?X][T\t][hH?X][hH?X]:[mM?X][mM?X]:[sS?X][sS?X]/
    445         yield :V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN, $&
    446       when /\A[yY][yY][yY][yY]-[mM?X][mM?X]-[dD?X][dD?X]/
    447         yield :V_ISO8601_DATE_CONSTRAINT_PATTERN, $&
    448       when /\A[hH][hH]:[mM?X][mM?X]:[sS?X][sS?X]/
    449         yield :V_ISO8601_TIME_CONSTRAINT_PATTERN, $&
    450       when /\A[a-z][a-zA-Z0-9_]*/
    451         word = $&.dup
    452         if @@cadl_reserved[word.downcase]
    453           yield @@cadl_reserved[word.downcase], @@cadl_reserved[word.downcase]
    454         else
    455           @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: V_ATTRIBUTE_IDENTIFIER = #{word} at #{@filename}:#{@lineno}")
    456           yield :V_ATTRIBUTE_IDENTIFIER, word #V_ATTRIBUTE_IDENTIFIER /\A[a-z][a-zA-Z0-9_]*/
    457         end
    458       when /\A[A-Z][a-zA-Z0-9_]*/
    459         word = $&.dup
    460         if @@cadl_reserved[word.downcase]
    461           yield @@cadl_reserved[word.downcase], @@cadl_reserved[word.downcase]
    462         else
    463           yield :V_TYPE_IDENTIFIER, $&
    464         end
    465       when /\Aa[ct][0-9.]+/   #V_LOCAL_CODE
    466         yield :V_LOCAL_CODE, $&
    467       when /\A[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9]:[0-6][0-9](,[0-9]+)?(Z|[+-][0-9]{4})?|[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9](Z|[+-][0-9]{4})?|[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9](Z|[+-][0-9]{4})?/   #V_ISO8601_EXTENDED_DATE_TIME YYYY-MM-DDThh:mm:ss[,sss][Z|+/- -n-n-n-n-]-
    468         yield :V_ISO8601_EXTENDED_DATE_TIME, $&
    469       when /\A[0-2][0-9]:[0-6][0-9]:[0-6][0-9](,[0-9]+)?(Z|[+-][0-9]{4})?|[0-2][0-9]:[0-6][0-9](Z|[+-][0-9]{4})? /   #V_ISO8601_EXTENDED_TIME hh:mm:ss[,sss][Z|+/-nnnn]
    470         yield :V_ISO8601_EXTENDED_TIME, $&
    471       when /\A[0-9]{4}-[0-1][0-9]-[0-3][0-9]|[0-9]{4}-[0-1][0-9]/   #V_ISO8601_EXTENDED_DATE YYYY-MM-DD
    472         yield :V_ISO8601_EXTENDED_DATE, $&
    473       when /\A[0-9]+|[0-9]+[eE][+-]?[0-9]+/   #V_INTEGER
    474         yield :V_INTEGER, $&
    475       when /\A[0-9]+\.[0-9]+|[0-9]+\.[0-9]+[eE][+-]?[0-9]+ /   #V_REAL
    476         yield :V_REAL, $&
    477            when /\A"((?:[^"\\]+|\\.)*)"/ #V_STRING
    478       when /\A"([^"]*)"/m #V_STRING
    479         yield :V_STRING, $1
    480       when /\A[a-z]+:\/\/[^<>|\\{}^~"\[\] ]*/ #V_URI
    481         yield :V_URI, $&
    482 ###       when /\AP([0-9]+[yY])?([0-9]+[mM])?([0-9]+[wW])?([0-9]+[dD])?T([0-9]+[hH])?([0-9]+[mM])?([0-9]+[sS])?|P([0-9]+[yY])?([0-9]+[mM])?([0-9]+[wW])?([0-9]+[dD])?/   #V_ISO8601_DURATION PnYnMnWnDTnnHnnMnnS
    483 ###         yield :V_ISO8601_DURATION, $&
    484       when /\A\S/ #UTF8CHAR
    485         yield :UTF8CHAR, $&
    486       else
    487         raise
    488       end
    489       data = $' # variable $' receives the string after the match
    490     when :adl
    491 #      puts "Entering scan_adl"
    492       data = scan_adl(data) do |sym, val|
    493         yield sym, val
    494       end
    495     when :dadl
    496 #      puts "Entering scan_dadl"
    497       data = scan_dadl(data) do |sym, val|
    498         yield sym, val
    499       end
    500     when :regexp
    501 #      puts "Entering scan_regexp"
    502       data = scan_regexp(data) do |sym, val|
    503         yield sym, val
    504       end
    505     when :term_constraint
    506 #      puts "Entering scan_term_constraint"
    507       data = scan_term_constraint(data) do |sym, val|
    508         yield sym, val
    509       end
    510     else
    511       raise
    512     end
    513   end # of until
    514 end # of scan_cadl
    515 
    516 def scan_dadl(data)
    517   until data.nil?  do
    518     case @adl_type.last
    519     when :dadl
    520 #      puts "Entering scan_dadl"
    521       case scanned = @@dadl_scanner.parse(data)
    522       when Yaparc::Result::OK
    523         yield scanned.value
    524         data = scanned.input
    525       else
    526       end
    527 
    528       case data
    529       when /\A\n/ # carriage return
    530         @lineno += 1
    531         ;
    532       when /\A[ \t\r\f]+/ #just drop it
    533         ;
    534       when /\A--.*\n/ # single line comment
    535         @lineno += 1
    536         @@log.info("#{__FILE__}:#{__LINE__}: scan_dadl: COMMENT = #{$&} at #{@filename}:#{@lineno}")
    537         ;
    538         ###----------/* symbols */ -------------------------------------------------
    539       when /\A\=/   # =
    540         yield :SYM_EQ, :SYM_EQ
    541       when /\A\>\=/   # >=
    542         yield :SYM_GE, :SYM_GE
    543       when /\A\<\=/   # <=
    544         yield :SYM_LE, :SYM_LE
    545       when /\A\</   # <
    546         if @in_interval
    547           yield :SYM_LT, :SYM_LT
    548         else
    549           @adl_type.push(:dadl)
    550           yield :SYM_START_DBLOCK, :SYM_START_DBLOCK
    551         end
    552       when /\A\>/   # >
    553         if @in_interval
    554 #          @in_interval = false
    555           yield :SYM_GT, :SYM_GT
    556         elsif @in_c_domain_type == true
    557           assert_at(__FILE__,__LINE__){@adl_type.last == :dadl}
    558           adl_type = @adl_type.pop
    559           if @adl_type.last == :cadl
    560             @in_c_domain_type = false
    561             yield :END_V_C_DOMAIN_TYPE_BLOCK, $&
    562           else
    563             yield :SYM_END_DBLOCK, $&
    564           end
    565         elsif @in_c_domain_type == false
    566           adl_type = @adl_type.pop
    567 #          puts "Escaping #{adl_type}"
    568           assert_at(__FILE__,__LINE__){adl_type == :dadl}
    569           yield :SYM_END_DBLOCK, $&
    570         else
    571           raise
    572         end
    573       when /\A\-/   # -
    574         yield :Minus_code, :Minus_code
    575       when /\A\+/   # +
    576         yield :Plus_code, :Plus_code
    577       when /\A\*/   # *
    578         yield :Star_code, :Star_code
    579       when /\A\//   # /
    580         yield :Slash_code, :Slash_code
    581       when /\A\^/   # ^
    582         yield :Caret_code, :Caret_code
    583       when /\A\.\.\./   # ...
    584         yield :SYM_LIST_CONTINUE, :SYM_LIST_CONTINUE
    585       when /\A\.\./   # ..
    586         yield :SYM_ELLIPSIS, :SYM_ELLIPSIS
    587       when /\A\./   # .
    588         yield :Dot_code, :Dot_code
    589       when /\A\;/   # ;
    590         yield :Semicolon_code, :Semicolon_code
    591       when /\A\,/   # ,
    592         yield :Comma_code, :Comma_code
    593       when /\A\:/   # :
    594         yield :Colon_code, :Colon_code
    595       when /\A\!/   # !
    596         yield :Exclamation_code, :Exclamation_code
    597       when /\A\(/   # (
    598         yield :Left_parenthesis_code, :Left_parenthesis_code
    599       when /\A\)/   # )
    600         yield :Right_parenthesis_code, :Right_parenthesis_code
    601       when /\A\$/   # $
    602         yield :Dollar_code, :Dollar_code
    603       when /\A\?\?/   # ??
    604         yield :SYM_DT_UNKNOWN, :SYM_DT_UNKNOWN
    605       when /\A\?/   # ?
    606         yield :Question_mark_code, :Question_mark_code
    607       when /\A\|/   # |
    608         @@log.info("#{__FILE__}:#{__LINE__}: scan_dadl: @in_interval = #{@in_interval} at #{@filename}:#{@lineno}")
    609         if @in_interval
    610           @in_interval = false
    611         else
    612 #          @in_interval = false
    613           @in_interval = true
    614         end
    615         @@log.info("#{__FILE__}:#{__LINE__}: scan_dadl: SYM_INTERVAL_DELIM at #{@filename}:#{@lineno}")
    616         yield :SYM_INTERVAL_DELIM, :SYM_INTERVAL_DELIM
    617 ###       when /\A\[[a-zA-Z0-9()\._-]+::[a-zA-Z0-9\._-]+\]/   #V_QUALIFIED_TERM_CODE_REF form [ICD10AM(1998)::F23]
    618 ###         yield :V_QUALIFIED_TERM_CODE_REF, $&
    619 ###       when /\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/   #V_LOCAL_TERM_CODE_REF
    620 ###         yield :V_LOCAL_TERM_CODE_REF, $&
    621 ###       when /\A\[[a-zA-Z0-9._\- ]+::[a-zA-Z0-9._\- ]+\]/   #ERR_V_QUALIFIED_TERM_CODE_REF
    622 ###         yield :ERR_V_QUALIFIED_TERM_CODE_REF, $&
    623       when /\A\[/   # [
    624         yield :Left_bracket_code, :Left_bracket_code
    625       when /\A\]/   # ]
    626         yield :Right_bracket_code, :Right_bracket_code
    627 ###       when /\A[A-Z][a-zA-Z0-9_-]*/
    628 ###         yield :V_TYPE_IDENTIFIER, $&
    629 ###       when /\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/   #V_GENERIC_TYPE_IDENTIFIER
    630 ###         yield :V_GENERIC_TYPE_IDENTIFIER, $&
    631 ###       when /\A[a-z][a-zA-Z0-9_]*/
    632 ###         word = $&.downcase
    633 ###         if @@dadl_reserved[word]
    634 ###           yield @@dadl_reserved[word], @@dadl_reserved[word]
    635 ###         else
    636 ###           yield :V_ATTRIBUTE_IDENTIFIER, $&
    637 ###         end
    638 ###       when /\Aa[ct][0-9.]+/   #V_LOCAL_CODE
    639 ###         yield :V_LOCAL_CODE, $&
    640       when /\A[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9]:[0-6][0-9](,[0-9]+)?(Z|[+-][0-9]{4})?|[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9](Z|[+-][0-9]{4})?|[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9](Z|[+-][0-9]{4})?/   #V_ISO8601_EXTENDED_DATE_TIME YYYY-MM-DDThh:mm:ss[,sss][Z|+/- -n-n-n-n-]-
    641         yield :V_ISO8601_EXTENDED_DATE_TIME, $&
    642       when /\A[0-2][0-9]:[0-6][0-9]:[0-6][0-9](,[0-9]+)?(Z|[+-][0-9]{4})?|[0-2][0-9]:[0-6][0-9](Z|[+-][0-9]{4})? /   #V_ISO8601_EXTENDED_TIME hh:mm:ss[,sss][Z|+/-nnnn]
    643         yield :V_ISO8601_EXTENDED_TIME, $&
    644       when /\A[0-9]{4}-[0-1][0-9]-[0-3][0-9]|[0-9]{4}-[0-1][0-9]/   #V_ISO8601_EXTENDED_DATE YYYY-MM-DD
    645         yield :V_ISO8601_EXTENDED_DATE, $&
    646       when /\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/   #V_GENERIC_TYPE_IDENTIFIER
    647         yield :V_GENERIC_TYPE_IDENTIFIER, $&
    648       when /\A[0-9]+|[0-9]+[eE][+-]?[0-9]+/   #V_INTEGER
    649         yield :V_INTEGER, $&
    650 ###       when /\A[0-9]+\.[0-9]+|[0-9]+\.[0-9]+[eE][+-]?[0-9]+ /   #V_REAL
    651 ###         yield :V_REAL, $&
    652         #    when /\A"((?:[^"\\]+|\\.)*)"/ #V_STRING
    653 ###       when /\A"([^"]*)"/m #V_STRING
    654 ###         yield :V_STRING, $1
    655       when /\A[a-z]+:\/\/[^<>|\\{}^~"\[\] ]*/ #V_URI
    656         yield :V_URI, $&
    657 ###       when /\AP([0-9]+[yY])?([0-9]+[mM])?([0-9]+[wW])?([0-9]+[dD])?T([0-9]+[hH])?([0-9]+[mM])?([0-9]+[sS])?|P([0-9]+[yY])?([0-9]+[mM])?([0-9]+[wW])?([0-9]+[dD])?/   #V_ISO8601_DURATION PnYnMnWnDTnnHnnMnnS
    658 ###         yield :V_ISO8601_DURATION, $&
    659       when /\A\S/ #UTF8CHAR
    660         yield :UTF8CHAR, $&
    661       end
    662       data = $' # variable $' receives the string after the match
    663     when :adl
    664 #      puts "Entering scan_adl"
    665       data = scan_adl(data) do |sym, val|
    666         yield sym, val
    667       end
    668     when :cadl
    669 #      puts "Entering scan_cadl"
    670       data = scan_cadl(data) do |sym, val|
    671         yield sym, val
    672       end
    673     when :regexp
    674 #      puts "Entering scan_regexp"
    675       data = scan_regexp(data) do |sym, val|
    676         yield sym, val
    677       end
    678     when :term_constraint
    679 #      puts "Entering scan_term_constraint"
    680       data = scan_term_constraint(data) do |sym, val|
    681         yield sym, val
    682       end
    683     else
    684       raise
    685     end
    686   end
    687 end # of scan_dadl
    688 
    689 def scan_regexp(data)
    690   until data.nil?  do
    691     case @adl_type.last
    692     when :regexp
    693 #      puts "Entering scan_regexp"
    694       case data
    695       when /\A\/\}/ #V_REGEXP
    696         if @adl_type.last == :regexp
    697           @in_regexp = false
    698           @adl_type.pop
    699           yield :END_REGEXP_BLOCK, :END_REGEXP_BLOCK
    700         else
    701           raise
    702         end
    703       when /\A(.*)(\/\})/ #V_REGEXP
    704         yield :REGEXP_BODY, $1
    705         if @adl_type.last == :regexp
    706           @in_regexp = false
    707           @adl_type.pop
    708           yield :END_REGEXP_BLOCK, :END_REGEXP_BLOCK
    709         else
    710           raise
    711         end
    712       else
    713         raise data
    714       end
    715       data = $' # variable $' receives the string after the match
    716     when :adl
    717 #      puts "Entering scan_adl"
    718       data = scan_adl(data) do |sym, val|
    719         yield sym, val
    720       end
    721     when :dadl
    722 #      puts "Entering scan_dadl"
    723       data = scan_dadl(data) do |sym, val|
    724         yield sym, val
    725       end
    726     when :cadl
    727 #      puts "Entering scan_cadl"
    728       data = scan_cadl(data) do |sym, val|
    729         yield sym, val
    730       end
    731     when :term_constraint
    732 #      puts "Entering scan_term_constraint"
    733       data = scan_term_constraint(data) do |sym, val|
    734         yield sym, val
    735       end
    736     else
    737       raise
    738     end
    739   end
    740 end # of scan_regexp
    741 
    742 def scan_term_constraint(data)
    743   until data.nil?  do
    744     case @adl_type.last
    745     when :term_constraint
    746 #      puts "Entering scan_term_constraint"
    747       case data
    748       when /\A\n/ # carriage return
    749         @lineno += 1
    750         ;
    751       when /\A[ \t\r\f]+/ #just drop it
    752         ;
    753       when /\A--.*$/ # single line comment
    754         @lineno += 1
    755         @@log.info("#{__FILE__}:#{__LINE__}: scan_term_constraint: COMMENT = #{$&} at #{@filename}:#{@lineno}")
    756         ;
    757       when /\A[a-zA-Z0-9\._\-]+[ \t]*,/ # match any line, with ',' termination
    758         yield :TERM_CODE, $&
    759       when /\A[a-zA-Z0-9\._\-]+[ \t]*;/ #match second last line with ';' termination (assumed value)
    760         yield :TERM_CODE, $&
    761 #      when /\A[a-zA-Z0-9\._\-]+[ \t]*\]/ # match final line, terminating in ']'
    762       when /\A[a-zA-Z0-9\._\-]*[ \t]*\]/ # match final line, terminating in ']'
    763         adl_type = @adl_type.pop
    764         assert_at(__FILE__,__LINE__){adl_type == :term_constraint}
    765         yield :END_TERM_CODE_CONSTRAINT, $&
    766       else
    767         raise "data = #{data}"
    768       end
    769       data = $' # variable $' receives the string after the match
    770     when :adl
    771 #      puts "Entering scan_adl"
    772       data = scan_adl(data) do |sym, val|
    773         yield sym, val
    774       end
    775     when :dadl
    776 #      puts "Entering scan_dadl"
    777       data = scan_dadl(data) do |sym, val|
    778         yield sym, val
    779       end
    780     when :cadl
    781 #      puts "Entering scan_cadl"
    782       data = scan_cadl(data) do |sym, val|
    783         yield sym, val
    784       end
    785     else
    786       raise
    787     end
    788   end
    789 end # of scan_term_constraint
    790115
    791116
     
    808133
    809134
    810 
     135__END__
    811136
    812137
     
    1128453  -376,  -376,  -376,  -195,  -376,  -208,  -376,  -221,  -376,  -234,
    1129454  -376,  -376,  -376,   -43,  -305,  -376,   -53,   -44,  -376,  -376,
    1130    -31,   -72,  -310,   -70,   -35,   -37,  -372,   -38,   -39,  -360,
    1131    -40,  -376,  -363,   -41,  -367,  -366,   -42,  -369,  -376,   -36,
     455   -31,   -72,  -310,   -70,   -36,   -37,  -372,   -38,   -39,  -360,
     456   -40,  -376,  -363,   -41,  -367,  -366,   -42,  -369,  -376,   -35,
    1132457  -376,  -376,  -376,  -376,  -376,  -309,  -160,  -175,  -159,  -376,
    1133458  -174,  -376,  -196,  -376,  -209,  -376,  -222,  -376,  -235,  -376,
     
    1306631  1, 109, :_reduce_12,
    1307632  0, 99, :_reduce_none,
    1308   2, 99, :_reduce_none,
     633  2, 99, :_reduce_14,
    1309634  2, 99, :_reduce_none,
    1310635  2, 100, :_reduce_16,
     
    1337662  1, 121, :_reduce_none,
    1338663  1, 121, :_reduce_none,
    1339   3, 122, :_reduce_45,
    1340   4, 123, :_reduce_46,
    1341   3, 123, :_reduce_none,
    1342   6, 124, :_reduce_48,
     664  3, 128, :_reduce_45,
     665  4, 122, :_reduce_46,
     666  3, 122, :_reduce_none,
     667  6, 123, :_reduce_48,
    1343668  2, 130, :_reduce_49,
    1344669  2, 133, :_reduce_50,
    1345670  3, 133, :_reduce_none,
    1346671  2, 133, :_reduce_none,
    1347   1, 128, :_reduce_53,
     672  1, 127, :_reduce_53,
    1348673  1, 134, :_reduce_54,
    1349674  1, 134, :_reduce_55,
     
    1483808  3, 189, :_reduce_none,
    1484809  3, 189, :_reduce_none,
    1485   1, 180, :_reduce_none,
     810  1, 180, :_reduce_191,
    1486811  3, 190, :_reduce_none,
    1487812  3, 190, :_reduce_none,
     
    1652977  3, 142, :_reduce_358,
    1653978  3, 142, :_reduce_359,
    1654   1, 127, :_reduce_none,
    1655   3, 127, :_reduce_none,
    1656   3, 127, :_reduce_none,
     979  1, 126, :_reduce_none,
     980  3, 126, :_reduce_none,
     981  3, 126, :_reduce_none,
    1657982  1, 221, :_reduce_none,
    1658983  3, 221, :_reduce_none,
    1659984  3, 222, :_reduce_365,
    1660   1, 126, :_reduce_366,
    1661   1, 126, :_reduce_367,
    1662   3, 223, :_reduce_none,
     985  1, 125, :_reduce_366,
     986  1, 125, :_reduce_367,
     987  3, 223, :_reduce_368,
    1663988  0, 224, :_reduce_none,
    1664989  1, 224, :_reduce_none,
    1665990  2, 224, :_reduce_none,
    1666   1, 125, :_reduce_372,
     991  1, 124, :_reduce_372,
    1667992  1, 150, :_reduce_373,
    1668993  1, 150, :_reduce_374,
     
    19131238  "c_attributes",
    19141239  "c_object",
    1915   "v_c_domain_type",
    19161240  "archetype_internal_ref",
    19171241  "archetype_slot",
     
    19201244  "c_ordinal",
    19211245  "c_primitive_object",
     1246  "v_c_domain_type",
    19221247  "absolute_path",
    19231248  "c_archetype_slot_head",
     
    20401365   
    20411366    archetype_id = val[0][:archetype_id]
     1367    parent_archtype_id = val[1][:parent_archtype_id] if val[1]
    20421368    adl_version = val[0][:arch_head][:arch_meta_data][:adl_version]
    20431369    concept = val[2]
     
    20451371    archetype = OpenEHR::AM::Archetype::ARCHETYPE.create(
    20461372                                                         :archetype_id => archetype_id,
     1373                                                         :parent_archtype_id => parent_archtype_id,
    20471374                                                         :adl_version => adl_version,
    20481375                                                         :concept => concept,
     
    20531380      archetype.original_language = language
    20541381    end
    2055     @@log.info("#{__FILE__}:#{__LINE__}: archetype = #{archetype} at #{@filename}:#{@lineno}")
     1382    @@logger.debug("#{__FILE__}:#{__LINE__}: archetype = #{archetype.to_yaml} at #{@filename}:#{@lineno}")
    20561383    result = archetype
    20571384 
     
    20601387.,.,
    20611388
    2062 module_eval(<<'.,.,', 'parser.y', 61)
     1389module_eval(<<'.,.,', 'parser.y', 63)
    20631390  def _reduce_4(val, _values, result)
    20641391        result = {:arch_head => val[0], :archetype_id => val[1] }
     
    20681395.,.,
    20691396
    2070 module_eval(<<'.,.,', 'parser.y', 65)
     1397module_eval(<<'.,.,', 'parser.y', 67)
    20711398  def _reduce_5(val, _values, result)
    20721399        raise
     
    20761403.,.,
    20771404
    2078 module_eval(<<'.,.,', 'parser.y', 70)
     1405module_eval(<<'.,.,', 'parser.y', 72)
    20791406  def _reduce_6(val, _values, result)
    20801407        result = {:arch_meta_data => nil }
     
    20841411.,.,
    20851412
    2086 module_eval(<<'.,.,', 'parser.y', 74)
     1413module_eval(<<'.,.,', 'parser.y', 76)
    20871414  def _reduce_7(val, _values, result)
    20881415        result = val[1]
     
    20921419.,.,
    20931420
    2094 module_eval(<<'.,.,', 'parser.y', 79)
     1421module_eval(<<'.,.,', 'parser.y', 81)
    20951422  def _reduce_8(val, _values, result)
    20961423        result = {:arch_meta_data => val[1] }
     
    21001427.,.,
    21011428
    2102 module_eval(<<'.,.,', 'parser.y', 84)
     1429module_eval(<<'.,.,', 'parser.y', 86)
    21031430  def _reduce_9(val, _values, result)
    21041431        result = val[0]
     
    21081435.,.,
    21091436
    2110 module_eval(<<'.,.,', 'parser.y', 88)
     1437module_eval(<<'.,.,', 'parser.y', 90)
    21111438  def _reduce_10(val, _values, result)
    21121439        result = val[0].merge(val[2])
     
    21161443.,.,
    21171444
    2118 module_eval(<<'.,.,', 'parser.y', 94)
     1445module_eval(<<'.,.,', 'parser.y', 96)
    21191446  def _reduce_11(val, _values, result)
    21201447        result = {:adl_version => val[2], :is_controlled => false }
     
    21241451.,.,
    21251452
    2126 module_eval(<<'.,.,', 'parser.y', 98)
     1453module_eval(<<'.,.,', 'parser.y', 100)
    21271454  def _reduce_12(val, _values, result)
    21281455        result = {:is_controlled => true }
     
    21341461# reduce 13 omitted
    21351462
    2136 # reduce 14 omitted
     1463module_eval(<<'.,.,', 'parser.y', 108)
     1464  def _reduce_14(val, _values, result)
     1465        result = {:parent_archtype_id => val[1]}
     1466 
     1467    result
     1468  end
     1469.,.,
    21371470
    21381471# reduce 15 omitted
    21391472
    2140 module_eval(<<'.,.,', 'parser.y', 109)
     1473module_eval(<<'.,.,', 'parser.y', 114)
    21411474  def _reduce_16(val, _values, result)
    21421475        result = {:arch_concept => val[1] }
     
    21481481# reduce 17 omitted
    21491482
    2150 module_eval(<<'.,.,', 'parser.y', 119)
     1483module_eval(<<'.,.,', 'parser.y', 124)
    21511484  def _reduce_18(val, _values, result)
    21521485        result = {:arch_language => nil}
     
    21561489.,.,
    21571490
    2158 module_eval(<<'.,.,', 'parser.y', 123)
     1491module_eval(<<'.,.,', 'parser.y', 128)
    21591492  def _reduce_19(val, _values, result)
    21601493        result = {:arch_language => val[1]}
     
    21681501# reduce 21 omitted
    21691502
    2170 module_eval(<<'.,.,', 'parser.y', 134)
     1503module_eval(<<'.,.,', 'parser.y', 139)
    21711504  def _reduce_22(val, _values, result)
    21721505        result = OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION.new(:details => val[1])
     
    21781511# reduce 23 omitted
    21791512
    2180 module_eval(<<'.,.,', 'parser.y', 142)
     1513module_eval(<<'.,.,', 'parser.y', 147)
    21811514  def _reduce_24(val, _values, result)
    21821515        result = val[1]
     
    21881521# reduce 25 omitted
    21891522
    2190 module_eval(<<'.,.,', 'parser.y', 150)
     1523module_eval(<<'.,.,', 'parser.y', 155)
    21911524  def _reduce_26(val, _values, result)
    21921525        assert_at(__FILE__,__LINE__){val[0].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT)}
    2193     @@log.info("#{__FILE__}:#{__LINE__}: c_complex_object = #{val[0]} at #{@filename}:#{@lineno}")
     1526    @@logger.debug("#{__FILE__}:#{__LINE__}: c_complex_object = #{val[0]} at #{@filename}:#{@lineno}")
    21941527    result = val[0]
    21951528 
     
    21981531.,.,
    21991532
    2200 module_eval(<<'.,.,', 'parser.y', 156)
     1533module_eval(<<'.,.,', 'parser.y', 161)
    22011534  def _reduce_27(val, _values, result)
    22021535        result = val[0]
     
    22061539.,.,
    22071540
    2208 module_eval(<<'.,.,', 'parser.y', 163)
     1541module_eval(<<'.,.,', 'parser.y', 168)
    22091542  def _reduce_28(val, _values, result)
    22101543        result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.create(:attributes => val[3]) do |c_complex_object|
     
    22181551.,.,
    22191552
    2220 module_eval(<<'.,.,', 'parser.y', 171)
     1553module_eval(<<'.,.,', 'parser.y', 176)
    22211554  def _reduce_29(val, _values, result)
    22221555        result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.create(:attributes => val[3]) do |c_complex_object|
     
    22301563.,.,
    22311564
    2232 module_eval(<<'.,.,', 'parser.y', 182)
     1565module_eval(<<'.,.,', 'parser.y', 187)
    22331566  def _reduce_30(val, _values, result)
    22341567        result = {:c_complex_object_id => val[0], :c_occurrences => val[1]}
     
    22381571.,.,
    22391572
    2240 module_eval(<<'.,.,', 'parser.y', 187)
     1573module_eval(<<'.,.,', 'parser.y', 192)
    22411574  def _reduce_31(val, _values, result)
    22421575        result = {:type_identifier => val[0]}
     
    22461579.,.,
    22471580
    2248 module_eval(<<'.,.,', 'parser.y', 191)
     1581module_eval(<<'.,.,', 'parser.y', 196)
    22491582  def _reduce_32(val, _values, result)
    22501583        result = {:type_identifier => val[0], :local_term_code_ref => val[1]}
     
    22561589# reduce 33 omitted
    22571590
    2258 module_eval(<<'.,.,', 'parser.y', 197)
     1591module_eval(<<'.,.,', 'parser.y', 202)
    22591592  def _reduce_34(val, _values, result)
    22601593        result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new(:attributes => val[0])
     
    22641597.,.,
    22651598
    2266 module_eval(<<'.,.,', 'parser.y', 205)
     1599module_eval(<<'.,.,', 'parser.y', 220)
    22671600  def _reduce_35(val, _values, result)
    2268         result = val[0]
    2269  
    2270     result
    2271   end
    2272 .,.,
    2273 
    2274 module_eval(<<'.,.,', 'parser.y', 209)
     1601        @@logger.debug("#{__FILE__}:#{__LINE__}: c_complex_object = #{val[0].inspect} at #{@filename}:#{@lineno}")
     1602    result = val[0]
     1603 
     1604    result
     1605  end
     1606.,.,
     1607
     1608module_eval(<<'.,.,', 'parser.y', 225)
    22751609  def _reduce_36(val, _values, result)
    2276         @@log.info("#{__FILE__}:#{__LINE__}: c_complex_object = #{val[0].inspect} at #{@filename}:#{@lineno}")
    2277     result = val[0]
    2278  
    2279     result
    2280   end
    2281 .,.,
    2282 
    2283 module_eval(<<'.,.,', 'parser.y', 214)
    2284   def _reduce_37(val, _values, result)
    22851610        result = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF.create do |archetype_internal_ref|
    22861611      archetype_internal_ref.target_path = val[0][:absolute_path]
     
    22931618.,.,
    22941619
    2295 module_eval(<<'.,.,', 'parser.y', 222)
     1620module_eval(<<'.,.,', 'parser.y', 233)
     1621  def _reduce_37(val, _values, result)
     1622        result = val[0]
     1623 
     1624    result
     1625  end
     1626.,.,
     1627
     1628module_eval(<<'.,.,', 'parser.y', 237)
    22961629  def _reduce_38(val, _values, result)
    2297         result = val[0]
    2298  
    2299     result
    2300   end
    2301 .,.,
    2302 
    2303 module_eval(<<'.,.,', 'parser.y', 226)
    2304   def _reduce_39(val, _values, result)
    23051630        result = OpenEHR::AM::Archetype::Constraint_Model::CONSTRAINT_REF.create do |constraint_ref|
    23061631      constraint_ref.reference = val[0]
     
    23111636.,.,
    23121637
    2313 module_eval(<<'.,.,', 'parser.y', 232)
     1638module_eval(<<'.,.,', 'parser.y', 243)
     1639  def _reduce_39(val, _values, result)
     1640        result = val[0]
     1641 
     1642    result
     1643  end
     1644.,.,
     1645
     1646module_eval(<<'.,.,', 'parser.y', 247)
    23141647  def _reduce_40(val, _values, result)
    23151648        result = val[0]
     
    23191652.,.,
    23201653
    2321 module_eval(<<'.,.,', 'parser.y', 236)
     1654module_eval(<<'.,.,', 'parser.y', 251)
    23221655  def _reduce_41(val, _values, result)
    23231656        result = val[0]
     
    23271660.,.,
    23281661
    2329 module_eval(<<'.,.,', 'parser.y', 240)
     1662module_eval(<<'.,.,', 'parser.y', 255)
    23301663  def _reduce_42(val, _values, result)
    23311664        result = val[0]
     
    23391672# reduce 44 omitted
    23401673
    2341 module_eval(<<'.,.,', 'parser.y', 255)
     1674module_eval(<<'.,.,', 'parser.y', 271)
    23421675  def _reduce_45(val, _values, result)
    23431676        result = val[1]
     
    23471680.,.,
    23481681
    2349 module_eval(<<'.,.,', 'parser.y', 261)
     1682module_eval(<<'.,.,', 'parser.y', 277)
    23501683  def _reduce_46(val, _values, result)
    23511684        result = {:type_identifier => val[1], :c_occurrences => val[2], :absolute_path => val[3] }
     
    23571690# reduce 47 omitted
    23581691
    2359 module_eval(<<'.,.,', 'parser.y', 268)
     1692module_eval(<<'.,.,', 'parser.y', 284)
    23601693  def _reduce_48(val, _values, result)
    23611694        result = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT.create do |archetype_slot|
     
    23701703.,.,
    23711704
    2372 module_eval(<<'.,.,', 'parser.y', 277)
     1705module_eval(<<'.,.,', 'parser.y', 293)
    23731706  def _reduce_49(val, _values, result)
    23741707        result = {:c_archetype_slot_id => val[0],:c_occurrences => val[1]}
     
    23781711.,.,
    23791712
    2380 module_eval(<<'.,.,', 'parser.y', 282)
     1713module_eval(<<'.,.,', 'parser.y', 298)
    23811714  def _reduce_50(val, _values, result)
    23821715        result = val[1]
     
    23901723# reduce 52 omitted
    23911724
    2392 module_eval(<<'.,.,', 'parser.y', 290)
     1725module_eval(<<'.,.,', 'parser.y', 306)
    23931726  def _reduce_53(val, _values, result)
    23941727        assert_at(__FILE__,__LINE__){val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_PRIMITIVE)}
     
    24011734.,.,
    24021735
    2403 module_eval(<<'.,.,', 'parser.y', 298)
     1736module_eval(<<'.,.,', 'parser.y', 314)
    24041737  def _reduce_54(val, _values, result)
    2405         @@log.info("#{__FILE__}:#{__LINE__}: c_integer = #{val[0]} at #{@filename}:#{@lineno}")
     1738        @@logger.debug("#{__FILE__}:#{__LINE__}: c_integer = #{val[0]} at #{@filename}:#{@lineno}")
    24061739    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_INTEGER.create do |c_integer|
    24071740      c_integer.list
     
    24141747.,.,
    24151748
    2416 module_eval(<<'.,.,', 'parser.y', 307)
     1749module_eval(<<'.,.,', 'parser.y', 323)
    24171750  def _reduce_55(val, _values, result)
    2418         @@log.info("#{__FILE__}:#{__LINE__}: c_real = #{val[0]} at #{@filename}:#{@lineno}")
     1751        @@logger.debug("#{__FILE__}:#{__LINE__}: c_real = #{val[0]} at #{@filename}:#{@lineno}")
    24191752    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_REAL.new
    24201753 
     
    24231756.,.,
    24241757
    2425 module_eval(<<'.,.,', 'parser.y', 312)
     1758module_eval(<<'.,.,', 'parser.y', 328)
    24261759  def _reduce_56(val, _values, result)
    2427         @@log.info("#{__FILE__}:#{__LINE__}: c_date = #{val[0]} at #{@filename}:#{@lineno}")
     1760        @@logger.debug("#{__FILE__}:#{__LINE__}: c_date = #{val[0]} at #{@filename}:#{@lineno}")
    24281761    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE.new
    24291762 
     
    24321765.,.,
    24331766
    2434 module_eval(<<'.,.,', 'parser.y', 317)
     1767module_eval(<<'.,.,', 'parser.y', 333)
    24351768  def _reduce_57(val, _values, result)
    2436         @@log.info("#{__FILE__}:#{__LINE__}: c_time = #{val[0]} at #{@filename}:#{@lineno}")
     1769        @@logger.debug("#{__FILE__}:#{__LINE__}: c_time = #{val[0]} at #{@filename}:#{@lineno}")
    24371770    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_TIME.new
    24381771 
     
    24411774.,.,
    24421775
    2443 module_eval(<<'.,.,', 'parser.y', 322)
     1776module_eval(<<'.,.,', 'parser.y', 338)
    24441777  def _reduce_58(val, _values, result)
    2445         @@log.info("#{__FILE__}:#{__LINE__}: c_date_time = #{val[0]} at #{@filename}:#{@lineno}")
     1778        @@logger.debug("#{__FILE__}:#{__LINE__}: c_date_time = #{val[0]} at #{@filename}:#{@lineno}")
    24461779    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME.new
    24471780 
     
    24501783.,.,
    24511784
    2452 module_eval(<<'.,.,', 'parser.y', 327)
     1785module_eval(<<'.,.,', 'parser.y', 343)
    24531786  def _reduce_59(val, _values, result)
    2454         @@log.info("#{__FILE__}:#{__LINE__}: c_duration = #{val[0]} at #{@filename}:#{@lineno}")
     1787        @@logger.debug("#{__FILE__}:#{__LINE__}: c_duration = #{val[0]} at #{@filename}:#{@lineno}")
    24551788    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DURATION.new
    24561789 
     
    24591792.,.,
    24601793
    2461 module_eval(<<'.,.,', 'parser.y', 332)
     1794module_eval(<<'.,.,', 'parser.y', 348)
    24621795  def _reduce_60(val, _values, result)
    2463         @@log.info("#{__FILE__}:#{__LINE__}: c_string = #{val[0]} at #{@filename}:#{@lineno}")
     1796        @@logger.debug("#{__FILE__}:#{__LINE__}: c_string = #{val[0]} at #{@filename}:#{@lineno}")
    24641797    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_STRING.new
    24651798 
     
    24681801.,.,
    24691802
    2470 module_eval(<<'.,.,', 'parser.y', 337)
     1803module_eval(<<'.,.,', 'parser.y', 353)
    24711804  def _reduce_61(val, _values, result)
    24721805        assert_at(__FILE__,__LINE__){val[0].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN)}
    2473     @@log.info("#{__FILE__}:#{__LINE__}: c_boolean = #{val[0]} at #{@filename}:#{@lineno}")
     1806    @@logger.debug("#{__FILE__}:#{__LINE__}: c_boolean = #{val[0]} at #{@filename}:#{@lineno}")
    24741807    result = val[0]
    24751808 
     
    24801813# reduce 62 omitted
    24811814
    2482 module_eval(<<'.,.,', 'parser.y', 349)
     1815module_eval(<<'.,.,', 'parser.y', 365)
    24831816  def _reduce_63(val, _values, result)
    24841817        result = [val[0]]
     
    24881821.,.,
    24891822
    2490 module_eval(<<'.,.,', 'parser.y', 353)
     1823module_eval(<<'.,.,', 'parser.y', 369)
    24911824  def _reduce_64(val, _values, result)
    24921825        result = (val[0] << val[1])
     
    24961829.,.,
    24971830
    2498 module_eval(<<'.,.,', 'parser.y', 359)
     1831module_eval(<<'.,.,', 'parser.y', 375)
    24991832  def _reduce_65(val, _values, result)
    25001833        assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
     
    25071840.,.,
    25081841
    2509 module_eval(<<'.,.,', 'parser.y', 366)
     1842module_eval(<<'.,.,', 'parser.y', 382)
    25101843  def _reduce_66(val, _values, result)
    25111844        assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
     
    25161849.,.,
    25171850
    2518 module_eval(<<'.,.,', 'parser.y', 371)
     1851module_eval(<<'.,.,', 'parser.y', 387)
    25191852  def _reduce_67(val, _values, result)
    25201853        assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
     
    25251858.,.,
    25261859
    2527 module_eval(<<'.,.,', 'parser.y', 378)
     1860module_eval(<<'.,.,', 'parser.y', 394)
    25281861  def _reduce_68(val, _values, result)
    2529         @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]}, c_existence = #{val[1]} at #{@filename}")
     1862        @@logger.debug("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]}, c_existence = #{val[1]} at #{@filename}")
    25301863    result = OpenEHR::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE.new(
    25311864                                                                              :rm_attribute_name => val[0],
     
    25381871.,.,
    25391872
    2540 module_eval(<<'.,.,', 'parser.y', 387)
     1873module_eval(<<'.,.,', 'parser.y', 403)
    25411874  def _reduce_69(val, _values, result)
    25421875        assert_at(__FILE__,__LINE__){ val[2].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY) }
    2543     @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER: #{val[0]}, c_existence = #{val[1]}, c_cardinality = #{val[2]} at #{@filename}")
     1876    @@logger.debug("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER: #{val[0]}, c_existence = #{val[1]}, c_cardinality = #{val[2]} at #{@filename}")
    25441877    result = OpenEHR::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE.new(
    25451878                                                                                :rm_attribute_name => val[0],
     
    25521885.,.,
    25531886
    2554 module_eval(<<'.,.,', 'parser.y', 398)
     1887module_eval(<<'.,.,', 'parser.y', 414)
    25551888  def _reduce_70(val, _values, result)
    25561889        result = Array[val[0]]
     
    25601893.,.,
    25611894
    2562 module_eval(<<'.,.,', 'parser.y', 402)
     1895module_eval(<<'.,.,', 'parser.y', 418)
    25631896  def _reduce_71(val, _values, result)
    25641897        result = (val[0] << val[1])
     
    25681901.,.,
    25691902
    2570 module_eval(<<'.,.,', 'parser.y', 406)
     1903module_eval(<<'.,.,', 'parser.y', 422)
    25711904  def _reduce_72(val, _values, result)
    25721905        result = Array[val[0]]
     
    25781911# reduce 73 omitted
    25791912
    2580 module_eval(<<'.,.,', 'parser.y', 414)
     1913module_eval(<<'.,.,', 'parser.y', 430)
    25811914  def _reduce_74(val, _values, result)
    25821915        result = val[1]
     
    25881921# reduce 75 omitted
    25891922
    2590 module_eval(<<'.,.,', 'parser.y', 422)
     1923module_eval(<<'.,.,', 'parser.y', 438)
    25911924  def _reduce_76(val, _values, result)
    25921925        result = val[1]
     
    26121945# reduce 84 omitted
    26131946
    2614 module_eval(<<'.,.,', 'parser.y', 442)
     1947module_eval(<<'.,.,', 'parser.y', 458)
    26151948  def _reduce_85(val, _values, result)
    26161949        dadl_section = val[1]
     
    26291962# reduce 89 omitted
    26301963
    2631 module_eval(<<'.,.,', 'parser.y', 457)
     1964module_eval(<<'.,.,', 'parser.y', 473)
    26321965  def _reduce_90(val, _values, result)
    26331966        result = Array[val[0]]
     
    26371970.,.,
    26381971
    2639 module_eval(<<'.,.,', 'parser.y', 461)
     1972module_eval(<<'.,.,', 'parser.y', 477)
    26401973  def _reduce_91(val, _values, result)
    26411974        result = (val[0] << val[1])
     
    26451978.,.,
    26461979
    2647 module_eval(<<'.,.,', 'parser.y', 465)
     1980module_eval(<<'.,.,', 'parser.y', 481)
    26481981  def _reduce_92(val, _values, result)
    26491982        result = (val[0] << val[2])
     
    26531986.,.,
    26541987
    2655 module_eval(<<'.,.,', 'parser.y', 470)
     1988module_eval(<<'.,.,', 'parser.y', 486)
    26561989  def _reduce_93(val, _values, result)
    2657         @@log.info("#{__FILE__}:#{__LINE__}: attr_id = #{val[0]}, object_block = #{val[2]} at #{@filename}:#{@lineno}")
     1990        @@logger.debug("#{__FILE__}:#{__LINE__}: attr_id = #{val[0]} at #{@filename}:#{@lineno}")
    26581991    result = {:attr_id => val[0], :object_block => val[2]}
    26591992 
     
    26621995.,.,
    26631996
    2664 module_eval(<<'.,.,', 'parser.y', 476)
     1997module_eval(<<'.,.,', 'parser.y', 492)
    26651998  def _reduce_94(val, _values, result)
    2666         @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}:#{@lineno}")
     1999        @@logger.debug("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}:#{@lineno}")
    26672000    result = val[0]
    26682001 
     
    26732006# reduce 95 omitted
    26742007
    2675 module_eval(<<'.,.,', 'parser.y', 483)
     2008module_eval(<<'.,.,', 'parser.y', 499)
    26762009  def _reduce_96(val, _values, result)
    26772010        result = val[0]
     
    26812014.,.,
    26822015
    2683 module_eval(<<'.,.,', 'parser.y', 487)
     2016module_eval(<<'.,.,', 'parser.y', 503)
    26842017  def _reduce_97(val, _values, result)
    26852018        result = val[0]
     
    26892022.,.,
    26902023
    2691 module_eval(<<'.,.,', 'parser.y', 492)
     2024module_eval(<<'.,.,', 'parser.y', 508)
    26922025  def _reduce_98(val, _values, result)
    26932026        result = val[0]
     
    26972030.,.,
    26982031
    2699 module_eval(<<'.,.,', 'parser.y', 496)
     2032module_eval(<<'.,.,', 'parser.y', 512)
    27002033  def _reduce_99(val, _values, result)
    27012034        result = val[0]
     
    27052038.,.,
    27062039
    2707 module_eval(<<'.,.,', 'parser.y', 501)
     2040module_eval(<<'.,.,', 'parser.y', 517)
    27082041  def _reduce_100(val, _values, result)
    27092042        result = {:untyped_multiple_attr_object_block => val[0]}
     
    27132046.,.,
    27142047
    2715 module_eval(<<'.,.,', 'parser.y', 505)
     2048module_eval(<<'.,.,', 'parser.y', 521)
    27162049  def _reduce_101(val, _values, result)
    27172050        result = {:type_identifier => val[0], :untyped_multiple_attr_object_block => val[1]}
     
    27212054.,.,
    27222055
    2723 module_eval(<<'.,.,', 'parser.y', 510)
     2056module_eval(<<'.,.,', 'parser.y', 526)
    27242057  def _reduce_102(val, _values, result)
    27252058        result = {:multiple_attr_object_block_head => val[0], :keyed_objects => val[1]}
     
    27292062.,.,
    27302063
    2731 module_eval(<<'.,.,', 'parser.y', 515)
     2064module_eval(<<'.,.,', 'parser.y', 531)
    27322065  def _reduce_103(val, _values, result)
    2733         @@log.info("SYM_START_DBLOCK: #{val[0]} at #{@filename}:#{@lineno}")
    2734     result = val[0]
    2735  
    2736     result
    2737   end
    2738 .,.,
    2739 
    2740 module_eval(<<'.,.,', 'parser.y', 521)
     2066        result = val[0]
     2067 
     2068    result
     2069  end
     2070.,.,
     2071
     2072module_eval(<<'.,.,', 'parser.y', 536)
    27412073  def _reduce_104(val, _values, result)
    27422074        result = Array[val[0]]
     
    27462078.,.,
    27472079
    2748 module_eval(<<'.,.,', 'parser.y', 525)
     2080module_eval(<<'.,.,', 'parser.y', 540)
    27492081  def _reduce_105(val, _values, result)
    27502082        result = (val[0] << val[1])
     
    27542086.,.,
    27552087
    2756 module_eval(<<'.,.,', 'parser.y', 530)
     2088module_eval(<<'.,.,', 'parser.y', 545)
    27572089  def _reduce_106(val, _values, result)
    2758         @@log.info("#{__FILE__}:#{__LINE__}: keyed_object = #{val[0]}, object_block = #{val[2]} at #{@filename}:#{@lineno}")
    2759     result = {:object_key => val[0], :object_block => val[1]}
    2760  
    2761     result
    2762   end
    2763 .,.,
    2764 
    2765 module_eval(<<'.,.,', 'parser.y', 536)
     2090        @@logger.debug("#{__FILE__}:#{__LINE__}: keyed_object = #{val[0]} at #{@filename}:#{@lineno}")
     2091    result = {:object_key => val[0], :object_block => val[2]}
     2092 
     2093    result
     2094  end
     2095.,.,
     2096
     2097module_eval(<<'.,.,', 'parser.y', 551)
    27662098  def _reduce_107(val, _values, result)
    2767         @@log.info("object_key: [#{val[1]}] at #{@filename}:#{@lineno}")
     2099        @@logger.debug("object_key: [#{val[1]}] at #{@filename}:#{@lineno}")
    27682100    result = val[1]
    27692101 
     
    27722104.,.,
    27732105
    2774 module_eval(<<'.,.,', 'parser.y', 542)
     2106module_eval(<<'.,.,', 'parser.y', 557)
    27752107  def _reduce_108(val, _values, result)
    27762108        result = {:untyped_single_attr_object_block => val[0]}
     
    27802112.,.,
    27812113
    2782 module_eval(<<'.,.,', 'parser.y', 546)
     2114module_eval(<<'.,.,', 'parser.y', 561)
    27832115  def _reduce_109(val, _values, result)
    27842116        result = {:type_identifier => val[0], :untyped_single_attr_object_block => val[1]}
     
    27882120.,.,
    27892121
    2790 module_eval(<<'.,.,', 'parser.y', 551)
     2122module_eval(<<'.,.,', 'parser.y', 566)
    27912123  def _reduce_110(val, _values, result)
    2792         @@log.info("#{__FILE__}:#{__LINE__}: single_attr_object_complex_head = #{val[0]} at #{@filename}:#{@lineno}")
     2124        @@logger.debug("#{__FILE__}:#{__LINE__}: single_attr_object_complex_head = #{val[0]} at #{@filename}:#{@lineno}")
    27932125    result = {:single_attr_object_complex_head => val[0]}
    27942126 
     
    27972129.,.,
    27982130
    2799 module_eval(<<'.,.,', 'parser.y', 556)
     2131module_eval(<<'.,.,', 'parser.y', 571)
    28002132  def _reduce_111(val, _values, result)
    2801         @@log.info("#{__FILE__}:#{__LINE__}: single_attr_object_complex_head = #{val[0]}, attr_vals = #{val[1]} at #{@filename}:#{@lineno}")
     2133        @@logger.debug("#{__FILE__}:#{__LINE__}: attr_vals = #{val[1]} at #{@filename}:#{@lineno}")
    28022134    result = {:single_attr_object_complex_head => val[0], :attr_vals => val[1]}
    28032135 
     
    28082140# reduce 112 omitted
    28092141
    2810 module_eval(<<'.,.,', 'parser.y', 562)
     2142module_eval(<<'.,.,', 'parser.y', 577)
    28112143  def _reduce_113(val, _values, result)
    2812         @@log.info("#{__FILE__}:#{__LINE__}: untyped_primitive_object_block = #{val[0]} at #{@filename}:#{@lineno}")
     2144        @@logger.debug("#{__FILE__}:#{__LINE__}: untyped_primitive_object_block = #{val[0]} at #{@filename}:#{@lineno}")
    28132145    result = {:untyped_primitive_object_block => val[0]}
    28142146 
     
    28172149.,.,
    28182150
    2819 module_eval(<<'.,.,', 'parser.y', 567)
     2151module_eval(<<'.,.,', 'parser.y', 582)
    28202152  def _reduce_114(val, _values, result)
    2821         @@log.info("#{__FILE__}:#{__LINE__}: type_identifier = #{val[0]}, untyped_primitive_object_block = #{val[1]} at #{@filename}:#{@lineno}")
     2153        @@logger.debug("#{__FILE__}:#{__LINE__}: type_identifier = #{val[0]}, untyped_primitive_object_block = #{val[1]} at #{@filename}:#{@lineno}")
    28222154    result = {:type_identifier => val[0], :untyped_primitive_object_block => val[1]}
    28232155 
     
    28262158.,.,
    28272159
    2828 module_eval(<<'.,.,', 'parser.y', 572)
     2160module_eval(<<'.,.,', 'parser.y', 587)
    28292161  def _reduce_115(val, _values, result)
    2830         @@log.info("#{__FILE__}:#{__LINE__}: primitive_object_block = <#{val[1]}> at #{@filename}:#{@lineno}")
     2162        @@logger.debug("#{__FILE__}:#{__LINE__}: primitive_object_block = <#{val[1]}> at #{@filename}:#{@lineno}")
    28312163    result = val[1]
    28322164 
     
    28352167.,.,
    28362168
    2837 module_eval(<<'.,.,', 'parser.y', 577)
     2169module_eval(<<'.,.,', 'parser.y', 592)
    28382170  def _reduce_116(val, _values, result)
    28392171        result = val[0]
     
    28432175.,.,
    28442176
    2845 module_eval(<<'.,.,', 'parser.y', 581)
     2177module_eval(<<'.,.,', 'parser.y', 596)
    28462178  def _reduce_117(val, _values, result)
    28472179        result = val[0]
     
    28512183.,.,
    28522184
    2853 module_eval(<<'.,.,', 'parser.y', 585)
     2185module_eval(<<'.,.,', 'parser.y', 600)
    28542186  def _reduce_118(val, _values, result)
    28552187        result = val[0]
     
    28592191.,.,
    28602192
    2861 module_eval(<<'.,.,', 'parser.y', 589)
     2193module_eval(<<'.,.,', 'parser.y', 604)
    28622194  def _reduce_119(val, _values, result)
    28632195        result = val[0]
     
    28672199.,.,
    28682200
    2869 module_eval(<<'.,.,', 'parser.y', 593)
     2201module_eval(<<'.,.,', 'parser.y', 608)
    28702202  def _reduce_120(val, _values, result)
    28712203        result = val[0]
     
    28752207.,.,
    28762208
    2877 module_eval(<<'.,.,', 'parser.y', 597)
     2209module_eval(<<'.,.,', 'parser.y', 612)
    28782210  def _reduce_121(val, _values, result)
    2879         @@log.info("string_value: #{val[0]} at #{@filename}:#{@lineno}")
     2211        @@logger.debug("string_value: #{val[0]} at #{@filename}:#{@lineno}")
    28802212    result = val[0]
    28812213 
     
    28842216.,.,
    28852217
    2886 module_eval(<<'.,.,', 'parser.y', 602)
     2218module_eval(<<'.,.,', 'parser.y', 617)
    28872219  def _reduce_122(val, _values, result)
    2888         @@log.info("integer_value: #{val[0]} at #{@filename}:#{@lineno}")
     2220        @@logger.debug("integer_value: #{val[0]} at #{@filename}:#{@lineno}")
    28892221    result = val[0]
    28902222 
     
    28932225.,.,
    28942226
    2895 module_eval(<<'.,.,', 'parser.y', 607)
     2227module_eval(<<'.,.,', 'parser.y', 622)
    28962228  def _reduce_123(val, _values, result)
    2897         @@log.info("real_value: #{val[0]} at #{@filename}:#{@lineno}")
     2229        @@logger.debug("real_value: #{val[0]} at #{@filename}:#{@lineno}")
    28982230    result = val[0]
    28992231 
     
    29022234.,.,
    29032235
    2904 module_eval(<<'.,.,', 'parser.y', 612)
     2236module_eval(<<'.,.,', 'parser.y', 627)
    29052237  def _reduce_124(val, _values, result)
    2906         @@log.info("boolean_value: #{val[0]} at #{@filename}:#{@lineno}")
     2238        @@logger.debug("boolean_value: #{val[0]} at #{@filename}:#{@lineno}")
    29072239    result = val[0]
    29082240 
     
    29112243.,.,
    29122244
    2913 module_eval(<<'.,.,', 'parser.y', 617)
     2245module_eval(<<'.,.,', 'parser.y', 632)
    29142246  def _reduce_125(val, _values, result)
    2915         @@log.info("character_value: #{val[0]} at #{@filename}:#{@lineno}")
     2247        @@logger.debug("character_value: #{val[0]} at #{@filename}:#{@lineno}")
    29162248    result = val[0]
    29172249 
     
    29202252.,.,
    29212253
    2922 module_eval(<<'.,.,', 'parser.y', 622)
     2254module_eval(<<'.,.,', 'parser.y', 637)
    29232255  def _reduce_126(val, _values, result)
    2924         @@log.info("date_value: #{val[0]} at #{@filename}:#{@lineno}")
     2256        @@logger.debug("date_value: #{val[0]} at #{@filename}:#{@lineno}")
    29252257    result = val[0]
    29262258 
     
    29292261.,.,
    29302262
    2931 module_eval(<<'.,.,', 'parser.y', 627)
     2263module_eval(<<'.,.,', 'parser.y', 642)
    29322264  def _reduce_127(val, _values, result)
    2933         @@log.info("time_value: #{val[0]} at #{@filename}:#{@lineno}")
     2265        @@logger.debug("time_value: #{val[0]} at #{@filename}:#{@lineno}")
    29342266    result = val[0]
    29352267 
     
    29382270.,.,
    29392271
    2940 module_eval(<<'.,.,', 'parser.y', 632)
     2272module_eval(<<'.,.,', 'parser.y', 647)
    29412273  def _reduce_128(val, _values, result)
    2942         @@log.info("date_time_value: #{val[0]} at #{@filename}:#{@lineno}")
     2274        @@logger.debug("date_time_value: #{val[0]} at #{@filename}:#{@lineno}")
    29432275    result = val[0]
    29442276 
     
    29472279.,.,
    29482280
    2949 module_eval(<<'.,.,', 'parser.y', 637)
     2281module_eval(<<'.,.,', 'parser.y', 652)
    29502282  def _reduce_129(val, _values, result)
    2951         @@log.info("duration_value: #{val[0]} at #{@filename}:#{@lineno}")
     2283        @@logger.debug("duration_value: #{val[0]} at #{@filename}:#{@lineno}")
    29522284    result = val[0]
    29532285 
     
    29562288.,.,
    29572289
    2958 module_eval(<<'.,.,', 'parser.y', 642)
     2290module_eval(<<'.,.,', 'parser.y', 657)
    29592291  def _reduce_130(val, _values, result)
    2960         @@log.info("uri_value: #{val[0]} at #{@filename}:#{@lineno}")
     2292        @@logger.debug("uri_value: #{val[0]} at #{@filename}:#{@lineno}")
    29612293    result = val[0]
    29622294 
     
    29952327# reduce 145 omitted
    29962328
    2997 module_eval(<<'.,.,', 'parser.y', 665)
     2329module_eval(<<'.,.,', 'parser.y', 680)
    29982330  def _reduce_146(val, _values, result)
    2999         @@log.info("V_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
     2331        @@logger.debug("V_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
    30002332    result = val[0]
    30012333 
     
    30042336.,.,
    30052337
    3006 module_eval(<<'.,.,', 'parser.y', 670)
     2338module_eval(<<'.,.,', 'parser.y', 685)
    30072339  def _reduce_147(val, _values, result)
    3008         @@log.info("V_GENERIC_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
     2340        @@logger.debug("V_GENERIC_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
    30092341    result = val[0]
    30102342 
     
    30132345.,.,
    30142346
    3015 module_eval(<<'.,.,', 'parser.y', 676)
     2347module_eval(<<'.,.,', 'parser.y', 691)
    30162348  def _reduce_148(val, _values, result)
    3017         @@log.info("V_STRING: #{val[0]} at #{@filename}:#{@lineno}")
     2349        @@logger.debug("V_STRING: #{val[0]} at #{@filename}:#{@lineno}")
    30182350    result = val[0]
    30192351 
     
    30282360# reduce 151 omitted
    30292361
    3030 module_eval(<<'.,.,', 'parser.y', 686)
     2362module_eval(<<'.,.,', 'parser.y', 701)
    30312363  def _reduce_152(val, _values, result)
    30322364        begin
     
    30412373.,.,
    30422374
    3043 module_eval(<<'.,.,', 'parser.y', 695)
     2375module_eval(<<'.,.,', 'parser.y', 710)
    30442376  def _reduce_153(val, _values, result)
    30452377        begin
     
    30542386.,.,
    30552387
    3056 module_eval(<<'.,.,', 'parser.y', 704)
     2388module_eval(<<'.,.,', 'parser.y', 719)
    30572389  def _reduce_154(val, _values, result)
    30582390        begin
     
    30912423# reduce 166 omitted
    30922424
    3093 module_eval(<<'.,.,', 'parser.y', 730)
     2425module_eval(<<'.,.,', 'parser.y', 745)
    30942426  def _reduce_167(val, _values, result)
    30952427        begin
     
    31042436.,.,
    31052437
    3106 module_eval(<<'.,.,', 'parser.y', 739)
     2438module_eval(<<'.,.,', 'parser.y', 754)
    31072439  def _reduce_168(val, _values, result)
    31082440        begin
     
    31172449.,.,
    31182450
    3119 module_eval(<<'.,.,', 'parser.y', 748)
     2451module_eval(<<'.,.,', 'parser.y', 763)
    31202452  def _reduce_169(val, _values, result)
    31212453        begin
     
    31542486# reduce 181 omitted
    31552487
    3156 module_eval(<<'.,.,', 'parser.y', 773)
     2488module_eval(<<'.,.,', 'parser.y', 788)
    31572489  def _reduce_182(val, _values, result)
    31582490        result = true
     
    31622494.,.,
    31632495
    3164 module_eval(<<'.,.,', 'parser.y', 777)
     2496module_eval(<<'.,.,', 'parser.y', 792)
    31652497  def _reduce_183(val, _values, result)
    31662498        result = false
     
    31842516# reduce 190 omitted
    31852517
    3186 # reduce 191 omitted
     2518module_eval(<<'.,.,', 'parser.y', 807)
     2519  def _reduce_191(val, _values, result)
     2520        result = val[0]
     2521 
     2522    result
     2523  end
     2524.,.,
    31872525
    31882526# reduce 192 omitted
     
    32622600# reduce 229 omitted
    32632601
    3264 module_eval(<<'.,.,', 'parser.y', 840)
     2602module_eval(<<'.,.,', 'parser.y', 858)
    32652603  def _reduce_230(val, _values, result)
    3266         @@log.info("V_ISO8601_DURATION: #{val[0]} at #{@filename}:#{@lineno}")
     2604        @@logger.debug("V_ISO8601_DURATION: #{val[0]} at #{@filename}:#{@lineno}")
    32672605    result = val[0]
    32682606 
     
    32952633# reduce 242 omitted
    32962634
    3297 module_eval(<<'.,.,', 'parser.y', 860)
     2635module_eval(<<'.,.,', 'parser.y', 878)
    32982636  def _reduce_243(val, _values, result)
    3299         @@log.info("#{__FILE__}:#{__LINE__}: V_QUALIFIED_TERM_CODE_REF = #{val[0]} at #{@filename}:#{@lineno}")
     2637        @@logger.debug("#{__FILE__}:#{__LINE__}: V_QUALIFIED_TERM_CODE_REF = #{val[0]} at #{@filename}:#{@lineno}")
    33002638    result = val[0]
    33012639 
     
    33102648# reduce 246 omitted
    33112649
    3312 module_eval(<<'.,.,', 'parser.y', 870)
     2650module_eval(<<'.,.,', 'parser.y', 888)
    33132651  def _reduce_247(val, _values, result)
    3314         @@log.info("#{__FILE__}:#{__LINE__}: V_URI = #{val[0]} at #{@filename}:#{@lineno}")
     2652        @@logger.debug("#{__FILE__}:#{__LINE__}: V_URI = #{val[0]} at #{@filename}:#{@lineno}")
    33152653    result = val[0]
    33162654 
     
    33992737# reduce 287 omitted
    34002738
    3401 module_eval(<<'.,.,', 'parser.y', 940)
     2739module_eval(<<'.,.,', 'parser.y', 958)
    34022740  def _reduce_288(val, _values, result)
    3403         @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}")
    3404  
    3405     result
    3406   end
    3407 .,.,
    3408 
    3409 module_eval(<<'.,.,', 'parser.y', 944)
     2741        @@logger.debug("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}")
     2742 
     2743    result
     2744  end
     2745.,.,
     2746
     2747module_eval(<<'.,.,', 'parser.y', 962)
    34102748  def _reduce_289(val, _values, result)
    3411         @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}")
    3412  
    3413     result
    3414   end
    3415 .,.,
    3416 
    3417 module_eval(<<'.,.,', 'parser.y', 955)
     2749        @@logger.debug("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}")
     2750 
     2751    result
     2752  end
     2753.,.,
     2754
     2755module_eval(<<'.,.,', 'parser.y', 973)
    34182756  def _reduce_290(val, _values, result)
    34192757        result = Range.new(1,1)
     
    34232761.,.,
    34242762
    3425 module_eval(<<'.,.,', 'parser.y', 959)
     2763module_eval(<<'.,.,', 'parser.y', 977)
    34262764  def _reduce_291(val, _values, result)
    34272765        result = val[3]
     
    34312769.,.,
    34322770
    3433 module_eval(<<'.,.,', 'parser.y', 964)
     2771module_eval(<<'.,.,', 'parser.y', 982)
    34342772  def _reduce_292(val, _values, result)
    34352773        begin
     
    34442782.,.,
    34452783
    3446 module_eval(<<'.,.,', 'parser.y', 973)
     2784module_eval(<<'.,.,', 'parser.y', 991)
    34472785  def _reduce_293(val, _values, result)
    34482786        begin
     
    34582796.,.,
    34592797
    3460 module_eval(<<'.,.,', 'parser.y', 984)
     2798module_eval(<<'.,.,', 'parser.y', 1002)
    34612799  def _reduce_294(val, _values, result)
    34622800        result = OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY.new
     
    34822820# reduce 302 omitted
    34832821
    3484 module_eval(<<'.,.,', 'parser.y', 998)
     2822module_eval(<<'.,.,', 'parser.y', 1016)
    34852823  def _reduce_303(val, _values, result)
    34862824        result = val[0]
     
    34902828.,.,
    34912829
    3492 module_eval(<<'.,.,', 'parser.y', 1002)
     2830module_eval(<<'.,.,', 'parser.y', 1020)
    34932831  def _reduce_304(val, _values, result)
    34942832        result = val[0]
     
    35002838# reduce 305 omitted
    35012839
    3502 module_eval(<<'.,.,', 'parser.y', 1009)
     2840module_eval(<<'.,.,', 'parser.y', 1027)
    35032841  def _reduce_306(val, _values, result)
    35042842        result = val[3]
     
    36002938# reduce 352 omitted
    36012939
    3602 module_eval(<<'.,.,', 'parser.y', 1079)
     2940module_eval(<<'.,.,', 'parser.y', 1097)
    36032941  def _reduce_353(val, _values, result)
    36042942        result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true)
     
    36082946.,.,
    36092947
    3610 module_eval(<<'.,.,', 'parser.y', 1083)
     2948module_eval(<<'.,.,', 'parser.y', 1101)
    36112949  def _reduce_354(val, _values, result)
    36122950        result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => false)
     
    36162954.,.,
    36172955
    3618 module_eval(<<'.,.,', 'parser.y', 1087)
     2956module_eval(<<'.,.,', 'parser.y', 1105)
    36192957  def _reduce_355(val, _values, result)
    36202958        result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true,:false_valid => false)
     
    36242962.,.,
    36252963
    3626 module_eval(<<'.,.,', 'parser.y', 1091)
     2964module_eval(<<'.,.,', 'parser.y', 1109)
    36272965  def _reduce_356(val, _values, result)
    36282966        result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => false,:false_valid => true)
     
    36322970.,.,
    36332971
    3634 module_eval(<<'.,.,', 'parser.y', 1096)
     2972module_eval(<<'.,.,', 'parser.y', 1114)
    36352973  def _reduce_357(val, _values, result)
    36362974        result = val[0]
     
    36402978.,.,
    36412979
    3642 module_eval(<<'.,.,', 'parser.y', 1100)
     2980module_eval(<<'.,.,', 'parser.y', 1118)
    36432981  def _reduce_358(val, _values, result)
    36442982        raise 'Not implemented yet'
     
    36482986.,.,
    36492987
    3650 module_eval(<<'.,.,', 'parser.y', 1104)
     2988module_eval(<<'.,.,', 'parser.y', 1122)
    36512989  def _reduce_359(val, _values, result)
    36522990        raise 'Not implemented yet'
     
    36663004# reduce 364 omitted
    36673005
    3668 module_eval(<<'.,.,', 'parser.y', 1116)
     3006module_eval(<<'.,.,', 'parser.y', 1134)
    36693007  def _reduce_365(val, _values, result)
    36703008        @in_interval = false
    3671     @@log.info("#{__FILE__}:#{__LINE__}, #{val[0]}|#{val[2]} at #{@filename}")
    3672  
    3673     result
    3674   end
    3675 .,.,
    3676 
    3677 module_eval(<<'.,.,', 'parser.y', 1123)
     3009    @@logger.debug("#{__FILE__}:#{__LINE__}, #{val[0]}|#{val[2]} at #{@filename}")
     3010 
     3011    result
     3012  end
     3013.,.,
     3014
     3015module_eval(<<'.,.,', 'parser.y', 1141)
    36783016  def _reduce_366(val, _values, result)
    36793017          result = val[0]
     
    36833021.,.,
    36843022
    3685 module_eval(<<'.,.,', 'parser.y', 1127)
     3023module_eval(<<'.,.,', 'parser.y', 1145)
    36863024  def _reduce_367(val, _values, result)
    36873025          result = val[0]
     
    36913029.,.,
    36923030
    3693 # reduce 368 omitted
     3031module_eval(<<'.,.,', 'parser.y', 1151)
     3032  def _reduce_368(val, _values, result)
     3033        @@logger.debug("#{__FILE__}:#{__LINE__}, START_TERM_CODE_CONSTRAINT = #{val[0]} at #{@filename}")
     3034    @@logger.debug("#{__FILE__}:#{__LINE__}, term_code_body = #{val[1]}")
     3035    @@logger.debug("#{__FILE__}:#{__LINE__}, END_TERM_CODE_CONSTRAINT = #{val[2]}")
     3036    result = val[1]
     3037 
     3038    result
     3039  end
     3040.,.,
    36943041
    36953042# reduce 369 omitted
     
    36993046# reduce 371 omitted
    37003047
    3701 module_eval(<<'.,.,', 'parser.y', 1142)
     3048module_eval(<<'.,.,', 'parser.y', 1167)
    37023049  def _reduce_372(val, _values, result)
    37033050          result = val[0]
     
    37073054.,.,
    37083055
    3709 module_eval(<<'.,.,', 'parser.y', 1147)
     3056module_eval(<<'.,.,', 'parser.y', 1172)
    37103057  def _reduce_373(val, _values, result)
    37113058          result = val[0]
     
    37153062.,.,
    37163063
    3717 module_eval(<<'.,.,', 'parser.y', 1151)
     3064module_eval(<<'.,.,', 'parser.y', 1176)
    37183065  def _reduce_374(val, _values, result)
    3719         @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{word} at #{@filename}")
     3066        @@logger.debug("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{word} at #{@filename}")
    37203067      result = val[0]
    37213068 
     
    37243071.,.,
    37253072
    3726 module_eval(<<'.,.,', 'parser.y', 1162)
     3073module_eval(<<'.,.,', 'parser.y', 1187)
    37273074  def _reduce_375(val, _values, result)
    37283075        result = val[0]
  • ruby/branches/0.5/lib/adl_parser/lib/parser.y

    r116 r290  
    4040   
    4141    archetype_id = val[0][:archetype_id]
     42    parent_archtype_id = val[1][:parent_archtype_id] if val[1]
    4243    adl_version = val[0][:arch_head][:arch_meta_data][:adl_version]
    4344    concept = val[2]
     
    4546    archetype = OpenEHR::AM::Archetype::ARCHETYPE.create(
    4647                                                         :archetype_id => archetype_id,
     48                                                         :parent_archtype_id => parent_archtype_id,
    4749                                                         :adl_version => adl_version,
    4850                                                         :concept => concept,
     
    5355      archetype.original_language = language
    5456    end
    55     @@log.info("#{__FILE__}:#{__LINE__}: archetype = #{archetype} at #{@filename}:#{@lineno}")
     57    @@logger.debug("#{__FILE__}:#{__LINE__}: archetype = #{archetype.to_yaml} at #{@filename}:#{@lineno}")
    5658    result = archetype
    5759  }
     
    104106arch_specialisation: #-- empty is ok
    105107  | SYM_SPECIALIZE V_ARCHETYPE_ID
     108  {
     109    result = {:parent_archtype_id => val[1]}
     110  }
    106111  | SYM_SPECIALIZE error
    107112
     
    150155  {
    151156    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}")
     157    @@logger.debug("#{__FILE__}:#{__LINE__}: c_complex_object = #{val[0]} at #{@filename}:#{@lineno}")
    153158    result = val[0]
    154159  }
     
    201206
    202207#------------------------- node types -----------------------
    203 
    204 c_object: v_c_domain_type
    205   {
    206     result = val[0]
    207   }
    208   | c_complex_object
    209   {
    210     @@log.info("#{__FILE__}:#{__LINE__}: c_complex_object = #{val[0].inspect} at #{@filename}:#{@lineno}")
     208### http://www.openehr.org/svn/ref_impl_eiffel/TRUNK/components/adl_parser/src/syntax/cadl/parser/cadl_validator.html
     209### c_object:  c_complex_object
     210### | archetype_internal_ref
     211### | archetype_slot
     212### | constraint_ref
     213### | c_code_phrase
     214### | c_ordinal
     215### | c_primitive_object
     216### | V_C_DOMAIN_TYPE
     217### | ERR_C_DOMAIN_TYPE
     218### | error
     219c_object: c_complex_object
     220  {
     221    @@logger.debug("#{__FILE__}:#{__LINE__}: c_complex_object = #{val[0].inspect} at #{@filename}:#{@lineno}")
    211222    result = val[0]
    212223  }
     
    241252    result = val[0]
    242253  }
     254  | v_c_domain_type
     255  {
     256    result = val[0]
     257  }
     258
    243259#  | v_c_domain_type
    244260#  | V_C_DOMAIN_TYPE
     
    297313c_primitive: c_integer
    298314  {
    299     @@log.info("#{__FILE__}:#{__LINE__}: c_integer = #{val[0]} at #{@filename}:#{@lineno}")
     315    @@logger.debug("#{__FILE__}:#{__LINE__}: c_integer = #{val[0]} at #{@filename}:#{@lineno}")
    300316    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_INTEGER.create do |c_integer|
    301317      c_integer.list
     
    306322  | c_real
    307323  {
    308     @@log.info("#{__FILE__}:#{__LINE__}: c_real = #{val[0]} at #{@filename}:#{@lineno}")
     324    @@logger.debug("#{__FILE__}:#{__LINE__}: c_real = #{val[0]} at #{@filename}:#{@lineno}")
    309325    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_REAL.new
    310326  }
    311327  | c_date
    312328  {
    313     @@log.info("#{__FILE__}:#{__LINE__}: c_date = #{val[0]} at #{@filename}:#{@lineno}")
     329    @@logger.debug("#{__FILE__}:#{__LINE__}: c_date = #{val[0]} at #{@filename}:#{@lineno}")
    314330    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE.new
    315331  }
    316332  | c_time
    317333  {
    318     @@log.info("#{__FILE__}:#{__LINE__}: c_time = #{val[0]} at #{@filename}:#{@lineno}")
     334    @@logger.debug("#{__FILE__}:#{__LINE__}: c_time = #{val[0]} at #{@filename}:#{@lineno}")
    319335    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_TIME.new
    320336  }
    321337  | c_date_time
    322338  {
    323     @@log.info("#{__FILE__}:#{__LINE__}: c_date_time = #{val[0]} at #{@filename}:#{@lineno}")
     339    @@logger.debug("#{__FILE__}:#{__LINE__}: c_date_time = #{val[0]} at #{@filename}:#{@lineno}")
    324340    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME.new
    325341  }
    326342  | c_duration
    327343  {
    328     @@log.info("#{__FILE__}:#{__LINE__}: c_duration = #{val[0]} at #{@filename}:#{@lineno}")
     344    @@logger.debug("#{__FILE__}:#{__LINE__}: c_duration = #{val[0]} at #{@filename}:#{@lineno}")
    329345    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DURATION.new
    330346  }
    331347  | c_string
    332348  {
    333     @@log.info("#{__FILE__}:#{__LINE__}: c_string = #{val[0]} at #{@filename}:#{@lineno}")
     349    @@logger.debug("#{__FILE__}:#{__LINE__}: c_string = #{val[0]} at #{@filename}:#{@lineno}")
    334350    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_STRING.new
    335351  }
     
    337353  {
    338354    assert_at(__FILE__,__LINE__){val[0].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN)}
    339     @@log.info("#{__FILE__}:#{__LINE__}: c_boolean = #{val[0]} at #{@filename}:#{@lineno}")
     355    @@logger.debug("#{__FILE__}:#{__LINE__}: c_boolean = #{val[0]} at #{@filename}:#{@lineno}")
    340356    result = val[0]
    341357  }
     
    377393c_attr_head: V_ATTRIBUTE_IDENTIFIER c_existence
    378394  {
    379     @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]}, c_existence = #{val[1]} at #{@filename}")
     395    @@logger.debug("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]}, c_existence = #{val[1]} at #{@filename}")
    380396    result = OpenEHR::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE.new(
    381397                                                                              :rm_attribute_name => val[0],
     
    387403  {
    388404    assert_at(__FILE__,__LINE__){ val[2].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY) }
    389     @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER: #{val[0]}, c_existence = #{val[1]}, c_cardinality = #{val[2]} at #{@filename}")
     405    @@logger.debug("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER: #{val[0]}, c_existence = #{val[1]}, c_cardinality = #{val[2]} at #{@filename}")
    390406    result = OpenEHR::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE.new(
    391407                                                                                :rm_attribute_name => val[0],
     
    469485attr_val: attr_id SYM_EQ object_block
    470486  {
    471     @@log.info("#{__FILE__}:#{__LINE__}: attr_id = #{val[0]}, object_block = #{val[2]} at #{@filename}:#{@lineno}")
     487    @@logger.debug("#{__FILE__}:#{__LINE__}: attr_id = #{val[0]} at #{@filename}:#{@lineno}")
    472488    result = {:attr_id => val[0], :object_block => val[2]}
    473489  }
     
    475491attr_id: V_ATTRIBUTE_IDENTIFIER
    476492  {
    477     @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}:#{@lineno}")
     493    @@logger.debug("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}:#{@lineno}")
    478494    result = val[0]
    479495  }
     
    514530multiple_attr_object_block_head: SYM_START_DBLOCK
    515531  {
    516     @@log.info("SYM_START_DBLOCK: #{val[0]} at #{@filename}:#{@lineno}")
    517532    result = val[0]
    518533  }
     
    529544keyed_object: object_key SYM_EQ object_block
    530545  {
    531     @@log.info("#{__FILE__}:#{__LINE__}: keyed_object = #{val[0]}, object_block = #{val[2]} at #{@filename}:#{@lineno}")
    532     result = {:object_key => val[0], :object_block => val[1]}
     546    @@logger.debug("#{__FILE__}:#{__LINE__}: keyed_object = #{val[0]} at #{@filename}:#{@lineno}")
     547    result = {:object_key => val[0], :object_block => val[2]}
    533548  }
    534549
    535550object_key: Left_bracket_code simple_value Right_bracket_code
    536551  {
    537     @@log.info("object_key: [#{val[1]}] at #{@filename}:#{@lineno}")
     552    @@logger.debug("object_key: [#{val[1]}] at #{@filename}:#{@lineno}")
    538553    result = val[1]
    539554  }
     
    548563  }
    549564
    550 untyped_single_attr_object_block: single_attr_object_complex_head SYM_END_DBLOCK # <>
    551   {
    552     @@log.info("#{__FILE__}:#{__LINE__}: single_attr_object_complex_head = #{val[0]} at #{@filename}:#{@lineno}")
     565untyped_single_attr_object_block: single_attr_object_complex_head SYM_END_DBLOCK # >
     566  {
     567    @@logger.debug("#{__FILE__}:#{__LINE__}: single_attr_object_complex_head = #{val[0]} at #{@filename}:#{@lineno}")
    553568    result = {:single_attr_object_complex_head => val[0]}
    554569  }
    555570  | single_attr_object_complex_head attr_vals SYM_END_DBLOCK
    556571  {
    557     @@log.info("#{__FILE__}:#{__LINE__}: single_attr_object_complex_head = #{val[0]}, attr_vals = #{val[1]} at #{@filename}:#{@lineno}")
     572    @@logger.debug("#{__FILE__}:#{__LINE__}: attr_vals = #{val[1]} at #{@filename}:#{@lineno}")
    558573    result = {:single_attr_object_complex_head => val[0], :attr_vals => val[1]}
    559574  }
     
    561576primitive_object_block: untyped_primitive_object_block
    562577  {
    563     @@log.info("#{__FILE__}:#{__LINE__}: untyped_primitive_object_block = #{val[0]} at #{@filename}:#{@lineno}")
     578    @@logger.debug("#{__FILE__}:#{__LINE__}: untyped_primitive_object_block = #{val[0]} at #{@filename}:#{@lineno}")
    564579    result = {:untyped_primitive_object_block => val[0]}
    565580  }
    566581  | type_identifier untyped_primitive_object_block
    567582  {
    568     @@log.info("#{__FILE__}:#{__LINE__}: type_identifier = #{val[0]}, untyped_primitive_object_block = #{val[1]} at #{@filename}:#{@lineno}")
     583    @@logger.debug("#{__FILE__}:#{__LINE__}: type_identifier = #{val[0]}, untyped_primitive_object_block = #{val[1]} at #{@filename}:#{@lineno}")
    569584    result = {:type_identifier => val[0], :untyped_primitive_object_block => val[1]}
    570585  }
    571586untyped_primitive_object_block: SYM_START_DBLOCK primitive_object_value SYM_END_DBLOCK
    572587  {
    573     @@log.info("#{__FILE__}:#{__LINE__}: primitive_object_block = <#{val[1]}> at #{@filename}:#{@lineno}")
     588    @@logger.debug("#{__FILE__}:#{__LINE__}: primitive_object_block = <#{val[1]}> at #{@filename}:#{@lineno}")
    574589    result = val[1]
    575590  }
     
    596611simple_value: string_value
    597612  {
    598     @@log.info("string_value: #{val[0]} at #{@filename}:#{@lineno}")
     613    @@logger.debug("string_value: #{val[0]} at #{@filename}:#{@lineno}")
    599614    result = val[0]
    600615  }
    601616  | integer_value
    602617  {
    603     @@log.info("integer_value: #{val[0]} at #{@filename}:#{@lineno}")
     618    @@logger.debug("integer_value: #{val[0]} at #{@filename}:#{@lineno}")
    604619    result = val[0]
    605620  }
    606621  | real_value
    607622  {
    608     @@log.info("real_value: #{val[0]} at #{@filename}:#{@lineno}")
     623    @@logger.debug("real_value: #{val[0]} at #{@filename}:#{@lineno}")
    609624    result = val[0]
    610625  }
    611626  | boolean_value
    612627  {
    613     @@log.info("boolean_value: #{val[0]} at #{@filename}:#{@lineno}")
     628    @@logger.debug("boolean_value: #{val[0]} at #{@filename}:#{@lineno}")
    614629    result = val[0]
    615630  }
    616631  | character_value
    617632  {
    618     @@log.info("character_value: #{val[0]} at #{@filename}:#{@lineno}")
     633    @@logger.debug("character_value: #{val[0]} at #{@filename}:#{@lineno}")
    619634    result = val[0]
    620635  }
    621636  | date_value
    622637  {
    623     @@log.info("date_value: #{val[0]} at #{@filename}:#{@lineno}")
     638    @@logger.debug("date_value: #{val[0]} at #{@filename}:#{@lineno}")
    624639    result = val[0]
    625640  }
    626641  | time_value
    627642  {
    628     @@log.info("time_value: #{val[0]} at #{@filename}:#{@lineno}")
     643    @@logger.debug("time_value: #{val[0]} at #{@filename}:#{@lineno}")
    629644    result = val[0]
    630645  }
    631646  | date_time_value
    632647  {
    633     @@log.info("date_time_value: #{val[0]} at #{@filename}:#{@lineno}")
     648    @@logger.debug("date_time_value: #{val[0]} at #{@filename}:#{@lineno}")
    634649    result = val[0]
    635650  }
    636651  | duration_value
    637652  {
    638     @@log.info("duration_value: #{val[0]} at #{@filename}:#{@lineno}")
     653    @@logger.debug("duration_value: #{val[0]} at #{@filename}:#{@lineno}")
    639654    result = val[0]
    640655  }
    641656  | uri_value
    642657  {
    643     @@log.info("uri_value: #{val[0]} at #{@filename}:#{@lineno}")
     658    @@logger.debug("uri_value: #{val[0]} at #{@filename}:#{@lineno}")
    644659    result = val[0]
    645660  }
     
    664679type_identifier: V_TYPE_IDENTIFIER
    665680  {
    666     @@log.info("V_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
     681    @@logger.debug("V_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
    667682    result = val[0]
    668683  }
    669684  | V_GENERIC_TYPE_IDENTIFIER
    670685  {
    671     @@log.info("V_GENERIC_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
     686    @@logger.debug("V_GENERIC_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
    672687    result = val[0]
    673688  }
     
    675690string_value: V_STRING
    676691  {
    677     @@log.info("V_STRING: #{val[0]} at #{@filename}:#{@lineno}")
     692    @@logger.debug("V_STRING: #{val[0]} at #{@filename}:#{@lineno}")
    678693    result = val[0]
    679694  }
     
    790805
    791806date_value: V_ISO8601_EXTENDED_DATE
     807  {
     808    result = val[0]
     809  }
    792810
    793811date_list_value: date_value Comma_code date_value
     
    839857duration_value: V_ISO8601_DURATION
    840858  {
    841     @@log.info("V_ISO8601_DURATION: #{val[0]} at #{@filename}:#{@lineno}")
     859    @@logger.debug("V_ISO8601_DURATION: #{val[0]} at #{@filename}:#{@lineno}")
    842860    result = val[0]
    843861  }
     
    859877term_code: V_QUALIFIED_TERM_CODE_REF
    860878  {
    861     @@log.info("#{__FILE__}:#{__LINE__}: V_QUALIFIED_TERM_CODE_REF = #{val[0]} at #{@filename}:#{@lineno}")
     879    @@logger.debug("#{__FILE__}:#{__LINE__}: V_QUALIFIED_TERM_CODE_REF = #{val[0]} at #{@filename}:#{@lineno}")
    862880    result = val[0]
    863881  }
     
    869887uri_value: V_URI
    870888  {
    871     @@log.info("#{__FILE__}:#{__LINE__}: V_URI = #{val[0]} at #{@filename}:#{@lineno}")
     889    @@logger.debug("#{__FILE__}:#{__LINE__}: V_URI = #{val[0]} at #{@filename}:#{@lineno}")
    872890    result = val[0]
    873891  }
     
    939957path_segment: V_ATTRIBUTE_IDENTIFIER V_LOCAL_TERM_CODE_REF
    940958  {
    941     @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}")
     959    @@logger.debug("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}")
    942960  }
    943961  | V_ATTRIBUTE_IDENTIFIER
    944962  {
    945     @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}")
     963    @@logger.debug("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}")
    946964  }
    947965
     
    11161134  {
    11171135    @in_interval = false
    1118     @@log.info("#{__FILE__}:#{__LINE__}, #{val[0]}|#{val[2]} at #{@filename}")
     1136    @@logger.debug("#{__FILE__}:#{__LINE__}, #{val[0]}|#{val[2]} at #{@filename}")
    11191137  }
    11201138
     
    11291147  }
    11301148
    1131 #term_code_constraint_section: START_TERM_CODE_CONSTRAINT term_code_body Right_bracket_code
     1149#                             [[a-zA-Z0-9\(\)\._\-]+::[ \t\n]*          [[a-zA-Z0-9\._\-]*[ \t]*]
    11321150term_code_constraint_section: START_TERM_CODE_CONSTRAINT term_code_body END_TERM_CODE_CONSTRAINT
     1151  {
     1152    @@logger.debug("#{__FILE__}:#{__LINE__}, START_TERM_CODE_CONSTRAINT = #{val[0]} at #{@filename}")
     1153    @@logger.debug("#{__FILE__}:#{__LINE__}, term_code_body = #{val[1]}")
     1154    @@logger.debug("#{__FILE__}:#{__LINE__}, END_TERM_CODE_CONSTRAINT = #{val[2]}")
     1155    result = val[1]
     1156  }
     1157
     1158
    11331159term_code_body: # empty
    11341160  | TERM_CODE
    11351161  | term_code_body TERM_CODE
    1136 ### term_code_constraint_section: START_TERM_CODE_CONSTRAINT term_code_body END_TERM_CODE_CONSTRAINT
    11371162### term_code_body: TERM_CODE
    11381163###   | term_code_body TERM_CODE
     
    11501175  | V_ATTRIBUTE_IDENTIFIER
    11511176  {
    1152     @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{word} at #{@filename}")
     1177    @@logger.debug("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{word} at #{@filename}")
    11531178      result = val[0]
    11541179  }
     
    11711196$:.unshift File.join(File.dirname(__FILE__))
    11721197require 'logger'
    1173 #require 'lib/util.rb'
    1174 #require 'lib/scanner.rb'
    1175 require 'lib/adl_parser.rb'
     1198require 'yaml'
    11761199require 'rubygems'
     1200require 'adl_parser.rb'
    11771201require 'am.rb'
     1202require 'rm.rb'
    11781203$DEBUG = false
    11791204
     
    11891214
    11901215if $DEBUG
    1191   @@log = Logger.new('log/parser.log','daily')
    1192   @@log.level = Logger::INFO
     1216  @@logger = Logger.new('log/parser.log','daily')
     1217  @@logger.level = Logger::DEBUG
    11931218else
    1194   @@log = Logger.new(STDOUT)
    1195   @@log.level = Logger::WARN
     1219  @@logger = Logger.new(STDOUT)
     1220  @@logger.level = Logger::WARN
    11961221end
    11971222
    1198 @@dadl_scanner = OpenEHR::ADL::Scanner::DADL::RootScanner.new
    1199 @@cadl_scanner = OpenEHR::ADL::Scanner::CADL::RootScanner.new
    12001223
    12011224###----------/* keywords */ ---------------------------------------------
     
    12571280###----------/* Scanner */ -----------------------------------------------
    12581281
     1282
    12591283def scan
     1284  @@logger.debug("#{__FILE__}:#{__LINE__}: Entering scan at #{@filename}:#{@lineno}:")
     1285  scanner = OpenEHR::ADL::Scanner::ADLScanner.new(@adl_type, @filename)
     1286
    12601287  until @data.nil?  do
    1261     case @adl_type.last
    1262     when :adl
    1263       @data = scan_adl(@data) do |sym, val|
     1288    @data = scanner.scan(@data) do |sym, val|
    12641289        yield sym, val
    1265       end
    1266     when :dadl
    1267       @data = scan_dadl(@data) do |sym, val|
    1268         yield sym, val
    1269       end
    1270     when :cadl
    1271       @data = scan_cadl(@data) do |sym, val|
    1272         yield sym, val
    1273       end
    1274     when :regexp
    1275       @data = scan_regexp(@data) do |sym, val|
    1276         yield sym, val
    1277       end
    1278     else
    1279       raise
    12801290    end
    12811291    @data = $' # variable $' receives the string after the match
     
    12841294  yield false, '$'
    12851295end # of scan
    1286 
    1287 def scan_adl(data)
    1288   until data.nil?  do
    1289     case @adl_type.last
    1290     when :adl
    1291 #      puts "Entering scan_adl"
    1292       case data
    1293       when /\A\n/ # carriage return
    1294         @lineno += 1
    1295         ;
    1296       when /\A[ \t\r\f]+/ #just drop it
    1297         ;
    1298       when /\A--.*\n/ # single line comment
    1299         @lineno += 1
    1300         @@log.info("#{__FILE__}:#{__LINE__}: scan_adl: COMMENT = #{$&} at #{@filename}:#{@lineno}")
    1301         ;
    1302       when /\Adescription/   # description
    1303         yield :SYM_DESCRIPTION, :SYM_DESCRIPTION
    1304       when /\Adefinition/   # definition
    1305         yield :SYM_DEFINITION, :SYM_DEFINITION
    1306 #        @adl_type.push(:cadl)
    1307         ###----------/* symbols */ -------------------------------------------------
    1308       when /\A[A-Z][a-zA-Z0-9_]*/
    1309         yield :V_TYPE_IDENTIFIER, $&
    1310       when /\A[a-zA-Z][a-zA-Z0-9_-]+\.[a-zA-Z][a-zA-Z0-9_-]+\.[a-zA-Z0-9]+/   #V_ARCHETYPE_ID
    1311         yield :V_ARCHETYPE_ID, $&
    1312       when /\A[a-z][a-zA-Z0-9_]*/
    1313 #        word = $&.downcase
    1314         word = $&
    1315         if @@adl_reserved[word]
    1316           @@log.info("#{__FILE__}:#{__LINE__}: scan_adl: @@adl_reserved = #{@@adl_reserved[word]} at #{@filename}:#{@lineno}")
    1317           yield @@adl_reserved[word], @@adl_reserved[word]
    1318         elsif #/\A[A-Z][a-zA-Z0-9_]*/
    1319           @@log.info("#{__FILE__}:#{__LINE__}: scan_adl: V_ATTRIBUTE_IDENTIFIER = #{$&} at #{@filename}:#{@lineno}")
    1320           yield :V_ATTRIBUTE_IDENTIFIER, $&
    1321         end
    1322       when /\A\=/   # =
    1323         yield :SYM_EQ, :SYM_EQ
    1324       when /\A\>=/   # >=
    1325         yield :SYM_GE, :SYM_GE
    1326       when /\A\<=/   # <=
    1327         yield :SYM_LE, :SYM_LE
    1328       when /\A\</   # <
    1329         if @in_interval
    1330 #          @start_block_received = false
    1331           yield :SYM_LT, :SYM_LT
    1332         else
    1333 #          @start_block_received = true
    1334           @adl_type.push(:dadl)
    1335           yield :SYM_START_DBLOCK,  $&
    1336         end
    1337       when /\A\>/   # >
    1338         if @in_interval
    1339           yield :SYM_GT, :SYM_GT
    1340         else
    1341           adl_type = @adl_type.pop
    1342 #          puts "Escaping #{adl_type}"
    1343           assert_at(__FILE__,__LINE__){adl_type == :dadl}
    1344           yield :SYM_END_DBLOCK, :SYM_END_DBLOCK
    1345         end
    1346       when /\A\{/   # {
    1347         @adl_type.push(:cadl)
    1348         @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: entering cADL at #{@filename}:#{@lineno}")
    1349         yield :SYM_START_CBLOCK, :SYM_START_CBLOCK
    1350       when /\A\}/   # }
    1351         adl_type = @adl_type.pop
    1352 #        puts "Escaping #{adl_type}"
    1353         assert_at(__FILE__,__LINE__){adl_type == :cadl}
    1354         @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: exiting cADL at #{@filename}:#{@lineno}")
    1355         yield :SYM_END_CBLOCK, $&
    1356       when /\A\-/   # -
    1357         yield :Minus_code, :Minus_code
    1358       when /\A\+/   # +
    1359         yield :Plus_code, :Plus_code
    1360       when /\A\*/   # *
    1361         yield :Star_code, :Star_code
    1362       when /\A\//   # /
    1363         yield :Slash_code, :Slash_code
    1364       when /\A\^/   # ^
    1365         yield :Caret_code, :Caret_code
    1366       when /\A\=/   # =
    1367         yield :Equal_code, :Equal_code
    1368       when /\A\.\.\./   # ...
    1369         yield :SYM_LIST_CONTINUE, :SYM_LIST_CONTINUE
    1370       when /\A\.\./   # ..
    1371         yield :SYM_ELLIPSIS, :SYM_ELLIPSIS
    1372       when /\A\./   # .
    1373         yield :Dot_code, :Dot_code
    1374       when /\A\;/   # ;
    1375         yield :Semicolon_code, :Semicolon_code
    1376       when /\A\,/   # ,
    1377         yield :Comma_code, :Comma_code
    1378       when /\A\:/   # :
    1379         yield :Colon_code, :Colon_code
    1380       when /\A\!/   # !
    1381         yield :Exclamation_code, :Exclamation_code
    1382       when /\A\(/   # (
    1383         yield :Left_parenthesis_code, :Left_parenthesis_code
    1384       when /\A\)/   # )
    1385         yield :Right_parenthesis_code, :Right_parenthesis_code
    1386       when /\A\$/   # $
    1387         yield :Dollar_code, :Dollar_code
    1388       when /\A\?\?/   # ??
    1389         yield :SYM_DT_UNKNOWN, :SYM_DT_UNKNOWN
    1390       when /\A\?/   # ?
    1391         yield :Question_mark_code, :Question_mark_code
    1392       when /\A[0-9]+\.[0-9]+(\.[0-9]+)*/   # ?
    1393         yield :V_VERSION_STRING, :V_VERSION_STRING
    1394       when /\A\|/   # |
    1395         if @in_interval
    1396           @in_interval = false
    1397         else
    1398           @in_interval = true
    1399         end
    1400         yield :SYM_INTERVAL_DELIM, :SYM_INTERVAL_DELIM
    1401       when /\A\[[a-zA-Z0-9()\._-]+::[a-zA-Z0-9\._-]+\]/
    1402 #      when /\A\[[a-zA-Z0-9()\._-]+\:\:[a-zA-Z0-9\._-]+\]/   #V_QUALIFIED_TERM_CODE_REF form [ICD10AM(1998)::F23]
    1403         yield :V_QUALIFIED_TERM_CODE_REF, $&
    1404       when /\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/   #V_LOCAL_TERM_CODE_REF
    1405         yield :V_LOCAL_TERM_CODE_REF, $&
    1406       when /\A\[/   # [
    1407         yield :Left_bracket_code, :Left_bracket_code
    1408       when /\A\]/   # ]
    1409         yield :Right_bracket_code, :Right_bracket_code
    1410 
    1411       when /\A\[[a-zA-Z0-9._\- ]+::[a-zA-Z0-9._\- ]+\]/   #ERR_V_QUALIFIED_TERM_CODE_REF
    1412         yield :ERR_V_QUALIFIED_TERM_CODE_REF, $&
    1413       when /\Aa[ct][0-9.]+/   #V_LOCAL_CODE
    1414         yield :V_LOCAL_CODE, $&
    1415       when /\A[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9]:[0-6][0-9](,[0-9]+)?(Z|[+-][0-9]{4})?|[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9](Z|[+-][0-9]{4})?|[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9](Z|[+-][0-9]{4})?/   #V_ISO8601_EXTENDED_DATE_TIME YYYY-MM-DDThh:mm:ss[,sss][Z|+/- -n-n-n-n-]-
    1416         yield :V_ISO8601_EXTENDED_DATE_TIME, $&
    1417       when /\A[0-2][0-9]:[0-6][0-9]:[0-6][0-9](,[0-9]+)?(Z|[+-][0-9]{4})?|[0-2][0-9]:[0-6][0-9](Z|[+-][0-9]{4})? /   #V_ISO8601_EXTENDED_TIME hh:mm:ss[,sss][Z|+/-nnnn]
    1418         yield :V_ISO8601_EXTENDED_TIME, $&
    1419       when /\A[0-9]{4}-[0-1][0-9]-[0-3][0-9]|[0-9]{4}-[0-1][0-9]/   #V_ISO8601_EXTENDED_DATE YYYY-MM-DD
    1420         yield :V_ISO8601_EXTENDED_DATE, $&
    1421       when /\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/   #V_GENERIC_TYPE_IDENTIFIER
    1422         yield :V_GENERIC_TYPE_IDENTIFIER, $&
    1423       when /\A[0-9]+|[0-9]+[eE][+-]?[0-9]+/   #V_INTEGER
    1424         yield :V_INTEGER, $&
    1425       when /\A[0-9]+\.[0-9]+|[0-9]+\.[0-9]+[eE][+-]?[0-9]+ /   #V_REAL
    1426         yield :V_REAL, $&
    1427         #    when /\A"((?:[^"\\]+|\\.)*)"/ #V_STRING
    1428       when /\A"([^"]*)"/m #V_STRING
    1429         yield :V_STRING, $1
    1430       when /\A[a-z]+:\/\/[^<>|\\{}^~"\[\] ]*/ #V_URI
    1431         yield :V_URI, $&
    1432       when /\AP([0-9]+[yY])?([0-9]+[mM])?([0-9]+[wW])?([0-9]+[dD])?T([0-9]+[hH])?([0-9]+[mM])?([0-9]+[sS])?|P([0-9]+[yY])?([0-9]+[mM])?([0-9]+[wW])?([0-9]+[dD])?/   #V_ISO8601_DURATION PnYnMnWnDTnnHnnMnnS
    1433         yield :V_ISO8601_DURATION, $&
    1434       when /\A\S/ #UTF8CHAR
    1435         yield :UTF8CHAR, $&
    1436       end
    1437       data = $' # variable $' receives the string after the match
    1438     when :dadl
    1439 #      puts "Entering scan_dadl"
    1440       data = scan_dadl(data) do |sym, val|
    1441         yield sym, val
    1442       end
    1443     when :cadl
    1444 #      puts "Entering scan_cadl"
    1445       data = scan_cadl(data) do |sym, val|
    1446         yield sym, val
    1447       end
    1448     when :regexp
    1449 #      puts "Entering scan_regexp"
    1450       data = scan_regexp(data) do |sym, val|
    1451         yield sym, val
    1452       end
    1453     when :term_constraint
    1454 #      puts "Entering scan_term_constraint"
    1455       data = scan_term_constraint(data) do |sym, val|
    1456         yield sym, val
    1457       end
    1458     else
    1459       raise
    1460     end
    1461   end
    1462 end # scan_adl
    1463 
    1464 
    1465 def scan_cadl(data)
    1466   until data.nil?  do
    1467     case @adl_type.last
    1468     when :cadl
    1469 #      puts "Entering scan_cadl"
    1470       case scanned = @@cadl_scanner.parse(data)
    1471       when Yaparc::Result::OK
    1472         if scanned.value[0] == :START_V_C_DOMAIN_TYPE_BLOCK
    1473           @in_c_domain_type = true
    1474           @adl_type.push(:dadl)
    1475           yield scanned.value
    1476         else
    1477           yield scanned.value
    1478         end
    1479         data = scanned.input
    1480       end
    1481 
    1482       case data
    1483       when /\A\n/ # carriage return
    1484         @lineno += 1
    1485         ;
    1486       when /\A[ \t\r\f]+/ #just drop it
    1487         ;
    1488       when /\A--.*\n/ # single line comment
    1489         @lineno += 1
    1490         @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: COMMENT = #{$&} at #{@filename}:#{@lineno}")
    1491         ;
    1492         ###----------/* symbols */ -------------------------------------------------
    1493       when /\A\=/   # =
    1494         yield :SYM_EQ, :SYM_EQ
    1495       when /\A\>=/   # >=
    1496         yield :SYM_GE, :SYM_GE
    1497       when /\A\<=/   # <=
    1498         yield :SYM_LE, :SYM_LE
    1499 ###       when /\A[A-Z][a-zA-Z0-9_]*[ \n]*\</   # V_C_DOMAIN_TYPE
    1500 ###         @in_c_domain_type = true
    1501 ###         @adl_type.push(:dadl)
    1502 ###         yield :START_V_C_DOMAIN_TYPE_BLOCK, $&
    1503       when /\A\</   # <
    1504         if @in_interval
    1505           yield :SYM_LT, :SYM_LT
    1506         else
    1507           @adl_type.push(:dadl)
    1508           yield :SYM_START_DBLOCK,  $&
    1509         end
    1510       when /\A\>/   # >
    1511         if @in_interval
    1512           yield :SYM_GT, :SYM_GT
    1513         else
    1514           adl_type = @adl_type.pop
    1515 #          puts "Escaping #{adl_type}"
    1516           assert_at(__FILE__,__LINE__){adl_type == :dadl}
    1517           yield :SYM_END_DBLOCK, :SYM_END_DBLOCK
    1518         end
    1519       when /\A\-/   # -
    1520         yield :Minus_code, :Minus_code
    1521       when /\A\+/   # +
    1522         yield :Plus_code, :Plus_code
    1523       when /\A\*/   # *
    1524         yield :Star_code, :Star_code
    1525       when /\A\//   # /
    1526         yield :Slash_code, :Slash_code
    1527       when /\A\^/   # ^
    1528         yield :Caret_code, :Caret_code
    1529       when /\A\.\.\./   # ...
    1530         yield :SYM_LIST_CONTINUE, :SYM_LIST_CONTINUE
    1531       when /\A\.\./   # ..
    1532         yield :SYM_ELLIPSIS, :SYM_ELLIPSIS
    1533       when /\A\./   # .
    1534         yield :Dot_code, :Dot_code
    1535       when /\A\;/   # ;
    1536         yield :Semicolon_code, :Semicolon_code
    1537       when /\A\,/   # ,
    1538         yield :Comma_code, :Comma_code
    1539       when /\A\:/   # :
    1540         yield :Colon_code, :Colon_code
    1541       when /\A\!/   # !
    1542         yield :Exclamation_code, :Exclamation_code
    1543       when /\A\(/   # (
    1544         yield :Left_parenthesis_code, :Left_parenthesis_code
    1545       when /\A\)/   # )
    1546         yield :Right_parenthesis_code, :Right_parenthesis_code
    1547       when /\A\{\// #V_REGEXP
    1548         if @adl_type.last != :regexp
    1549           @in_regexp = true
    1550           @adl_type.push(:regexp)
    1551           yield :START_REGEXP_BLOCK, :START_REGEXP_BLOCK
    1552         else
    1553           raise
    1554         end
    1555 #        yield :V_REGEXP, :V_REGEXP
    1556       when /\A\{/   # {
    1557         @adl_type.push(:cadl)
    1558         @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: entering cADL at #{@filename}:#{@lineno}")
    1559         yield :SYM_START_CBLOCK, :SYM_START_CBLOCK
    1560       when /\A\}/   # }
    1561         adl_type = @adl_type.pop
    1562 #        puts "Escaping #{adl_type}"
    1563         assert_at(__FILE__,__LINE__){adl_type == :cadl}
    1564         @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: exiting cADL at #{@filename}:#{@lineno}")
    1565         yield :SYM_END_CBLOCK, :SYM_END_CBLOCK
    1566       when /\A\$/   # $
    1567         yield :Dollar_code, :Dollar_code
    1568       when /\A\?\?/   # ??
    1569         yield :SYM_DT_UNKNOWN, :SYM_DT_UNKNOWN
    1570       when /\A\?/   # ?
    1571         yield :Question_mark_code, :Question_mark_code
    1572       when /\A\|/   # |
    1573         @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: @in_interval = #{@in_interval} at #{@filename}:#{@lineno}")
    1574         if @in_interval
    1575           @in_interval = false
    1576         else
    1577 #          @in_interval = false
    1578           @in_interval = true
    1579         end
    1580         @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: SYM_INTERVAL_DELIM at #{@filename}:#{@lineno}")
    1581         yield :SYM_INTERVAL_DELIM, :SYM_INTERVAL_DELIM
    1582 
    1583       when /\A\[[a-zA-Z0-9._\-]+::[a-zA-Z0-9._\-]+\]/   #V_QUALIFIED_TERM_CODE_REF form [ICD10AM(1998)::F23]
    1584         yield :V_QUALIFIED_TERM_CODE_REF, $&
    1585       when /\A\[[a-zA-Z0-9._\- ]+::[a-zA-Z0-9._\- ]+\]/   #ERR_V_QUALIFIED_TERM_CODE_REF
    1586         yield :ERR_V_QUALIFIED_TERM_CODE_REF, $&
    1587       when /\A\[([a-zA-Z0-9()._\-]+::[a-zA-Z0-9._\_-]+)\]/
    1588         yield :V_TERM_CODE_CONSTRAINT, :V_TERM_CODE_CONSTRAINT
    1589       when /\A\[[a-zA-Z0-9\(\)\._\-]+::[ \t\n]*/
    1590         @adl_type.push(:term_constraint)
    1591         yield :START_TERM_CODE_CONSTRAINT, $&
    1592       when /\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/   #V_LOCAL_TERM_CODE_REF
    1593         yield :V_LOCAL_TERM_CODE_REF, $&
    1594       when /\A\[/   # [
    1595         yield :Left_bracket_code, :Left_bracket_code
    1596       when /\A\]/   # ]
    1597         yield :Right_bracket_code, :Right_bracket_code
    1598       when /\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/   #V_GENERIC_TYPE_IDENTIFIER
    1599         yield :V_GENERIC_TYPE_IDENTIFIER, $&
    1600       when /\A[yY][yY][yY][yY]-[mM?X][mM?X]-[dD?X][dD?X][T\t][hH?X][hH?X]:[mM?X][mM?X]:[sS?X][sS?X]/
    1601         yield :V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN, $&
    1602       when /\A[yY][yY][yY][yY]-[mM?X][mM?X]-[dD?X][dD?X]/
    1603         yield :V_ISO8601_DATE_CONSTRAINT_PATTERN, $&
    1604       when /\A[hH][hH]:[mM?X][mM?X]:[sS?X][sS?X]/
    1605         yield :V_ISO8601_TIME_CONSTRAINT_PATTERN, $&
    1606       when /\A[a-z][a-zA-Z0-9_]*/
    1607         word = $&.dup
    1608         if @@cadl_reserved[word.downcase]
    1609           yield @@cadl_reserved[word.downcase], @@cadl_reserved[word.downcase]
    1610         else
    1611           @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: V_ATTRIBUTE_IDENTIFIER = #{word} at #{@filename}:#{@lineno}")
    1612           yield :V_ATTRIBUTE_IDENTIFIER, word #V_ATTRIBUTE_IDENTIFIER /\A[a-z][a-zA-Z0-9_]*/
    1613         end
    1614       when /\A[A-Z][a-zA-Z0-9_]*/
    1615         word = $&.dup
    1616         if @@cadl_reserved[word.downcase]
    1617           yield @@cadl_reserved[word.downcase], @@cadl_reserved[word.downcase]
    1618         else
    1619           yield :V_TYPE_IDENTIFIER, $&
    1620         end
    1621       when /\Aa[ct][0-9.]+/   #V_LOCAL_CODE
    1622         yield :V_LOCAL_CODE, $&
    1623       when /\A[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9]:[0-6][0-9](,[0-9]+)?(Z|[+-][0-9]{4})?|[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9](Z|[+-][0-9]{4})?|[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9](Z|[+-][0-9]{4})?/   #V_ISO8601_EXTENDED_DATE_TIME YYYY-MM-DDThh:mm:ss[,sss][Z|+/- -n-n-n-n-]-
    1624         yield :V_ISO8601_EXTENDED_DATE_TIME, $&
    1625       when /\A[0-2][0-9]:[0-6][0-9]:[0-6][0-9](,[0-9]+)?(Z|[+-][0-9]{4})?|[0-2][0-9]:[0-6][0-9](Z|[+-][0-9]{4})? /   #V_ISO8601_EXTENDED_TIME hh:mm:ss[,sss][Z|+/-nnnn]
    1626         yield :V_ISO8601_EXTENDED_TIME, $&
    1627       when /\A[0-9]{4}-[0-1][0-9]-[0-3][0-9]|[0-9]{4}-[0-1][0-9]/   #V_ISO8601_EXTENDED_DATE YYYY-MM-DD
    1628         yield :V_ISO8601_EXTENDED_DATE, $&
    1629       when /\A[0-9]+|[0-9]+[eE][+-]?[0-9]+/   #V_INTEGER
    1630         yield :V_INTEGER, $&
    1631       when /\A[0-9]+\.[0-9]+|[0-9]+\.[0-9]+[eE][+-]?[0-9]+ /   #V_REAL
    1632         yield :V_REAL, $&
    1633            when /\A"((?:[^"\\]+|\\.)*)"/ #V_STRING
    1634       when /\A"([^"]*)"/m #V_STRING
    1635         yield :V_STRING, $1
    1636       when /\A[a-z]+:\/\/[^<>|\\{}^~"\[\] ]*/ #V_URI
    1637         yield :V_URI, $&
    1638 ###       when /\AP([0-9]+[yY])?([0-9]+[mM])?([0-9]+[wW])?([0-9]+[dD])?T([0-9]+[hH])?([0-9]+[mM])?([0-9]+[sS])?|P([0-9]+[yY])?([0-9]+[mM])?([0-9]+[wW])?([0-9]+[dD])?/   #V_ISO8601_DURATION PnYnMnWnDTnnHnnMnnS
    1639 ###         yield :V_ISO8601_DURATION, $&
    1640       when /\A\S/ #UTF8CHAR
    1641         yield :UTF8CHAR, $&
    1642       else
    1643         raise
    1644       end
    1645       data = $' # variable $' receives the string after the match
    1646     when :adl
    1647 #      puts "Entering scan_adl"
    1648       data = scan_adl(data) do |sym, val|
    1649         yield sym, val
    1650       end
    1651     when :dadl
    1652 #      puts "Entering scan_dadl"
    1653       data = scan_dadl(data) do |sym, val|
    1654         yield sym, val
    1655       end
    1656     when :regexp
    1657 #      puts "Entering scan_regexp"
    1658       data = scan_regexp(data) do |sym, val|
    1659         yield sym, val
    1660       end
    1661     when :term_constraint
    1662 #      puts "Entering scan_term_constraint"
    1663       data = scan_term_constraint(data) do |sym, val|
    1664         yield sym, val
    1665       end
    1666     else
    1667       raise
    1668     end
    1669   end # of until
    1670 end # of scan_cadl
    1671 
    1672 def scan_dadl(data)
    1673   until data.nil?  do
    1674     case @adl_type.last
    1675     when :dadl
    1676 #      puts "Entering scan_dadl"
    1677       case scanned = @@dadl_scanner.parse(data)
    1678       when Yaparc::Result::OK
    1679         yield scanned.value
    1680         data = scanned.input
    1681       else
    1682       end
    1683 
    1684       case data
    1685       when /\A\n/ # carriage return
    1686         @lineno += 1
    1687         ;
    1688       when /\A[ \t\r\f]+/ #just drop it
    1689         ;
    1690       when /\A--.*\n/ # single line comment
    1691         @lineno += 1
    1692         @@log.info("#{__FILE__}:#{__LINE__}: scan_dadl: COMMENT = #{$&} at #{@filename}:#{@lineno}")
    1693         ;
    1694         ###----------/* symbols */ -------------------------------------------------
    1695       when /\A\=/   # =
    1696         yield :SYM_EQ, :SYM_EQ
    1697       when /\A\>\=/   # >=
    1698         yield :SYM_GE, :SYM_GE
    1699       when /\A\<\=/   # <=
    1700         yield :SYM_LE, :SYM_LE
    1701       when /\A\</   # <
    1702         if @in_interval
    1703           yield :SYM_LT, :SYM_LT
    1704         else
    1705           @adl_type.push(:dadl)
    1706           yield :SYM_START_DBLOCK, :SYM_START_DBLOCK
    1707         end
    1708       when /\A\>/   # >
    1709         if @in_interval
    1710 #          @in_interval = false
    1711           yield :SYM_GT, :SYM_GT
    1712         elsif @in_c_domain_type == true
    1713           assert_at(__FILE__,__LINE__){@adl_type.last == :dadl}
    1714           adl_type = @adl_type.pop
    1715           if @adl_type.last == :cadl
    1716             @in_c_domain_type = false
    1717             yield :END_V_C_DOMAIN_TYPE_BLOCK, $&
    1718           else
    1719             yield :SYM_END_DBLOCK, $&
    1720           end
    1721         elsif @in_c_domain_type == false
    1722           adl_type = @adl_type.pop
    1723 #          puts "Escaping #{adl_type}"
    1724           assert_at(__FILE__,__LINE__){adl_type == :dadl}
    1725           yield :SYM_END_DBLOCK, $&
    1726         else
    1727           raise
    1728         end
    1729       when /\A\-/   # -
    1730         yield :Minus_code, :Minus_code
    1731       when /\A\+/   # +
    1732         yield :Plus_code, :Plus_code
    1733       when /\A\*/   # *
    1734         yield :Star_code, :Star_code
    1735       when /\A\//   # /
    1736         yield :Slash_code, :Slash_code
    1737       when /\A\^/   # ^
    1738         yield :Caret_code, :Caret_code
    1739       when /\A\.\.\./   # ...
    1740         yield :SYM_LIST_CONTINUE, :SYM_LIST_CONTINUE
    1741       when /\A\.\./   # ..
    1742         yield :SYM_ELLIPSIS, :SYM_ELLIPSIS
    1743       when /\A\./   # .
    1744         yield :Dot_code, :Dot_code
    1745       when /\A\;/   # ;
    1746         yield :Semicolon_code, :Semicolon_code
    1747       when /\A\,/   # ,
    1748         yield :Comma_code, :Comma_code
    1749       when /\A\:/   # :
    1750         yield :Colon_code, :Colon_code
    1751       when /\A\!/   # !
    1752         yield :Exclamation_code, :Exclamation_code
    1753       when /\A\(/   # (
    1754         yield :Left_parenthesis_code, :Left_parenthesis_code
    1755       when /\A\)/   # )
    1756         yield :Right_parenthesis_code, :Right_parenthesis_code
    1757       when /\A\$/   # $
    1758         yield :Dollar_code, :Dollar_code
    1759       when /\A\?\?/   # ??
    1760         yield :SYM_DT_UNKNOWN, :SYM_DT_UNKNOWN
    1761       when /\A\?/   # ?
    1762         yield :Question_mark_code, :Question_mark_code
    1763       when /\A\|/   # |
    1764         @@log.info("#{__FILE__}:#{__LINE__}: scan_dadl: @in_interval = #{@in_interval} at #{@filename}:#{@lineno}")
    1765         if @in_interval
    1766           @in_interval = false
    1767         else
    1768 #          @in_interval = false
    1769           @in_interval = true
    1770         end
    1771         @@log.info("#{__FILE__}:#{__LINE__}: scan_dadl: SYM_INTERVAL_DELIM at #{@filename}:#{@lineno}")
    1772         yield :SYM_INTERVAL_DELIM, :SYM_INTERVAL_DELIM
    1773 ###       when /\A\[[a-zA-Z0-9()\._-]+::[a-zA-Z0-9\._-]+\]/   #V_QUALIFIED_TERM_CODE_REF form [ICD10AM(1998)::F23]
    1774 ###         yield :V_QUALIFIED_TERM_CODE_REF, $&
    1775 ###       when /\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/   #V_LOCAL_TERM_CODE_REF
    1776 ###         yield :V_LOCAL_TERM_CODE_REF, $&
    1777 ###       when /\A\[[a-zA-Z0-9._\- ]+::[a-zA-Z0-9._\- ]+\]/   #ERR_V_QUALIFIED_TERM_CODE_REF
    1778 ###         yield :ERR_V_QUALIFIED_TERM_CODE_REF, $&
    1779       when /\A\[/   # [
    1780         yield :Left_bracket_code, :Left_bracket_code
    1781       when /\A\]/   # ]
    1782         yield :Right_bracket_code, :Right_bracket_code
    1783 ###       when /\A[A-Z][a-zA-Z0-9_-]*/
    1784 ###         yield :V_TYPE_IDENTIFIER, $&
    1785 ###       when /\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/   #V_GENERIC_TYPE_IDENTIFIER
    1786 ###         yield :V_GENERIC_TYPE_IDENTIFIER, $&
    1787 ###       when /\A[a-z][a-zA-Z0-9_]*/
    1788 ###         word = $&.downcase
    1789 ###         if @@dadl_reserved[word]
    1790 ###           yield @@dadl_reserved[word], @@dadl_reserved[word]
    1791 ###         else
    1792 ###           yield :V_ATTRIBUTE_IDENTIFIER, $&
    1793 ###         end
    1794 ###       when /\Aa[ct][0-9.]+/   #V_LOCAL_CODE
    1795 ###         yield :V_LOCAL_CODE, $&
    1796       when /\A[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9]:[0-6][0-9](,[0-9]+)?(Z|[+-][0-9]{4})?|[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9](Z|[+-][0-9]{4})?|[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9](Z|[+-][0-9]{4})?/   #V_ISO8601_EXTENDED_DATE_TIME YYYY-MM-DDThh:mm:ss[,sss][Z|+/- -n-n-n-n-]-
    1797         yield :V_ISO8601_EXTENDED_DATE_TIME, $&
    1798       when /\A[0-2][0-9]:[0-6][0-9]:[0-6][0-9](,[0-9]+)?(Z|[+-][0-9]{4})?|[0-2][0-9]:[0-6][0-9](Z|[+-][0-9]{4})? /   #V_ISO8601_EXTENDED_TIME hh:mm:ss[,sss][Z|+/-nnnn]
    1799         yield :V_ISO8601_EXTENDED_TIME, $&
    1800       when /\A[0-9]{4}-[0-1][0-9]-[0-3][0-9]|[0-9]{4}-[0-1][0-9]/   #V_ISO8601_EXTENDED_DATE YYYY-MM-DD
    1801         yield :V_ISO8601_EXTENDED_DATE, $&
    1802       when /\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/   #V_GENERIC_TYPE_IDENTIFIER
    1803         yield :V_GENERIC_TYPE_IDENTIFIER, $&
    1804       when /\A[0-9]+|[0-9]+[eE][+-]?[0-9]+/   #V_INTEGER
    1805         yield :V_INTEGER, $&
    1806 ###       when /\A[0-9]+\.[0-9]+|[0-9]+\.[0-9]+[eE][+-]?[0-9]+ /   #V_REAL
    1807 ###         yield :V_REAL, $&
    1808         #    when /\A"((?:[^"\\]+|\\.)*)"/ #V_STRING
    1809 ###       when /\A"([^"]*)"/m #V_STRING
    1810 ###         yield :V_STRING, $1
    1811       when /\A[a-z]+:\/\/[^<>|\\{}^~"\[\] ]*/ #V_URI
    1812         yield :V_URI, $&
    1813 ###       when /\AP([0-9]+[yY])?([0-9]+[mM])?([0-9]+[wW])?([0-9]+[dD])?T([0-9]+[hH])?([0-9]+[mM])?([0-9]+[sS])?|P([0-9]+[yY])?([0-9]+[mM])?([0-9]+[wW])?([0-9]+[dD])?/   #V_ISO8601_DURATION PnYnMnWnDTnnHnnMnnS
    1814 ###         yield :V_ISO8601_DURATION, $&
    1815       when /\A\S/ #UTF8CHAR
    1816         yield :UTF8CHAR, $&
    1817       end
    1818       data = $' # variable $' receives the string after the match
    1819     when :adl
    1820 #      puts "Entering scan_adl"
    1821       data = scan_adl(data) do |sym, val|
    1822         yield sym, val
    1823       end
    1824     when :cadl
    1825 #      puts "Entering scan_cadl"
    1826       data = scan_cadl(data) do |sym, val|
    1827         yield sym, val
    1828       end
    1829     when :regexp
    1830 #      puts "Entering scan_regexp"
    1831       data = scan_regexp(data) do |sym, val|
    1832         yield sym, val
    1833       end
    1834     when :term_constraint
    1835 #      puts "Entering scan_term_constraint"
    1836       data = scan_term_constraint(data) do |sym, val|
    1837         yield sym, val
    1838       end
    1839     else
    1840       raise
    1841     end
    1842   end
    1843 end # of scan_dadl
    1844 
    1845 def scan_regexp(data)
    1846   until data.nil?  do
    1847     case @adl_type.last
    1848     when :regexp
    1849 #      puts "Entering scan_regexp"
    1850       case data
    1851       when /\A\/\}/ #V_REGEXP
    1852         if @adl_type.last == :regexp
    1853           @in_regexp = false
    1854           @adl_type.pop
    1855           yield :END_REGEXP_BLOCK, :END_REGEXP_BLOCK
    1856         else
    1857           raise
    1858         end
    1859       when /\A(.*)(\/\})/ #V_REGEXP
    1860         yield :REGEXP_BODY, $1
    1861         if @adl_type.last == :regexp
    1862           @in_regexp = false
    1863           @adl_type.pop
    1864           yield :END_REGEXP_BLOCK, :END_REGEXP_BLOCK
    1865         else
    1866           raise
    1867         end
    1868       else
    1869         raise data
    1870       end
    1871       data = $' # variable $' receives the string after the match
    1872     when :adl
    1873 #      puts "Entering scan_adl"
    1874       data = scan_adl(data) do |sym, val|
    1875         yield sym, val
    1876       end
    1877     when :dadl
    1878 #      puts "Entering scan_dadl"
    1879       data = scan_dadl(data) do |sym, val|
    1880         yield sym, val
    1881       end
    1882     when :cadl
    1883 #      puts "Entering scan_cadl"
    1884       data = scan_cadl(data) do |sym, val|
    1885         yield sym, val
    1886       end
    1887     when :term_constraint
    1888 #      puts "Entering scan_term_constraint"
    1889       data = scan_term_constraint(data) do |sym, val|
    1890         yield sym, val
    1891       end
    1892     else
    1893       raise
    1894     end
    1895   end
    1896 end # of scan_regexp
    1897 
    1898 def scan_term_constraint(data)
    1899   until data.nil?  do
    1900     case @adl_type.last
    1901     when :term_constraint
    1902 #      puts "Entering scan_term_constraint"
    1903       case data
    1904       when /\A\n/ # carriage return
    1905         @lineno += 1
    1906         ;
    1907       when /\A[ \t\r\f]+/ #just drop it
    1908         ;
    1909       when /\A--.*$/ # single line comment
    1910         @lineno += 1
    1911         @@log.info("#{__FILE__}:#{__LINE__}: scan_term_constraint: COMMENT = #{$&} at #{@filename}:#{@lineno}")
    1912         ;
    1913       when /\A[a-zA-Z0-9\._\-]+[ \t]*,/ # match any line, with ',' termination
    1914         yield :TERM_CODE, $&
    1915       when /\A[a-zA-Z0-9\._\-]+[ \t]*;/ #match second last line with ';' termination (assumed value)
    1916         yield :TERM_CODE, $&
    1917 #      when /\A[a-zA-Z0-9\._\-]+[ \t]*\]/ # match final line, terminating in ']'
    1918       when /\A[a-zA-Z0-9\._\-]*[ \t]*\]/ # match final line, terminating in ']'
    1919         adl_type = @adl_type.pop
    1920         assert_at(__FILE__,__LINE__){adl_type == :term_constraint}
    1921         yield :END_TERM_CODE_CONSTRAINT, $&
    1922       else
    1923         raise "data = #{data}"
    1924       end
    1925       data = $' # variable $' receives the string after the match
    1926     when :adl
    1927 #      puts "Entering scan_adl"
    1928       data = scan_adl(data) do |sym, val|
    1929         yield sym, val
    1930       end
    1931     when :dadl
    1932 #      puts "Entering scan_dadl"
    1933       data = scan_dadl(data) do |sym, val|
    1934         yield sym, val
    1935       end
    1936     when :cadl
    1937 #      puts "Entering scan_cadl"
    1938       data = scan_cadl(data) do |sym, val|
    1939         yield sym, val
    1940       end
    1941     else
    1942       raise
    1943     end
    1944   end
    1945 end # of scan_term_constraint
    19461296
    19471297
     
    19641314
    19651315
    1966 
     1316__END__
    19671317
    19681318
  • ruby/branches/0.5/lib/adl_parser/test/adl/openEHR-EHR-COMPOSITION.encounter.v1draft.adl

    r116 r290  
    1010        ["name"] = <"Thomas Beale">
    1111        ["organisation"] = <"Ocean Informatics">
    12         ["date"] = <"2005-10-10">
     12        ["date"] = <"10/10/2005">
    1313    >
    1414    details = <
  • ruby/branches/0.5/lib/adl_parser/test/adl/openEHR-EHR-OBSERVATION.apgar.v1.adl

    r116 r290  
    2525        ["name"] = <"Sam Heard">
    2626        ["organisation"] = <"Ocean Informatics">
    27         ["date"] = <"2004-05-18">
     27        ["date"] = <"18/05/2004">
    2828        ["email"] = <"sam.heard@oceaninformatics.biz">
    2929    >
     
    4545        ["de"] = <
    4646            language = <[ISO_639-1::de]>
    47             purpose = <"Zur Dokumentation des Apgar Wertes oder Beurteilung f%G�%@r Neugeborene. Der zu Grunde liegende Zeitpunkt der Ereignisreihe ist immer die Geburt.">
    48             use = <"Erm%G�%@glicht die Dokumentation des Wohlergehens des S%G�%@uglings 1, 2, 5 und/ oder 10 Minuten nach der Geburt. Die Summe kann einzeln dokumentiert werden - falls nur diese verf%G�%@gbar ist - es sollten aber alle f%G�%@nf Zahlenwerte vervollst%G�%@ndigt werden, damit die Summe errechnet werden kann. Die Gesamtsumme ist die Summe der f%G�%@nf Zahlenwerte (minimal 0, maximal 10).">
     47            purpose = <"Zur Dokumentation des Apgar Wertes oder Beurteilung f%G%@r Neugeborene. Der zu Grunde liegende Zeitpunkt der Ereignisreihe ist immer die Geburt.">
     48            use = <"Erm%G�%@glicht die Dokumentation des Wohlergehens des S%G�%@uglings 1, 2, 5 und/ oder 10 Minuten nach der Geburt. Die Summe kann einzeln dokumentiert werden - falls nur diese verf%G�%@gbar ist - es sollten aber alle f%G�%@nf Zahlenwerte vervollst%G�%@ndigt werden, damit die Summe errechnet werden kann. Die Gesamtsumme ist die Summe der f%G�%@nf Zahlenwerte (minimal 0, maximal 10).">
    4949            keywords = <"Apgar", "Neugeborenes", "Index", "Wert">
    50             misuse = <"Nur teilweise Vervollst%G�%@ndigung der Werte und Addieren von weniger als f%G�%@nf Werten zur Gesamtsumme.">
     50            misuse = <"Nur teilweise Vervollst%G�%@ndigung der Werte und Addieren von weniger als f%G�%@nf Werten zur Gesamtsumme.">
    5151        >
    5252    >
     
    414414            items = <
    415415                ["at0000"] = <
    416                     description = <"Klinischer Wert, abgeleitet von der Beurteilung der Atmung, der Hautfarbe, dem Muskeltonus, der Herzfrequenz und der Reaktion von Reflexen, %G�%@blicherweise 1, 5 und 10 Minuten nach der Geburt erhoben">
     416                    description = <"Klinischer Wert, abgeleitet von der Beurteilung der Atmung, der Hautfarbe, dem Muskeltonus, der Herzfrequenz und der Reaktion von Reflexen, %G%@blicherweise 1, 5 und 10 Minuten nach der Geburt erhoben">
    417417                    text = <"Apgar Wert">
    418418                >
     
    438438                >
    439439                ["at0007"] = <
    440                     description = <"Herzfrequenz von weniger als 100 Schl%G�%@gen pro Minute">
    441                     text = <"Weniger als 100 Schl%G�%@ge pro Minute">
     440                    description = <"Herzfrequenz von weniger als 100 Schl%G%@gen pro Minute">
     441                    text = <"Weniger als 100 Schl%G%@ge pro Minute">
    442442                >
    443443                ["at0008"] = <
    444                     description = <"Herzfrequenz von mehr als oder genau 100 Schl%G�%@gen pro Minute">
    445                     text = <"Mehr als oder genau 100 Schl%G�%@ge pro Minute">
     444                    description = <"Herzfrequenz von mehr als oder genau 100 Schl%G%@gen pro Minute">
     445                    text = <"Mehr als oder genau 100 Schl%G%@ge pro Minute">
    446446                >
    447447                ["at0009"] = <
     
    478478                >
    479479                ["at0017"] = <
    480                     description = <"Beurteilung der Reaktion des Neugeborenen auf die Absaugung der Nasenl%G�%@cher">
     480                    description = <"Beurteilung der Reaktion des Neugeborenen auf die Absaugung der Nasenl%G%@cher">
    481481                    text = <"Reflexantwort">
    482482                >
    483483                ["at0018"] = <
    484                     description = <"kein W%G�%@rgen oder keine Reaktion auf das Absaugen der Atemwege">
     484                    description = <"kein W%G%@rgen oder keine Reaktion auf das Absaugen der Atemwege">
    485485                    text = <"Keine Reaktion auf die Absaugung der Atemwege">
    486486                >
    487487                ["at0019"] = <
    488488                    description = <"Grimasse als einzige Reaktion auf das Absaugen der Atemwege">
    489                     text = <"Grimasse w%G�%@hrend der Absaugung der Atemwege">
     489                    text = <"Grimasse w%G%@hrend der Absaugung der Atemwege">
    490490                >
    491491                ["at0020"] = <
    492                     description = <"Grimasse und husten, niesen oder w%G�%@rgen als Reaktion auf die Absaugung der Atemwege">
    493                     text = <"Grimasse und Husten/Niesen w%G�%@hrend der Absaugung der Atemwege ">
     492                    description = <"Grimasse und husten, niesen oder w%G%@rgen als Reaktion auf die Absaugung der Atemwege">
     493                    text = <"Grimasse und Husten/Niesen w%G%@hrend der Absaugung der Atemwege ">
    494494                >
    495495                ["at0021"] = <
    496                     description = <"Die Farbe der Haut am K%G�%@rper, am Rumpf und an den Gliedern">
     496                    description = <"Die Farbe der Haut am K%G%@rper, am Rumpf und an den Gliedern">
    497497                    text = <"Hautfarbe">
    498498                >
    499499                ["at0022"] = <
    500                     description = <"Der K%G�%@rper ist blass oder blau gef%G�%@rbt">
    501                     text = <"Gesamter K%G�%@rper ist blau oder blass">
     500                    description = <"Der K%G�%@rper ist blass oder blau gef%G�%@rbt">
     501                    text = <"Gesamter K%G%@rper ist blau oder blass">
    502502                >
    503503                ["at0023"] = <
    504                     description = <"Der K%G�%@rper ist rosig, H%G�%@nde und F%G��%@e sind blass oder blau">
    505                     text = <"Gesunde K%G�%@rperfarbe, blaue H%G�%@nde oder F%G��%@e">
     504                    description = <"Der K%G�%@rper ist rosig, H%G�%@nde und F%G��%@e sind blass oder blau">
     505                    text = <"Gesunde K%G�%@rperfarbe, blaue H%G�%@nde oder F%G��%@e">
    506506                >
    507507                ["at0024"] = <
    508                     description = <"Rosige oder gesunde F%G�%@rbung des gesamten K%G�%@rpers">
    509                     text = <"Vollst%G�%@ndig gesunde oder rosige Farbe">
     508                    description = <"Rosige oder gesunde F%G�%@rbung des gesamten K%G�%@rpers">
     509                    text = <"Vollst%G%@ndig gesunde oder rosige Farbe">
    510510                >
    511511                ["at0025"] = <
  • ruby/branches/0.5/lib/adl_parser/test/parser_test.rb

    r167 r290  
    1 #require 'lib/parser.rb'
    2 require 'lib/adl_parser.rb'
    3 require 'test/unit'
     1require File.dirname(__FILE__) + '/test_helper.rb'
    42
    53class ADLParserTest < Test::Unit::TestCase
     
    86  end
    97
    10   def test_init
     8  must "assert parser instance" do
    119    assert_instance_of ::OpenEHR::ADL::Parser,@parser
    1210  end
    1311
    14   def test_parse
    15     laboratory_request = File.read('test/adl/openEHR-EHR-ITEM_TREE.Laboratory_request.v1.adl')
    16     assert_nothing_raised do
    17       result = @parser.parse(laboratory_request, 'openEHR-EHR-ITEM_TREE.Laboratory_request.v1.adl')
    18       assert_instance_of OpenEhr::AM::Archetype::ARCHETYPE, result
    19       assert_instance_of OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION, result.description
    20       assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, result.definition
    21 #      assert_equal '', result.definition
    22     end
    23 
    24     apgar = File.read('test/adl/openEHR-EHR-OBSERVATION.apgar.v1.adl')
    25     assert_nothing_raised do
    26       result = @parser.parse(apgar, 'openEHR-EHR-OBSERVATION.apgar.v1.adl')
    27       assert_instance_of OpenEhr::AM::Archetype::ARCHETYPE, result
    28       assert_instance_of OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION, result.description
    29       assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, result.definition
    30     end
    31 
    32     evaluation = File.read('test/adl/openEHR-EHR-EVALUATION.adverse.v1.adl')
    33     assert_nothing_raised do
    34       @parser.parse(evaluation, 'openEHR-EHR-EVALUATION.adverse.v1.adl')
    35     end
    36 
    37 
    38 
    39     referral = File.read('test/adl/openEHR-EHR-ITEM_TREE.referral.v1.adl')
    40     assert_nothing_raised do
    41       @parser.parse(referral, 'openEHR-EHR-ITEM_TREE.referral.v1.adl')
    42     end
    43 
    44     exam_fetus = File.read('test/adl/openEHR-EHR-CLUSTER.exam-fetus.v1.adl')
    45     assert_nothing_raised do
    46       @parser.parse(exam_fetus, 'openEHR-EHR-CLUSTER.exam-fetus.v1.adl')
    47     end
    48 
    49     exam_uterine_cervix = File.read('test/adl/openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl')
    50     assert_nothing_raised do
    51       @parser.parse(exam_uterine_cervix, 'openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl')
    52     end
    53 
    54     imaging = File.read('test/adl/openEHR-EHR-ACTION.imaging.v1.adl')
    55     assert_nothing_raised do
    56       @parser.parse(imaging, 'openEHR-EHR-ACTION.imaging.v1.adl')
    57     end
    58 
    59     exam_nervous_system = File.read('test/adl/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl')
    60     assert_nothing_raised do
    61       @parser.parse(exam_nervous_system, 'openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl')
    62     end
    63     exam_generic = File.read('test/adl/openEHR-EHR-CLUSTER.exam-generic.v1.adl')
    64     assert_nothing_raised do
    65       @parser.parse(exam_generic, 'openEHR-EHR-CLUSTER.exam-generic.v1.adl')
    66     end
    67     exam_generic_mass = File.read('test/adl/openEHR-EHR-CLUSTER.exam-generic-mass.v1.adl')
    68     assert_nothing_raised do
    69       @parser.parse(exam_generic_mass, 'openEHR-EHR-CLUSTER.exam-generic-mass.v1.adl')
    70     end
    71     exam_generic_lymphnode = File.read('test/adl/openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1.adl')
    72     assert_nothing_raised do
    73       @parser.parse(exam_generic_lymphnode, 'openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1.adl')
    74     end
    75     exam_generic_joint = File.read('test/adl/openEHR-EHR-CLUSTER.exam-generic-joint.v1.adl')
    76     assert_nothing_raised do
    77       @parser.parse(exam_generic_joint, 'openEHR-EHR-CLUSTER.exam-generic-joint.v1.adl')
    78     end
    79     exam_chest = File.read('test/adl/openEHR-EHR-CLUSTER.exam-chest.v1.adl')
    80     assert_nothing_raised do
    81       @parser.parse(exam_chest, 'openEHR-EHR-CLUSTER.exam-chest.v1.adl')
    82     end
    83     exam_abdomen = File.read('test/adl/openEHR-EHR-CLUSTER.exam-abdomen.v1.adl')
    84     assert_nothing_raised do
    85       @parser.parse(exam_abdomen, 'openEHR-EHR-CLUSTER.exam-abdomen.v1.adl')
    86     end
    87     cluster_auscultation = File.read('test/adl/openEHR-EHR-CLUSTER.auscultation.v1.adl')
    88     assert_nothing_raised do
    89       @parser.parse(cluster_auscultation, 'openEHR-EHR-CLUSTER.auscultation.v1.adl')
    90     end
    91     cluster_auscultation_chest = File.read('test/adl/openEHR-EHR-CLUSTER.auscultation-chest.v1.adl')
    92     assert_nothing_raised do
    93       @parser.parse(cluster_auscultation_chest, 'openEHR-EHR-CLUSTER.auscultation-chest.v1.adl')
    94     end
    95     vital_signs = File.read('test/adl/openEHR-EHR-SECTION.vital_signs.v1.adl')
    96     assert_nothing_raised do
    97       @parser.parse(vital_signs, 'openEHR-EHR-SECTION.vital_signs.v1')
    98     end
    99     summary = File.read('test/adl/openEHR-EHR-SECTION.summary.v1.adl')
    100     assert_nothing_raised do
    101       @parser.parse(summary, 'openEHR-EHR-SECTION.summary.v1.adl')
    102     end
    103 
    104     findings = File.read('test/adl/openEHR-EHR-SECTION.findings.v1.adl')
    105     assert_nothing_raised do
    106       @parser.parse(findings, 'openEHR-EHR-SECTION.findings.v1.adl')
    107     end
    108 
    109     reason_for_encounter = File.read('test/adl/openEHR-EHR-SECTION.reason_for_encounter.v1.adl')
    110     assert_nothing_raised do
    111       @parser.parse(reason_for_encounter, 'openEHR-EHR-SECTION.reason_for_encounter.v1.adl')
    112     end
    113 
    114     imaging = File.read('test/adl/openEHR-EHR-ITEM_TREE.imaging.v1.adl')
    115     assert_nothing_raised do
    116       @parser.parse(imaging, 'openEHR-EHR-ITEM_TREE.imaging.v1.adl')
    117     end
    118     instruction_referral = File.read('test/adl/openEHR-EHR-INSTRUCTION.referral.v1.adl')
    119     assert_nothing_raised do
    120       @parser.parse(instruction_referral, 'openEHR-EHR-INSTRUCTION.referral.v1.adl')
    121     end
    122     instruction_medication = File.read('test/adl/openEHR-EHR-INSTRUCTION.medication.v1.adl')
    123     assert_nothing_raised do
    124       @parser.parse(instruction_medication, 'openEHR-EHR-INSTRUCTION.medication.v1.adl')
    125     end
    126     action_referral = File.read('test/adl/openEHR-EHR-ACTION.referral.v1.adl')
    127     assert_nothing_raised do
    128       @parser.parse(action_referral, 'openEHR-EHR-ACTION.referral.v1.adl')
    129     end
    130 
    131     dimensions_circumference = File.read('test/adl/openEHR-EHR-CLUSTER.dimensions.v1.adl')
    132     assert_nothing_raised do
    133       @parser.parse(dimensions_circumference, 'openEHR-EHR-CLUSTER.dimensions.v1.adl')
    134     end
    135 
    136     discharge = File.read('test/adl/openEHR-EHR-COMPOSITION.discharge.v1draft.adl')
    137     assert_nothing_raised do
    138       @parser.parse(discharge, 'openEHR-EHR-COMPOSITION.discharge.v1draft.adl')
    139     end
    140 
    141     encounter = File.read('test/adl/openEHR-EHR-COMPOSITION.encounter.v1draft.adl')
    142     assert_nothing_raised do
    143       @parser.parse(encounter, 'openEHR-EHR-COMPOSITION.encounter.v1draft.adl')
    144     end
    145 
    146 
    147 #     medication = File.read('test/adl/openEHR-EHR-ITEM_TREE.medication.v1.adl')
    148 #     assert_nothing_raised do
    149 #       @parser.parse(medication, 'openEHR-EHR-ITEM_TREE.medication.v1.adl')
    150 #     end
    151   end
     12  must "test_archetype_id.adl be properly parsed" do
     13    file =  File.read("#{TEST_ROOT_DIR}/adl/test_archetype_id.adl")
     14    assert_nothing_raised do
     15      ast = @parser.parse(file, 'openEHR-EHR-SECTION.summary.v1')
     16      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     17    end
     18  end
     19
     20  must "openEHR-EHR-ACTION.imaging.v1.adl be properly parsed" do
     21    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-ACTION.imaging.v1.adl")
     22    assert_nothing_raised do
     23      ast = @parser.parse(file, 'openEHR-EHR-ACTION.imaging.v1')
     24      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     25    end
     26  end
     27
     28  must "openEHR-EHR-ACTION.referral.v1.adl be properly parsed" do
     29    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-ACTION.referral.v1.adl")
     30    assert_nothing_raised do
     31      ast = @parser.parse(file, 'openEHR-EHR-ACTION.referral.v1')
     32      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     33    end
     34  end
     35
     36  must "openEHR-EHR-CLUSTER.auscultation-chest.v1.adl be properly parsed" do
     37    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.auscultation-chest.v1.adl")
     38    assert_nothing_raised do
     39      ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.auscultation-chest.v1')
     40      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     41    end
     42  end
     43
     44  must "openEHR-EHR-CLUSTER.auscultation.v1.adl be properly parsed" do
     45    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.auscultation.v1.adl")
     46    assert_nothing_raised do
     47      ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.auscultation.v1')
     48      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     49    end
     50  end
     51
     52
     53  must "openEHR-EHR-CLUSTER.exam-abdomen.v1.adl be properly parsed" do
     54    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-abdomen.v1.adl")
     55    assert_nothing_raised do
     56      ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-abdomen.v1')
     57      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     58    end
     59  end
     60
     61  must "openEHR-EHR-CLUSTER.exam-chest.v1.adl be properly parsed" do
     62    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-chest.v1.adl")
     63    assert_nothing_raised do
     64      ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-chest.v1')
     65      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     66    end
     67  end
     68
     69  must "openEHR-EHR-CLUSTER.exam-generic-joint.v1.adl be properly parsed" do
     70    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-generic-joint.v1.adl")
     71    assert_nothing_raised do
     72      ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-generic-joint.v1')
     73      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     74    end
     75  end
     76
     77  must "openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1.adl be properly parsed" do
     78    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1.adl")
     79    assert_nothing_raised do
     80      ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1')
     81      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     82    end
     83  end
     84
     85  must "openEHR-EHR-CLUSTER.exam-generic-mass.v1.adl be properly parsed" do
     86    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-generic-mass.v1.adl")
     87    assert_nothing_raised do
     88      ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-generic-mass.v1')
     89      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     90    end
     91  end
     92
     93  must "openEHR-EHR-CLUSTER.exam-generic.v1.adl be properly parsed" do
     94    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-generic.v1.adl")
     95    assert_nothing_raised do
     96      ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-generic.v1')
     97      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     98    end
     99  end
     100
     101  must "openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl be properly parsed" do
     102    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl")
     103    assert_nothing_raised do
     104      ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-nervous_system.v1')
     105      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     106    end
     107  end
     108
     109  must "openEHR-EHR-COMPOSITION.discharge.v1draft.adl be properly parsed" do
     110    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-COMPOSITION.discharge.v1draft.adl")
     111    assert_nothing_raised do
     112      ast = @parser.parse(file, 'openEHR-EHR-COMPOSITION.discharge.v1draft')
     113      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     114    end
     115  end
     116
     117  must "openEHR-EHR-COMPOSITION.encounter.v1draft.adl be properly parsed" do
     118    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-COMPOSITION.encounter.v1draft.adl")
     119    assert_nothing_raised do
     120      ast = @parser.parse(file, 'openEHR-EHR-COMPOSITION.encounter.v1draft')
     121      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     122    end
     123  end
     124
     125  must "openEHR-EHR-INSTRUCTION.medication.v1.adl be properly parsed" do
     126    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-INSTRUCTION.medication.v1.adl")
     127    assert_nothing_raised do
     128      ast = @parser.parse(file, 'openEHR-EHR-INSTRUCTION.medication.v1')
     129      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     130    end
     131  end
     132
     133  must "openEHR-EHR-INSTRUCTION.referral.v1.adl be properly parsed" do
     134    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-INSTRUCTION.referral.v1.adl")
     135    assert_nothing_raised do
     136      ast = @parser.parse(file, 'openEHR-EHR-INSTRUCTION.referral.v1')
     137      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     138    end
     139  end
     140
     141  must "openEHR-EHR-ITEM_TREE.Laboratory_request.v1.adl be properly parsed" do
     142    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-ITEM_TREE.Laboratory_request.v1.adl")
     143    assert_nothing_raised do
     144      ast = @parser.parse(file, 'openEHR-EHR-ITEM_TREE.Laboratory_request.v1')
     145      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     146    end
     147  end
     148
     149
     150  must "openEHR-EHR-OBSERVATION.apgar.v1.adl be properly parsed" do
     151    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-OBSERVATION.apgar.v1.adl")
     152    assert_nothing_raised do
     153      ast = @parser.parse(file, 'openEHR-EHR-OBSERVATION.apgar.v1')
     154      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     155    end
     156  end
     157
     158  must "openEHR-EHR-SECTION.findings.v1.adl be properly parsed" do
     159    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-SECTION.findings.v1.adl")
     160    assert_nothing_raised do
     161      ast = @parser.parse(file, 'openEHR-EHR-SECTION.findings.v1')
     162      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     163    end
     164  end
     165
     166  must "openEHR-EHR-SECTION.reason_for_encounter.v1.adl be properly parsed" do
     167    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-SECTION.reason_for_encounter.v1.adl")
     168    assert_nothing_raised do
     169      ast = @parser.parse(file, 'openEHR-EHR-SECTION.reason_for_encounter.v1')
     170      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     171    end
     172  end
     173
     174
     175  must "openEHR-EHR-SECTION.vital_signs.v1.adl be properly parsed" do
     176    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-SECTION.vital_signs.v1.adl")
     177    assert_nothing_raised do
     178      ast = @parser.parse(file, 'openEHR-EHR-SECTION.vital_signs.v1')
     179      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     180    end
     181  end
     182
     183
     184# C_DV_QUANTITY parse error
     185#   must "openEHR-EHR-CLUSTER.dimensions-circumference.v1.adl be properly parsed" do
     186#     file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.dimensions-circumference.v1.adl")
     187#     assert_nothing_raised do
     188#       ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.dimensions-circumference.v1')
     189#       assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     190#     end
     191#   end
     192
     193#   must "openEHR-EHR-CLUSTER.dimensions.v1.adl be properly parsed" do
     194#     file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.dimensions.v1.adl")
     195#     assert_nothing_raised do
     196#       ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.dimensions.v1')
     197#       assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     198#     end
     199#   end
     200
     201#   must "openEHR-EHR-CLUSTER.exam-fetus.v1.adl be properly parsed" do
     202#     file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-fetus.v1.adl")
     203#     assert_nothing_raised do
     204#       ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-fetus.v1')
     205#       assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     206#     end
     207#   end
     208
     209#   must "openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl be properly parsed" do
     210#     file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl")
     211#     assert_nothing_raised do
     212#       ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-uterine_cervix.v1')
     213#       assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     214#     end
     215#   end
     216
     217#   must "openEHR-EHR-EVALUATION.adverse.v1.adl be properly parsed" do
     218#     file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-EVALUATION.adverse.v1.adl")
     219#     assert_nothing_raised do
     220#       ast = @parser.parse(file, 'openEHR-EHR-EVALUATION.adverse.v1')
     221#       assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     222#     end
     223#   end
     224#   must "openEHR-EHR-OBSERVATION.body_mass_index.v1.adl be properly parsed" do
     225#     file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-OBSERVATION.body_mass_index.v1.adl")
     226#     assert_nothing_raised do
     227#       ast = @parser.parse(file, 'openEHR-EHR-OBSERVATION.body_mass_index.v1')
     228#       assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
     229#     end
     230#   end
     231
     232
    152233end
  • ruby/branches/0.5/lib/adl_parser/test/scanner_test.rb

    r167 r290  
    1 require 'lib/adl_parser.rb'
    2 #require 'lib/scanner.rb'
    3 require 'test/unit'
     1require File.dirname(__FILE__) + '/test_helper.rb'
    42
    5 class YaparcParserTest < Test::Unit::TestCase
    6   def test_RootScanner
    7     parser = OpenEhr::ADL::Scanner::DADL::RootScanner.new
    8     assert_instance_of OpenEhr::ADL::Scanner::DADL::RootScanner,parser
    9     result = parser.parse('')
     3class ADLScannerTest < Test::Unit::TestCase
     4  def setup
     5    @scanner = OpenEHR::ADL::Scanner::ADLScanner.new([:adl], "filename")
    106  end
    117
    12   def test_V_LOCAL_TERM_CODE_REF
    13     parser = OpenEhr::ADL::Scanner::Common::V_LOCAL_TERM_CODE_REF.new
    14     assert_instance_of OpenEhr::ADL::Scanner::Common::V_LOCAL_TERM_CODE_REF,parser
    15     result = parser.parse('[en-us]')
    16     assert_instance_of Yaparc::Result::OK, result
     8  must "assert OpenEHR::ADL::Scanner::ADLScanner scanner instance" do
     9    assert_instance_of OpenEHR::ADL::Scanner::ADLScanner, @scanner
    1710  end
    1811
    19   def test_V_QUALIFIED_TERM_CODE_REF
    20     parser = OpenEhr::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF.new
    21     assert_instance_of OpenEhr::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF,parser
    22     result = parser.parse('[ISO_639::en]')
    23     assert_instance_of Yaparc::Result::OK, result
    24     result = parser.parse('[ISO_639::en-us]')
    25     assert_instance_of Yaparc::Result::OK, result
     12  must "assert ADLScanner scanner scan CR and lineno incremented" do
     13    lineno = @scanner.lineno
     14    @scanner.scan("\n")
     15    assert_equal lineno+1, @scanner.lineno
    2616  end
    2717
    28   def test_V_STRING
    29     parser = OpenEhr::ADL::Scanner::Common::V_STRING.new
    30     assert_instance_of OpenEhr::ADL::Scanner::Common::V_STRING,parser
    31     result = parser.parse('"this is a string"')
    32     assert_instance_of Yaparc::Result::OK, result
    33     result = parser.parse('"en-us"')
    34     assert_instance_of Yaparc::Result::OK, result
     18  must "assert ADLScanner scanner scan ARCHETYPE_ID" do
     19    lineno = @scanner.lineno
     20    @scanner.scan("openEHR-EHR-OBSERVATION.body_mass_index.v1") do |sym, val|
     21      assert_equal :V_ARCHETYPE_ID,sym
     22      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID,val
     23    end
    3524  end
    3625
    37   def test_V_REAL
    38     parser = OpenEhr::ADL::Scanner::Common::V_REAL.new
    39     assert_instance_of OpenEhr::ADL::Scanner::Common::V_REAL,parser
    40     result = parser.parse('0.1')
    41     assert_instance_of Yaparc::Result::OK, result
    42     result = parser.parse('0.0..20000.0')
    43     assert_instance_of Yaparc::Result::OK, result
    44     assert_equal [:V_REAL, "0.0"], result.value
    45     assert_equal "..20000.0", result.input
     26  must "assert ADLScanner scanner scan white space and lineno unchanged" do
     27    lineno = @scanner.lineno
     28    @scanner.scan(" ")
     29    assert_equal lineno, @scanner.lineno
    4630  end
    4731
    48   def test_V_ISO8601_DURATION
    49     parser = OpenEhr::ADL::Scanner::Common::V_ISO8601_DURATION.new
    50     assert_instance_of OpenEhr::ADL::Scanner::Common::V_ISO8601_DURATION,parser
    51     result = parser.parse('PT1M')
    52     assert_instance_of Yaparc::Result::OK, result
    53     result = parser.parse('PYMWDTHMS')
    54     assert_instance_of Yaparc::Result::OK, result
    55     assert_equal [:V_ISO8601_DURATION, "PYMWDTHMS"], result.value
     32  must "assert ADLScanner scanner scan V_QUALIFIED_TERM_CODE_REF" do
     33    @scanner.scan("[ICD10AM(1998)::F23]") do |sym, val|
     34      assert_equal :V_QUALIFIED_TERM_CODE_REF,sym
     35      assert_equal "ICD10AM(1998)::F23",val
     36    end
     37  end
     38end
     39
     40class CADLScannerTest < Test::Unit::TestCase
     41  def setup
     42    @scanner = OpenEHR::ADL::Scanner::CADLScanner.new([:cadl], "filename")
    5643  end
    5744
    58   def test_V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN
    59     parser = OpenEhr::ADL::Scanner::CADL::V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN.new
    60     assert_instance_of OpenEhr::ADL::Scanner::CADL::V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN,parser
    61     result = parser.parse('yyyy-??-??T??:??:??')
    62     assert_instance_of Yaparc::Result::OK, result
     45  must "assert OpenEHR::ADL::Scanner::CADLScanner scanner instance" do
     46    assert_instance_of OpenEHR::ADL::Scanner::CADLScanner, @scanner
    6347  end
    6448
    65   def test_V_ISO8601_DATE_CONSTRAINT_PATTERN
    66     parser = OpenEhr::ADL::Scanner::CADL::V_ISO8601_DATE_CONSTRAINT_PATTERN.new
    67     assert_instance_of OpenEhr::ADL::Scanner::CADL::V_ISO8601_DATE_CONSTRAINT_PATTERN,parser
    68     result = parser.parse('yyyy-mm-XX-dd')
    69     assert_instance_of Yaparc::Result::OK, result
     49  must "assert CADLScanner scanner scan V_ATTRIBUTE_IDENTIFIER" do
     50    lineno = @scanner.lineno
     51    @scanner.scan("identifier") do |sym, val|
     52      assert_equal :V_ATTRIBUTE_IDENTIFIER, sym
     53      assert_equal "identifier", val
     54    end
     55    assert_equal lineno, @scanner.lineno
    7056  end
    7157
    72   def test_V_ISO8601_TIME_CONSTRAINT_PATTERN
    73     parser = OpenEhr::ADL::Scanner::CADL::V_ISO8601_TIME_CONSTRAINT_PATTERN.new
    74     assert_instance_of OpenEhr::ADL::Scanner::CADL::V_ISO8601_TIME_CONSTRAINT_PATTERN,parser
    75     result = parser.parse('hh:mm:ss:??')
    76     assert_instance_of Yaparc::Result::OK, result
     58  must "assert CADLScanner scanner scan reserved words" do
     59    lineno = @scanner.lineno
     60    @scanner.scan("then") do |sym, val|
     61      assert_equal :SYM_THEN, sym
     62    end
    7763  end
    7864
    79   def test_dadl_reserved
    80     parser = OpenEhr::ADL::Scanner::DADL::RootScanner.new
    81     result = parser.parse('then')
    82     assert_instance_of Yaparc::Result::OK, result
    83     result = parser.parse('infinity')
    84     assert_instance_of Yaparc::Result::OK, result
    85     assert_equal [:SYM_INFINITY, :SYM_INFINITY], result.value
     65  must "assert CADLScanner scanner scan V_QUALIFIED_TERM_CODE_REF" do
     66    @scanner.scan("[ICD10AM(1998)::F23]") do |sym, val|
     67      assert_equal :V_QUALIFIED_TERM_CODE_REF,sym
     68      assert_equal "ICD10AM(1998)::F23",val
     69    end
    8670  end
    8771
    88   def test_cadl
    89     parser = OpenEhr::ADL::Scanner::CADL::RootScanner.new
    90     assert_instance_of OpenEhr::ADL::Scanner::CADL::RootScanner,parser
    91     result = parser.parse('PT1M')
    92     assert_instance_of Yaparc::Result::OK, result
    93     assert_equal [:V_ISO8601_DURATION, "PT1M"], result.value
    94     result = parser.parse('PYMWDTHMS')
    95     assert_instance_of Yaparc::Result::OK, result
    96     assert_equal [:V_ISO8601_DURATION, "PYMWDTHMS"], result.value
     72  must "assert CADLScanner scanner scan V_ISO8601_DURATION" do
     73    @scanner.scan("PT1M") do |sym, val|
     74      assert_equal :V_ISO8601_DURATION,sym
     75      assert_equal "PT1M",val
     76    end
     77  end
     78end
     79
     80class DADLScannerTest < Test::Unit::TestCase
     81  def setup
     82    @scanner = OpenEHR::ADL::Scanner::DADLScanner.new([:dadl], "filename")
    9783  end
    9884
    99   def test_cadl_reserved
    100     parser = OpenEhr::ADL::Scanner::CADL::RootScanner.new
    101     result = parser.parse('then')
    102     assert_instance_of Yaparc::Result::OK, result
    103     result = parser.parse('cardinality')
    104     assert_instance_of Yaparc::Result::OK, result
    105     assert_equal [:SYM_CARDINALITY, :SYM_CARDINALITY], result.value
    106     result = parser.parse('ordered')
    107     assert_instance_of Yaparc::Result::OK, result
    108     assert_equal "", result.input
    109     assert_equal [:SYM_ORDERED, :SYM_ORDERED], result.value
     85  must "assert DADLScanner scanner scan V_QUALIFIED_TERM_CODE_REF" do
     86    @scanner.scan("[ICD10AM(1998)::F23]") do |sym, val|
     87      assert_equal :V_QUALIFIED_TERM_CODE_REF,sym
     88      assert_equal "ICD10AM(1998)::F23",val
     89    end
    11090  end
    11191
    112  
     92  must "assert DADLScanner scanner scan V_ISO8601_EXTENDED_DATE" do
     93    @scanner.scan("2005-10-10") do |sym, val|
     94      assert_equal :V_ISO8601_EXTENDED_DATE,sym
     95      assert_equal "2005-10-10",val
     96    end
     97  end
     98
     99  must "assert DADLScanner scanner scan V_STRING" do
     100    @scanner.scan("\"string\"") do |sym, val|
     101      assert_equal :V_STRING,sym
     102      assert_equal "string",val
     103    end
     104  end
    113105end
  • ruby/branches/0.5/lib/adl_parser/test/semantic_test.rb

    r116 r290  
    1 require 'lib/adl_parser.rb'
    2 require 'test/unit'
     1require File.dirname(__FILE__) + '/test_helper.rb'
    32
    43class ADLSemanticTest < Test::Unit::TestCase
     
    76  end
    87
    9   def test_init
     8  must "assert adl parser instance" do
    109    assert_instance_of ::OpenEHR::ADL::Parser,@parser
    1110  end
  • ruby/branches/0.5/lib/adl_parser/test/shell_test.rb

    r116 r290  
    1 require 'lib/adl_parser.rb'
    2 require 'test/unit'
     1require File.dirname(__FILE__) + '/test_helper.rb'
    32
    43class ShellADLValidatorTest < Test::Unit::TestCase
     
    76  end
    87
    9   def test_init
     8  must "assert application validator instance" do
    109    assert_instance_of ::OpenEHR::Application::ADLValidator,@adl_validator
    1110  end
    1211
    13   def test_run
     12
     13  must "validating openEHR-EHR-CLUSTER.exam-nervous_system.v1 using File.open not raised" do
    1414    assert_nothing_raised do
    15       adl_file = File.open('test/adl/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl')
     15      adl_file = File.open("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl")
    1616      @adl_validator.run(adl_file)
    1717    end
     18  end
     19
     20  must "validating openEHR-EHR-CLUSTER.exam-nervous_system.v1 using File.read not raised" do
    1821    assert_nothing_raised do
    19       adl_string = File.open('test/adl/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl')
    20       @adl_validator.run(adl_string)
    21     end
    22     assert_nothing_raised do
    23       adl_string = File.read('test/adl/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl')
     22      adl_string = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl")
    2423      stringio = StringIO.new(adl_string)
    2524      @adl_validator.run(stringio)
  • ruby/branches/0.5/lib/adl_parser/test/validator_test.rb

    r116 r290  
    1 require 'lib/adl_parser.rb'
    2 require 'test/unit'
     1require File.dirname(__FILE__) + '/test_helper.rb'
     2
    33
    44class ADLValidatorTest < Test::Unit::TestCase
     
    77  end
    88
    9   def test_init
     9  must "assert adl validator instance" do
    1010    assert_instance_of ::OpenEHR::ADL::Validator,@validator
    1111  end
    1212
    13   def test_validate
    14     exam_nervous_system = File.read('test/adl/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl')
     13  must "assert validation openEHR-EHR-CLUSTER.exam-nervous_system.v1" do
     14    exam_nervous_system = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl")
    1515    assert_nothing_raised do
    16       @validator.validate(exam_nervous_system, 'openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl')
     16      @validator.validate(exam_nervous_system, 'openEHR-EHR-CLUSTER.exam-nervous_system.v1')
    1717    end
    18 
     18  end
    1919#     exam_uterine_cervix = File.read('tests/openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl')
    2020# #    assert_raise(Racc::ParseError) do
    2121#    @validator.validate(exam_uterine_cervix, 'openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl')
    2222# #    end
    23 
    24   end
    2523end
  • ruby/branches/0.5/lib/models/Rakefile

    r142 r290  
    4141  s.email = 'openehr-jp@openehr.jp'
    4242  s.test_files = FileList['tests/test_*.rb', '*.adl']
     43
    4344  candidates = Dir.glob("{am,rm,docs,tests}/**/*") + FileList['COPYING', 'Rakefile','am.rb','assumed_library_types.rb','rm.rb']
    4445  s.files = candidates.delete_if do |item|
Note: See TracChangeset for help on using the changeset viewer.