Index: ruby/trunk/lib/adl_parser/Rakefile
===================================================================
--- ruby/trunk/lib/adl_parser/Rakefile	(revision 48)
+++ ruby/trunk/lib/adl_parser/Rakefile	(revision 49)
@@ -10,6 +10,6 @@
 $DEBUG = false
 
-RACC_SRC = FileList["*.y"]
-RACC_PARSER = FileList['parser.rb']
+RACC_SRC = FileList["lib/parser.y"]
+RACC_PARSER = FileList['lib/parser.rb']
 
 task :default => [:racc]
@@ -40,5 +40,5 @@
 
 Rake::TestTask.new('test:shell') do |t|
-  t.libs = ["."]
+  t.libs = ["lib"]
   t.pattern = ['tests/shell_test.rb']
   t.warning = true
@@ -70,5 +70,5 @@
 Rake::RDocTask.new('rdoc') do |t|
   t.rdoc_dir = 'rdoc'
-  t.rdoc_files.include('README', 'lib/*.rb', 'bin/*.rb')
+  t.rdoc_files.include('README', 'lib/*.rb')
   t.main = 'README'
   t.title = "ADL parser API documentation"
@@ -78,14 +78,13 @@
   s.name = 'adl_parser'
   s.author = 'Akimichi Tatsukawa'
-  s.version = '0.0.2'
+  s.version = '0.0.3'
   s.summary = 'ADL parser'
   s.email = 'akimichi_tatsukawa@nifty.com'
   s.test_files = FileList['tests/*_test.rb', '*.adl']
-  candidates = Dir.glob("{bin,docs,lib,tests,ext}/**/*")
+  candidates = Dir.glob("{docs,lib,tests}/**/*") + FileList['README', 'Rakefile']
   s.files = candidates.delete_if do |item|
     item.include?(".svn") || item.include?("rdoc")
   end
-  s.files = FileList['README', 'COPYING', 'Rakefile']
-  s.require_path = "lib"
+#  s.require_path = "lib"
   s.has_rdoc = true
   s.extra_rdoc_files = ["README"]
Index: ruby/trunk/lib/adl_parser/lib/adl_parser.rb
===================================================================
--- ruby/trunk/lib/adl_parser/lib/adl_parser.rb	(revision 49)
+++ ruby/trunk/lib/adl_parser/lib/adl_parser.rb	(revision 49)
@@ -0,0 +1,40 @@
+# component: openEHR Ruby ADL parser implementation
+# description: 
+# keywords: archetype, ADL, parser
+# author: Akimichi TATSUKAWA, Shinji KOBAYASHI
+# support: openEHR.jp
+# license: openEHR open source license
+
+$:.unshift File.join(File.dirname(__FILE__))
+require 'logger'
+
+module OpenEHR
+
+  if $DEBUG
+    LOG = Logger.new('log/adl_parser.log','daily')
+    LOG.level = Logger::INFO
+  else
+    LOG = Logger.new(STDOUT)
+    LOG.level = Logger::WARN
+  end
+  
+  
+
+
+  module ADL
+    autoload :Parser, "parser.rb"
+    autoload :Validator, "validator.rb"
+    
+    module Scanner
+      module DADL
+        autoload :RootScanner, "scanner.rb"
+      end
+    end
+  end
+
+  module Application
+    autoload :ADLValidator, "shell.rb"
+  end # of Application
+
+  
+end # of OpenEHR
Index: ruby/trunk/lib/adl_parser/lib/parser.rb
===================================================================
--- ruby/trunk/lib/adl_parser/lib/parser.rb	(revision 49)
+++ ruby/trunk/lib/adl_parser/lib/parser.rb	(revision 49)
@@ -0,0 +1,3613 @@
+#
+# DO NOT MODIFY!!!!
+# This file is automatically generated by racc 1.4.5
+# from racc grammer file "lib/parser.y".
+#
+
+require 'racc/parser'
+
+
+
+
+$:.unshift File.join(File.dirname(__FILE__))
+require 'logger'
+#require 'lib/util.rb'
+#require 'lib/scanner.rb'
+require 'rubygems'
+require 'am.rb'
+$DEBUG = false
+
+
+
+
+module OpenEHR
+
+  module ADL
+
+    class Parser < Racc::Parser
+
+module_eval <<'..end lib/parser.y modeval..idc8fd0a7fcc', 'lib/parser.y', 1182
+
+def assert_at(file,line, message = "")
+  unless yield
+    raise "Assertion failed !: #{file}, #{line}: #{message}"
+  end
+end
+
+if $DEBUG
+  @@log = Logger.new('log/parser.log','daily')
+  @@log.level = Logger::INFO
+else
+  @@log = Logger.new(STDOUT)
+  @@log.level = Logger::WARN
+end
+
+@@dadl_scanner = OpenEHR::ADL::Scanner::DADL::RootScanner.new
+@@cadl_scanner = OpenEHR::ADL::Scanner::CADL::RootScanner.new
+
+###----------/* keywords */ --------------------------------------------- 
+@@adl_reserved = {
+    'archetype' => :SYM_ARCHETYPE,
+    'adl_version' => :SYM_ADL_VERSION,
+    'controlled' => :SYM_IS_CONTROLLED,
+    'specialize' => :SYM_SPECIALIZE,
+    'concept' => :SYM_CONCEPT,
+    'language' => :SYM_LANGUAGE,
+    'description' => :SYM_DESCRIPTION,
+    'definition' => :SYM_DEFINITION,
+    'invariant' => :SYM_INVARIANT,
+    'ontology' => :SYM_ONTOLOGY,
+    'matches' => :SYM_MATCHES,
+    'is_in' => :SYM_MATCHES,
+    'occurrences' => :SYM_OCCURRENCES,
+    'true' => :SYM_TRUE, #[Tt][Rr][Uu][Ee] -- -> SYM_TRUE 
+    'false' => :SYM_FALSE, # [Ff][Aa][Ll][Ss][Ee] -- -> SYM_FALSE 
+    'infinity' => :SYM_INFINITY # [Ii][Nn][Ff][Ii][Nn][Ii][Tt][Yy] -- -> SYM_INFINITY 
+}
+
+@@dadl_reserved = {
+  'true' => :SYM_TRUE, #[Tt][Rr][Uu][Ee] -- -> SYM_TRUE 
+  'false' => :SYM_FALSE, # [Ff][Aa][Ll][Ss][Ee] -- -> SYM_FALSE 
+  'infinity' => :SYM_INFINITY # [Ii][Nn][Ff][Ii][Nn][Ii][Tt][Yy] -- -> SYM_INFINITY 
+}
+
+@@cadl_reserved = {
+  'then' => :SYM_THEN, # [Tt][Hh][Ee][Nn]
+  'else' => :SYM_ELSE, # [Ee][Ll][Ss][Ee]
+  'and' => :SYM_AND, # [Aa][Nn][Dd]
+  'or' => :SYM_OR, # [Oo][Rr]
+  'xor' => :SYM_XOR, # [Xx][Oo][Rr]
+  'not' => :SYM_NOT, # [Nn][Oo][Tt]
+  'implies' => :SYM_IMPLIES, # [Ii][Mm][Pp][Ll][Ii][Ee][Ss]
+  'true' => :SYM_TRUE, #[Tt][Rr][Uu][Ee] -- -> SYM_TRUE 
+  'false' => :SYM_FALSE, # [Ff][Aa][Ll][Ss][Ee] -- -> SYM_FALSE 
+  'forall' => :SYM_FORALL, # [Ff][Oo][Rr][_][Aa][Ll][Ll]
+  'exists' => :SYM_EXISTS, # [Ee][Xx][Ii][Ss][Tt][Ss]
+  'existence' => :SYM_EXISTENCE, # [Ee][Xx][Iu][Ss][Tt][Ee][Nn][Cc][Ee]
+  'occurrences' => :SYM_OCCURRENCES, # [Oo][Cc][Cc][Uu][Rr][Rr][Ee][Nn][Cc][Ee][Ss]
+  'cardinality' => :SYM_CARDINALITY, # [Cc][Aa][Rr][Dd][Ii][Nn][Aa][Ll][Ii][Tt][Yy]
+  'ordered' => :SYM_ORDERED, # [Oo][Rr][Dd][Ee][Rr][Ee][Dd]
+  'unordered' => :SYM_UNORDERED, # [Uu][Nn][Oo][Rr][Dd][Ee][Rr][Ee][Dd]
+  'unique' => :SYM_UNIQUE, # [Uu][Nn][Ii][Qq][Uu][Ee]
+  'matches' => :SYM_MATCHES, # [Mm][Aa][Tt][Cc][Hh][Ee][Ss]
+  'is_in' => :SYM_MATCHES, # [Ii][Ss][_][Ii][Nn]
+  'invariant' => :SYM_INVARIANT, # [Ii][Nn][Vv][Aa][Rr][Ii][Aa][Nn][Tt]
+  'infinity' => :SYM_INFINITY, # [Ii][Nn][Ff][Ii][Nn][Ii][Tt][Yy] -- -> SYM_INFINITY 
+  'use_node' => :SYM_USE_NODE, # [Uu][Ss][Ee][_][Nn][Oo][Dd][Ee]
+  'use_archetype' => :SYM_ALLOW_ARCHETYPE, # [Uu][Ss][Ee][_][Aa][Rr][Cc][Hh][Ee][Tt][Yy][Pp][Ee]
+  'allow_archetype' => :SYM_ALLOW_ARCHETYPE, # [Aa][Ll][Ll][Oo][Ww][_][Aa][Rr][Cc][Hh][Ee][Tt][Yy][Pp][Ee]
+  'include' => :SYM_INCLUDE, # [Ii][Nn][Cc][Ll][Uu][Dd][Ee]
+  'exclude' => :SYM_EXCLUDE # [Ee][Xx][Cc][Ll][Uu][Dd][Ee]
+}
+
+
+###----------/* Scanner */ ----------------------------------------------- 
+
+def scan
+  until @data.nil?  do
+    case @adl_type.last
+    when :adl
+      @data = scan_adl(@data) do |sym, val|
+        yield sym, val
+      end
+    when :dadl
+      @data = scan_dadl(@data) do |sym, val|
+        yield sym, val
+      end
+    when :cadl
+      @data = scan_cadl(@data) do |sym, val|
+        yield sym, val
+      end
+    when :regexp
+      @data = scan_regexp(@data) do |sym, val|
+        yield sym, val
+      end
+    else
+      raise
+    end
+    @data = $' # variable $' receives the string after the match
+  end
+  yield :EOF, nil
+  yield false, '$'
+end # of scan
+
+def scan_adl(data)
+  until data.nil?  do
+    case @adl_type.last
+    when :adl
+#      puts "Entering scan_adl"
+      case data
+      when /\A\n/ # carriage return
+        @lineno += 1
+        ;
+      when /\A[ \t\r\f]+/ #just drop it
+        ;
+      when /\A--.*\n/ # single line comment
+        @lineno += 1
+        @@log.info("#{__FILE__}:#{__LINE__}: scan_adl: COMMENT = #{$&} at #{@filename}:#{@lineno}")
+        ;
+      when /\Adescription/   # description
+        yield :SYM_DESCRIPTION, :SYM_DESCRIPTION
+      when /\Adefinition/   # definition
+        yield :SYM_DEFINITION, :SYM_DEFINITION
+#        @adl_type.push(:cadl)
+        ###----------/* symbols */ ------------------------------------------------- 
+      when /\A[A-Z][a-zA-Z0-9_]*/
+        yield :V_TYPE_IDENTIFIER, $&
+      when /\A[a-zA-Z][a-zA-Z0-9_-]+\.[a-zA-Z][a-zA-Z0-9_-]+\.[a-zA-Z0-9]+/   #V_ARCHETYPE_ID
+        yield :V_ARCHETYPE_ID, $&
+      when /\A[a-z][a-zA-Z0-9_]*/
+#        word = $&.downcase
+        word = $&
+        if @@adl_reserved[word]
+          @@log.info("#{__FILE__}:#{__LINE__}: scan_adl: @@adl_reserved = #{@@adl_reserved[word]} at #{@filename}:#{@lineno}")
+          yield @@adl_reserved[word], @@adl_reserved[word]
+        elsif #/\A[A-Z][a-zA-Z0-9_]*/
+          @@log.info("#{__FILE__}:#{__LINE__}: scan_adl: V_ATTRIBUTE_IDENTIFIER = #{$&} at #{@filename}:#{@lineno}")
+          yield :V_ATTRIBUTE_IDENTIFIER, $&
+        end
+      when /\A\=/   # =
+        yield :SYM_EQ, :SYM_EQ
+      when /\A\>=/   # >=
+        yield :SYM_GE, :SYM_GE
+      when /\A\<=/   # <=
+        yield :SYM_LE, :SYM_LE
+      when /\A\</   # <
+        if @in_interval
+#          @start_block_received = false
+          yield :SYM_LT, :SYM_LT
+        else
+#          @start_block_received = true
+          @adl_type.push(:dadl)
+          yield :SYM_START_DBLOCK,  $&
+        end
+      when /\A\>/   # >
+        if @in_interval
+          yield :SYM_GT, :SYM_GT
+        else
+          adl_type = @adl_type.pop
+#          puts "Escaping #{adl_type}"
+          assert_at(__FILE__,__LINE__){adl_type == :dadl}
+          yield :SYM_END_DBLOCK, :SYM_END_DBLOCK
+        end
+      when /\A\{/   # {
+        @adl_type.push(:cadl)
+        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: entering cADL at #{@filename}:#{@lineno}")
+        yield :SYM_START_CBLOCK, :SYM_START_CBLOCK
+      when /\A\}/   # }
+        adl_type = @adl_type.pop
+#        puts "Escaping #{adl_type}"
+        assert_at(__FILE__,__LINE__){adl_type == :cadl}
+        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: exiting cADL at #{@filename}:#{@lineno}")
+        yield :SYM_END_CBLOCK, $&
+      when /\A\-/   # -
+        yield :Minus_code, :Minus_code
+      when /\A\+/   # +
+        yield :Plus_code, :Plus_code
+      when /\A\*/   # *
+        yield :Star_code, :Star_code
+      when /\A\//   # /
+        yield :Slash_code, :Slash_code
+      when /\A\^/   # ^
+        yield :Caret_code, :Caret_code
+      when /\A\=/   # =
+        yield :Equal_code, :Equal_code
+      when /\A\.\.\./   # ...
+        yield :SYM_LIST_CONTINUE, :SYM_LIST_CONTINUE
+      when /\A\.\./   # ..
+        yield :SYM_ELLIPSIS, :SYM_ELLIPSIS
+      when /\A\./   # .
+        yield :Dot_code, :Dot_code
+      when /\A\;/   # ;
+        yield :Semicolon_code, :Semicolon_code
+      when /\A\,/   # ,
+        yield :Comma_code, :Comma_code
+      when /\A\:/   # :
+        yield :Colon_code, :Colon_code
+      when /\A\!/   # !
+        yield :Exclamation_code, :Exclamation_code
+      when /\A\(/   # (
+        yield :Left_parenthesis_code, :Left_parenthesis_code
+      when /\A\)/   # )
+        yield :Right_parenthesis_code, :Right_parenthesis_code
+      when /\A\$/   # $
+        yield :Dollar_code, :Dollar_code
+      when /\A\?\?/   # ??
+        yield :SYM_DT_UNKNOWN, :SYM_DT_UNKNOWN
+      when /\A\?/   # ?
+        yield :Question_mark_code, :Question_mark_code
+      when /\A[0-9]+\.[0-9]+(\.[0-9]+)*/   # ?
+        yield :V_VERSION_STRING, :V_VERSION_STRING
+      when /\A\|/   # |
+        if @in_interval
+          @in_interval = false
+        else
+          @in_interval = true
+        end
+        yield :SYM_INTERVAL_DELIM, :SYM_INTERVAL_DELIM
+      when /\A\[[a-zA-Z0-9()\._-]+::[a-zA-Z0-9\._-]+\]/
+#      when /\A\[[a-zA-Z0-9()\._-]+\:\:[a-zA-Z0-9\._-]+\]/   #V_QUALIFIED_TERM_CODE_REF form [ICD10AM(1998)::F23]
+        yield :V_QUALIFIED_TERM_CODE_REF, $&
+      when /\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/   #V_LOCAL_TERM_CODE_REF
+        yield :V_LOCAL_TERM_CODE_REF, $&
+      when /\A\[/   # [
+        yield :Left_bracket_code, :Left_bracket_code
+      when /\A\]/   # ]
+        yield :Right_bracket_code, :Right_bracket_code
+
+      when /\A\[[a-zA-Z0-9._\- ]+::[a-zA-Z0-9._\- ]+\]/   #ERR_V_QUALIFIED_TERM_CODE_REF
+        yield :ERR_V_QUALIFIED_TERM_CODE_REF, $&
+      when /\Aa[ct][0-9.]+/   #V_LOCAL_CODE
+        yield :V_LOCAL_CODE, $&
+      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-]-
+        yield :V_ISO8601_EXTENDED_DATE_TIME, $&
+      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]
+        yield :V_ISO8601_EXTENDED_TIME, $&
+      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
+        yield :V_ISO8601_EXTENDED_DATE, $&
+      when /\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/   #V_GENERIC_TYPE_IDENTIFIER
+        yield :V_GENERIC_TYPE_IDENTIFIER, $&
+      when /\A[0-9]+|[0-9]+[eE][+-]?[0-9]+/   #V_INTEGER
+        yield :V_INTEGER, $&
+      when /\A[0-9]+\.[0-9]+|[0-9]+\.[0-9]+[eE][+-]?[0-9]+ /   #V_REAL
+        yield :V_REAL, $&
+        #    when /\A"((?:[^"\\]+|\\.)*)"/ #V_STRING
+      when /\A"([^"]*)"/m #V_STRING
+        yield :V_STRING, $1
+      when /\A[a-z]+:\/\/[^<>|\\{}^~"\[\] ]*/ #V_URI
+        yield :V_URI, $&
+      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
+        yield :V_ISO8601_DURATION, $&
+      when /\A\S/ #UTF8CHAR
+        yield :UTF8CHAR, $&
+      end
+      data = $' # variable $' receives the string after the match
+    when :dadl
+#      puts "Entering scan_dadl"
+      data = scan_dadl(data) do |sym, val|
+        yield sym, val
+      end
+    when :cadl
+#      puts "Entering scan_cadl"
+      data = scan_cadl(data) do |sym, val|
+        yield sym, val
+      end
+    when :regexp
+#      puts "Entering scan_regexp"
+      data = scan_regexp(data) do |sym, val|
+        yield sym, val
+      end
+    when :term_constraint
+#      puts "Entering scan_term_constraint"
+      data = scan_term_constraint(data) do |sym, val|
+        yield sym, val
+      end
+    else
+      raise
+    end
+  end
+end # scan_adl
+
+
+def scan_cadl(data)
+  until data.nil?  do
+    case @adl_type.last
+    when :cadl
+#      puts "Entering scan_cadl"
+      case scanned = @@cadl_scanner.parse(data)
+      when Yaparc::Result::OK
+        if scanned.value[0] == :START_V_C_DOMAIN_TYPE_BLOCK
+          @in_c_domain_type = true
+          @adl_type.push(:dadl)
+          yield scanned.value
+        else
+          yield scanned.value
+        end
+        data = scanned.input
+      end
+
+      case data
+      when /\A\n/ # carriage return
+        @lineno += 1
+        ;
+      when /\A[ \t\r\f]+/ #just drop it
+        ;
+      when /\A--.*\n/ # single line comment
+        @lineno += 1
+        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: COMMENT = #{$&} at #{@filename}:#{@lineno}")
+        ;
+        ###----------/* symbols */ ------------------------------------------------- 
+      when /\A\=/   # =
+        yield :SYM_EQ, :SYM_EQ
+      when /\A\>=/   # >=
+        yield :SYM_GE, :SYM_GE
+      when /\A\<=/   # <=
+        yield :SYM_LE, :SYM_LE
+###       when /\A[A-Z][a-zA-Z0-9_]*[ \n]*\</   # V_C_DOMAIN_TYPE
+###         @in_c_domain_type = true
+###         @adl_type.push(:dadl)
+###         yield :START_V_C_DOMAIN_TYPE_BLOCK, $&
+      when /\A\</   # <
+        if @in_interval
+          yield :SYM_LT, :SYM_LT
+        else
+          @adl_type.push(:dadl)
+          yield :SYM_START_DBLOCK,  $&
+        end
+      when /\A\>/   # >
+        if @in_interval
+          yield :SYM_GT, :SYM_GT
+        else
+          adl_type = @adl_type.pop
+#          puts "Escaping #{adl_type}"
+          assert_at(__FILE__,__LINE__){adl_type == :dadl}
+          yield :SYM_END_DBLOCK, :SYM_END_DBLOCK
+        end
+      when /\A\-/   # -
+        yield :Minus_code, :Minus_code
+      when /\A\+/   # +
+        yield :Plus_code, :Plus_code
+      when /\A\*/   # *
+        yield :Star_code, :Star_code
+      when /\A\//   # /
+        yield :Slash_code, :Slash_code
+      when /\A\^/   # ^
+        yield :Caret_code, :Caret_code
+      when /\A\.\.\./   # ...
+        yield :SYM_LIST_CONTINUE, :SYM_LIST_CONTINUE
+      when /\A\.\./   # ..
+        yield :SYM_ELLIPSIS, :SYM_ELLIPSIS
+      when /\A\./   # .
+        yield :Dot_code, :Dot_code
+      when /\A\;/   # ;
+        yield :Semicolon_code, :Semicolon_code
+      when /\A\,/   # ,
+        yield :Comma_code, :Comma_code
+      when /\A\:/   # :
+        yield :Colon_code, :Colon_code
+      when /\A\!/   # !
+        yield :Exclamation_code, :Exclamation_code
+      when /\A\(/   # (
+        yield :Left_parenthesis_code, :Left_parenthesis_code
+      when /\A\)/   # )
+        yield :Right_parenthesis_code, :Right_parenthesis_code
+      when /\A\{\// #V_REGEXP
+        if @adl_type.last != :regexp
+          @in_regexp = true
+          @adl_type.push(:regexp)
+          yield :START_REGEXP_BLOCK, :START_REGEXP_BLOCK
+        else
+          raise
+        end
+#        yield :V_REGEXP, :V_REGEXP
+      when /\A\{/   # {
+        @adl_type.push(:cadl)
+        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: entering cADL at #{@filename}:#{@lineno}")
+        yield :SYM_START_CBLOCK, :SYM_START_CBLOCK
+      when /\A\}/   # }
+        adl_type = @adl_type.pop
+#        puts "Escaping #{adl_type}"
+        assert_at(__FILE__,__LINE__){adl_type == :cadl}
+        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: exiting cADL at #{@filename}:#{@lineno}")
+        yield :SYM_END_CBLOCK, :SYM_END_CBLOCK
+      when /\A\$/   # $
+        yield :Dollar_code, :Dollar_code
+      when /\A\?\?/   # ??
+        yield :SYM_DT_UNKNOWN, :SYM_DT_UNKNOWN
+      when /\A\?/   # ?
+        yield :Question_mark_code, :Question_mark_code
+      when /\A\|/   # |
+        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: @in_interval = #{@in_interval} at #{@filename}:#{@lineno}")
+        if @in_interval
+          @in_interval = false
+        else
+#          @in_interval = false
+          @in_interval = true
+        end
+        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: SYM_INTERVAL_DELIM at #{@filename}:#{@lineno}")
+        yield :SYM_INTERVAL_DELIM, :SYM_INTERVAL_DELIM
+
+      when /\A\[[a-zA-Z0-9._\-]+::[a-zA-Z0-9._\-]+\]/   #V_QUALIFIED_TERM_CODE_REF form [ICD10AM(1998)::F23]
+        yield :V_QUALIFIED_TERM_CODE_REF, $&
+      when /\A\[[a-zA-Z0-9._\- ]+::[a-zA-Z0-9._\- ]+\]/   #ERR_V_QUALIFIED_TERM_CODE_REF
+        yield :ERR_V_QUALIFIED_TERM_CODE_REF, $&
+      when /\A\[([a-zA-Z0-9()._\-]+::[a-zA-Z0-9._\_-]+)\]/
+        yield :V_TERM_CODE_CONSTRAINT, :V_TERM_CODE_CONSTRAINT
+      when /\A\[[a-zA-Z0-9\(\)\._\-]+::[ \t\n]*/
+        @adl_type.push(:term_constraint)
+        yield :START_TERM_CODE_CONSTRAINT, $&
+      when /\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/   #V_LOCAL_TERM_CODE_REF
+        yield :V_LOCAL_TERM_CODE_REF, $&
+      when /\A\[/   # [
+        yield :Left_bracket_code, :Left_bracket_code
+      when /\A\]/   # ]
+        yield :Right_bracket_code, :Right_bracket_code
+      when /\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/   #V_GENERIC_TYPE_IDENTIFIER
+        yield :V_GENERIC_TYPE_IDENTIFIER, $&
+      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]/
+        yield :V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN, $&
+      when /\A[yY][yY][yY][yY]-[mM?X][mM?X]-[dD?X][dD?X]/
+        yield :V_ISO8601_DATE_CONSTRAINT_PATTERN, $&
+      when /\A[hH][hH]:[mM?X][mM?X]:[sS?X][sS?X]/
+        yield :V_ISO8601_TIME_CONSTRAINT_PATTERN, $&
+      when /\A[a-z][a-zA-Z0-9_]*/
+        word = $&.dup
+        if @@cadl_reserved[word.downcase]
+          yield @@cadl_reserved[word.downcase], @@cadl_reserved[word.downcase]
+        else
+          @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: V_ATTRIBUTE_IDENTIFIER = #{word} at #{@filename}:#{@lineno}")
+          yield :V_ATTRIBUTE_IDENTIFIER, word #V_ATTRIBUTE_IDENTIFIER /\A[a-z][a-zA-Z0-9_]*/
+        end
+      when /\A[A-Z][a-zA-Z0-9_]*/
+        word = $&.dup
+        if @@cadl_reserved[word.downcase]
+          yield @@cadl_reserved[word.downcase], @@cadl_reserved[word.downcase]
+        else
+          yield :V_TYPE_IDENTIFIER, $&
+        end
+      when /\Aa[ct][0-9.]+/   #V_LOCAL_CODE
+        yield :V_LOCAL_CODE, $&
+      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-]-
+        yield :V_ISO8601_EXTENDED_DATE_TIME, $&
+      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]
+        yield :V_ISO8601_EXTENDED_TIME, $&
+      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
+        yield :V_ISO8601_EXTENDED_DATE, $&
+      when /\A[0-9]+|[0-9]+[eE][+-]?[0-9]+/   #V_INTEGER
+        yield :V_INTEGER, $&
+      when /\A[0-9]+\.[0-9]+|[0-9]+\.[0-9]+[eE][+-]?[0-9]+ /   #V_REAL
+        yield :V_REAL, $&
+           when /\A"((?:[^"\\]+|\\.)*)"/ #V_STRING
+      when /\A"([^"]*)"/m #V_STRING
+        yield :V_STRING, $1
+      when /\A[a-z]+:\/\/[^<>|\\{}^~"\[\] ]*/ #V_URI
+        yield :V_URI, $&
+###       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
+###         yield :V_ISO8601_DURATION, $&
+      when /\A\S/ #UTF8CHAR
+        yield :UTF8CHAR, $&
+      else
+        raise
+      end
+      data = $' # variable $' receives the string after the match
+    when :adl
+#      puts "Entering scan_adl"
+      data = scan_adl(data) do |sym, val|
+        yield sym, val
+      end
+    when :dadl
+#      puts "Entering scan_dadl"
+      data = scan_dadl(data) do |sym, val|
+        yield sym, val
+      end
+    when :regexp
+#      puts "Entering scan_regexp"
+      data = scan_regexp(data) do |sym, val|
+        yield sym, val
+      end
+    when :term_constraint
+#      puts "Entering scan_term_constraint"
+      data = scan_term_constraint(data) do |sym, val|
+        yield sym, val
+      end
+    else
+      raise
+    end
+  end # of until
+end # of scan_cadl
+
+def scan_dadl(data)
+  until data.nil?  do
+    case @adl_type.last
+    when :dadl
+#      puts "Entering scan_dadl"
+      case scanned = @@dadl_scanner.parse(data)
+      when Yaparc::Result::OK
+        yield scanned.value
+        data = scanned.input
+      else
+      end
+
+      case data
+      when /\A\n/ # carriage return
+        @lineno += 1
+        ;
+      when /\A[ \t\r\f]+/ #just drop it
+        ;
+      when /\A--.*\n/ # single line comment
+        @lineno += 1
+        @@log.info("#{__FILE__}:#{__LINE__}: scan_dadl: COMMENT = #{$&} at #{@filename}:#{@lineno}")
+        ;
+        ###----------/* symbols */ ------------------------------------------------- 
+      when /\A\=/   # =
+        yield :SYM_EQ, :SYM_EQ
+      when /\A\>\=/   # >=
+        yield :SYM_GE, :SYM_GE
+      when /\A\<\=/   # <=
+        yield :SYM_LE, :SYM_LE
+      when /\A\</   # <
+        if @in_interval
+          yield :SYM_LT, :SYM_LT
+        else
+          @adl_type.push(:dadl)
+          yield :SYM_START_DBLOCK, :SYM_START_DBLOCK
+        end
+      when /\A\>/   # >
+        if @in_interval
+#          @in_interval = false
+          yield :SYM_GT, :SYM_GT
+        elsif @in_c_domain_type == true
+          assert_at(__FILE__,__LINE__){@adl_type.last == :dadl}
+          adl_type = @adl_type.pop
+          if @adl_type.last == :cadl
+            @in_c_domain_type = false
+            yield :END_V_C_DOMAIN_TYPE_BLOCK, $&
+          else
+            yield :SYM_END_DBLOCK, $&
+          end
+        elsif @in_c_domain_type == false
+          adl_type = @adl_type.pop
+#          puts "Escaping #{adl_type}"
+          assert_at(__FILE__,__LINE__){adl_type == :dadl}
+          yield :SYM_END_DBLOCK, $&
+        else
+          raise
+        end
+      when /\A\-/   # -
+        yield :Minus_code, :Minus_code
+      when /\A\+/   # +
+        yield :Plus_code, :Plus_code
+      when /\A\*/   # *
+        yield :Star_code, :Star_code
+      when /\A\//   # /
+        yield :Slash_code, :Slash_code
+      when /\A\^/   # ^
+        yield :Caret_code, :Caret_code
+      when /\A\.\.\./   # ...
+        yield :SYM_LIST_CONTINUE, :SYM_LIST_CONTINUE
+      when /\A\.\./   # ..
+        yield :SYM_ELLIPSIS, :SYM_ELLIPSIS
+      when /\A\./   # .
+        yield :Dot_code, :Dot_code
+      when /\A\;/   # ;
+        yield :Semicolon_code, :Semicolon_code
+      when /\A\,/   # ,
+        yield :Comma_code, :Comma_code
+      when /\A\:/   # :
+        yield :Colon_code, :Colon_code
+      when /\A\!/   # !
+        yield :Exclamation_code, :Exclamation_code
+      when /\A\(/   # (
+        yield :Left_parenthesis_code, :Left_parenthesis_code
+      when /\A\)/   # )
+        yield :Right_parenthesis_code, :Right_parenthesis_code
+      when /\A\$/   # $
+        yield :Dollar_code, :Dollar_code
+      when /\A\?\?/   # ??
+        yield :SYM_DT_UNKNOWN, :SYM_DT_UNKNOWN
+      when /\A\?/   # ?
+        yield :Question_mark_code, :Question_mark_code
+      when /\A\|/   # |
+        @@log.info("#{__FILE__}:#{__LINE__}: scan_dadl: @in_interval = #{@in_interval} at #{@filename}:#{@lineno}")
+        if @in_interval
+          @in_interval = false
+        else
+#          @in_interval = false
+          @in_interval = true
+        end
+        @@log.info("#{__FILE__}:#{__LINE__}: scan_dadl: SYM_INTERVAL_DELIM at #{@filename}:#{@lineno}")
+        yield :SYM_INTERVAL_DELIM, :SYM_INTERVAL_DELIM
+###       when /\A\[[a-zA-Z0-9()\._-]+::[a-zA-Z0-9\._-]+\]/   #V_QUALIFIED_TERM_CODE_REF form [ICD10AM(1998)::F23]
+###         yield :V_QUALIFIED_TERM_CODE_REF, $&
+###       when /\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/   #V_LOCAL_TERM_CODE_REF
+###         yield :V_LOCAL_TERM_CODE_REF, $&
+###       when /\A\[[a-zA-Z0-9._\- ]+::[a-zA-Z0-9._\- ]+\]/   #ERR_V_QUALIFIED_TERM_CODE_REF
+###         yield :ERR_V_QUALIFIED_TERM_CODE_REF, $&
+      when /\A\[/   # [
+        yield :Left_bracket_code, :Left_bracket_code
+      when /\A\]/   # ]
+        yield :Right_bracket_code, :Right_bracket_code
+###       when /\A[A-Z][a-zA-Z0-9_-]*/
+###         yield :V_TYPE_IDENTIFIER, $&
+###       when /\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/   #V_GENERIC_TYPE_IDENTIFIER
+###         yield :V_GENERIC_TYPE_IDENTIFIER, $&
+###       when /\A[a-z][a-zA-Z0-9_]*/
+###         word = $&.downcase
+###         if @@dadl_reserved[word]
+###           yield @@dadl_reserved[word], @@dadl_reserved[word]
+###         else
+###           yield :V_ATTRIBUTE_IDENTIFIER, $&
+###         end
+###       when /\Aa[ct][0-9.]+/   #V_LOCAL_CODE
+###         yield :V_LOCAL_CODE, $&
+      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-]-
+        yield :V_ISO8601_EXTENDED_DATE_TIME, $&
+      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]
+        yield :V_ISO8601_EXTENDED_TIME, $&
+      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
+        yield :V_ISO8601_EXTENDED_DATE, $&
+      when /\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/   #V_GENERIC_TYPE_IDENTIFIER
+        yield :V_GENERIC_TYPE_IDENTIFIER, $&
+      when /\A[0-9]+|[0-9]+[eE][+-]?[0-9]+/   #V_INTEGER
+        yield :V_INTEGER, $&
+###       when /\A[0-9]+\.[0-9]+|[0-9]+\.[0-9]+[eE][+-]?[0-9]+ /   #V_REAL
+###         yield :V_REAL, $&
+        #    when /\A"((?:[^"\\]+|\\.)*)"/ #V_STRING
+###       when /\A"([^"]*)"/m #V_STRING
+###         yield :V_STRING, $1
+      when /\A[a-z]+:\/\/[^<>|\\{}^~"\[\] ]*/ #V_URI
+        yield :V_URI, $&
+###       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
+###         yield :V_ISO8601_DURATION, $&
+      when /\A\S/ #UTF8CHAR
+        yield :UTF8CHAR, $&
+      end
+      data = $' # variable $' receives the string after the match
+    when :adl
+#      puts "Entering scan_adl"
+      data = scan_adl(data) do |sym, val|
+        yield sym, val
+      end
+    when :cadl
+#      puts "Entering scan_cadl"
+      data = scan_cadl(data) do |sym, val|
+        yield sym, val
+      end
+    when :regexp
+#      puts "Entering scan_regexp"
+      data = scan_regexp(data) do |sym, val|
+        yield sym, val
+      end
+    when :term_constraint
+#      puts "Entering scan_term_constraint"
+      data = scan_term_constraint(data) do |sym, val|
+        yield sym, val
+      end
+    else
+      raise
+    end
+  end
+end # of scan_dadl
+
+def scan_regexp(data)
+  until data.nil?  do
+    case @adl_type.last
+    when :regexp
+#      puts "Entering scan_regexp"
+      case data
+      when /\A\/\}/ #V_REGEXP
+        if @adl_type.last == :regexp
+          @in_regexp = false
+          @adl_type.pop
+          yield :END_REGEXP_BLOCK, :END_REGEXP_BLOCK
+        else
+          raise
+        end
+      when /\A(.*)(\/\})/ #V_REGEXP
+        yield :REGEXP_BODY, $1
+        if @adl_type.last == :regexp
+          @in_regexp = false
+          @adl_type.pop
+          yield :END_REGEXP_BLOCK, :END_REGEXP_BLOCK
+        else
+          raise
+        end
+      else
+        raise data
+      end
+      data = $' # variable $' receives the string after the match
+    when :adl
+#      puts "Entering scan_adl"
+      data = scan_adl(data) do |sym, val|
+        yield sym, val
+      end
+    when :dadl
+#      puts "Entering scan_dadl"
+      data = scan_dadl(data) do |sym, val|
+        yield sym, val
+      end
+    when :cadl
+#      puts "Entering scan_cadl"
+      data = scan_cadl(data) do |sym, val|
+        yield sym, val
+      end
+    when :term_constraint
+#      puts "Entering scan_term_constraint"
+      data = scan_term_constraint(data) do |sym, val|
+        yield sym, val
+      end
+    else
+      raise
+    end
+  end
+end # of scan_regexp
+
+def scan_term_constraint(data)
+  until data.nil?  do
+    case @adl_type.last
+    when :term_constraint
+#      puts "Entering scan_term_constraint"
+      case data
+      when /\A\n/ # carriage return
+        @lineno += 1
+        ;
+      when /\A[ \t\r\f]+/ #just drop it
+        ;
+      when /\A--.*$/ # single line comment
+        @lineno += 1
+        @@log.info("#{__FILE__}:#{__LINE__}: scan_term_constraint: COMMENT = #{$&} at #{@filename}:#{@lineno}")
+        ;
+      when /\A[a-zA-Z0-9\._\-]+[ \t]*,/ # match any line, with ',' termination
+        yield :TERM_CODE, $&
+      when /\A[a-zA-Z0-9\._\-]+[ \t]*;/ #match second last line with ';' termination (assumed value)
+        yield :TERM_CODE, $&
+#      when /\A[a-zA-Z0-9\._\-]+[ \t]*\]/ # match final line, terminating in ']'
+      when /\A[a-zA-Z0-9\._\-]*[ \t]*\]/ # match final line, terminating in ']'
+        adl_type = @adl_type.pop
+        assert_at(__FILE__,__LINE__){adl_type == :term_constraint}
+        yield :END_TERM_CODE_CONSTRAINT, $&
+      else
+        raise "data = #{data}"
+      end
+      data = $' # variable $' receives the string after the match
+    when :adl
+#      puts "Entering scan_adl"
+      data = scan_adl(data) do |sym, val|
+        yield sym, val
+      end
+    when :dadl
+#      puts "Entering scan_dadl"
+      data = scan_dadl(data) do |sym, val|
+        yield sym, val
+      end
+    when :cadl
+#      puts "Entering scan_cadl"
+      data = scan_cadl(data) do |sym, val|
+        yield sym, val
+      end
+    else
+      raise
+    end
+  end
+end # of scan_term_constraint
+
+
+def parse(data, filename, lineno = 1, debug = false)
+  @yydebug = true
+  @parsestring = data
+  @data = data
+  @lineno = lineno
+  @filename = filename
+  @adl_type = [:adl] # {:adl, :cadl, :dadl}
+  @in_regexp = false
+  @in_interval = false
+  @in_c_domain_type = false
+  yyparse self, :scan
+end
+
+def on_error( t, v, values)
+  raise Racc::ParseError, "#{@filename}:#{@lineno}: Inline syntax error on #{v.inspect}"
+end
+
+
+
+
+
+
+
+### Local Variables:
+### mode:ruby
+### mode:font-lock
+### comment-column:0
+### comment-start: "### "
+### comment-end:"" 
+### End:
+
+
+
+
+..end lib/parser.y modeval..idc8fd0a7fcc
+
+##### racc 1.4.5 generates ###
+
+racc_reduce_table = [
+ 0, 0, :racc_error,
+ 2, 96, :_reduce_1,
+ 1, 96, :_reduce_none,
+ 8, 97, :_reduce_3,
+ 2, 98, :_reduce_4,
+ 2, 98, :_reduce_5,
+ 1, 106, :_reduce_6,
+ 2, 106, :_reduce_7,
+ 3, 107, :_reduce_8,
+ 1, 108, :_reduce_9,
+ 3, 108, :_reduce_10,
+ 3, 109, :_reduce_11,
+ 1, 109, :_reduce_12,
+ 0, 99, :_reduce_none,
+ 2, 99, :_reduce_none,
+ 2, 99, :_reduce_none,
+ 2, 100, :_reduce_16,
+ 2, 100, :_reduce_none,
+ 0, 101, :_reduce_18,
+ 2, 101, :_reduce_19,
+ 2, 101, :_reduce_none,
+ 0, 102, :_reduce_none,
+ 2, 102, :_reduce_22,
+ 2, 102, :_reduce_none,
+ 2, 103, :_reduce_24,
+ 2, 103, :_reduce_none,
+ 1, 111, :_reduce_26,
+ 1, 111, :_reduce_27,
+ 5, 112, :_reduce_28,
+ 5, 112, :_reduce_29,
+ 2, 114, :_reduce_30,
+ 1, 116, :_reduce_31,
+ 2, 116, :_reduce_32,
+ 1, 115, :_reduce_none,
+ 1, 115, :_reduce_34,
+ 1, 121, :_reduce_35,
+ 1, 121, :_reduce_36,
+ 1, 121, :_reduce_37,
+ 1, 121, :_reduce_38,
+ 1, 121, :_reduce_39,
+ 1, 121, :_reduce_40,
+ 1, 121, :_reduce_41,
+ 1, 121, :_reduce_42,
+ 1, 121, :_reduce_none,
+ 1, 121, :_reduce_none,
+ 3, 122, :_reduce_45,
+ 4, 123, :_reduce_46,
+ 3, 123, :_reduce_none,
+ 6, 124, :_reduce_48,
+ 2, 130, :_reduce_49,
+ 2, 133, :_reduce_50,
+ 3, 133, :_reduce_none,
+ 2, 133, :_reduce_none,
+ 1, 128, :_reduce_53,
+ 1, 134, :_reduce_54,
+ 1, 134, :_reduce_55,
+ 1, 134, :_reduce_56,
+ 1, 134, :_reduce_57,
+ 1, 134, :_reduce_58,
+ 1, 134, :_reduce_59,
+ 1, 134, :_reduce_60,
+ 1, 134, :_reduce_61,
+ 1, 119, :_reduce_none,
+ 1, 120, :_reduce_63,
+ 2, 120, :_reduce_64,
+ 5, 143, :_reduce_65,
+ 5, 143, :_reduce_66,
+ 5, 143, :_reduce_67,
+ 2, 144, :_reduce_68,
+ 3, 144, :_reduce_69,
+ 1, 145, :_reduce_70,
+ 2, 145, :_reduce_71,
+ 1, 145, :_reduce_72,
+ 0, 131, :_reduce_none,
+ 2, 131, :_reduce_74,
+ 0, 132, :_reduce_none,
+ 2, 132, :_reduce_76,
+ 1, 148, :_reduce_none,
+ 2, 148, :_reduce_none,
+ 3, 149, :_reduce_none,
+ 1, 149, :_reduce_none,
+ 3, 149, :_reduce_none,
+ 0, 104, :_reduce_none,
+ 2, 104, :_reduce_none,
+ 2, 104, :_reduce_none,
+ 2, 105, :_reduce_85,
+ 2, 105, :_reduce_none,
+ 1, 110, :_reduce_none,
+ 1, 152, :_reduce_none,
+ 1, 152, :_reduce_none,
+ 1, 153, :_reduce_90,
+ 2, 153, :_reduce_91,
+ 3, 153, :_reduce_92,
+ 3, 155, :_reduce_93,
+ 1, 156, :_reduce_94,
+ 2, 156, :_reduce_none,
+ 1, 157, :_reduce_96,
+ 1, 157, :_reduce_97,
+ 1, 154, :_reduce_98,
+ 1, 154, :_reduce_99,
+ 1, 160, :_reduce_100,
+ 2, 160, :_reduce_101,
+ 3, 161, :_reduce_102,
+ 1, 162, :_reduce_103,
+ 1, 163, :_reduce_104,
+ 2, 163, :_reduce_105,
+ 3, 164, :_reduce_106,
+ 3, 165, :_reduce_107,
+ 1, 159, :_reduce_108,
+ 2, 159, :_reduce_109,
+ 2, 167, :_reduce_110,
+ 3, 167, :_reduce_111,
+ 1, 168, :_reduce_none,
+ 1, 158, :_reduce_113,
+ 2, 158, :_reduce_114,
+ 3, 169, :_reduce_115,
+ 1, 170, :_reduce_116,
+ 1, 170, :_reduce_117,
+ 1, 170, :_reduce_118,
+ 1, 170, :_reduce_119,
+ 1, 170, :_reduce_120,
+ 1, 166, :_reduce_121,
+ 1, 166, :_reduce_122,
+ 1, 166, :_reduce_123,
+ 1, 166, :_reduce_124,
+ 1, 166, :_reduce_125,
+ 1, 166, :_reduce_126,
+ 1, 166, :_reduce_127,
+ 1, 166, :_reduce_128,
+ 1, 166, :_reduce_129,
+ 1, 166, :_reduce_130,
+ 1, 171, :_reduce_none,
+ 1, 171, :_reduce_none,
+ 1, 171, :_reduce_none,
+ 1, 171, :_reduce_none,
+ 1, 171, :_reduce_none,
+ 1, 171, :_reduce_none,
+ 1, 171, :_reduce_none,
+ 1, 171, :_reduce_none,
+ 1, 171, :_reduce_none,
+ 1, 172, :_reduce_none,
+ 1, 172, :_reduce_none,
+ 1, 172, :_reduce_none,
+ 1, 172, :_reduce_none,
+ 1, 172, :_reduce_none,
+ 1, 172, :_reduce_none,
+ 1, 118, :_reduce_146,
+ 1, 118, :_reduce_147,
+ 1, 175, :_reduce_148,
+ 3, 185, :_reduce_none,
+ 3, 185, :_reduce_none,
+ 3, 185, :_reduce_none,
+ 1, 176, :_reduce_152,
+ 2, 176, :_reduce_153,
+ 2, 176, :_reduce_154,
+ 3, 186, :_reduce_none,
+ 3, 186, :_reduce_none,
+ 3, 186, :_reduce_none,
+ 5, 194, :_reduce_none,
+ 6, 194, :_reduce_none,
+ 6, 194, :_reduce_none,
+ 7, 194, :_reduce_none,
+ 4, 194, :_reduce_none,
+ 4, 194, :_reduce_none,
+ 4, 194, :_reduce_none,
+ 4, 194, :_reduce_none,
+ 3, 194, :_reduce_none,
+ 1, 177, :_reduce_167,
+ 2, 177, :_reduce_168,
+ 2, 177, :_reduce_169,
+ 3, 187, :_reduce_none,
+ 3, 187, :_reduce_none,
+ 3, 187, :_reduce_none,
+ 5, 195, :_reduce_none,
+ 6, 195, :_reduce_none,
+ 6, 195, :_reduce_none,
+ 7, 195, :_reduce_none,
+ 4, 195, :_reduce_none,
+ 4, 195, :_reduce_none,
+ 4, 195, :_reduce_none,
+ 4, 195, :_reduce_none,
+ 3, 195, :_reduce_none,
+ 1, 178, :_reduce_182,
+ 1, 178, :_reduce_183,
+ 3, 188, :_reduce_none,
+ 3, 188, :_reduce_none,
+ 3, 188, :_reduce_none,
+ 1, 179, :_reduce_none,
+ 3, 189, :_reduce_none,
+ 3, 189, :_reduce_none,
+ 3, 189, :_reduce_none,
+ 1, 180, :_reduce_none,
+ 3, 190, :_reduce_none,
+ 3, 190, :_reduce_none,
+ 3, 190, :_reduce_none,
+ 5, 196, :_reduce_none,
+ 6, 196, :_reduce_none,
+ 6, 196, :_reduce_none,
+ 7, 196, :_reduce_none,
+ 4, 196, :_reduce_none,
+ 4, 196, :_reduce_none,
+ 4, 196, :_reduce_none,
+ 4, 196, :_reduce_none,
+ 3, 196, :_reduce_none,
+ 1, 181, :_reduce_none,
+ 3, 191, :_reduce_none,
+ 3, 191, :_reduce_none,
+ 3, 191, :_reduce_none,
+ 5, 197, :_reduce_none,
+ 6, 197, :_reduce_none,
+ 6, 197, :_reduce_none,
+ 7, 197, :_reduce_none,
+ 4, 197, :_reduce_none,
+ 4, 197, :_reduce_none,
+ 4, 197, :_reduce_none,
+ 4, 197, :_reduce_none,
+ 3, 197, :_reduce_none,
+ 1, 182, :_reduce_none,
+ 3, 192, :_reduce_none,
+ 3, 192, :_reduce_none,
+ 3, 192, :_reduce_none,
+ 5, 198, :_reduce_none,
+ 6, 198, :_reduce_none,
+ 6, 198, :_reduce_none,
+ 7, 198, :_reduce_none,
+ 4, 198, :_reduce_none,
+ 4, 198, :_reduce_none,
+ 4, 198, :_reduce_none,
+ 4, 198, :_reduce_none,
+ 3, 198, :_reduce_none,
+ 1, 183, :_reduce_230,
+ 3, 193, :_reduce_none,
+ 3, 193, :_reduce_none,
+ 3, 193, :_reduce_none,
+ 5, 199, :_reduce_none,
+ 6, 199, :_reduce_none,
+ 6, 199, :_reduce_none,
+ 7, 199, :_reduce_none,
+ 4, 199, :_reduce_none,
+ 4, 199, :_reduce_none,
+ 4, 199, :_reduce_none,
+ 4, 199, :_reduce_none,
+ 3, 199, :_reduce_none,
+ 1, 173, :_reduce_243,
+ 3, 174, :_reduce_none,
+ 3, 174, :_reduce_none,
+ 3, 174, :_reduce_none,
+ 1, 184, :_reduce_247,
+ 1, 113, :_reduce_none,
+ 2, 113, :_reduce_none,
+ 3, 200, :_reduce_none,
+ 1, 200, :_reduce_none,
+ 3, 200, :_reduce_none,
+ 1, 151, :_reduce_none,
+ 1, 151, :_reduce_none,
+ 2, 202, :_reduce_none,
+ 2, 202, :_reduce_none,
+ 5, 202, :_reduce_none,
+ 5, 202, :_reduce_none,
+ 2, 202, :_reduce_none,
+ 3, 202, :_reduce_none,
+ 3, 202, :_reduce_none,
+ 3, 202, :_reduce_none,
+ 3, 202, :_reduce_none,
+ 3, 202, :_reduce_none,
+ 3, 202, :_reduce_none,
+ 3, 202, :_reduce_none,
+ 3, 202, :_reduce_none,
+ 3, 202, :_reduce_none,
+ 3, 202, :_reduce_none,
+ 3, 201, :_reduce_none,
+ 1, 201, :_reduce_none,
+ 1, 201, :_reduce_none,
+ 1, 204, :_reduce_none,
+ 1, 204, :_reduce_none,
+ 3, 206, :_reduce_none,
+ 3, 206, :_reduce_none,
+ 3, 206, :_reduce_none,
+ 3, 206, :_reduce_none,
+ 3, 206, :_reduce_none,
+ 3, 205, :_reduce_none,
+ 1, 205, :_reduce_none,
+ 1, 205, :_reduce_none,
+ 1, 205, :_reduce_none,
+ 1, 129, :_reduce_none,
+ 2, 129, :_reduce_none,
+ 1, 203, :_reduce_none,
+ 3, 203, :_reduce_none,
+ 2, 207, :_reduce_288,
+ 1, 207, :_reduce_289,
+ 0, 146, :_reduce_290,
+ 5, 146, :_reduce_291,
+ 1, 208, :_reduce_292,
+ 3, 208, :_reduce_293,
+ 5, 147, :_reduce_294,
+ 1, 209, :_reduce_none,
+ 3, 209, :_reduce_none,
+ 3, 209, :_reduce_none,
+ 3, 209, :_reduce_none,
+ 5, 209, :_reduce_none,
+ 5, 209, :_reduce_none,
+ 5, 209, :_reduce_none,
+ 5, 209, :_reduce_none,
+ 1, 211, :_reduce_303,
+ 1, 211, :_reduce_304,
+ 0, 117, :_reduce_none,
+ 5, 117, :_reduce_306,
+ 2, 117, :_reduce_none,
+ 1, 210, :_reduce_none,
+ 3, 210, :_reduce_none,
+ 1, 212, :_reduce_none,
+ 1, 212, :_reduce_none,
+ 1, 212, :_reduce_none,
+ 1, 135, :_reduce_none,
+ 3, 135, :_reduce_none,
+ 3, 135, :_reduce_none,
+ 1, 213, :_reduce_none,
+ 1, 213, :_reduce_none,
+ 1, 213, :_reduce_none,
+ 1, 136, :_reduce_none,
+ 3, 136, :_reduce_none,
+ 3, 136, :_reduce_none,
+ 1, 214, :_reduce_none,
+ 1, 214, :_reduce_none,
+ 1, 214, :_reduce_none,
+ 1, 137, :_reduce_none,
+ 3, 137, :_reduce_none,
+ 3, 137, :_reduce_none,
+ 1, 215, :_reduce_none,
+ 1, 215, :_reduce_none,
+ 1, 215, :_reduce_none,
+ 1, 138, :_reduce_none,
+ 3, 138, :_reduce_none,
+ 3, 138, :_reduce_none,
+ 1, 216, :_reduce_none,
+ 1, 216, :_reduce_none,
+ 1, 216, :_reduce_none,
+ 1, 139, :_reduce_none,
+ 3, 139, :_reduce_none,
+ 3, 139, :_reduce_none,
+ 1, 217, :_reduce_none,
+ 3, 217, :_reduce_none,
+ 1, 217, :_reduce_none,
+ 1, 217, :_reduce_none,
+ 1, 140, :_reduce_none,
+ 3, 140, :_reduce_none,
+ 3, 140, :_reduce_none,
+ 1, 219, :_reduce_none,
+ 1, 219, :_reduce_none,
+ 3, 219, :_reduce_none,
+ 1, 141, :_reduce_none,
+ 3, 141, :_reduce_none,
+ 3, 141, :_reduce_none,
+ 1, 220, :_reduce_353,
+ 1, 220, :_reduce_354,
+ 3, 220, :_reduce_355,
+ 3, 220, :_reduce_356,
+ 1, 142, :_reduce_357,
+ 3, 142, :_reduce_358,
+ 3, 142, :_reduce_359,
+ 1, 127, :_reduce_none,
+ 3, 127, :_reduce_none,
+ 3, 127, :_reduce_none,
+ 1, 221, :_reduce_none,
+ 3, 221, :_reduce_none,
+ 3, 222, :_reduce_365,
+ 1, 126, :_reduce_366,
+ 1, 126, :_reduce_367,
+ 3, 223, :_reduce_none,
+ 0, 224, :_reduce_none,
+ 1, 224, :_reduce_none,
+ 2, 224, :_reduce_none,
+ 1, 125, :_reduce_372,
+ 1, 150, :_reduce_373,
+ 1, 150, :_reduce_374,
+ 1, 218, :_reduce_375 ]
+
+racc_reduce_n = 376
+
+racc_shift_n = 633
+
+racc_action_table = [
+   576,   483,   147,   164,   476,   594,   474,    59,   215,   472,
+   131,   470,   452,   578,   575,   464,   462,    29,   383,   341,
+   387,    67,   385,   321,   155,   157,    25,    26,   526,   114,
+   119,   216,    73,   500,   190,   121,    36,   513,   515,   463,
+   518,   519,    36,   517,   502,    30,    62,   574,   148,   155,
+   157,   434,    49,    51,   284,   112,   444,    81,    84,    87,
+   194,   160,    97,   309,   314,   238,   114,   117,   119,   121,
+   534,   526,   121,   121,   119,    73,   117,   114,   128,   129,
+   513,   515,    79,   518,   519,   277,   160,   281,   286,   288,
+   537,   163,   119,   298,    75,    49,    51,   284,   152,   153,
+    81,    84,    87,   194,   121,    97,   309,   314,   114,   114,
+   117,   119,   121,   534,   102,   119,   436,   230,   232,   494,
+   168,   498,   134,   152,   153,     9,    73,   496,   155,   157,
+   281,   286,   288,   537,   155,   157,   298,    71,   102,   338,
+   249,   322,   631,   323,   344,    11,    49,    51,   111,   248,
+   231,    81,    84,    87,   467,   117,    97,   100,   101,   155,
+   157,   140,   102,   100,   101,   160,    91,    95,   325,   326,
+   135,   160,    97,    79,   117,    81,    84,    87,   468,   117,
+    97,   100,   101,   389,   114,   140,   190,   155,   157,   138,
+    91,    95,   173,   155,   157,   121,   160,    79,   392,    81,
+    84,    87,   152,   153,    97,   100,   101,  -374,   152,   153,
+  -373,    81,   329,   330,    91,    95,   155,   157,   219,   158,
+   161,    79,   571,   151,   160,    22,   154,   156,   155,   157,
+   160,   158,   161,   152,   153,   151,   325,   326,   154,   156,
+    97,   219,   242,    23,   238,   544,   103,   573,   541,   394,
+   601,   542,   543,   160,     1,    81,    84,    87,   602,   603,
+    97,   152,   153,   263,   109,   160,   256,   152,   153,   259,
+   261,   395,    67,     4,    49,    51,   103,    79,    81,    84,
+    87,   144,    16,    97,    17,   159,   145,   102,    49,    51,
+   152,   153,   333,    36,   325,   326,   219,   159,    97,   149,
+    79,   396,   152,   153,   150,   121,   219,    81,   329,   330,
+   140,    81,    84,    87,   102,    16,    97,    17,    49,    51,
+   114,   117,   119,   121,    81,    84,    87,   128,   129,    97,
+   100,   101,   219,    81,    84,    87,   420,   140,    97,    91,
+    95,   272,   219,    81,    84,    87,    79,   416,    97,   277,
+   272,    81,    84,    87,   398,    79,    97,   100,   101,   389,
+   102,   481,   415,   329,   330,    79,    91,    95,   335,    81,
+    84,    87,   102,    79,    97,   128,   129,   212,   241,    81,
+    84,    87,   242,    71,    97,   325,   326,    35,   240,    97,
+   244,    79,    49,    51,   399,   140,   400,    81,    84,    87,
+   102,    79,    97,   100,   101,   401,   418,   402,   219,    81,
+    84,    87,    91,    95,    97,   100,   101,   403,    40,    79,
+    36,   629,   630,    71,    91,    95,   404,   219,    35,    49,
+    51,    79,    49,    51,    81,   329,   330,    81,    84,    87,
+   102,   405,    97,   100,   101,    81,    84,    87,   431,   432,
+    97,   406,    91,    95,    81,   329,   330,   492,   102,    79,
+   407,    36,   408,    71,    81,    84,    87,    79,   409,    97,
+    49,    51,    49,    51,   429,   430,   219,    81,    84,    87,
+   410,    71,    97,   100,   101,   102,    79,    81,   329,   330,
+    49,    51,    91,    95,   270,    81,    84,    87,   411,    79,
+    97,   100,   101,   102,   239,    81,   329,   330,   140,   247,
+    91,    95,   246,    81,    84,    87,   145,    79,    97,    81,
+   329,   330,    81,    84,    87,   150,   140,    97,   100,   101,
+   144,   102,   611,   612,   613,    79,   416,    91,    95,   219,
+    81,    84,    87,   149,    79,    97,   100,   101,   245,   219,
+   244,   415,   329,   330,    71,    91,    95,   219,   172,   169,
+   170,   171,    79,    49,    51,   346,   347,    35,    81,    84,
+    87,   348,   349,    97,   100,   101,    81,    84,    87,   251,
+   102,    97,    56,    91,    95,   252,    81,    84,    87,   416,
+    79,    97,    35,   253,    81,    84,    87,   264,    79,    97,
+    36,   427,   428,   140,    81,   329,   330,   265,    79,    49,
+    51,   325,   326,   356,   357,    97,    79,    81,    84,    87,
+   358,   359,    97,   100,   101,    36,   325,   326,   425,   426,
+    97,   119,    91,    95,    49,    51,   243,   284,   242,    79,
+    81,    84,    87,   194,   437,    97,   309,   314,   438,   114,
+   117,   119,   121,    81,    84,    87,   325,   326,    97,   439,
+    97,   440,   114,   117,   119,   121,   172,   169,   170,   171,
+   281,   286,   288,  -103,   366,   367,   298,   176,   423,   424,
+    81,    84,    87,   194,   441,    97,   128,   129,   111,   114,
+   117,   119,   121,   190,   124,   112,   374,   375,    81,    84,
+    87,   421,   422,    97,   128,   129,   111,   114,   117,   119,
+   121,   442,   124,    81,    84,    87,    49,    51,    97,    81,
+   329,   330,   114,   117,   119,   121,    81,    84,    87,   241,
+   445,    97,   446,   447,   448,   114,   117,   119,   121,    81,
+    84,    87,   449,   450,    97,   240,   453,   454,   114,   117,
+   119,   121,   172,   169,   170,   171,   172,   169,   170,   171,
+   328,    81,   329,   330,   172,   169,   170,   171,   172,   169,
+   170,   171,   172,   169,   170,   171,   172,   169,   170,   171,
+   172,   169,   170,   171,   455,   456,   457,   458,   460,   461,
+   140,   214,   148,   138,   213,   210,   103,   166,   478,   480,
+   266,   482,   163,   485,   486,   487,   117,   489,   146,   140,
+   139,   136,    36,   110,    69,   503,   114,   505,   117,   507,
+   119,   509,   121,   511,   512,    35,   540,    62,    58,   546,
+   547,   548,   267,   550,    57,   552,   114,   554,   117,   556,
+   119,   558,   121,   560,   561,   562,   563,   564,   565,   163,
+  -103,   569,   250,    54,   173,    34,   114,    31,   580,   581,
+   582,   121,   121,    28,   121,   583,   584,   585,   586,   587,
+   588,   268,   591,   592,   593,    24,   596,   597,   111,    21,
+   269,   604,   605,   606,   607,    79,   573,   609,   270,   271,
+   619,   620,   621,   622,    15,   624,    14,   625,    12,   627,
+   628,   319,     8,     7,   121 ]
+
+racc_action_check = [
+   531,   410,    86,    91,   405,   570,   404,    43,   147,   403,
+    63,   402,   375,   531,   529,   398,   395,    21,   265,   250,
+   267,    52,   266,   231,   222,   222,    18,    18,   531,   250,
+   265,   147,   531,   430,   267,   266,    43,   531,   531,   395,
+   531,   531,    52,   462,   432,    21,    63,   529,    86,   320,
+   320,   357,   531,   531,   531,   410,   367,   531,   531,   531,
+   531,   222,   531,   531,   531,   320,   531,   531,   531,   531,
+   531,   462,   375,   405,   404,   462,   403,   402,   398,   398,
+   462,   462,    91,   462,   462,   462,   320,   531,   531,   531,
+   531,   570,   430,   531,    54,   462,   462,   462,   222,   222,
+   462,   462,   462,   462,   432,   462,   462,   462,   357,   462,
+   462,   462,   462,   462,    54,   367,   359,   163,   166,   424,
+    95,   428,    69,   320,   320,     4,    54,   426,   227,   227,
+   462,   462,   462,   462,   229,   229,   462,    54,   166,   248,
+   188,   240,   624,   240,   252,     4,    54,    54,   248,   187,
+   163,    54,    54,    54,   400,   252,    54,    54,    54,   224,
+   224,   166,   624,    95,    95,   227,    54,    54,   424,   424,
+    69,   229,   424,    54,   359,   166,   166,   166,   401,   428,
+   166,   166,   166,   268,   426,   624,   269,   218,   218,    71,
+   166,   166,    98,   226,   226,   264,   224,   166,   271,   624,
+   624,   624,   227,   227,   624,   624,   624,    71,   229,   229,
+    98,   400,   400,   400,   624,   624,    88,    88,   157,    88,
+    88,   624,   519,    88,   218,    14,    88,    88,   174,   174,
+   226,   174,   174,   224,   224,   174,   401,   401,   174,   174,
+   401,   152,   522,    14,   174,   480,   110,   522,   480,   272,
+   575,   480,   480,    88,     0,   157,   157,   157,   579,   579,
+   157,   218,   218,   194,    60,   174,   194,   226,   226,   194,
+   194,   274,    60,     0,   519,   519,    58,   157,   152,   152,
+   152,    84,    11,   152,    11,    88,    84,   171,   110,   110,
+    88,    88,   244,    60,   244,   244,   153,   174,   244,    87,
+   152,   275,   174,   174,    87,   480,   161,   575,   575,   575,
+   171,   194,   194,   194,   168,    26,   194,    26,    58,    58,
+   194,   194,   194,   194,   171,   171,   171,   243,   243,   171,
+   171,   171,   160,   153,   153,   153,   349,   168,   153,   171,
+   171,   278,   159,   161,   161,   161,   171,   321,   161,   214,
+   214,   168,   168,   168,   279,   153,   168,   168,   168,   408,
+   626,   408,   321,   321,   321,   161,   168,   168,   246,   160,
+   160,   160,   170,   168,   160,   246,   246,   136,   282,   159,
+   159,   159,   283,   626,   159,   349,   349,   136,   284,   349,
+   287,   160,   626,   626,   289,   170,   290,   626,   626,   626,
+   619,   159,   626,   626,   626,   293,   347,   296,   158,   170,
+   170,   170,   626,   626,   170,   170,   170,   300,    28,   626,
+   136,   622,   622,   619,   170,   170,   303,   151,    28,   136,
+   136,   170,   619,   619,   270,   270,   270,   619,   619,   619,
+    82,   306,   619,   619,   619,   158,   158,   158,   355,   355,
+   158,   309,   619,   619,   347,   347,   347,   422,   614,   619,
+   310,    28,   312,    82,   151,   151,   151,   158,   314,   151,
+    28,    28,    82,    82,   354,   354,   154,    82,    82,    82,
+   315,   614,    82,    82,    82,   169,   151,   574,   574,   574,
+   614,   614,    82,    82,   317,   614,   614,   614,   319,    82,
+   614,   614,   614,   102,   175,   422,   422,   422,   169,   186,
+   614,   614,   185,   154,   154,   154,   325,   614,   154,   418,
+   418,   418,   169,   169,   169,   326,   102,   169,   169,   169,
+   329,   609,   606,   606,   606,   154,   564,   169,   169,   219,
+   102,   102,   102,   330,   169,   102,   102,   102,   184,   156,
+   182,   564,   564,   564,   609,   102,   102,   155,   175,   175,
+   175,   175,   102,   609,   609,   254,   254,   515,   609,   609,
+   609,   255,   255,   609,   609,   609,   219,   219,   219,   191,
+   172,   219,    34,   609,   609,   192,   156,   156,   156,   486,
+   609,   156,    34,   193,   155,   155,   155,   195,   219,   155,
+   515,   353,   353,   172,   486,   486,   486,   196,   156,   515,
+   515,   420,   420,   257,   257,   420,   155,   172,   172,   172,
+   258,   258,   172,   172,   172,    34,   494,   494,   352,   352,
+   494,   251,   172,   172,    34,    34,   181,   215,   179,   172,
+   215,   215,   215,   215,   360,   215,   215,   215,   361,   215,
+   215,   215,   215,   263,   263,   263,   241,   241,   263,   362,
+   241,   363,   263,   263,   263,   263,    96,    96,    96,    96,
+   215,   215,   215,   103,   260,   260,   215,   103,   351,   351,
+   103,   103,   103,   103,   364,   103,   103,   103,   103,   103,
+   103,   103,   103,   103,   103,    62,   262,   262,    62,    62,
+    62,   350,   350,    62,    62,    62,    62,    62,    62,    62,
+    62,   365,    62,   256,   256,   256,   518,   518,   256,   492,
+   492,   492,   256,   256,   256,   256,   261,   261,   261,   178,
+   368,   261,   369,   370,   371,   261,   261,   261,   261,   259,
+   259,   259,   372,   373,   259,   176,   376,   377,   259,   259,
+   259,   259,   237,   237,   237,   237,   234,   234,   234,   234,
+   242,   242,   242,   242,   236,   236,   236,   236,   617,   617,
+   617,   617,   235,   235,   235,   235,   233,   233,   233,   233,
+   632,   632,   632,   632,   378,   379,   380,   381,   393,   394,
+   148,   146,   141,   140,   139,   116,   108,    92,   406,   407,
+   199,   409,    89,   413,   415,   417,   249,   419,    85,    79,
+    73,    70,    67,    61,    53,   433,   434,   435,   436,   443,
+   444,   451,   452,   460,   461,    48,   463,    47,    42,   488,
+   490,   491,   202,   493,    36,   495,   496,   497,   498,   499,
+   500,   501,   502,   504,   506,   508,   510,   511,   512,   514,
+    35,   517,   189,    33,   520,    27,   247,    24,   537,   538,
+   540,   541,   542,    20,   544,   549,   551,   553,   555,   557,
+   559,   204,   565,   566,   568,    16,   572,   573,   245,    13,
+   205,   581,   589,   590,   591,   595,   598,   604,   207,   213,
+   610,   611,   612,   613,     8,   616,     6,   618,     5,   620,
+   621,   216,     3,     2,   543 ]
+
+racc_action_pointer = [
+   253,   nil,   884,   902,   124,   880,   869,   nil,   894,   nil,
+   nil,   258,   nil,   851,   224,   nil,   867,   nil,     4,   nil,
+   833,    16,   nil,   nil,   832,   nil,   291,   824,   417,   nil,
+   nil,   nil,   nil,   821,   581,   799,   833,   nil,   nil,   nil,
+   nil,   nil,   820,    -8,   nil,   nil,   nil,   776,   814,   nil,
+   nil,   nil,    -2,   766,    93,   nil,   nil,   nil,   265,   nil,
+   249,   805,   640,    -5,   nil,   nil,   nil,   768,   nil,   121,
+   761,   160,   nil,   776,   nil,   nil,   nil,   nil,   nil,   765,
+   nil,   nil,   419,   nil,   223,   774,   -32,   241,   210,   715,
+   nil,     2,   750,   nil,   nil,    99,   590,   nil,   163,   nil,
+   nil,   nil,   482,   622,   nil,   nil,   nil,   nil,   785,   nil,
+   235,   nil,   nil,   nil,   nil,   nil,   743,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,   nil,   376,   nil,   nil,   759,
+   764,   712,   nil,   nil,   nil,   nil,   779,    -4,   746,   nil,
+   nil,   406,   220,   275,   455,   536,   528,   197,   387,   321,
+   311,   285,   nil,   116,   nil,   nil,   117,   nil,   293,   464,
+   351,   266,   559,   nil,   222,   482,   689,   nil,   673,   582,
+   nil,   580,   494,   nil,   492,   456,   453,    93,    84,   796,
+   nil,   523,   529,   578,   253,   541,   551,   nil,   nil,   744,
+   nil,   nil,   776,   nil,   815,   824,   nil,   832,   nil,   nil,
+   nil,   nil,   nil,   853,   306,   582,   865,   nil,   181,   518,
+   nil,   nil,    18,   nil,   153,   nil,   187,   122,   nil,   128,
+   nil,    11,   nil,   700,   680,   696,   688,   676,   nil,   nil,
+    86,   597,   703,   263,   235,   812,   311,   789,    82,   738,
+   -38,   562,    87,   nil,   504,   510,   655,   552,   559,   681,
+   613,   668,   635,   595,   125,   -39,   -35,   -37,   128,   115,
+   376,   161,   167,   nil,   237,   287,   nil,   nil,   297,   331,
+   nil,   nil,   322,   326,   332,   nil,   nil,   334,   nil,   380,
+   373,   nil,   nil,   382,   nil,   nil,   384,   nil,   nil,   nil,
+   394,   nil,   nil,   403,   nil,   nil,   418,   nil,   nil,   395,
+   380,   nil,   406,   nil,   412,   457,   nil,   438,   nil,   461,
+    43,   304,   nil,   nil,   nil,   453,   462,   nil,   nil,   472,
+   485,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,   nil,   nil,   396,   nil,   326,
+   640,   617,   567,   540,   413,   387,   nil,    41,   nil,   106,
+   583,   587,   598,   600,   623,   650,   nil,    46,   669,   671,
+   672,   673,   681,   682,   nil,     2,   685,   686,   723,   724,
+   725,   726,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   nil,   nil,   nil,   705,   755,     4,   nil,   nil,    14,   nil,
+   153,   177,    10,     8,     5,     3,   733,   738,   304,   737,
+     0,   nil,   nil,   789,   nil,   742,   nil,   744,   461,   746,
+   552,   nil,   447,   nil,   109,   nil,   117,   nil,   111,   nil,
+    23,   nil,    34,   754,   749,   756,   750,   nil,   nil,   nil,
+   nil,   nil,   nil,   758,   751,   nil,   nil,   nil,   nil,   nil,
+   nil,   760,   752,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   789,   812,    42,   790,   nil,   nil,   nil,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   235,   nil,   nil,   nil,   nil,   nil,   546,   nil,   768,   nil,
+   769,   770,   661,   772,   567,   774,   769,   776,   770,   778,
+   771,   780,   772,   nil,   782,   nil,   783,   nil,   784,   nil,
+   785,   835,   790,   nil,   762,   556,   nil,   837,   663,   221,
+   825,   nil,   186,   nil,   nil,   nil,   nil,   nil,   nil,    -9,
+   nil,    -1,   nil,   nil,   nil,   nil,   nil,   765,   825,   nil,
+   823,   791,   792,   834,   794,   nil,   nil,   nil,   nil,   804,
+   nil,   805,   nil,   806,   nil,   807,   nil,   808,   nil,   809,
+   nil,   nil,   nil,   nil,   493,   810,   859,   nil,   834,   nil,
+     4,   nil,   847,   806,   429,   249,   nil,   nil,   nil,   166,
+   nil,   869,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   868,
+   860,   826,   nil,   nil,   nil,   805,   nil,   nil,   825,   nil,
+   nil,   nil,   nil,   nil,   842,   nil,   448,   nil,   nil,   510,
+   844,   868,   869,   870,   437,   nil,   848,   692,   883,   379,
+   813,   814,   337,   nil,   141,   nil,   339,   nil,   nil,   nil,
+   nil,   nil,   704 ]
+
+racc_action_default = [
+  -376,    -2,  -376,  -376,    -6,  -376,   -13,    -4,  -376,    -5,
+    -7,  -376,    -1,  -376,  -376,   633,  -376,   -12,  -376,    -9,
+   -18,  -376,   -15,   -14,  -376,    -8,  -376,   -21,  -376,   -17,
+   -16,   -11,   -10,  -376,  -376,  -112,   -94,   -89,   -19,   -90,
+   -20,  -108,  -376,  -376,   -98,   -99,  -100,  -376,  -376,  -146,
+   -87,  -147,   -88,   -82,  -376,   -22,   -23,   -95,  -376,  -110,
+  -376,  -376,  -376,  -376,  -104,  -109,  -101,  -376,   -91,  -376,
+  -376,  -289,  -281,  -376,  -282,   -25,   -24,  -248,   -26,  -284,
+  -253,  -152,   -27,  -254,  -376,  -376,  -376,  -376,  -376,  -305,
+  -273,  -376,  -376,  -283,  -274,  -376,  -251,  -167,   -31,  -286,
+  -271,  -272,  -376,  -112,   -96,   -93,  -113,   -97,  -376,  -111,
+  -376,  -187,  -148,  -122,  -191,  -123,  -376,  -204,  -124,  -217,
+  -125,  -230,  -126,  -127,  -247,  -128,  -129,  -130,  -182,  -183,
+  -121,  -102,  -105,   -92,   -84,   -83,  -376,    -3,  -288,  -376,
+  -289,  -285,  -249,  -373,  -153,  -168,  -376,  -376,  -376,  -154,
+  -169,  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,
+  -376,  -376,   -30,  -376,  -256,  -255,  -376,  -259,  -376,  -376,
+  -376,  -376,  -376,   -32,  -376,  -376,  -148,  -144,  -133,  -122,
+  -145,  -134,  -123,  -116,  -135,  -124,  -136,  -125,  -137,  -126,
+  -243,  -138,  -127,  -376,  -376,  -139,  -128,  -117,  -140,  -129,
+  -118,  -141,  -119,  -142,  -131,  -120,  -143,  -132,  -114,  -106,
+  -107,   -85,   -86,  -376,  -376,  -376,  -376,  -287,  -263,  -376,
+  -278,  -279,  -264,  -275,  -265,  -276,  -261,  -260,  -277,  -262,
+  -307,  -376,  -252,  -250,  -267,  -268,  -269,  -266,  -280,  -270,
+  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,
+  -376,  -376,  -376,  -115,  -376,  -376,  -376,  -376,  -376,  -376,
+  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,
+  -376,  -376,  -290,   -63,  -376,  -376,   -33,   -62,   -34,  -357,
+  -336,  -322,  -317,  -310,  -347,  -343,  -328,  -316,  -334,  -376,
+  -313,   -54,  -323,  -319,   -55,  -329,  -325,   -56,  -375,  -335,
+  -331,   -57,  -342,  -337,  -312,   -58,  -344,  -318,   -59,  -353,
+  -340,  -324,  -348,   -60,  -354,  -350,  -330,  -311,   -61,  -376,
+  -376,  -376,  -149,  -151,  -171,  -376,  -376,  -155,  -157,  -376,
+  -376,  -185,  -170,  -172,  -189,  -186,  -184,  -193,  -190,  -188,
+  -206,  -194,  -192,  -219,  -207,  -205,  -166,  -376,  -181,  -376,
+  -376,  -376,  -376,  -376,  -376,  -376,  -203,  -376,  -216,  -376,
+  -376,  -376,  -376,  -376,  -376,  -376,  -229,  -376,  -376,  -376,
+  -376,  -376,  -376,  -376,  -242,  -376,  -376,  -376,  -376,  -376,
+  -376,  -376,  -232,  -220,  -218,  -233,  -231,  -246,  -244,  -150,
+  -245,  -156,   -28,   -68,  -376,  -376,   -29,   -64,  -376,  -257,
+  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,
+  -376,  -258,  -303,  -376,  -308,  -152,  -304,  -376,  -376,  -376,
+  -376,  -164,  -376,  -179,  -376,  -201,  -376,  -214,  -376,  -227,
+  -376,  -240,  -376,  -376,  -376,  -376,  -376,  -163,  -178,  -200,
+  -213,  -226,  -239,  -376,  -376,  -165,  -180,  -202,  -215,  -228,
+  -241,  -376,  -376,  -162,  -177,  -199,  -212,  -225,  -238,   -69,
+  -376,  -376,  -376,  -376,  -359,  -358,  -314,  -315,  -321,  -320,
+  -327,  -326,  -333,  -332,  -339,  -338,  -346,  -345,  -355,  -341,
+  -376,  -349,  -356,  -352,  -351,  -306,  -376,  -158,  -376,  -173,
+  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,
+  -376,  -376,  -376,  -195,  -376,  -208,  -376,  -221,  -376,  -234,
+  -376,  -376,  -376,   -43,  -305,  -376,   -53,   -44,  -376,  -376,
+   -31,   -72,  -310,   -70,   -35,   -37,  -372,   -38,   -39,  -360,
+   -40,  -376,  -363,   -41,  -367,  -366,   -42,  -369,  -376,   -36,
+  -376,  -376,  -376,  -376,  -376,  -309,  -160,  -175,  -159,  -376,
+  -174,  -376,  -196,  -376,  -209,  -376,  -222,  -376,  -235,  -376,
+  -197,  -210,  -223,  -236,  -376,  -292,  -376,   -49,  -376,   -67,
+  -305,   -52,   -50,  -376,  -376,  -376,   -44,   -71,   -65,  -376,
+  -370,  -376,   -66,  -161,  -176,  -198,  -211,  -224,  -237,  -376,
+  -295,  -376,  -291,   -45,   -47,  -376,   -51,  -365,  -376,  -364,
+  -361,  -362,  -368,  -371,   -73,  -294,  -376,  -293,   -46,  -376,
+   -75,  -296,  -297,  -298,   -74,   -77,  -376,   -80,  -376,  -376,
+  -376,  -376,  -376,   -78,  -376,   -48,   -76,  -299,  -300,  -301,
+  -302,   -81,   -79 ]
+
+racc_goto_table = [
+    96,   113,   165,    38,   162,    48,   118,   180,   276,    55,
+   413,    48,   202,   120,   523,   104,    65,   273,   105,   126,
+   116,    92,    77,   174,    66,   125,    68,    64,    96,    19,
+   614,    98,     3,   115,    68,   108,   393,   531,    60,   623,
+   626,   133,   179,   132,    32,   289,   618,   185,   175,    92,
+   142,   623,   610,   123,   187,   278,    63,   275,   459,    82,
+   199,   183,   208,   193,   197,   200,   196,   104,    78,   205,
+   209,   484,   218,    76,   182,   222,    65,   224,   122,   226,
+   227,   397,   229,   577,    66,   220,   221,   108,   223,    18,
+   225,    10,     2,   228,   192,   137,    70,    53,    33,   204,
+   207,   178,   181,   184,   186,   188,   191,   195,   198,   201,
+   203,   211,   233,    48,   175,   234,   235,   236,   237,   189,
+   206,   177,    27,    20,   167,   141,    13,     6,   217,   566,
+   589,     5,   545,   254,   599,   579,   nil,   nil,   nil,   nil,
+   320,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   nil,   262,   nil,   nil,   283,   nil,   nil,   260,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,   255,   nil,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,   nil,   388,   nil,   390,   nil,
+   nil,   327,   nil,   nil,   nil,   258,   287,   331,   nil,   nil,
+   336,   nil,   nil,   nil,   nil,   350,   334,   nil,   360,   339,
+   368,   nil,   376,   nil,   nil,   nil,   nil,   nil,   nil,   391,
+   257,   nil,   324,   355,   343,   332,   365,   nil,   373,   354,
+   381,   382,   364,   386,   372,   nil,   380,   351,   384,   nil,
+   361,   nil,   369,   nil,   377,   nil,   nil,   nil,   nil,   nil,
+   340,   nil,   nil,   345,   nil,   nil,   nil,   353,   nil,   nil,
+   363,   nil,   371,   590,   379,   nil,   521,   nil,   nil,   nil,
+   412,   nil,   nil,   337,   nil,   nil,   342,   nil,   nil,   nil,
+   nil,   nil,   352,   nil,   nil,   362,   nil,   370,   nil,   378,
+   nil,   nil,   nil,   nil,   nil,   nil,   417,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   nil,   479,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   419,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   443,   nil,   451,   nil,   nil,   nil,   nil,   nil,   nil,   466,
+   nil,   nil,   465,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   435,   nil,   nil,   nil,   nil,   nil,   nil,   488,   nil,   nil,
+   nil,   491,   477,   nil,   nil,   nil,   nil,   475,   nil,   nil,
+   nil,   nil,   469,   433,   nil,   nil,   nil,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   501,
+   nil,   490,   nil,   499,   473,   493,   nil,   nil,   nil,   nil,
+   nil,   522,   nil,   nil,   nil,   nil,   nil,   508,   nil,   510,
+   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   471,   497,
+   nil,   nil,   nil,   nil,   nil,   412,   nil,   506,   nil,   567,
+   nil,   549,   nil,   287,   nil,   nil,   nil,   262,   nil,   520,
+   nil,   nil,   495,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   504,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   559,
+   nil,   nil,   nil,   557,   nil,   551,   nil,   nil,   nil,   nil,
+   522,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,   595,   nil,   nil,   nil,   555,
+   568,   nil,    48,   nil,   nil,   570,   572,   nil,   355,   365,
+   373,   381,   287,   412,   nil,   nil,   608,   nil,   520,   nil,
+   nil,   nil,   553,   598,   600,   nil,   nil,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   632 ]
+
+racc_goto_check = [
+    56,    81,    34,    15,    22,    23,    83,   104,    24,    15,
+   115,    23,    78,    84,    26,    59,    72,    48,    62,    88,
+    71,    55,   105,   109,    66,    87,    60,    69,    56,    14,
+    53,    23,     1,    82,    60,    23,    51,    50,    58,    54,
+    53,    60,    81,    69,    14,    39,    37,    83,    56,    55,
+   105,    54,    36,    86,    84,    25,    68,    20,    52,    18,
+    88,    71,    74,    75,    76,    77,    87,    59,    17,    79,
+    62,    80,   109,    16,    82,   109,    72,   109,    85,   109,
+   109,    48,   109,    26,    66,   110,   110,    23,   110,    13,
+   110,    12,    11,   110,    86,    10,     9,     8,     7,    90,
+    91,    92,    93,    94,    95,    96,    97,    98,    99,   100,
+   101,    15,    56,    23,    56,    56,    56,    56,    56,    85,
+   102,   103,     6,     5,   106,   108,     4,     3,   112,   113,
+   114,     2,   116,    81,   127,   129,   nil,   nil,   nil,   nil,
+   109,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   nil,    88,   nil,   nil,    81,   nil,   nil,    87,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,    82,   nil,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,   nil,    78,   nil,    78,   nil,
+   nil,    81,   nil,   nil,   nil,    86,    82,    83,   nil,   nil,
+    83,   nil,   nil,   nil,   nil,    81,    84,   nil,    81,    84,
+    81,   nil,    81,   nil,   nil,   nil,   nil,   nil,   nil,    81,
+    85,   nil,    82,    88,    87,    82,    88,   nil,    88,    87,
+    88,    88,    87,    88,    87,   nil,    87,    82,    87,   nil,
+    82,   nil,    82,   nil,    82,   nil,   nil,   nil,   nil,   nil,
+    86,   nil,   nil,    86,   nil,   nil,   nil,    86,   nil,   nil,
+    86,   nil,    86,   115,    86,   nil,    24,   nil,   nil,   nil,
+    81,   nil,   nil,    85,   nil,   nil,    85,   nil,   nil,   nil,
+   nil,   nil,    85,   nil,   nil,    85,   nil,    85,   nil,    85,
+   nil,   nil,   nil,   nil,   nil,   nil,    81,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   nil,   104,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+    82,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+    87,   nil,    88,   nil,   nil,   nil,   nil,   nil,   nil,    81,
+   nil,   nil,    83,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+    86,   nil,   nil,   nil,   nil,   nil,   nil,    81,   nil,   nil,
+   nil,    81,    88,   nil,   nil,   nil,   nil,    87,   nil,   nil,
+   nil,   nil,    82,    85,   nil,   nil,   nil,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,    88,
+   nil,    82,   nil,    87,    86,    82,   nil,   nil,   nil,   nil,
+   nil,    81,   nil,   nil,   nil,   nil,   nil,    87,   nil,    88,
+   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,    85,    86,
+   nil,   nil,   nil,   nil,   nil,    81,   nil,    86,   nil,    22,
+   nil,    81,   nil,    82,   nil,   nil,   nil,    88,   nil,    23,
+   nil,   nil,    85,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+    85,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,    88,
+   nil,   nil,   nil,    87,   nil,    82,   nil,   nil,   nil,   nil,
+    81,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,    22,   nil,   nil,   nil,    86,
+    15,   nil,    23,   nil,   nil,    23,    23,   nil,    88,    88,
+    88,    88,    82,    81,   nil,   nil,    34,   nil,    23,   nil,
+   nil,   nil,    85,    81,    81,   nil,   nil,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+    56 ]
+
+racc_goto_pointer = [
+   nil,    32,   131,   127,   120,   110,   102,    71,    64,    43,
+    25,    92,    87,    78,    18,   -25,    19,    14,     5,   nil,
+  -157,   nil,   -85,   -23,  -206,  -159,  -448,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   -89,   nil,  -552,  -564,   nil,  -170,
+   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,  -197,   nil,
+  -425,  -236,  -335,  -579,  -575,   -33,   -54,   nil,    -5,   -43,
+   -26,   nil,   -40,   nil,   nil,   nil,   -24,   nil,     9,   -20,
+   nil,   -42,   -32,   nil,   -46,   -40,   -39,   -38,   -91,   -34,
+  -339,   -61,   -29,   -56,   -49,    16,    -9,   -37,   -43,   nil,
+    -4,    -3,    -2,    -1,     0,     1,     2,     3,     4,     5,
+     6,     7,    17,    18,   -96,   -32,    29,   nil,    46,   -79,
+   -67,   nil,   -20,  -383,  -434,  -311,  -354,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,   nil,   nil,  -440,   nil,  -402 ]
+
+racc_goto_default = [
+   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
+   nil,   nil,   nil,   nil,   nil,   nil,   nil,   539,   nil,    85,
+   nil,    89,   nil,   143,   nil,   nil,   nil,   524,   525,   527,
+   528,   530,   533,   536,    93,   538,   nil,   nil,   514,   516,
+   291,   294,   297,   301,   305,   308,   313,   318,   nil,   274,
+   nil,   nil,   nil,   nil,   615,   616,   617,    50,    52,    37,
+    39,    42,   nil,   107,    44,    45,    46,    47,   nil,   nil,
+    61,   nil,    41,    43,   106,   nil,   nil,   nil,   nil,   nil,
+   130,    72,    74,   nil,   nil,   292,   295,   299,   302,   127,
+   312,   317,   282,   nil,   nil,   nil,   nil,   nil,   nil,   304,
+   307,   311,   316,   280,   285,   nil,    80,    83,    86,    88,
+    90,    94,    99,   nil,   nil,   nil,   414,   290,   293,   296,
+   300,   303,   306,   310,   315,   279,   529,   532,   535,   nil ]
+
+racc_token_table = {
+ false => 0,
+ Object.new => 1,
+ :UMINUS => 2,
+ :UPLUS => 3,
+ "*" => 4,
+ "/" => 5,
+ "+" => 6,
+ "-" => 7,
+ :SYM_EQ => 8,
+ :SYM_NE => 9,
+ :SYM_LT => 10,
+ :SYM_START_DBLOCK => 11,
+ :SYM_START_CBLOCK => 12,
+ :SYM_GT => 13,
+ :SYM_END_CBLOCK => 14,
+ :SYM_END_DBLOCK => 15,
+ :SYM_LE => 16,
+ :SYM_GE => 17,
+ :EOF => 18,
+ :V_ARCHETYPE_ID => 19,
+ :SYM_ARCHETYPE => 20,
+ :Left_parenthesis_code => 21,
+ :Right_parenthesis_code => 22,
+ :Semicolon_code => 23,
+ :SYM_ADL_VERSION => 24,
+ :V_VERSION_STRING => 25,
+ :SYM_IS_CONTROLLED => 26,
+ :SYM_SPECIALIZE => 27,
+ :SYM_CONCEPT => 28,
+ :V_LOCAL_TERM_CODE_REF => 29,
+ :SYM_LANGUAGE => 30,
+ :SYM_DESCRIPTION => 31,
+ :SYM_DEFINITION => 32,
+ :c_complx_object_head => 33,
+ :SYM_MATCHES => 34,
+ :START_REGEXP_BLOCK => 35,
+ :REGEXP_BODY => 36,
+ :END_REGEXP_BLOCK => 37,
+ :ERR_C_DOMAIN_TYPE => 38,
+ :START_V_C_DOMAIN_TYPE_BLOCK => 39,
+ :END_V_C_DOMAIN_TYPE_BLOCK => 40,
+ :SYM_USE_NODE => 41,
+ :SYM_ALLOW_ARCHETYPE => 42,
+ :Star_code => 43,
+ :V_ATTRIBUTE_IDENTIFIER => 44,
+ :SYM_INCLUDE => 45,
+ :SYM_EXCLUDE => 46,
+ ":" => 47,
+ :SYM_INVARIANT => 48,
+ :V_ASSERTION_TEXT => 49,
+ :SYM_ONTOLOGY => 50,
+ :Left_bracket_code => 51,
+ :Right_bracket_code => 52,
+ :V_TYPE_IDENTIFIER => 53,
+ :V_GENERIC_TYPE_IDENTIFIER => 54,
+ :V_STRING => 55,
+ :Comma_code => 56,
+ :SYM_LIST_CONTINUE => 57,
+ :V_INTEGER => 58,
+ :Plus_code => 59,
+ :Minus_code => 60,
+ :SYM_INTERVAL_DELIM => 61,
+ :SYM_ELLIPSIS => 62,
+ :V_REAL => 63,
+ :SYM_TRUE => 64,
+ :SYM_FALSE => 65,
+ :V_CHARACTER => 66,
+ :V_ISO8601_EXTENDED_DATE => 67,
+ :V_ISO8601_EXTENDED_TIME => 68,
+ :V_ISO8601_EXTENDED_DATE_TIME => 69,
+ :V_ISO8601_DURATION => 70,
+ :V_QUALIFIED_TERM_CODE_REF => 71,
+ :V_URI => 72,
+ :SYM_EXISTS => 73,
+ :SYM_NOT => 74,
+ "=" => 75,
+ :SYM_AND => 76,
+ :SYM_OR => 77,
+ :SYM_XOR => 78,
+ :SYM_IMPLIES => 79,
+ :Slash_code => 80,
+ "^" => 81,
+ :SYM_EXISTENCE => 82,
+ :SYM_CARDINALITY => 83,
+ :SYM_ORDERED => 84,
+ :SYM_UNORDERED => 85,
+ :SYM_UNIQUE => 86,
+ :SYM_OCCURRENCES => 87,
+ :V_ISO8601_DATE_CONSTRAINT_PATTERN => 88,
+ :V_ISO8601_TIME_CONSTRAINT_PATTERN => 89,
+ :V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN => 90,
+ :START_TERM_CODE_CONSTRAINT => 91,
+ :END_TERM_CODE_CONSTRAINT => 92,
+ :TERM_CODE => 93,
+ :V_ISO8601_DURATION_CONSTRAINT_PATTERN => 94 }
+
+racc_use_result_var = true
+
+racc_nt_base = 95
+
+Racc_arg = [
+ racc_action_table,
+ racc_action_check,
+ racc_action_default,
+ racc_action_pointer,
+ racc_goto_table,
+ racc_goto_check,
+ racc_goto_default,
+ racc_goto_pointer,
+ racc_nt_base,
+ racc_reduce_table,
+ racc_token_table,
+ racc_shift_n,
+ racc_reduce_n,
+ racc_use_result_var ]
+
+Racc_token_to_s_table = [
+'$end',
+'error',
+'UMINUS',
+'UPLUS',
+'"*"',
+'"/"',
+'"+"',
+'"-"',
+'SYM_EQ',
+'SYM_NE',
+'SYM_LT',
+'SYM_START_DBLOCK',
+'SYM_START_CBLOCK',
+'SYM_GT',
+'SYM_END_CBLOCK',
+'SYM_END_DBLOCK',
+'SYM_LE',
+'SYM_GE',
+'EOF',
+'V_ARCHETYPE_ID',
+'SYM_ARCHETYPE',
+'Left_parenthesis_code',
+'Right_parenthesis_code',
+'Semicolon_code',
+'SYM_ADL_VERSION',
+'V_VERSION_STRING',
+'SYM_IS_CONTROLLED',
+'SYM_SPECIALIZE',
+'SYM_CONCEPT',
+'V_LOCAL_TERM_CODE_REF',
+'SYM_LANGUAGE',
+'SYM_DESCRIPTION',
+'SYM_DEFINITION',
+'c_complx_object_head',
+'SYM_MATCHES',
+'START_REGEXP_BLOCK',
+'REGEXP_BODY',
+'END_REGEXP_BLOCK',
+'ERR_C_DOMAIN_TYPE',
+'START_V_C_DOMAIN_TYPE_BLOCK',
+'END_V_C_DOMAIN_TYPE_BLOCK',
+'SYM_USE_NODE',
+'SYM_ALLOW_ARCHETYPE',
+'Star_code',
+'V_ATTRIBUTE_IDENTIFIER',
+'SYM_INCLUDE',
+'SYM_EXCLUDE',
+'":"',
+'SYM_INVARIANT',
+'V_ASSERTION_TEXT',
+'SYM_ONTOLOGY',
+'Left_bracket_code',
+'Right_bracket_code',
+'V_TYPE_IDENTIFIER',
+'V_GENERIC_TYPE_IDENTIFIER',
+'V_STRING',
+'Comma_code',
+'SYM_LIST_CONTINUE',
+'V_INTEGER',
+'Plus_code',
+'Minus_code',
+'SYM_INTERVAL_DELIM',
+'SYM_ELLIPSIS',
+'V_REAL',
+'SYM_TRUE',
+'SYM_FALSE',
+'V_CHARACTER',
+'V_ISO8601_EXTENDED_DATE',
+'V_ISO8601_EXTENDED_TIME',
+'V_ISO8601_EXTENDED_DATE_TIME',
+'V_ISO8601_DURATION',
+'V_QUALIFIED_TERM_CODE_REF',
+'V_URI',
+'SYM_EXISTS',
+'SYM_NOT',
+'"="',
+'SYM_AND',
+'SYM_OR',
+'SYM_XOR',
+'SYM_IMPLIES',
+'Slash_code',
+'"^"',
+'SYM_EXISTENCE',
+'SYM_CARDINALITY',
+'SYM_ORDERED',
+'SYM_UNORDERED',
+'SYM_UNIQUE',
+'SYM_OCCURRENCES',
+'V_ISO8601_DATE_CONSTRAINT_PATTERN',
+'V_ISO8601_TIME_CONSTRAINT_PATTERN',
+'V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN',
+'START_TERM_CODE_CONSTRAINT',
+'END_TERM_CODE_CONSTRAINT',
+'TERM_CODE',
+'V_ISO8601_DURATION_CONSTRAINT_PATTERN',
+'$start',
+'input',
+'archetype',
+'arch_identification',
+'arch_specialisation',
+'arch_concept',
+'arch_language',
+'arch_description',
+'arch_definition',
+'arch_invariant',
+'arch_ontology',
+'arch_head',
+'arch_meta_data',
+'arch_meta_data_items',
+'arch_meta_data_item',
+'dadl_section',
+'cadl_section',
+'c_complex_object',
+'assertions',
+'c_complex_object_head',
+'c_complex_object_body',
+'c_complex_object_id',
+'c_occurrences',
+'type_identifier',
+'c_any',
+'c_attributes',
+'c_object',
+'v_c_domain_type',
+'archetype_internal_ref',
+'archetype_slot',
+'constraint_ref',
+'c_code_phrase',
+'c_ordinal',
+'c_primitive_object',
+'absolute_path',
+'c_archetype_slot_head',
+'c_includes',
+'c_excludes',
+'c_archetype_slot_id',
+'c_primitive',
+'c_integer',
+'c_real',
+'c_date',
+'c_time',
+'c_date_time',
+'c_duration',
+'c_string',
+'c_boolean',
+'c_attribute',
+'c_attr_head',
+'c_attr_values',
+'c_existence',
+'c_cardinality',
+'invariants',
+'invariant',
+'any_identifier',
+'boolean_expression',
+'dadl_input',
+'attr_vals',
+'complex_object_block',
+'attr_val',
+'attr_id',
+'object_block',
+'primitive_object_block',
+'single_attr_object_block',
+'multiple_attr_object_block',
+'untyped_multiple_attr_object_block',
+'multiple_attr_object_block_head',
+'keyed_objects',
+'keyed_object',
+'object_key',
+'simple_value',
+'untyped_single_attr_object_block',
+'single_attr_object_complex_head',
+'untyped_primitive_object_block',
+'primitive_object_value',
+'simple_list_value',
+'simple_interval_value',
+'term_code',
+'term_code_list_value',
+'string_value',
+'integer_value',
+'real_value',
+'boolean_value',
+'character_value',
+'date_value',
+'time_value',
+'date_time_value',
+'duration_value',
+'uri_value',
+'string_list_value',
+'integer_list_value',
+'real_list_value',
+'boolean_list_value',
+'character_list_value',
+'date_list_value',
+'time_list_value',
+'date_time_list_value',
+'duration_list_value',
+'integer_interval_value',
+'real_interval_value',
+'date_interval_value',
+'time_interval_value',
+'date_time_interval_value',
+'duration_interval_value',
+'assertion',
+'boolean_leaf',
+'boolean_node',
+'relative_path',
+'arithmetic_expression',
+'arithmetic_leaf',
+'arithmetic_node',
+'path_segment',
+'existence_spec',
+'cardinality_spec',
+'occurrence_spec',
+'cardinality_limit_value',
+'c_integer_spec',
+'c_real_spec',
+'c_date_constraint',
+'c_time_constraint',
+'c_date_time_constraint',
+'c_duration_constraint',
+'duration_pattern',
+'c_string_spec',
+'c_boolean_spec',
+'c_ordinal_spec',
+'ordinal',
+'term_code_constraint_section',
+'term_code_body']
+
+Racc_debug_parser = false
+
+##### racc system variables end #####
+
+ # reduce 0 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 32
+  def _reduce_1( val, _values, result )
+    result = val[0]
+   result
+  end
+.,.,
+
+ # reduce 2 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 57
+  def _reduce_3( val, _values, result )
+    assert_at(__FILE__,__LINE__) do
+      val[4].instance_of?(OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION) and val[5].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT) and val[7].instance_of?(OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY) 
+    end
+    
+    archetype_id = val[0][:archetype_id]
+    adl_version = val[0][:arch_head][:arch_meta_data][:adl_version]
+    concept = val[2]
+    language = val[3][:arch_language]
+    archetype = OpenEHR::AM::Archetype::ARCHETYPE.create(
+                                                         :archetype_id => archetype_id,
+                                                         :adl_version => adl_version,
+                                                         :concept => concept,
+                                                         :description => val[4],
+                                                         :definition => val[5],
+                                                         :ontology => val[7]
+                                                         ) do |archetype|
+      archetype.original_language = language
+    end
+    @@log.info("#{__FILE__}:#{__LINE__}: archetype = #{archetype} at #{@filename}:#{@lineno}")
+    result = archetype
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 63
+  def _reduce_4( val, _values, result )
+    result = {:arch_head => val[0], :archetype_id => val[1] }
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 67
+  def _reduce_5( val, _values, result )
+    raise
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 72
+  def _reduce_6( val, _values, result )
+    result = {:arch_meta_data => nil }
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 76
+  def _reduce_7( val, _values, result )
+    result = val[1]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 81
+  def _reduce_8( val, _values, result )
+    result = {:arch_meta_data => val[1] }
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 86
+  def _reduce_9( val, _values, result )
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 90
+  def _reduce_10( val, _values, result )
+    result = val[0].merge(val[2])
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 96
+  def _reduce_11( val, _values, result )
+    result = {:adl_version => val[2], :is_controlled => false }
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 100
+  def _reduce_12( val, _values, result )
+    result = {:is_controlled => true }
+   result
+  end
+.,.,
+
+ # reduce 13 omitted
+
+ # reduce 14 omitted
+
+ # reduce 15 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 111
+  def _reduce_16( val, _values, result )
+    result = {:arch_concept => val[1] }
+   result
+  end
+.,.,
+
+ # reduce 17 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 121
+  def _reduce_18( val, _values, result )
+    result = {:arch_language => nil}
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 125
+  def _reduce_19( val, _values, result )
+    result = {:arch_language => val[1]}
+   result
+  end
+.,.,
+
+ # reduce 20 omitted
+
+ # reduce 21 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 136
+  def _reduce_22( val, _values, result )
+    result = OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION.new(:details => val[1])
+   result
+  end
+.,.,
+
+ # reduce 23 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 144
+  def _reduce_24( val, _values, result )
+    result = val[1]
+   result
+  end
+.,.,
+
+ # reduce 25 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 154
+  def _reduce_26( val, _values, result )
+    assert_at(__FILE__,__LINE__){val[0].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT)}
+    @@log.info("#{__FILE__}:#{__LINE__}: c_complex_object = #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 158
+  def _reduce_27( val, _values, result )
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 169
+  def _reduce_28( val, _values, result )
+    result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.create(:attributes => val[3]) do |c_complex_object|
+      c_complex_object.node_id = val[0][:c_complex_object_id][:local_term_code_ref]
+      c_complex_object.rm_type_name = val[0][:c_complex_object_id][:type_identifier]
+      c_complex_object.occurrences = val[0][:c_occurrences]
+    end
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 177
+  def _reduce_29( val, _values, result )
+    result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.create(:attributes => val[3]) do |c_complex_object|
+      c_complex_object.node_id = val[0][:c_complex_object_id][:local_term_code_ref]
+      c_complex_object.rm_type_name = val[0][:c_complex_object_id][:type_identifier]
+      c_complex_object.occurrences = val[0][:c_occurrences]
+    end
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 184
+  def _reduce_30( val, _values, result )
+    result = {:c_complex_object_id => val[0], :c_occurrences => val[1]}
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 189
+  def _reduce_31( val, _values, result )
+    result = {:type_identifier => val[0]}
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 193
+  def _reduce_32( val, _values, result )
+    result = {:type_identifier => val[0], :local_term_code_ref => val[1]}
+   result
+  end
+.,.,
+
+ # reduce 33 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 199
+  def _reduce_34( val, _values, result )
+    result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new(:attributes => val[0])
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 207
+  def _reduce_35( val, _values, result )
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 212
+  def _reduce_36( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}: c_complex_object = #{val[0].inspect} at #{@filename}:#{@lineno}")
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 220
+  def _reduce_37( val, _values, result )
+    result = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF.create do |archetype_internal_ref|
+      archetype_internal_ref.target_path = val[0][:absolute_path]
+      archetype_internal_ref.rm_type_name = val[0][:type_identifier]
+      archetype_internal_ref.occurrences = val[0][:c_occurrences]
+    end
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 224
+  def _reduce_38( val, _values, result )
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 230
+  def _reduce_39( val, _values, result )
+    result = OpenEHR::AM::Archetype::Constraint_Model::CONSTRAINT_REF.create do |constraint_ref|
+      constraint_ref.reference = val[0]
+    end
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 234
+  def _reduce_40( val, _values, result )
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 238
+  def _reduce_41( val, _values, result )
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 242
+  def _reduce_42( val, _values, result )
+    result = val[0]
+   result
+  end
+.,.,
+
+ # reduce 43 omitted
+
+ # reduce 44 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 257
+  def _reduce_45( val, _values, result )
+    result = val[1]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 263
+  def _reduce_46( val, _values, result )
+    result = {:type_identifier => val[1], :c_occurrences => val[2], :absolute_path => val[3] }
+   result
+  end
+.,.,
+
+ # reduce 47 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 275
+  def _reduce_48( val, _values, result )
+    result = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT.create do |archetype_slot|
+      archetype_slot.includes = val[3]
+      archetype_slot.excludes = val[4]
+      archetype_slot.rm_type_name = val[0][:c_archetype_slot_id]
+      archetype_slot.occurrences = val[0][:c_occurrences]
+    end
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 279
+  def _reduce_49( val, _values, result )
+    result = {:c_archetype_slot_id => val[0],:c_occurrences => val[1]}
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 284
+  def _reduce_50( val, _values, result )
+    result = val[1]
+   result
+  end
+.,.,
+
+ # reduce 51 omitted
+
+ # reduce 52 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 295
+  def _reduce_53( val, _values, result )
+    assert_at(__FILE__,__LINE__){val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_PRIMITIVE)}
+    result = OpenEHR::AM::Archetype::Constraint_Model::C_PRIMITIVE_OBJECT.create do |c_primitive_object|
+      c_primitive_object.item = val[0]
+    end
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 305
+  def _reduce_54( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}: c_integer = #{val[0]} at #{@filename}:#{@lineno}")
+    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_INTEGER.create do |c_integer|
+      c_integer.list
+      c_integer.range
+      c_integer.assumed_value
+    end
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 310
+  def _reduce_55( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}: c_real = #{val[0]} at #{@filename}:#{@lineno}")
+    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_REAL.new
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 315
+  def _reduce_56( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}: c_date = #{val[0]} at #{@filename}:#{@lineno}")
+    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE.new
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 320
+  def _reduce_57( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}: c_time = #{val[0]} at #{@filename}:#{@lineno}")
+    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_TIME.new
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 325
+  def _reduce_58( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}: c_date_time = #{val[0]} at #{@filename}:#{@lineno}")
+    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME.new
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 330
+  def _reduce_59( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}: c_duration = #{val[0]} at #{@filename}:#{@lineno}")
+    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DURATION.new
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 335
+  def _reduce_60( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}: c_string = #{val[0]} at #{@filename}:#{@lineno}")
+    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_STRING.new
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 341
+  def _reduce_61( val, _values, result )
+    assert_at(__FILE__,__LINE__){val[0].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN)}
+    @@log.info("#{__FILE__}:#{__LINE__}: c_boolean = #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+   result
+  end
+.,.,
+
+ # reduce 62 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 351
+  def _reduce_63( val, _values, result )
+    result = [val[0]]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 355
+  def _reduce_64( val, _values, result )
+    result = (val[0] << val[1])
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 364
+  def _reduce_65( val, _values, result )
+    assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
+    c_attribute = val[0]
+    c_attribute.children = val[3]
+    result = c_attribute
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 369
+  def _reduce_66( val, _values, result )
+    assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 374
+  def _reduce_67( val, _values, result )
+    assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 385
+  def _reduce_68( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]}, c_existence = #{val[1]} at #{@filename}")
+    result = OpenEHR::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE.new(
+                                                                              :rm_attribute_name => val[0],
+                                                                              :existence => val[1]
+                                                                              )
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 395
+  def _reduce_69( val, _values, result )
+    assert_at(__FILE__,__LINE__){ val[2].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY) }
+    @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER: #{val[0]}, c_existence = #{val[1]}, c_cardinality = #{val[2]} at #{@filename}") 
+    result = OpenEHR::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE.new(
+                                                                                :rm_attribute_name => val[0],
+                                                                                :existence => val[1],
+                                                                                :cardinality => val[2]
+                                                                                )
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 400
+  def _reduce_70( val, _values, result )
+    result = Array[val[0]]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 404
+  def _reduce_71( val, _values, result )
+    result = (val[0] << val[1])
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 408
+  def _reduce_72( val, _values, result )
+    result = Array[val[0]]
+   result
+  end
+.,.,
+
+ # reduce 73 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 416
+  def _reduce_74( val, _values, result )
+    result = val[1]
+   result
+  end
+.,.,
+
+ # reduce 75 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 424
+  def _reduce_76( val, _values, result )
+    result = val[1]
+   result
+  end
+.,.,
+
+ # reduce 77 omitted
+
+ # reduce 78 omitted
+
+ # reduce 79 omitted
+
+ # reduce 80 omitted
+
+ # reduce 81 omitted
+
+ # reduce 82 omitted
+
+ # reduce 83 omitted
+
+ # reduce 84 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 445
+  def _reduce_85( val, _values, result )
+    dadl_section = val[1]
+    result = OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY.new
+   result
+  end
+.,.,
+
+ # reduce 86 omitted
+
+ # reduce 87 omitted
+
+ # reduce 88 omitted
+
+ # reduce 89 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 459
+  def _reduce_90( val, _values, result )
+    result = Array[val[0]]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 463
+  def _reduce_91( val, _values, result )
+    result = (val[0] << val[1])
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 467
+  def _reduce_92( val, _values, result )
+    result = (val[0] << val[2])
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 473
+  def _reduce_93( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}: attr_id = #{val[0]}, object_block = #{val[2]} at #{@filename}:#{@lineno}")
+    result = {:attr_id => val[0], :object_block => val[2]}
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 479
+  def _reduce_94( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+   result
+  end
+.,.,
+
+ # reduce 95 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 485
+  def _reduce_96( val, _values, result )
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 489
+  def _reduce_97( val, _values, result )
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 494
+  def _reduce_98( val, _values, result )
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 498
+  def _reduce_99( val, _values, result )
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 503
+  def _reduce_100( val, _values, result )
+    result = {:untyped_multiple_attr_object_block => val[0]}
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 507
+  def _reduce_101( val, _values, result )
+    result = {:type_identifier => val[0], :untyped_multiple_attr_object_block => val[1]}
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 512
+  def _reduce_102( val, _values, result )
+    result = {:multiple_attr_object_block_head => val[0], :keyed_objects => val[1]}
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 518
+  def _reduce_103( val, _values, result )
+    @@log.info("SYM_START_DBLOCK: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 523
+  def _reduce_104( val, _values, result )
+    result = Array[val[0]]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 527
+  def _reduce_105( val, _values, result )
+    result = (val[0] << val[1])
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 533
+  def _reduce_106( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}: keyed_object = #{val[0]}, object_block = #{val[2]} at #{@filename}:#{@lineno}")
+    result = {:object_key => val[0], :object_block => val[1]}
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 539
+  def _reduce_107( val, _values, result )
+    @@log.info("object_key: [#{val[1]}] at #{@filename}:#{@lineno}")
+    result = val[1]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 544
+  def _reduce_108( val, _values, result )
+    result = {:untyped_single_attr_object_block => val[0]}
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 548
+  def _reduce_109( val, _values, result )
+    result = {:type_identifier => val[0], :untyped_single_attr_object_block => val[1]}
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 554
+  def _reduce_110( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}: single_attr_object_complex_head = #{val[0]} at #{@filename}:#{@lineno}")
+    result = {:single_attr_object_complex_head => val[0]}
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 559
+  def _reduce_111( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}: single_attr_object_complex_head = #{val[0]}, attr_vals = #{val[1]} at #{@filename}:#{@lineno}")
+    result = {:single_attr_object_complex_head => val[0], :attr_vals => val[1]}
+   result
+  end
+.,.,
+
+ # reduce 112 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 565
+  def _reduce_113( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}: untyped_primitive_object_block = #{val[0]} at #{@filename}:#{@lineno}")
+    result = {:untyped_primitive_object_block => val[0]}
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 570
+  def _reduce_114( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}: type_identifier = #{val[0]}, untyped_primitive_object_block = #{val[1]} at #{@filename}:#{@lineno}")
+    result = {:type_identifier => val[0], :untyped_primitive_object_block => val[1]}
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 575
+  def _reduce_115( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}: primitive_object_block = <#{val[1]}> at #{@filename}:#{@lineno}")
+    result = val[1]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 579
+  def _reduce_116( val, _values, result )
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 583
+  def _reduce_117( val, _values, result )
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 587
+  def _reduce_118( val, _values, result )
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 591
+  def _reduce_119( val, _values, result )
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 595
+  def _reduce_120( val, _values, result )
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 600
+  def _reduce_121( val, _values, result )
+    @@log.info("string_value: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 605
+  def _reduce_122( val, _values, result )
+    @@log.info("integer_value: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 610
+  def _reduce_123( val, _values, result )
+    @@log.info("real_value: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 615
+  def _reduce_124( val, _values, result )
+    @@log.info("boolean_value: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 620
+  def _reduce_125( val, _values, result )
+    @@log.info("character_value: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 625
+  def _reduce_126( val, _values, result )
+    @@log.info("date_value: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 630
+  def _reduce_127( val, _values, result )
+    @@log.info("time_value: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 635
+  def _reduce_128( val, _values, result )
+    @@log.info("date_time_value: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 640
+  def _reduce_129( val, _values, result )
+    @@log.info("duration_value: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 645
+  def _reduce_130( val, _values, result )
+    @@log.info("uri_value: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+   result
+  end
+.,.,
+
+ # reduce 131 omitted
+
+ # reduce 132 omitted
+
+ # reduce 133 omitted
+
+ # reduce 134 omitted
+
+ # reduce 135 omitted
+
+ # reduce 136 omitted
+
+ # reduce 137 omitted
+
+ # reduce 138 omitted
+
+ # reduce 139 omitted
+
+ # reduce 140 omitted
+
+ # reduce 141 omitted
+
+ # reduce 142 omitted
+
+ # reduce 143 omitted
+
+ # reduce 144 omitted
+
+ # reduce 145 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 668
+  def _reduce_146( val, _values, result )
+    @@log.info("V_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 673
+  def _reduce_147( val, _values, result )
+    @@log.info("V_GENERIC_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 679
+  def _reduce_148( val, _values, result )
+    @@log.info("V_STRING: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+   result
+  end
+.,.,
+
+ # reduce 149 omitted
+
+ # reduce 150 omitted
+
+ # reduce 151 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 693
+  def _reduce_152( val, _values, result )
+    begin
+      integer = Integer(val[0])
+    rescue
+      raise
+    end
+    result = integer
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 702
+  def _reduce_153( val, _values, result )
+    begin
+      integer = Integer(val[0])
+    rescue
+      raise
+    end
+    result = integer
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 711
+  def _reduce_154( val, _values, result )
+    begin
+      integer = Integer(val[0])
+    rescue
+      raise
+    end
+    result = - integer
+   result
+  end
+.,.,
+
+ # reduce 155 omitted
+
+ # reduce 156 omitted
+
+ # reduce 157 omitted
+
+ # reduce 158 omitted
+
+ # reduce 159 omitted
+
+ # reduce 160 omitted
+
+ # reduce 161 omitted
+
+ # reduce 162 omitted
+
+ # reduce 163 omitted
+
+ # reduce 164 omitted
+
+ # reduce 165 omitted
+
+ # reduce 166 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 737
+  def _reduce_167( val, _values, result )
+    begin
+      real = Float(val[0])
+    rescue
+      raise
+    end
+    result = real
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 746
+  def _reduce_168( val, _values, result )
+    begin
+      real = Float(val[1])
+    rescue
+      raise
+    end
+    result = real
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 755
+  def _reduce_169( val, _values, result )
+    begin
+      real = Float(val[1])
+    rescue
+      raise
+    end
+    result = - real
+   result
+  end
+.,.,
+
+ # reduce 170 omitted
+
+ # reduce 171 omitted
+
+ # reduce 172 omitted
+
+ # reduce 173 omitted
+
+ # reduce 174 omitted
+
+ # reduce 175 omitted
+
+ # reduce 176 omitted
+
+ # reduce 177 omitted
+
+ # reduce 178 omitted
+
+ # reduce 179 omitted
+
+ # reduce 180 omitted
+
+ # reduce 181 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 775
+  def _reduce_182( val, _values, result )
+    result = true
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 779
+  def _reduce_183( val, _values, result )
+    result = false
+   result
+  end
+.,.,
+
+ # reduce 184 omitted
+
+ # reduce 185 omitted
+
+ # reduce 186 omitted
+
+ # reduce 187 omitted
+
+ # reduce 188 omitted
+
+ # reduce 189 omitted
+
+ # reduce 190 omitted
+
+ # reduce 191 omitted
+
+ # reduce 192 omitted
+
+ # reduce 193 omitted
+
+ # reduce 194 omitted
+
+ # reduce 195 omitted
+
+ # reduce 196 omitted
+
+ # reduce 197 omitted
+
+ # reduce 198 omitted
+
+ # reduce 199 omitted
+
+ # reduce 200 omitted
+
+ # reduce 201 omitted
+
+ # reduce 202 omitted
+
+ # reduce 203 omitted
+
+ # reduce 204 omitted
+
+ # reduce 205 omitted
+
+ # reduce 206 omitted
+
+ # reduce 207 omitted
+
+ # reduce 208 omitted
+
+ # reduce 209 omitted
+
+ # reduce 210 omitted
+
+ # reduce 211 omitted
+
+ # reduce 212 omitted
+
+ # reduce 213 omitted
+
+ # reduce 214 omitted
+
+ # reduce 215 omitted
+
+ # reduce 216 omitted
+
+ # reduce 217 omitted
+
+ # reduce 218 omitted
+
+ # reduce 219 omitted
+
+ # reduce 220 omitted
+
+ # reduce 221 omitted
+
+ # reduce 222 omitted
+
+ # reduce 223 omitted
+
+ # reduce 224 omitted
+
+ # reduce 225 omitted
+
+ # reduce 226 omitted
+
+ # reduce 227 omitted
+
+ # reduce 228 omitted
+
+ # reduce 229 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 843
+  def _reduce_230( val, _values, result )
+    @@log.info("V_ISO8601_DURATION: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+   result
+  end
+.,.,
+
+ # reduce 231 omitted
+
+ # reduce 232 omitted
+
+ # reduce 233 omitted
+
+ # reduce 234 omitted
+
+ # reduce 235 omitted
+
+ # reduce 236 omitted
+
+ # reduce 237 omitted
+
+ # reduce 238 omitted
+
+ # reduce 239 omitted
+
+ # reduce 240 omitted
+
+ # reduce 241 omitted
+
+ # reduce 242 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 863
+  def _reduce_243( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}: V_QUALIFIED_TERM_CODE_REF = #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+   result
+  end
+.,.,
+
+ # reduce 244 omitted
+
+ # reduce 245 omitted
+
+ # reduce 246 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 873
+  def _reduce_247( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}: V_URI = #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+   result
+  end
+.,.,
+
+ # reduce 248 omitted
+
+ # reduce 249 omitted
+
+ # reduce 250 omitted
+
+ # reduce 251 omitted
+
+ # reduce 252 omitted
+
+ # reduce 253 omitted
+
+ # reduce 254 omitted
+
+ # reduce 255 omitted
+
+ # reduce 256 omitted
+
+ # reduce 257 omitted
+
+ # reduce 258 omitted
+
+ # reduce 259 omitted
+
+ # reduce 260 omitted
+
+ # reduce 261 omitted
+
+ # reduce 262 omitted
+
+ # reduce 263 omitted
+
+ # reduce 264 omitted
+
+ # reduce 265 omitted
+
+ # reduce 266 omitted
+
+ # reduce 267 omitted
+
+ # reduce 268 omitted
+
+ # reduce 269 omitted
+
+ # reduce 270 omitted
+
+ # reduce 271 omitted
+
+ # reduce 272 omitted
+
+ # reduce 273 omitted
+
+ # reduce 274 omitted
+
+ # reduce 275 omitted
+
+ # reduce 276 omitted
+
+ # reduce 277 omitted
+
+ # reduce 278 omitted
+
+ # reduce 279 omitted
+
+ # reduce 280 omitted
+
+ # reduce 281 omitted
+
+ # reduce 282 omitted
+
+ # reduce 283 omitted
+
+ # reduce 284 omitted
+
+ # reduce 285 omitted
+
+ # reduce 286 omitted
+
+ # reduce 287 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 942
+  def _reduce_288( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}")
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 946
+  def _reduce_289( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}")
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 957
+  def _reduce_290( val, _values, result )
+    result = Range.new(1,1)
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 961
+  def _reduce_291( val, _values, result )
+    result = val[3]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 971
+  def _reduce_292( val, _values, result )
+    begin
+      integer = Integer(val[0])
+    rescue
+      raise
+    end
+    result = integer
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 981
+  def _reduce_293( val, _values, result )
+    begin
+      from_integer = Integer(val[0])
+      to_integer = Integer(val[2])
+    rescue
+      raise
+    end
+    result = Range.new(from_integer,to_integer)
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 986
+  def _reduce_294( val, _values, result )
+    result = OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY.new
+   result
+  end
+.,.,
+
+ # reduce 295 omitted
+
+ # reduce 296 omitted
+
+ # reduce 297 omitted
+
+ # reduce 298 omitted
+
+ # reduce 299 omitted
+
+ # reduce 300 omitted
+
+ # reduce 301 omitted
+
+ # reduce 302 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 1000
+  def _reduce_303( val, _values, result )
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 1004
+  def _reduce_304( val, _values, result )
+    result = val[0]
+   result
+  end
+.,.,
+
+ # reduce 305 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 1011
+  def _reduce_306( val, _values, result )
+    result = val[3]
+   result
+  end
+.,.,
+
+ # reduce 307 omitted
+
+ # reduce 308 omitted
+
+ # reduce 309 omitted
+
+ # reduce 310 omitted
+
+ # reduce 311 omitted
+
+ # reduce 312 omitted
+
+ # reduce 313 omitted
+
+ # reduce 314 omitted
+
+ # reduce 315 omitted
+
+ # reduce 316 omitted
+
+ # reduce 317 omitted
+
+ # reduce 318 omitted
+
+ # reduce 319 omitted
+
+ # reduce 320 omitted
+
+ # reduce 321 omitted
+
+ # reduce 322 omitted
+
+ # reduce 323 omitted
+
+ # reduce 324 omitted
+
+ # reduce 325 omitted
+
+ # reduce 326 omitted
+
+ # reduce 327 omitted
+
+ # reduce 328 omitted
+
+ # reduce 329 omitted
+
+ # reduce 330 omitted
+
+ # reduce 331 omitted
+
+ # reduce 332 omitted
+
+ # reduce 333 omitted
+
+ # reduce 334 omitted
+
+ # reduce 335 omitted
+
+ # reduce 336 omitted
+
+ # reduce 337 omitted
+
+ # reduce 338 omitted
+
+ # reduce 339 omitted
+
+ # reduce 340 omitted
+
+ # reduce 341 omitted
+
+ # reduce 342 omitted
+
+ # reduce 343 omitted
+
+ # reduce 344 omitted
+
+ # reduce 345 omitted
+
+ # reduce 346 omitted
+
+ # reduce 347 omitted
+
+ # reduce 348 omitted
+
+ # reduce 349 omitted
+
+ # reduce 350 omitted
+
+ # reduce 351 omitted
+
+ # reduce 352 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 1081
+  def _reduce_353( val, _values, result )
+    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true)
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 1085
+  def _reduce_354( val, _values, result )
+    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => false)
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 1089
+  def _reduce_355( val, _values, result )
+    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true,:false_valid => false)
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 1093
+  def _reduce_356( val, _values, result )
+    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => false,:false_valid => true)
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 1098
+  def _reduce_357( val, _values, result )
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 1102
+  def _reduce_358( val, _values, result )
+    raise 'Not implemented yet'
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 1106
+  def _reduce_359( val, _values, result )
+    raise 'Not implemented yet'
+   result
+  end
+.,.,
+
+ # reduce 360 omitted
+
+ # reduce 361 omitted
+
+ # reduce 362 omitted
+
+ # reduce 363 omitted
+
+ # reduce 364 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 1119
+  def _reduce_365( val, _values, result )
+    @in_interval = false
+    @@log.info("#{__FILE__}:#{__LINE__}, #{val[0]}|#{val[2]} at #{@filename}")
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 1125
+  def _reduce_366( val, _values, result )
+      result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 1129
+  def _reduce_367( val, _values, result )
+      result = val[0]
+   result
+  end
+.,.,
+
+ # reduce 368 omitted
+
+ # reduce 369 omitted
+
+ # reduce 370 omitted
+
+ # reduce 371 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 1144
+  def _reduce_372( val, _values, result )
+      result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 1149
+  def _reduce_373( val, _values, result )
+      result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 1154
+  def _reduce_374( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{word} at #{@filename}")
+      result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 1164
+  def _reduce_375( val, _values, result )
+    result = val[0]
+   result
+  end
+.,.,
+
+ def _reduce_none( val, _values, result )
+  result
+ end
+
+    end   # class Parser
+
+  end   # module ADL
+
+end   # module OpenEHR
Index: ruby/trunk/lib/adl_parser/lib/parser.y
===================================================================
--- ruby/trunk/lib/adl_parser/lib/parser.y	(revision 49)
+++ ruby/trunk/lib/adl_parser/lib/parser.y	(revision 49)
@@ -0,0 +1,1980 @@
+
+class OpenEHR::ADL::Parser
+
+#options omit_action_call
+
+prechigh
+
+  nonassoc UMINUS UPLUS
+  left '*' '/'
+  left '+' '-'
+
+  nonassoc SYM_EQ
+  nonassoc SYM_NE
+  nonassoc SYM_LT
+  nonassoc SYM_START_DBLOCK
+  nonassoc SYM_START_CBLOCK
+  nonassoc SYM_GT
+  nonassoc SYM_END_CBLOCK
+  nonassoc SYM_END_DBLOCK
+  nonassoc SYM_LE
+  nonassoc SYM_GE
+
+preclow
+
+
+rule
+### http://svn.openehr.org/ref_impl_eiffel/TRUNK/components/adl_parser/src/syntax/adl/parser/adl_validator.y
+
+input: archetype EOF
+  { 
+    result = val[0]
+  }
+  | error
+
+archetype: arch_identification arch_specialisation arch_concept arch_language arch_description arch_definition arch_invariant arch_ontology
+  { 
+    assert_at(__FILE__,__LINE__) do
+      val[4].instance_of?(OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION) and val[5].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT) and val[7].instance_of?(OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY) 
+    end
+    
+    archetype_id = val[0][:archetype_id]
+    adl_version = val[0][:arch_head][:arch_meta_data][:adl_version]
+    concept = val[2]
+    language = val[3][:arch_language]
+    archetype = OpenEHR::AM::Archetype::ARCHETYPE.create(
+                                                         :archetype_id => archetype_id,
+                                                         :adl_version => adl_version,
+                                                         :concept => concept,
+                                                         :description => val[4],
+                                                         :definition => val[5],
+                                                         :ontology => val[7]
+                                                         ) do |archetype|
+      archetype.original_language = language
+    end
+    @@log.info("#{__FILE__}:#{__LINE__}: archetype = #{archetype} at #{@filename}:#{@lineno}")
+    result = archetype
+  }
+
+
+arch_identification: arch_head V_ARCHETYPE_ID
+  { 
+    result = {:arch_head => val[0], :archetype_id => val[1] }
+  }
+  | SYM_ARCHETYPE error
+  { 
+    raise
+  }
+
+arch_head: SYM_ARCHETYPE
+  { 
+    result = {:arch_meta_data => nil }
+  }
+  | SYM_ARCHETYPE arch_meta_data
+  { 
+    result = val[1]
+  }
+
+arch_meta_data: Left_parenthesis_code arch_meta_data_items Right_parenthesis_code
+  { 
+    result = {:arch_meta_data => val[1] }
+  }
+
+arch_meta_data_items: arch_meta_data_item
+  { 
+    result = val[0]
+  }
+  | arch_meta_data_items Semicolon_code arch_meta_data_item
+  { 
+    result = val[0].merge(val[2])
+  }
+
+
+arch_meta_data_item: SYM_ADL_VERSION SYM_EQ V_VERSION_STRING
+  { 
+    result = {:adl_version => val[2], :is_controlled => false }
+  }
+  | SYM_IS_CONTROLLED
+  { 
+    result = {:is_controlled => true }
+  }
+
+# Define specialization in which its constraints are narrower than those of the parent.
+# Any data created via the use of the specialized archetype shall be conformant both to it and its parent.
+arch_specialisation: #-- empty is ok
+  | SYM_SPECIALIZE V_ARCHETYPE_ID
+  | SYM_SPECIALIZE error
+
+arch_concept: SYM_CONCEPT V_LOCAL_TERM_CODE_REF
+  { 
+    result = {:arch_concept => val[1] }
+  }
+  | SYM_CONCEPT error
+
+#arch_language: #-- empty is ok for ADL 1.4 tools
+#    | SYM_LANGUAGE V_DADL_TEXT
+#  | SYM_LANGUAGE error
+
+arch_language: #-- empty is ok for ADL 1.4 tools
+  {
+    result = {:arch_language => nil}
+  }
+    | SYM_LANGUAGE dadl_section
+  {
+    result = {:arch_language => val[1]}
+  }
+  | SYM_LANGUAGE error
+
+#arch_description: #-- no meta-data ok
+#    | SYM_DESCRIPTION V_DADL_TEXT
+#  | SYM_DESCRIPTION error
+
+arch_description: #-- no meta-data ok
+    | SYM_DESCRIPTION dadl_section
+  { 
+    result = OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION.new(:details => val[1])
+  }
+  | SYM_DESCRIPTION error
+  
+#arch_definition: SYM_DEFINITION V_CADL_TEXT
+#  | SYM_DEFINITION error
+arch_definition: SYM_DEFINITION cadl_section
+  { 
+    result = val[1]
+  }
+  | SYM_DEFINITION error
+
+
+### cADL section
+cadl_section: c_complex_object
+  {
+    assert_at(__FILE__,__LINE__){val[0].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT)}
+    @@log.info("#{__FILE__}:#{__LINE__}: c_complex_object = #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+  }
+  | assertions
+  { 
+    result = val[0]
+  }
+#  | error
+
+#c_complex_object: c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body SYM_END_CBLOCK
+c_complex_object: c_complx_object_head SYM_MATCHES START_REGEXP_BLOCK REGEXP_BODY END_REGEXP_BLOCK # added by akimichi
+  { 
+    result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.create(:attributes => val[3]) do |c_complex_object|
+      c_complex_object.node_id = val[0][:c_complex_object_id][:local_term_code_ref]
+      c_complex_object.rm_type_name = val[0][:c_complex_object_id][:type_identifier]
+      c_complex_object.occurrences = val[0][:c_occurrences]
+    end
+  }
+    | c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body SYM_END_CBLOCK
+  { 
+    result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.create(:attributes => val[3]) do |c_complex_object|
+      c_complex_object.node_id = val[0][:c_complex_object_id][:local_term_code_ref]
+      c_complex_object.rm_type_name = val[0][:c_complex_object_id][:type_identifier]
+      c_complex_object.occurrences = val[0][:c_occurrences]
+    end
+  }
+#    | c_complex_object_head error SYM_END_CBLOCK
+#    | c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body c_invariants SYM_END_CBLOCK
+
+c_complex_object_head: c_complex_object_id c_occurrences
+  {
+    result = {:c_complex_object_id => val[0], :c_occurrences => val[1]}
+  }
+
+c_complex_object_id: type_identifier
+  {
+    result = {:type_identifier => val[0]}
+  }
+  | type_identifier V_LOCAL_TERM_CODE_REF
+  {
+    result = {:type_identifier => val[0], :local_term_code_ref => val[1]}
+  }
+
+c_complex_object_body: c_any #-- used to indicate that any value of a type is ok
+  | c_attributes
+  { 
+    result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new(:attributes => val[0])
+  }
+
+
+#------------------------- node types -----------------------
+
+c_object: v_c_domain_type
+  {
+    result = val[0]
+  }
+  | c_complex_object
+  {
+    @@log.info("#{__FILE__}:#{__LINE__}: c_complex_object = #{val[0].inspect} at #{@filename}:#{@lineno}")
+    result = val[0]
+  }
+  | archetype_internal_ref
+  {
+    result = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF.create do |archetype_internal_ref|
+      archetype_internal_ref.target_path = val[0][:absolute_path]
+      archetype_internal_ref.rm_type_name = val[0][:type_identifier]
+      archetype_internal_ref.occurrences = val[0][:c_occurrences]
+    end
+  }
+  | archetype_slot
+  {
+    result = val[0]
+  }
+  | constraint_ref
+  {
+    result = OpenEHR::AM::Archetype::Constraint_Model::CONSTRAINT_REF.create do |constraint_ref|
+      constraint_ref.reference = val[0]
+    end
+  }
+  | c_code_phrase
+  {
+    result = val[0]
+  }
+  | c_ordinal
+  {
+    result = val[0]
+  }
+  | c_primitive_object
+  {
+    result = val[0]
+  }
+#  | v_c_domain_type
+#  | V_C_DOMAIN_TYPE
+  #   this is an attempt to match a dADL section inside cADL. It will
+  #   probably never work 100% properly since there can be '>' inside "||"
+  #   ranges, and also strings containing any character, e.g. units string
+  #   contining "{}" chars. The real solution is to use the dADL parser on
+  #   the buffer from the current point on and be able to fast-forward the
+  #   cursor to the last character matched by the dADL scanner
+  | ERR_C_DOMAIN_TYPE
+  | error
+
+v_c_domain_type: START_V_C_DOMAIN_TYPE_BLOCK dadl_section END_V_C_DOMAIN_TYPE_BLOCK
+  { 
+    result = val[1]
+  }
+
+# 'archetype_internal_ref' is a node that refers to a previously defined object node in the same archetype.
+archetype_internal_ref: SYM_USE_NODE type_identifier c_occurrences absolute_path
+  {
+    result = {:type_identifier => val[1], :c_occurrences => val[2], :absolute_path => val[3] }
+  }
+  | SYM_USE_NODE type_identifier error
+
+# 'archetype_slot' is a node whose statements define a constraint that determines which other archetypes may appear at that point in the current archetype.
+archetype_slot: c_archetype_slot_head SYM_MATCHES SYM_START_CBLOCK c_includes c_excludes SYM_END_CBLOCK
+  {
+    result = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT.create do |archetype_slot|
+      archetype_slot.includes = val[3]
+      archetype_slot.excludes = val[4]
+      archetype_slot.rm_type_name = val[0][:c_archetype_slot_id]
+      archetype_slot.occurrences = val[0][:c_occurrences]
+    end
+  }
+c_archetype_slot_head: c_archetype_slot_id c_occurrences
+  {
+    result = {:c_archetype_slot_id => val[0],:c_occurrences => val[1]}
+  }
+
+c_archetype_slot_id: SYM_ALLOW_ARCHETYPE type_identifier
+  {
+    result = val[1]
+  }
+  | SYM_ALLOW_ARCHETYPE type_identifier V_LOCAL_TERM_CODE_REF
+  | SYM_ALLOW_ARCHETYPE error
+
+# 'c_primitive_object' is an node representing a constraint on a primitive object type.
+c_primitive_object: c_primitive
+  {
+    assert_at(__FILE__,__LINE__){val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_PRIMITIVE)}
+    result = OpenEHR::AM::Archetype::Constraint_Model::C_PRIMITIVE_OBJECT.create do |c_primitive_object|
+      c_primitive_object.item = val[0]
+    end
+  }
+
+c_primitive: c_integer
+  {
+    @@log.info("#{__FILE__}:#{__LINE__}: c_integer = #{val[0]} at #{@filename}:#{@lineno}")
+    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_INTEGER.create do |c_integer|
+      c_integer.list
+      c_integer.range
+      c_integer.assumed_value
+    end
+  }
+  | c_real
+  {
+    @@log.info("#{__FILE__}:#{__LINE__}: c_real = #{val[0]} at #{@filename}:#{@lineno}")
+    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_REAL.new
+  }
+  | c_date
+  {
+    @@log.info("#{__FILE__}:#{__LINE__}: c_date = #{val[0]} at #{@filename}:#{@lineno}")
+    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE.new
+  }
+  | c_time
+  {
+    @@log.info("#{__FILE__}:#{__LINE__}: c_time = #{val[0]} at #{@filename}:#{@lineno}")
+    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_TIME.new
+  }
+  | c_date_time
+  {
+    @@log.info("#{__FILE__}:#{__LINE__}: c_date_time = #{val[0]} at #{@filename}:#{@lineno}")
+    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME.new
+  }
+  | c_duration
+  {
+    @@log.info("#{__FILE__}:#{__LINE__}: c_duration = #{val[0]} at #{@filename}:#{@lineno}")
+    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DURATION.new
+  }
+  | c_string
+  {
+    @@log.info("#{__FILE__}:#{__LINE__}: c_string = #{val[0]} at #{@filename}:#{@lineno}")
+    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_STRING.new
+  }
+  | c_boolean
+  {
+    assert_at(__FILE__,__LINE__){val[0].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN)}
+    @@log.info("#{__FILE__}:#{__LINE__}: c_boolean = #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+  }
+
+c_any: Star_code
+#c_any: '*'
+
+#---------------- BODY - relationships ----------------
+
+c_attributes: c_attribute
+  { 
+    result = [val[0]]
+  }
+  | c_attributes c_attribute
+  { 
+    result = (val[0] << val[1])
+  }
+
+# 'c_attribute' is a node representing a constraint on an attribute in an object model.
+c_attribute: c_attr_head SYM_MATCHES SYM_START_CBLOCK c_attr_values SYM_END_CBLOCK
+  { 
+    assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
+    c_attribute = val[0]
+    c_attribute.children = val[3]
+    result = c_attribute
+  }
+  | c_attr_head SYM_MATCHES START_REGEXP_BLOCK REGEXP_BODY END_REGEXP_BLOCK # added by akimichi
+  { 
+    assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
+    result = val[0]
+  }
+  | c_attr_head SYM_MATCHES SYM_START_CBLOCK error SYM_END_CBLOCK
+  { 
+    assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
+    result = val[0]
+  }
+
+
+c_attr_head: V_ATTRIBUTE_IDENTIFIER c_existence
+  {
+    @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]}, c_existence = #{val[1]} at #{@filename}")
+    result = OpenEHR::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE.new(
+                                                                              :rm_attribute_name => val[0],
+                                                                              :existence => val[1]
+                                                                              )
+
+  }
+  | V_ATTRIBUTE_IDENTIFIER c_existence c_cardinality
+  {
+    assert_at(__FILE__,__LINE__){ val[2].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY) }
+    @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER: #{val[0]}, c_existence = #{val[1]}, c_cardinality = #{val[2]} at #{@filename}") 
+    result = OpenEHR::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE.new(
+                                                                                :rm_attribute_name => val[0],
+                                                                                :existence => val[1],
+                                                                                :cardinality => val[2]
+                                                                                )
+  }
+
+c_attr_values: c_object
+  { 
+    result = Array[val[0]]
+  }
+  | c_attr_values c_object
+  { 
+    result = (val[0] << val[1])
+  }
+  | c_any #	-- to allow a property to have any value
+  { 
+    result = Array[val[0]]
+  }
+
+### c_includes: #-- Empty
+###     | SYM_INCLUDE assertions
+c_includes: #-- Empty
+    | SYM_INCLUDE invariants
+{
+    result = val[1]
+}
+
+### c_excludes: #-- Empty
+###     | SYM_EXCLUDE assertions
+c_excludes: #-- Empty
+    | SYM_EXCLUDE invariants
+{
+    result = val[1]
+}
+
+invariants: invariant
+  | invariants invariant
+
+invariant: any_identifier ':' boolean_expression
+  | boolean_expression
+  | any_identifier ':' error
+
+arch_invariant: #-- no invariant ok
+    | SYM_INVARIANT V_ASSERTION_TEXT
+    | SYM_INVARIANT error
+
+# define all linguistic entries in this part as dADL.
+#arch_ontology: SYM_ONTOLOGY V_DADL_TEXT
+#  | SYM_ONTOLOGY error
+
+arch_ontology: SYM_ONTOLOGY dadl_section
+  { 
+    dadl_section = val[1]
+    result = OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY.new
+  }
+  | SYM_ONTOLOGY error
+
+
+### dADL section
+dadl_section: dadl_input
+
+dadl_input: attr_vals
+  | complex_object_block
+#  | error
+
+attr_vals: attr_val
+  {
+    result = Array[val[0]]
+  }
+  | attr_vals attr_val
+  {
+    result = (val[0] << val[1])
+  }
+  | attr_vals Semicolon_code attr_val
+  {
+    result = (val[0] << val[2])
+  }
+
+attr_val: attr_id SYM_EQ object_block
+  {
+    @@log.info("#{__FILE__}:#{__LINE__}: attr_id = #{val[0]}, object_block = #{val[2]} at #{@filename}:#{@lineno}")
+    result = {:attr_id => val[0], :object_block => val[2]}
+  }
+
+attr_id: V_ATTRIBUTE_IDENTIFIER
+  {
+    @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+  }
+  | V_ATTRIBUTE_IDENTIFIER error
+
+object_block: complex_object_block
+  { 
+    result = val[0]
+  }
+  | primitive_object_block
+  { 
+    result = val[0]
+  }
+
+complex_object_block: single_attr_object_block
+  { 
+    result = val[0]
+  }
+  | multiple_attr_object_block
+  { 
+    result = val[0]
+  }
+
+multiple_attr_object_block: untyped_multiple_attr_object_block
+  { 
+    result = {:untyped_multiple_attr_object_block => val[0]}
+  }
+  | type_identifier untyped_multiple_attr_object_block
+  { 
+    result = {:type_identifier => val[0], :untyped_multiple_attr_object_block => val[1]}
+  }
+
+untyped_multiple_attr_object_block: multiple_attr_object_block_head keyed_objects SYM_END_DBLOCK
+  { 
+    result = {:multiple_attr_object_block_head => val[0], :keyed_objects => val[1]}
+  }
+
+multiple_attr_object_block_head: SYM_START_DBLOCK
+  { 
+    @@log.info("SYM_START_DBLOCK: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+  }
+
+keyed_objects: keyed_object
+  { 
+    result = Array[val[0]]
+  }
+  | keyed_objects keyed_object
+  { 
+    result = (val[0] << val[1])
+  }
+
+keyed_object: object_key SYM_EQ object_block
+  {
+    @@log.info("#{__FILE__}:#{__LINE__}: keyed_object = #{val[0]}, object_block = #{val[2]} at #{@filename}:#{@lineno}")
+    result = {:object_key => val[0], :object_block => val[1]}
+  }
+
+object_key: Left_bracket_code simple_value Right_bracket_code
+  {
+    @@log.info("object_key: [#{val[1]}] at #{@filename}:#{@lineno}")
+    result = val[1]
+  }
+
+single_attr_object_block: untyped_single_attr_object_block
+  {
+    result = {:untyped_single_attr_object_block => val[0]}
+  }
+  | type_identifier untyped_single_attr_object_block
+  {
+    result = {:type_identifier => val[0], :untyped_single_attr_object_block => val[1]}
+  }
+
+untyped_single_attr_object_block: single_attr_object_complex_head SYM_END_DBLOCK # <>
+  {
+    @@log.info("#{__FILE__}:#{__LINE__}: single_attr_object_complex_head = #{val[0]} at #{@filename}:#{@lineno}")
+    result = {:single_attr_object_complex_head => val[0]}
+  }
+  | single_attr_object_complex_head attr_vals SYM_END_DBLOCK
+  {
+    @@log.info("#{__FILE__}:#{__LINE__}: single_attr_object_complex_head = #{val[0]}, attr_vals = #{val[1]} at #{@filename}:#{@lineno}")
+    result = {:single_attr_object_complex_head => val[0], :attr_vals => val[1]}
+  }
+single_attr_object_complex_head: SYM_START_DBLOCK
+primitive_object_block: untyped_primitive_object_block
+  {
+    @@log.info("#{__FILE__}:#{__LINE__}: untyped_primitive_object_block = #{val[0]} at #{@filename}:#{@lineno}")
+    result = {:untyped_primitive_object_block => val[0]}
+  }
+  | type_identifier untyped_primitive_object_block
+  {
+    @@log.info("#{__FILE__}:#{__LINE__}: type_identifier = #{val[0]}, untyped_primitive_object_block = #{val[1]} at #{@filename}:#{@lineno}")
+    result = {:type_identifier => val[0], :untyped_primitive_object_block => val[1]}
+  }
+untyped_primitive_object_block: SYM_START_DBLOCK primitive_object_value SYM_END_DBLOCK
+  {
+    @@log.info("#{__FILE__}:#{__LINE__}: primitive_object_block = <#{val[1]}> at #{@filename}:#{@lineno}")
+    result = val[1]
+  }
+primitive_object_value: simple_value
+  {
+    result = val[0]
+  }
+  | simple_list_value
+  {
+    result = val[0]
+  }
+  | simple_interval_value
+  {
+    result = val[0]
+  }
+  | term_code
+  {
+    result = val[0]
+  }
+  | term_code_list_value
+  {
+    result = val[0]
+  }
+simple_value: string_value
+  {
+    @@log.info("string_value: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+  }
+  | integer_value
+  {
+    @@log.info("integer_value: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+  }
+  | real_value
+  {
+    @@log.info("real_value: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+  }
+  | boolean_value
+  {
+    @@log.info("boolean_value: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+  }
+  | character_value
+  {
+    @@log.info("character_value: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+  }
+  | date_value
+  {
+    @@log.info("date_value: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+  }
+  | time_value
+  {
+    @@log.info("time_value: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+  }
+  | date_time_value
+  {
+    @@log.info("date_time_value: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+  }
+  | duration_value
+  {
+    @@log.info("duration_value: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+  }
+  | uri_value
+  {
+    @@log.info("uri_value: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+  }
+
+simple_list_value: string_list_value
+  | integer_list_value
+  | real_list_value
+  | boolean_list_value
+  | character_list_value
+  | date_list_value
+  | time_list_value
+  | date_time_list_value
+  | duration_list_value
+
+simple_interval_value: integer_interval_value
+  | real_interval_value
+  | date_interval_value
+  | time_interval_value
+  | date_time_interval_value
+  | duration_interval_value
+
+type_identifier: V_TYPE_IDENTIFIER
+  {
+    @@log.info("V_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+  }
+  | V_GENERIC_TYPE_IDENTIFIER
+  {
+    @@log.info("V_GENERIC_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+  }
+
+string_value: V_STRING
+  {
+    @@log.info("V_STRING: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+  }
+
+string_list_value: V_STRING Comma_code V_STRING
+  | string_list_value Comma_code V_STRING
+  | V_STRING Comma_code SYM_LIST_CONTINUE
+
+integer_value: V_INTEGER
+  { 
+    begin
+      integer = Integer(val[0])
+    rescue
+      raise
+    end
+    result = integer
+  }
+  | Plus_code V_INTEGER
+  {
+    begin
+      integer = Integer(val[0])
+    rescue
+      raise
+    end
+    result = integer
+  }
+  | Minus_code V_INTEGER
+  {
+    begin
+      integer = Integer(val[0])
+    rescue
+      raise
+    end
+    result = - integer
+  }
+###   | '+' V_INTEGER
+###   | '-' V_INTEGER
+
+integer_list_value: integer_value Comma_code integer_value
+  | integer_list_value Comma_code integer_value
+  | integer_value Comma_code SYM_LIST_CONTINUE
+
+integer_interval_value: SYM_INTERVAL_DELIM integer_value SYM_ELLIPSIS integer_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT integer_value SYM_ELLIPSIS integer_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM integer_value SYM_ELLIPSIS SYM_LT integer_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT integer_value SYM_ELLIPSIS SYM_LT integer_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LT integer_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LE integer_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT integer_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GE integer_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM integer_value SYM_INTERVAL_DELIM
+
+real_value: V_REAL
+  {
+    begin
+      real = Float(val[0])
+    rescue
+      raise
+    end
+    result = real
+  }
+  | Plus_code V_REAL
+  {
+    begin
+      real = Float(val[1])
+    rescue
+      raise
+    end
+    result = real
+  }
+  | Minus_code V_REAL
+  {
+    begin
+      real = Float(val[1])
+    rescue
+      raise
+    end
+    result = - real
+  }
+
+real_list_value: real_value Comma_code real_value
+  | real_list_value Comma_code real_value
+  | real_value Comma_code SYM_LIST_CONTINUE
+
+real_interval_value: SYM_INTERVAL_DELIM real_value SYM_ELLIPSIS real_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT real_value SYM_ELLIPSIS real_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM real_value SYM_ELLIPSIS SYM_LT real_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT real_value SYM_ELLIPSIS SYM_LT real_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LT real_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LE real_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT real_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GE real_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM real_value SYM_INTERVAL_DELIM
+
+
+boolean_value: SYM_TRUE
+  { 
+    result = true
+  }
+  | SYM_FALSE
+  { 
+    result = false
+  }
+
+boolean_list_value: boolean_value Comma_code boolean_value
+  | boolean_list_value Comma_code boolean_value
+  | boolean_value Comma_code SYM_LIST_CONTINUE
+
+character_value: V_CHARACTER
+
+character_list_value: character_value Comma_code character_value
+  | character_list_value Comma_code character_value
+  | character_value Comma_code SYM_LIST_CONTINUE
+
+date_value: V_ISO8601_EXTENDED_DATE
+
+date_list_value: date_value Comma_code date_value
+  | date_list_value Comma_code date_value
+  | date_value Comma_code SYM_LIST_CONTINUE
+
+date_interval_value: SYM_INTERVAL_DELIM date_value SYM_ELLIPSIS date_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT date_value SYM_ELLIPSIS date_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM date_value SYM_ELLIPSIS SYM_LT date_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT date_value SYM_ELLIPSIS SYM_LT date_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LT date_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LE date_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT date_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GE date_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM date_value SYM_INTERVAL_DELIM
+
+time_value: V_ISO8601_EXTENDED_TIME
+
+time_list_value: time_value Comma_code time_value
+  | time_list_value Comma_code time_value
+  | time_value Comma_code SYM_LIST_CONTINUE
+
+time_interval_value: SYM_INTERVAL_DELIM time_value SYM_ELLIPSIS time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT time_value SYM_ELLIPSIS time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM time_value SYM_ELLIPSIS SYM_LT time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT time_value SYM_ELLIPSIS SYM_LT time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LT time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LE time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GE time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM time_value SYM_INTERVAL_DELIM
+
+date_time_value: V_ISO8601_EXTENDED_DATE_TIME
+
+date_time_list_value: date_time_value Comma_code date_time_value
+  | date_time_list_value Comma_code date_time_value
+  | date_time_value Comma_code SYM_LIST_CONTINUE
+
+date_time_interval_value: SYM_INTERVAL_DELIM date_time_value SYM_ELLIPSIS date_time_value  SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT date_time_value SYM_ELLIPSIS date_time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM date_time_value SYM_ELLIPSIS SYM_LT date_time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT date_time_value SYM_ELLIPSIS SYM_LT date_time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LT date_time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LE date_time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT date_time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GE date_time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM date_time_value SYM_INTERVAL_DELIM
+
+duration_value: V_ISO8601_DURATION
+  {
+    @@log.info("V_ISO8601_DURATION: #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+  }
+
+duration_list_value: duration_value Comma_code duration_value
+  | duration_list_value Comma_code duration_value
+  | duration_value Comma_code SYM_LIST_CONTINUE
+
+duration_interval_value: SYM_INTERVAL_DELIM duration_value SYM_ELLIPSIS duration_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT duration_value SYM_ELLIPSIS duration_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM duration_value SYM_ELLIPSIS SYM_LT duration_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT duration_value SYM_ELLIPSIS SYM_LT duration_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LT duration_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LE duration_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT duration_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GE duration_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM duration_value SYM_INTERVAL_DELIM
+
+term_code: V_QUALIFIED_TERM_CODE_REF
+  {
+    @@log.info("#{__FILE__}:#{__LINE__}: V_QUALIFIED_TERM_CODE_REF = #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+  }
+
+term_code_list_value: term_code Comma_code term_code
+  | term_code_list_value Comma_code term_code
+  | term_code Comma_code SYM_LIST_CONTINUE
+
+uri_value: V_URI
+  {
+    @@log.info("#{__FILE__}:#{__LINE__}: V_URI = #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+  }
+
+
+#---------------------- ASSERTIONS ------------------------
+
+assertions: assertion
+  | assertions assertion
+
+assertion: any_identifier ':' boolean_expression
+  | boolean_expression
+  | any_identifier ':' error
+
+#---------------------- expressions ---------------------
+
+boolean_expression: boolean_leaf
+  | boolean_node
+
+boolean_node: SYM_EXISTS absolute_path
+#  | absolute_path
+  | SYM_EXISTS error
+  | relative_path SYM_MATCHES SYM_START_CBLOCK c_primitive SYM_END_CBLOCK
+  | relative_path SYM_MATCHES START_REGEXP_BLOCK REGEXP_BODY END_REGEXP_BLOCK # added by akimichi
+  | SYM_NOT boolean_leaf
+  | arithmetic_expression '=' arithmetic_expression
+  | arithmetic_expression SYM_NE arithmetic_expression
+  | arithmetic_expression SYM_LT arithmetic_expression
+  | arithmetic_expression SYM_GT arithmetic_expression
+  | arithmetic_expression SYM_LE arithmetic_expression
+  | arithmetic_expression SYM_GE arithmetic_expression
+  | boolean_expression SYM_AND boolean_expression
+  | boolean_expression SYM_OR boolean_expression
+  | boolean_expression SYM_XOR boolean_expression
+  | boolean_expression SYM_IMPLIES boolean_expression
+
+boolean_leaf: Left_parenthesis_code boolean_expression Right_parenthesis_code
+  | SYM_TRUE
+  | SYM_FALSE
+
+arithmetic_expression: arithmetic_leaf
+  | arithmetic_node
+
+arithmetic_node: arithmetic_expression '+' arithmetic_leaf
+  | arithmetic_expression '-' arithmetic_leaf
+  | arithmetic_expression Star_code arithmetic_leaf
+  | arithmetic_expression Slash_code arithmetic_leaf
+  | arithmetic_expression '^' arithmetic_leaf
+
+arithmetic_leaf:  Left_parenthesis_code arithmetic_expression Right_parenthesis_code
+  | integer_value
+  | real_value
+  | absolute_path
+
+
+#--------------- THE FOLLOWING SOURCE TAKEN FROM OG_PATH_VALIDATOR.Y -------------
+#--------------- except to remove movable_path ----------------------------------------------------
+
+
+absolute_path: Slash_code
+  | Slash_code relative_path
+#  | absolute_path Slash_code relative_path
+
+
+
+relative_path: path_segment
+  | relative_path Slash_code path_segment
+
+path_segment: V_ATTRIBUTE_IDENTIFIER V_LOCAL_TERM_CODE_REF
+  {
+    @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}") 
+  }
+  | V_ATTRIBUTE_IDENTIFIER
+  {
+    @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}") 
+  }
+
+
+#-------------------------------- END SOURCE TAKEN FROM OG_PATH_VALIDATOR.Y ----------------------
+
+
+#---------------- existence, occurrences, cardinality ----------------
+
+c_existence: #-- default to 1..1
+    { 
+    result = Range.new(1,1)
+  }
+  | SYM_EXISTENCE SYM_MATCHES SYM_START_CBLOCK existence_spec SYM_END_CBLOCK
+  { 
+    result = val[3]
+  }
+
+existence_spec:  V_INTEGER #-- can only be 0 or 1
+  { 
+    begin
+      integer = Integer(val[0])
+    rescue
+      raise
+    end
+    result = integer
+  }
+  | V_INTEGER SYM_ELLIPSIS V_INTEGER #-- can only be 0..0, 0..1, 1..1
+  { 
+    begin
+      from_integer = Integer(val[0])
+      to_integer = Integer(val[2])
+    rescue
+      raise
+    end
+    result = Range.new(from_integer,to_integer)
+  }
+
+c_cardinality: SYM_CARDINALITY SYM_MATCHES SYM_START_CBLOCK cardinality_spec SYM_END_CBLOCK
+  { 
+    result = OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY.new
+  }
+
+cardinality_spec: occurrence_spec
+  | occurrence_spec Semicolon_code SYM_ORDERED
+  | occurrence_spec Semicolon_code SYM_UNORDERED
+  | occurrence_spec Semicolon_code SYM_UNIQUE
+  | occurrence_spec Semicolon_code SYM_ORDERED Semicolon_code SYM_UNIQUE
+  | occurrence_spec Semicolon_code SYM_UNORDERED Semicolon_code SYM_UNIQUE
+  | occurrence_spec Semicolon_code SYM_UNIQUE Semicolon_code SYM_ORDERED
+  | occurrence_spec Semicolon_code SYM_UNIQUE Semicolon_code SYM_UNORDERED
+
+cardinality_limit_value: integer_value
+  {
+    result = val[0]
+  }
+  | Star_code # '*'
+  {
+    result = val[0]
+  }
+
+
+c_occurrences:  #-- default to 1..1
+  | SYM_OCCURRENCES SYM_MATCHES SYM_START_CBLOCK occurrence_spec SYM_END_CBLOCK
+  { 
+    result = val[3]
+  }
+  | SYM_OCCURRENCES error
+
+occurrence_spec: cardinality_limit_value #-- single integer or '*'
+  | V_INTEGER SYM_ELLIPSIS cardinality_limit_value
+
+#---------------------- leaf constraint types -----------------------
+
+c_integer_spec: integer_value
+  | integer_list_value
+  | integer_interval_value
+
+c_integer: c_integer_spec
+  | c_integer_spec Semicolon_code integer_value
+  | c_integer_spec Semicolon_code error
+
+c_real_spec: real_value
+  | real_list_value
+  | real_interval_value
+
+c_real: c_real_spec
+  | c_real_spec Semicolon_code real_value
+  | c_real_spec Semicolon_code error
+
+c_date_constraint: V_ISO8601_DATE_CONSTRAINT_PATTERN
+  | date_value
+  | date_interval_value
+
+c_date: c_date_constraint
+  | c_date_constraint Semicolon_code date_value
+  | c_date_constraint Semicolon_code error
+
+c_time_constraint: V_ISO8601_TIME_CONSTRAINT_PATTERN
+  | time_value
+  | time_interval_value
+
+c_time: c_time_constraint
+  | c_time_constraint Semicolon_code time_value
+  | c_time_constraint Semicolon_code error
+
+c_date_time_constraint: V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN
+  | date_time_value
+  | date_time_interval_value
+
+c_date_time: c_date_time_constraint
+  | c_date_time_constraint Semicolon_code date_time_value
+  | c_date_time_constraint Semicolon_code error
+
+c_duration_constraint: duration_pattern
+  | duration_pattern Slash_code duration_interval_value
+  | duration_value
+  | duration_interval_value
+
+c_duration: c_duration_constraint
+  | c_duration_constraint Semicolon_code duration_value
+  | c_duration_constraint Semicolon_code error
+
+c_string_spec:  V_STRING #-- single value, generates closed list
+  | string_list_value #-- closed list
+  | string_list_value Comma_code SYM_LIST_CONTINUE #-- open list
+#  | string_list_value ',' SYM_LIST_CONTINUE #-- open list
+#  | V_REGEXP #-- regular expression with "//" or "^^" delimiters
+
+c_string: c_string_spec
+  | c_string_spec Semicolon_code string_value
+  | c_string_spec Semicolon_code error
+
+c_boolean_spec: SYM_TRUE
+  { 
+    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true)
+  }
+  | SYM_FALSE
+  { 
+    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => false)
+  }
+  | SYM_TRUE Comma_code SYM_FALSE
+  { 
+    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true,:false_valid => false)
+  }
+  | SYM_FALSE Comma_code SYM_TRUE
+  { 
+    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => false,:false_valid => true)
+  }
+
+c_boolean: c_boolean_spec
+  { 
+    result = val[0]
+  }
+  | c_boolean_spec Semicolon_code boolean_value
+  {
+    raise 'Not implemented yet'
+  }
+  | c_boolean_spec Semicolon_code error
+  {
+    raise 'Not implemented yet'
+  }
+
+c_ordinal: c_ordinal_spec
+  | c_ordinal_spec Semicolon_code integer_value
+  | c_ordinal_spec Semicolon_code error
+
+c_ordinal_spec: ordinal
+  | c_ordinal_spec Comma_code ordinal
+
+ordinal: integer_value SYM_INTERVAL_DELIM V_QUALIFIED_TERM_CODE_REF
+  {
+    @in_interval = false
+    @@log.info("#{__FILE__}:#{__LINE__}, #{val[0]}|#{val[2]} at #{@filename}") 
+  }
+
+#c_code_phrase: V_TERM_CODE_CONSTRAINT #-- e.g. "[local::at0040, at0041; at0040]"
+c_code_phrase: term_code_constraint_section #-- e.g. "[local::at0040, at0041; at0040]"
+  {
+      result = val[0]
+  }
+  | V_QUALIFIED_TERM_CODE_REF
+  {
+      result = val[0]
+  }
+
+#term_code_constraint_section: START_TERM_CODE_CONSTRAINT term_code_body Right_bracket_code
+term_code_constraint_section: START_TERM_CODE_CONSTRAINT term_code_body END_TERM_CODE_CONSTRAINT
+term_code_body: # empty
+  | TERM_CODE
+  | term_code_body TERM_CODE
+### term_code_constraint_section: START_TERM_CODE_CONSTRAINT term_code_body END_TERM_CODE_CONSTRAINT
+### term_code_body: TERM_CODE
+###   | term_code_body TERM_CODE
+
+# A Constraint_Ref is a proxy for a set of constraints on an object.
+constraint_ref: V_LOCAL_TERM_CODE_REF #-- e.g. "ac0003"
+  {
+      result = val[0]
+  }
+
+any_identifier: type_identifier
+  {
+      result = val[0]
+  }
+  | V_ATTRIBUTE_IDENTIFIER
+  {
+    @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{word} at #{@filename}")
+      result = val[0]
+  }
+
+
+#----------------- TAKEN FROM DADL_VALIDATOR.Y -------------------
+#-----------------        DO NOT MODIFY        -------------------
+#---------------------- BASIC DATA VALUES -----------------------
+
+duration_pattern: V_ISO8601_DURATION_CONSTRAINT_PATTERN
+  { 
+    result = val[0]
+  }
+
+
+
+---- header
+
+
+$:.unshift File.join(File.dirname(__FILE__))
+require 'logger'
+#require 'lib/util.rb'
+#require 'lib/scanner.rb'
+require 'rubygems'
+require 'am.rb'
+$DEBUG = false
+
+
+
+---- inner
+
+def assert_at(file,line, message = "")
+  unless yield
+    raise "Assertion failed !: #{file}, #{line}: #{message}"
+  end
+end
+
+if $DEBUG
+  @@log = Logger.new('log/parser.log','daily')
+  @@log.level = Logger::INFO
+else
+  @@log = Logger.new(STDOUT)
+  @@log.level = Logger::WARN
+end
+
+@@dadl_scanner = OpenEHR::ADL::Scanner::DADL::RootScanner.new
+@@cadl_scanner = OpenEHR::ADL::Scanner::CADL::RootScanner.new
+
+###----------/* keywords */ --------------------------------------------- 
+@@adl_reserved = {
+    'archetype' => :SYM_ARCHETYPE,
+    'adl_version' => :SYM_ADL_VERSION,
+    'controlled' => :SYM_IS_CONTROLLED,
+    'specialize' => :SYM_SPECIALIZE,
+    'concept' => :SYM_CONCEPT,
+    'language' => :SYM_LANGUAGE,
+    'description' => :SYM_DESCRIPTION,
+    'definition' => :SYM_DEFINITION,
+    'invariant' => :SYM_INVARIANT,
+    'ontology' => :SYM_ONTOLOGY,
+    'matches' => :SYM_MATCHES,
+    'is_in' => :SYM_MATCHES,
+    'occurrences' => :SYM_OCCURRENCES,
+    'true' => :SYM_TRUE, #[Tt][Rr][Uu][Ee] -- -> SYM_TRUE 
+    'false' => :SYM_FALSE, # [Ff][Aa][Ll][Ss][Ee] -- -> SYM_FALSE 
+    'infinity' => :SYM_INFINITY # [Ii][Nn][Ff][Ii][Nn][Ii][Tt][Yy] -- -> SYM_INFINITY 
+}
+
+@@dadl_reserved = {
+  'true' => :SYM_TRUE, #[Tt][Rr][Uu][Ee] -- -> SYM_TRUE 
+  'false' => :SYM_FALSE, # [Ff][Aa][Ll][Ss][Ee] -- -> SYM_FALSE 
+  'infinity' => :SYM_INFINITY # [Ii][Nn][Ff][Ii][Nn][Ii][Tt][Yy] -- -> SYM_INFINITY 
+}
+
+@@cadl_reserved = {
+  'then' => :SYM_THEN, # [Tt][Hh][Ee][Nn]
+  'else' => :SYM_ELSE, # [Ee][Ll][Ss][Ee]
+  'and' => :SYM_AND, # [Aa][Nn][Dd]
+  'or' => :SYM_OR, # [Oo][Rr]
+  'xor' => :SYM_XOR, # [Xx][Oo][Rr]
+  'not' => :SYM_NOT, # [Nn][Oo][Tt]
+  'implies' => :SYM_IMPLIES, # [Ii][Mm][Pp][Ll][Ii][Ee][Ss]
+  'true' => :SYM_TRUE, #[Tt][Rr][Uu][Ee] -- -> SYM_TRUE 
+  'false' => :SYM_FALSE, # [Ff][Aa][Ll][Ss][Ee] -- -> SYM_FALSE 
+  'forall' => :SYM_FORALL, # [Ff][Oo][Rr][_][Aa][Ll][Ll]
+  'exists' => :SYM_EXISTS, # [Ee][Xx][Ii][Ss][Tt][Ss]
+  'existence' => :SYM_EXISTENCE, # [Ee][Xx][Iu][Ss][Tt][Ee][Nn][Cc][Ee]
+  'occurrences' => :SYM_OCCURRENCES, # [Oo][Cc][Cc][Uu][Rr][Rr][Ee][Nn][Cc][Ee][Ss]
+  'cardinality' => :SYM_CARDINALITY, # [Cc][Aa][Rr][Dd][Ii][Nn][Aa][Ll][Ii][Tt][Yy]
+  'ordered' => :SYM_ORDERED, # [Oo][Rr][Dd][Ee][Rr][Ee][Dd]
+  'unordered' => :SYM_UNORDERED, # [Uu][Nn][Oo][Rr][Dd][Ee][Rr][Ee][Dd]
+  'unique' => :SYM_UNIQUE, # [Uu][Nn][Ii][Qq][Uu][Ee]
+  'matches' => :SYM_MATCHES, # [Mm][Aa][Tt][Cc][Hh][Ee][Ss]
+  'is_in' => :SYM_MATCHES, # [Ii][Ss][_][Ii][Nn]
+  'invariant' => :SYM_INVARIANT, # [Ii][Nn][Vv][Aa][Rr][Ii][Aa][Nn][Tt]
+  'infinity' => :SYM_INFINITY, # [Ii][Nn][Ff][Ii][Nn][Ii][Tt][Yy] -- -> SYM_INFINITY 
+  'use_node' => :SYM_USE_NODE, # [Uu][Ss][Ee][_][Nn][Oo][Dd][Ee]
+  'use_archetype' => :SYM_ALLOW_ARCHETYPE, # [Uu][Ss][Ee][_][Aa][Rr][Cc][Hh][Ee][Tt][Yy][Pp][Ee]
+  'allow_archetype' => :SYM_ALLOW_ARCHETYPE, # [Aa][Ll][Ll][Oo][Ww][_][Aa][Rr][Cc][Hh][Ee][Tt][Yy][Pp][Ee]
+  'include' => :SYM_INCLUDE, # [Ii][Nn][Cc][Ll][Uu][Dd][Ee]
+  'exclude' => :SYM_EXCLUDE # [Ee][Xx][Cc][Ll][Uu][Dd][Ee]
+}
+
+
+###----------/* Scanner */ ----------------------------------------------- 
+
+def scan
+  until @data.nil?  do
+    case @adl_type.last
+    when :adl
+      @data = scan_adl(@data) do |sym, val|
+        yield sym, val
+      end
+    when :dadl
+      @data = scan_dadl(@data) do |sym, val|
+        yield sym, val
+      end
+    when :cadl
+      @data = scan_cadl(@data) do |sym, val|
+        yield sym, val
+      end
+    when :regexp
+      @data = scan_regexp(@data) do |sym, val|
+        yield sym, val
+      end
+    else
+      raise
+    end
+    @data = $' # variable $' receives the string after the match
+  end
+  yield :EOF, nil
+  yield false, '$'
+end # of scan
+
+def scan_adl(data)
+  until data.nil?  do
+    case @adl_type.last
+    when :adl
+#      puts "Entering scan_adl"
+      case data
+      when /\A\n/ # carriage return
+        @lineno += 1
+        ;
+      when /\A[ \t\r\f]+/ #just drop it
+        ;
+      when /\A--.*\n/ # single line comment
+        @lineno += 1
+        @@log.info("#{__FILE__}:#{__LINE__}: scan_adl: COMMENT = #{$&} at #{@filename}:#{@lineno}")
+        ;
+      when /\Adescription/   # description
+        yield :SYM_DESCRIPTION, :SYM_DESCRIPTION
+      when /\Adefinition/   # definition
+        yield :SYM_DEFINITION, :SYM_DEFINITION
+#        @adl_type.push(:cadl)
+        ###----------/* symbols */ ------------------------------------------------- 
+      when /\A[A-Z][a-zA-Z0-9_]*/
+        yield :V_TYPE_IDENTIFIER, $&
+      when /\A[a-zA-Z][a-zA-Z0-9_-]+\.[a-zA-Z][a-zA-Z0-9_-]+\.[a-zA-Z0-9]+/   #V_ARCHETYPE_ID
+        yield :V_ARCHETYPE_ID, $&
+      when /\A[a-z][a-zA-Z0-9_]*/
+#        word = $&.downcase
+        word = $&
+        if @@adl_reserved[word]
+          @@log.info("#{__FILE__}:#{__LINE__}: scan_adl: @@adl_reserved = #{@@adl_reserved[word]} at #{@filename}:#{@lineno}")
+          yield @@adl_reserved[word], @@adl_reserved[word]
+        elsif #/\A[A-Z][a-zA-Z0-9_]*/
+          @@log.info("#{__FILE__}:#{__LINE__}: scan_adl: V_ATTRIBUTE_IDENTIFIER = #{$&} at #{@filename}:#{@lineno}")
+          yield :V_ATTRIBUTE_IDENTIFIER, $&
+        end
+      when /\A\=/   # =
+        yield :SYM_EQ, :SYM_EQ
+      when /\A\>=/   # >=
+        yield :SYM_GE, :SYM_GE
+      when /\A\<=/   # <=
+        yield :SYM_LE, :SYM_LE
+      when /\A\</   # <
+        if @in_interval
+#          @start_block_received = false
+          yield :SYM_LT, :SYM_LT
+        else
+#          @start_block_received = true
+          @adl_type.push(:dadl)
+          yield :SYM_START_DBLOCK,  $&
+        end
+      when /\A\>/   # >
+        if @in_interval
+          yield :SYM_GT, :SYM_GT
+        else
+          adl_type = @adl_type.pop
+#          puts "Escaping #{adl_type}"
+          assert_at(__FILE__,__LINE__){adl_type == :dadl}
+          yield :SYM_END_DBLOCK, :SYM_END_DBLOCK
+        end
+      when /\A\{/   # {
+        @adl_type.push(:cadl)
+        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: entering cADL at #{@filename}:#{@lineno}")
+        yield :SYM_START_CBLOCK, :SYM_START_CBLOCK
+      when /\A\}/   # }
+        adl_type = @adl_type.pop
+#        puts "Escaping #{adl_type}"
+        assert_at(__FILE__,__LINE__){adl_type == :cadl}
+        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: exiting cADL at #{@filename}:#{@lineno}")
+        yield :SYM_END_CBLOCK, $&
+      when /\A\-/   # -
+        yield :Minus_code, :Minus_code
+      when /\A\+/   # +
+        yield :Plus_code, :Plus_code
+      when /\A\*/   # *
+        yield :Star_code, :Star_code
+      when /\A\//   # /
+        yield :Slash_code, :Slash_code
+      when /\A\^/   # ^
+        yield :Caret_code, :Caret_code
+      when /\A\=/   # =
+        yield :Equal_code, :Equal_code
+      when /\A\.\.\./   # ...
+        yield :SYM_LIST_CONTINUE, :SYM_LIST_CONTINUE
+      when /\A\.\./   # ..
+        yield :SYM_ELLIPSIS, :SYM_ELLIPSIS
+      when /\A\./   # .
+        yield :Dot_code, :Dot_code
+      when /\A\;/   # ;
+        yield :Semicolon_code, :Semicolon_code
+      when /\A\,/   # ,
+        yield :Comma_code, :Comma_code
+      when /\A\:/   # :
+        yield :Colon_code, :Colon_code
+      when /\A\!/   # !
+        yield :Exclamation_code, :Exclamation_code
+      when /\A\(/   # (
+        yield :Left_parenthesis_code, :Left_parenthesis_code
+      when /\A\)/   # )
+        yield :Right_parenthesis_code, :Right_parenthesis_code
+      when /\A\$/   # $
+        yield :Dollar_code, :Dollar_code
+      when /\A\?\?/   # ??
+        yield :SYM_DT_UNKNOWN, :SYM_DT_UNKNOWN
+      when /\A\?/   # ?
+        yield :Question_mark_code, :Question_mark_code
+      when /\A[0-9]+\.[0-9]+(\.[0-9]+)*/   # ?
+        yield :V_VERSION_STRING, :V_VERSION_STRING
+      when /\A\|/   # |
+        if @in_interval
+          @in_interval = false
+        else
+          @in_interval = true
+        end
+        yield :SYM_INTERVAL_DELIM, :SYM_INTERVAL_DELIM
+      when /\A\[[a-zA-Z0-9()\._-]+::[a-zA-Z0-9\._-]+\]/
+#      when /\A\[[a-zA-Z0-9()\._-]+\:\:[a-zA-Z0-9\._-]+\]/   #V_QUALIFIED_TERM_CODE_REF form [ICD10AM(1998)::F23]
+        yield :V_QUALIFIED_TERM_CODE_REF, $&
+      when /\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/   #V_LOCAL_TERM_CODE_REF
+        yield :V_LOCAL_TERM_CODE_REF, $&
+      when /\A\[/   # [
+        yield :Left_bracket_code, :Left_bracket_code
+      when /\A\]/   # ]
+        yield :Right_bracket_code, :Right_bracket_code
+
+      when /\A\[[a-zA-Z0-9._\- ]+::[a-zA-Z0-9._\- ]+\]/   #ERR_V_QUALIFIED_TERM_CODE_REF
+        yield :ERR_V_QUALIFIED_TERM_CODE_REF, $&
+      when /\Aa[ct][0-9.]+/   #V_LOCAL_CODE
+        yield :V_LOCAL_CODE, $&
+      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-]-
+        yield :V_ISO8601_EXTENDED_DATE_TIME, $&
+      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]
+        yield :V_ISO8601_EXTENDED_TIME, $&
+      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
+        yield :V_ISO8601_EXTENDED_DATE, $&
+      when /\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/   #V_GENERIC_TYPE_IDENTIFIER
+        yield :V_GENERIC_TYPE_IDENTIFIER, $&
+      when /\A[0-9]+|[0-9]+[eE][+-]?[0-9]+/   #V_INTEGER
+        yield :V_INTEGER, $&
+      when /\A[0-9]+\.[0-9]+|[0-9]+\.[0-9]+[eE][+-]?[0-9]+ /   #V_REAL
+        yield :V_REAL, $&
+        #    when /\A"((?:[^"\\]+|\\.)*)"/ #V_STRING
+      when /\A"([^"]*)"/m #V_STRING
+        yield :V_STRING, $1
+      when /\A[a-z]+:\/\/[^<>|\\{}^~"\[\] ]*/ #V_URI
+        yield :V_URI, $&
+      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
+        yield :V_ISO8601_DURATION, $&
+      when /\A\S/ #UTF8CHAR
+        yield :UTF8CHAR, $&
+      end
+      data = $' # variable $' receives the string after the match
+    when :dadl
+#      puts "Entering scan_dadl"
+      data = scan_dadl(data) do |sym, val|
+        yield sym, val
+      end
+    when :cadl
+#      puts "Entering scan_cadl"
+      data = scan_cadl(data) do |sym, val|
+        yield sym, val
+      end
+    when :regexp
+#      puts "Entering scan_regexp"
+      data = scan_regexp(data) do |sym, val|
+        yield sym, val
+      end
+    when :term_constraint
+#      puts "Entering scan_term_constraint"
+      data = scan_term_constraint(data) do |sym, val|
+        yield sym, val
+      end
+    else
+      raise
+    end
+  end
+end # scan_adl
+
+
+def scan_cadl(data)
+  until data.nil?  do
+    case @adl_type.last
+    when :cadl
+#      puts "Entering scan_cadl"
+      case scanned = @@cadl_scanner.parse(data)
+      when Yaparc::Result::OK
+        if scanned.value[0] == :START_V_C_DOMAIN_TYPE_BLOCK
+          @in_c_domain_type = true
+          @adl_type.push(:dadl)
+          yield scanned.value
+        else
+          yield scanned.value
+        end
+        data = scanned.input
+      end
+
+      case data
+      when /\A\n/ # carriage return
+        @lineno += 1
+        ;
+      when /\A[ \t\r\f]+/ #just drop it
+        ;
+      when /\A--.*\n/ # single line comment
+        @lineno += 1
+        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: COMMENT = #{$&} at #{@filename}:#{@lineno}")
+        ;
+        ###----------/* symbols */ ------------------------------------------------- 
+      when /\A\=/   # =
+        yield :SYM_EQ, :SYM_EQ
+      when /\A\>=/   # >=
+        yield :SYM_GE, :SYM_GE
+      when /\A\<=/   # <=
+        yield :SYM_LE, :SYM_LE
+###       when /\A[A-Z][a-zA-Z0-9_]*[ \n]*\</   # V_C_DOMAIN_TYPE
+###         @in_c_domain_type = true
+###         @adl_type.push(:dadl)
+###         yield :START_V_C_DOMAIN_TYPE_BLOCK, $&
+      when /\A\</   # <
+        if @in_interval
+          yield :SYM_LT, :SYM_LT
+        else
+          @adl_type.push(:dadl)
+          yield :SYM_START_DBLOCK,  $&
+        end
+      when /\A\>/   # >
+        if @in_interval
+          yield :SYM_GT, :SYM_GT
+        else
+          adl_type = @adl_type.pop
+#          puts "Escaping #{adl_type}"
+          assert_at(__FILE__,__LINE__){adl_type == :dadl}
+          yield :SYM_END_DBLOCK, :SYM_END_DBLOCK
+        end
+      when /\A\-/   # -
+        yield :Minus_code, :Minus_code
+      when /\A\+/   # +
+        yield :Plus_code, :Plus_code
+      when /\A\*/   # *
+        yield :Star_code, :Star_code
+      when /\A\//   # /
+        yield :Slash_code, :Slash_code
+      when /\A\^/   # ^
+        yield :Caret_code, :Caret_code
+      when /\A\.\.\./   # ...
+        yield :SYM_LIST_CONTINUE, :SYM_LIST_CONTINUE
+      when /\A\.\./   # ..
+        yield :SYM_ELLIPSIS, :SYM_ELLIPSIS
+      when /\A\./   # .
+        yield :Dot_code, :Dot_code
+      when /\A\;/   # ;
+        yield :Semicolon_code, :Semicolon_code
+      when /\A\,/   # ,
+        yield :Comma_code, :Comma_code
+      when /\A\:/   # :
+        yield :Colon_code, :Colon_code
+      when /\A\!/   # !
+        yield :Exclamation_code, :Exclamation_code
+      when /\A\(/   # (
+        yield :Left_parenthesis_code, :Left_parenthesis_code
+      when /\A\)/   # )
+        yield :Right_parenthesis_code, :Right_parenthesis_code
+      when /\A\{\// #V_REGEXP
+        if @adl_type.last != :regexp
+          @in_regexp = true
+          @adl_type.push(:regexp)
+          yield :START_REGEXP_BLOCK, :START_REGEXP_BLOCK
+        else
+          raise
+        end
+#        yield :V_REGEXP, :V_REGEXP
+      when /\A\{/   # {
+        @adl_type.push(:cadl)
+        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: entering cADL at #{@filename}:#{@lineno}")
+        yield :SYM_START_CBLOCK, :SYM_START_CBLOCK
+      when /\A\}/   # }
+        adl_type = @adl_type.pop
+#        puts "Escaping #{adl_type}"
+        assert_at(__FILE__,__LINE__){adl_type == :cadl}
+        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: exiting cADL at #{@filename}:#{@lineno}")
+        yield :SYM_END_CBLOCK, :SYM_END_CBLOCK
+      when /\A\$/   # $
+        yield :Dollar_code, :Dollar_code
+      when /\A\?\?/   # ??
+        yield :SYM_DT_UNKNOWN, :SYM_DT_UNKNOWN
+      when /\A\?/   # ?
+        yield :Question_mark_code, :Question_mark_code
+      when /\A\|/   # |
+        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: @in_interval = #{@in_interval} at #{@filename}:#{@lineno}")
+        if @in_interval
+          @in_interval = false
+        else
+#          @in_interval = false
+          @in_interval = true
+        end
+        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: SYM_INTERVAL_DELIM at #{@filename}:#{@lineno}")
+        yield :SYM_INTERVAL_DELIM, :SYM_INTERVAL_DELIM
+
+      when /\A\[[a-zA-Z0-9._\-]+::[a-zA-Z0-9._\-]+\]/   #V_QUALIFIED_TERM_CODE_REF form [ICD10AM(1998)::F23]
+        yield :V_QUALIFIED_TERM_CODE_REF, $&
+      when /\A\[[a-zA-Z0-9._\- ]+::[a-zA-Z0-9._\- ]+\]/   #ERR_V_QUALIFIED_TERM_CODE_REF
+        yield :ERR_V_QUALIFIED_TERM_CODE_REF, $&
+      when /\A\[([a-zA-Z0-9()._\-]+::[a-zA-Z0-9._\_-]+)\]/
+        yield :V_TERM_CODE_CONSTRAINT, :V_TERM_CODE_CONSTRAINT
+      when /\A\[[a-zA-Z0-9\(\)\._\-]+::[ \t\n]*/
+        @adl_type.push(:term_constraint)
+        yield :START_TERM_CODE_CONSTRAINT, $&
+      when /\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/   #V_LOCAL_TERM_CODE_REF
+        yield :V_LOCAL_TERM_CODE_REF, $&
+      when /\A\[/   # [
+        yield :Left_bracket_code, :Left_bracket_code
+      when /\A\]/   # ]
+        yield :Right_bracket_code, :Right_bracket_code
+      when /\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/   #V_GENERIC_TYPE_IDENTIFIER
+        yield :V_GENERIC_TYPE_IDENTIFIER, $&
+      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]/
+        yield :V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN, $&
+      when /\A[yY][yY][yY][yY]-[mM?X][mM?X]-[dD?X][dD?X]/
+        yield :V_ISO8601_DATE_CONSTRAINT_PATTERN, $&
+      when /\A[hH][hH]:[mM?X][mM?X]:[sS?X][sS?X]/
+        yield :V_ISO8601_TIME_CONSTRAINT_PATTERN, $&
+      when /\A[a-z][a-zA-Z0-9_]*/
+        word = $&.dup
+        if @@cadl_reserved[word.downcase]
+          yield @@cadl_reserved[word.downcase], @@cadl_reserved[word.downcase]
+        else
+          @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: V_ATTRIBUTE_IDENTIFIER = #{word} at #{@filename}:#{@lineno}")
+          yield :V_ATTRIBUTE_IDENTIFIER, word #V_ATTRIBUTE_IDENTIFIER /\A[a-z][a-zA-Z0-9_]*/
+        end
+      when /\A[A-Z][a-zA-Z0-9_]*/
+        word = $&.dup
+        if @@cadl_reserved[word.downcase]
+          yield @@cadl_reserved[word.downcase], @@cadl_reserved[word.downcase]
+        else
+          yield :V_TYPE_IDENTIFIER, $&
+        end
+      when /\Aa[ct][0-9.]+/   #V_LOCAL_CODE
+        yield :V_LOCAL_CODE, $&
+      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-]-
+        yield :V_ISO8601_EXTENDED_DATE_TIME, $&
+      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]
+        yield :V_ISO8601_EXTENDED_TIME, $&
+      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
+        yield :V_ISO8601_EXTENDED_DATE, $&
+      when /\A[0-9]+|[0-9]+[eE][+-]?[0-9]+/   #V_INTEGER
+        yield :V_INTEGER, $&
+      when /\A[0-9]+\.[0-9]+|[0-9]+\.[0-9]+[eE][+-]?[0-9]+ /   #V_REAL
+        yield :V_REAL, $&
+           when /\A"((?:[^"\\]+|\\.)*)"/ #V_STRING
+      when /\A"([^"]*)"/m #V_STRING
+        yield :V_STRING, $1
+      when /\A[a-z]+:\/\/[^<>|\\{}^~"\[\] ]*/ #V_URI
+        yield :V_URI, $&
+###       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
+###         yield :V_ISO8601_DURATION, $&
+      when /\A\S/ #UTF8CHAR
+        yield :UTF8CHAR, $&
+      else
+        raise
+      end
+      data = $' # variable $' receives the string after the match
+    when :adl
+#      puts "Entering scan_adl"
+      data = scan_adl(data) do |sym, val|
+        yield sym, val
+      end
+    when :dadl
+#      puts "Entering scan_dadl"
+      data = scan_dadl(data) do |sym, val|
+        yield sym, val
+      end
+    when :regexp
+#      puts "Entering scan_regexp"
+      data = scan_regexp(data) do |sym, val|
+        yield sym, val
+      end
+    when :term_constraint
+#      puts "Entering scan_term_constraint"
+      data = scan_term_constraint(data) do |sym, val|
+        yield sym, val
+      end
+    else
+      raise
+    end
+  end # of until
+end # of scan_cadl
+
+def scan_dadl(data)
+  until data.nil?  do
+    case @adl_type.last
+    when :dadl
+#      puts "Entering scan_dadl"
+      case scanned = @@dadl_scanner.parse(data)
+      when Yaparc::Result::OK
+        yield scanned.value
+        data = scanned.input
+      else
+      end
+
+      case data
+      when /\A\n/ # carriage return
+        @lineno += 1
+        ;
+      when /\A[ \t\r\f]+/ #just drop it
+        ;
+      when /\A--.*\n/ # single line comment
+        @lineno += 1
+        @@log.info("#{__FILE__}:#{__LINE__}: scan_dadl: COMMENT = #{$&} at #{@filename}:#{@lineno}")
+        ;
+        ###----------/* symbols */ ------------------------------------------------- 
+      when /\A\=/   # =
+        yield :SYM_EQ, :SYM_EQ
+      when /\A\>\=/   # >=
+        yield :SYM_GE, :SYM_GE
+      when /\A\<\=/   # <=
+        yield :SYM_LE, :SYM_LE
+      when /\A\</   # <
+        if @in_interval
+          yield :SYM_LT, :SYM_LT
+        else
+          @adl_type.push(:dadl)
+          yield :SYM_START_DBLOCK, :SYM_START_DBLOCK
+        end
+      when /\A\>/   # >
+        if @in_interval
+#          @in_interval = false
+          yield :SYM_GT, :SYM_GT
+        elsif @in_c_domain_type == true
+          assert_at(__FILE__,__LINE__){@adl_type.last == :dadl}
+          adl_type = @adl_type.pop
+          if @adl_type.last == :cadl
+            @in_c_domain_type = false
+            yield :END_V_C_DOMAIN_TYPE_BLOCK, $&
+          else
+            yield :SYM_END_DBLOCK, $&
+          end
+        elsif @in_c_domain_type == false
+          adl_type = @adl_type.pop
+#          puts "Escaping #{adl_type}"
+          assert_at(__FILE__,__LINE__){adl_type == :dadl}
+          yield :SYM_END_DBLOCK, $&
+        else
+          raise
+        end
+      when /\A\-/   # -
+        yield :Minus_code, :Minus_code
+      when /\A\+/   # +
+        yield :Plus_code, :Plus_code
+      when /\A\*/   # *
+        yield :Star_code, :Star_code
+      when /\A\//   # /
+        yield :Slash_code, :Slash_code
+      when /\A\^/   # ^
+        yield :Caret_code, :Caret_code
+      when /\A\.\.\./   # ...
+        yield :SYM_LIST_CONTINUE, :SYM_LIST_CONTINUE
+      when /\A\.\./   # ..
+        yield :SYM_ELLIPSIS, :SYM_ELLIPSIS
+      when /\A\./   # .
+        yield :Dot_code, :Dot_code
+      when /\A\;/   # ;
+        yield :Semicolon_code, :Semicolon_code
+      when /\A\,/   # ,
+        yield :Comma_code, :Comma_code
+      when /\A\:/   # :
+        yield :Colon_code, :Colon_code
+      when /\A\!/   # !
+        yield :Exclamation_code, :Exclamation_code
+      when /\A\(/   # (
+        yield :Left_parenthesis_code, :Left_parenthesis_code
+      when /\A\)/   # )
+        yield :Right_parenthesis_code, :Right_parenthesis_code
+      when /\A\$/   # $
+        yield :Dollar_code, :Dollar_code
+      when /\A\?\?/   # ??
+        yield :SYM_DT_UNKNOWN, :SYM_DT_UNKNOWN
+      when /\A\?/   # ?
+        yield :Question_mark_code, :Question_mark_code
+      when /\A\|/   # |
+        @@log.info("#{__FILE__}:#{__LINE__}: scan_dadl: @in_interval = #{@in_interval} at #{@filename}:#{@lineno}")
+        if @in_interval
+          @in_interval = false
+        else
+#          @in_interval = false
+          @in_interval = true
+        end
+        @@log.info("#{__FILE__}:#{__LINE__}: scan_dadl: SYM_INTERVAL_DELIM at #{@filename}:#{@lineno}")
+        yield :SYM_INTERVAL_DELIM, :SYM_INTERVAL_DELIM
+###       when /\A\[[a-zA-Z0-9()\._-]+::[a-zA-Z0-9\._-]+\]/   #V_QUALIFIED_TERM_CODE_REF form [ICD10AM(1998)::F23]
+###         yield :V_QUALIFIED_TERM_CODE_REF, $&
+###       when /\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/   #V_LOCAL_TERM_CODE_REF
+###         yield :V_LOCAL_TERM_CODE_REF, $&
+###       when /\A\[[a-zA-Z0-9._\- ]+::[a-zA-Z0-9._\- ]+\]/   #ERR_V_QUALIFIED_TERM_CODE_REF
+###         yield :ERR_V_QUALIFIED_TERM_CODE_REF, $&
+      when /\A\[/   # [
+        yield :Left_bracket_code, :Left_bracket_code
+      when /\A\]/   # ]
+        yield :Right_bracket_code, :Right_bracket_code
+###       when /\A[A-Z][a-zA-Z0-9_-]*/
+###         yield :V_TYPE_IDENTIFIER, $&
+###       when /\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/   #V_GENERIC_TYPE_IDENTIFIER
+###         yield :V_GENERIC_TYPE_IDENTIFIER, $&
+###       when /\A[a-z][a-zA-Z0-9_]*/
+###         word = $&.downcase
+###         if @@dadl_reserved[word]
+###           yield @@dadl_reserved[word], @@dadl_reserved[word]
+###         else
+###           yield :V_ATTRIBUTE_IDENTIFIER, $&
+###         end
+###       when /\Aa[ct][0-9.]+/   #V_LOCAL_CODE
+###         yield :V_LOCAL_CODE, $&
+      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-]-
+        yield :V_ISO8601_EXTENDED_DATE_TIME, $&
+      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]
+        yield :V_ISO8601_EXTENDED_TIME, $&
+      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
+        yield :V_ISO8601_EXTENDED_DATE, $&
+      when /\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/   #V_GENERIC_TYPE_IDENTIFIER
+        yield :V_GENERIC_TYPE_IDENTIFIER, $&
+      when /\A[0-9]+|[0-9]+[eE][+-]?[0-9]+/   #V_INTEGER
+        yield :V_INTEGER, $&
+###       when /\A[0-9]+\.[0-9]+|[0-9]+\.[0-9]+[eE][+-]?[0-9]+ /   #V_REAL
+###         yield :V_REAL, $&
+        #    when /\A"((?:[^"\\]+|\\.)*)"/ #V_STRING
+###       when /\A"([^"]*)"/m #V_STRING
+###         yield :V_STRING, $1
+      when /\A[a-z]+:\/\/[^<>|\\{}^~"\[\] ]*/ #V_URI
+        yield :V_URI, $&
+###       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
+###         yield :V_ISO8601_DURATION, $&
+      when /\A\S/ #UTF8CHAR
+        yield :UTF8CHAR, $&
+      end
+      data = $' # variable $' receives the string after the match
+    when :adl
+#      puts "Entering scan_adl"
+      data = scan_adl(data) do |sym, val|
+        yield sym, val
+      end
+    when :cadl
+#      puts "Entering scan_cadl"
+      data = scan_cadl(data) do |sym, val|
+        yield sym, val
+      end
+    when :regexp
+#      puts "Entering scan_regexp"
+      data = scan_regexp(data) do |sym, val|
+        yield sym, val
+      end
+    when :term_constraint
+#      puts "Entering scan_term_constraint"
+      data = scan_term_constraint(data) do |sym, val|
+        yield sym, val
+      end
+    else
+      raise
+    end
+  end
+end # of scan_dadl
+
+def scan_regexp(data)
+  until data.nil?  do
+    case @adl_type.last
+    when :regexp
+#      puts "Entering scan_regexp"
+      case data
+      when /\A\/\}/ #V_REGEXP
+        if @adl_type.last == :regexp
+          @in_regexp = false
+          @adl_type.pop
+          yield :END_REGEXP_BLOCK, :END_REGEXP_BLOCK
+        else
+          raise
+        end
+      when /\A(.*)(\/\})/ #V_REGEXP
+        yield :REGEXP_BODY, $1
+        if @adl_type.last == :regexp
+          @in_regexp = false
+          @adl_type.pop
+          yield :END_REGEXP_BLOCK, :END_REGEXP_BLOCK
+        else
+          raise
+        end
+      else
+        raise data
+      end
+      data = $' # variable $' receives the string after the match
+    when :adl
+#      puts "Entering scan_adl"
+      data = scan_adl(data) do |sym, val|
+        yield sym, val
+      end
+    when :dadl
+#      puts "Entering scan_dadl"
+      data = scan_dadl(data) do |sym, val|
+        yield sym, val
+      end
+    when :cadl
+#      puts "Entering scan_cadl"
+      data = scan_cadl(data) do |sym, val|
+        yield sym, val
+      end
+    when :term_constraint
+#      puts "Entering scan_term_constraint"
+      data = scan_term_constraint(data) do |sym, val|
+        yield sym, val
+      end
+    else
+      raise
+    end
+  end
+end # of scan_regexp
+
+def scan_term_constraint(data)
+  until data.nil?  do
+    case @adl_type.last
+    when :term_constraint
+#      puts "Entering scan_term_constraint"
+      case data
+      when /\A\n/ # carriage return
+        @lineno += 1
+        ;
+      when /\A[ \t\r\f]+/ #just drop it
+        ;
+      when /\A--.*$/ # single line comment
+        @lineno += 1
+        @@log.info("#{__FILE__}:#{__LINE__}: scan_term_constraint: COMMENT = #{$&} at #{@filename}:#{@lineno}")
+        ;
+      when /\A[a-zA-Z0-9\._\-]+[ \t]*,/ # match any line, with ',' termination
+        yield :TERM_CODE, $&
+      when /\A[a-zA-Z0-9\._\-]+[ \t]*;/ #match second last line with ';' termination (assumed value)
+        yield :TERM_CODE, $&
+#      when /\A[a-zA-Z0-9\._\-]+[ \t]*\]/ # match final line, terminating in ']'
+      when /\A[a-zA-Z0-9\._\-]*[ \t]*\]/ # match final line, terminating in ']'
+        adl_type = @adl_type.pop
+        assert_at(__FILE__,__LINE__){adl_type == :term_constraint}
+        yield :END_TERM_CODE_CONSTRAINT, $&
+      else
+        raise "data = #{data}"
+      end
+      data = $' # variable $' receives the string after the match
+    when :adl
+#      puts "Entering scan_adl"
+      data = scan_adl(data) do |sym, val|
+        yield sym, val
+      end
+    when :dadl
+#      puts "Entering scan_dadl"
+      data = scan_dadl(data) do |sym, val|
+        yield sym, val
+      end
+    when :cadl
+#      puts "Entering scan_cadl"
+      data = scan_cadl(data) do |sym, val|
+        yield sym, val
+      end
+    else
+      raise
+    end
+  end
+end # of scan_term_constraint
+
+
+def parse(data, filename, lineno = 1, debug = false)
+  @yydebug = true
+  @parsestring = data
+  @data = data
+  @lineno = lineno
+  @filename = filename
+  @adl_type = [:adl] # {:adl, :cadl, :dadl}
+  @in_regexp = false
+  @in_interval = false
+  @in_c_domain_type = false
+  yyparse self, :scan
+end
+
+def on_error( t, v, values)
+  raise Racc::ParseError, "#{@filename}:#{@lineno}: Inline syntax error on #{v.inspect}"
+end
+
+
+
+
+
+
+
+### Local Variables:
+### mode:ruby
+### mode:font-lock
+### comment-column:0
+### comment-start: "### "
+### comment-end:"" 
+### End:
+
+
+
+
Index: ruby/trunk/lib/adl_parser/lib/scanner.rb
===================================================================
--- ruby/trunk/lib/adl_parser/lib/scanner.rb	(revision 49)
+++ ruby/trunk/lib/adl_parser/lib/scanner.rb	(revision 49)
@@ -0,0 +1,326 @@
+require 'rubygems'
+gem 'yaparc'
+require 'yaparc'
+
+
+module OpenEHR
+  module ADL
+    module Scanner
+      module Common
+        class V_QUALIFIED_TERM_CODE_REF
+          include Yaparc::Parsable
+          def initialize
+            @parser = lambda do |input|
+              Yaparc::Apply.new(Yaparc::Regex.new(/\A\[[a-zA-Z0-9()\._-]+::[a-zA-Z0-9\._-]+\]/)) do |match|
+                OpenEHR::LOG.debug("V_QUALIFIED_TERM_CODE_REF: #{match}")
+                [:V_QUALIFIED_TERM_CODE_REF, match]
+              end
+            end
+          end
+        end
+        
+        class V_LOCAL_TERM_CODE_REF
+          include Yaparc::Parsable
+          def initialize
+            @parser = lambda do |input|
+              Yaparc::Apply.new(Yaparc::Regex.new(/\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/)) do |match|
+                OpenEHR::LOG.debug("V_TERM_CODE_REF: #{match}")
+                [:V_LOCAL_TERM_CODE_REF, match]
+              end
+            end
+          end
+        end
+
+        class ERR_V_QUALIFIED_TERM_CODE_REF
+          include Yaparc::Parsable
+          def initialize
+            @parser = lambda do |input|
+              Yaparc::Apply.new(Yaparc::Regex.new(/\A\[[a-zA-Z0-9._\- ]+::[a-zA-Z0-9._\- ]+\]/)) do |match|
+                OpenEHR::LOG.debug("ERR_V_QUALIFIED_TERM_CODE_REF: #{match}")
+                [:ERR_V_QUALIFIED_TERM_CODE_REF, match]
+              end
+            end
+          end
+        end
+
+        class V_TYPE_IDENTIFIER
+          include Yaparc::Parsable
+          def initialize
+            @parser = lambda do |input|
+              Yaparc::Apply.new(Yaparc::Regex.new(/\A[A-Z][a-zA-Z0-9_]*/)) do |match|
+                OpenEHR::LOG.debug("V_TYPE_IDENTIFIER: #{match}")
+                [:V_TYPE_IDENTIFIER, match]
+              end
+            end
+          end
+        end
+
+        class V_GENERIC_TYPE_IDENTIFIER
+          include Yaparc::Parsable
+          def initialize
+            @parser = lambda do |input|
+              Yaparc::Apply.new(Yaparc::Regex.new(/\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/)) do |match|
+                OpenEHR::LOG.debug("V_GENERIC_TYPE_IDENTIFIER: #{match}")
+                [:V_GENERIC_TYPE_IDENTIFIER, match]
+              end
+            end
+          end
+        end
+
+
+        class V_LOCAL_CODE
+          include Yaparc::Parsable
+          def initialize
+            @parser = lambda do |input|
+              Yaparc::Apply.new(Yaparc::Regex.new(/\Aa[ct][0-9.]+/)) do |match|
+                OpenEHR::LOG.debug("V_LOCAL_CODE: #{match}")
+                [:V_LOCAL_CODE, match]
+              end
+            end
+          end
+        end
+
+        class V_STRING
+          include Yaparc::Parsable
+          def initialize
+            @parser = lambda do |input|
+              Yaparc::Apply.new(Yaparc::Regex.new(/\A"([^"]*)"/m)) do |match|
+                OpenEHR::LOG.debug("V_STRING: #{match}")
+                [:V_STRING, match]
+              end
+            end
+          end
+        end
+
+        class V_REAL
+          include Yaparc::Parsable
+          def initialize
+            @parser = lambda do |input|
+              Yaparc::Apply.new(Yaparc::Regex.new(/\A[0-9]+\.[0-9]+|[0-9]+\.[0-9]+[eE][+-]?[0-9]+/)) do |match|
+                OpenEHR::LOG.debug("V_REAL: #{match}")
+                [:V_REAL, match]
+              end
+            end
+          end
+        end
+
+        #V_ISO8601_DURATION PnYnMnWnDTnnHnnMnnS
+        class V_ISO8601_DURATION
+          include Yaparc::Parsable
+          def initialize
+            @parser = lambda do |input|
+              Yaparc::Apply.new(
+                                Yaparc::Alt.new(Yaparc::Regex.new(/\AP([0-9]+|[yY])?([0-9]+|[mM])?([0-9]+|[wW])?([0-9]+|[dD])?T([0-9]+|[hH])?([0-9]+|[mM])?([0-9]+|[sS])?/),
+                                                Yaparc::Regex.new(/\AP([0-9]+|[yY])?([0-9]+|[mM])?([0-9]+|[wW])?([0-9]+|[dD])?/))) do |match|
+                OpenEHR::LOG.debug("V_ISO8601_DURATION: #{match}")
+                [:V_ISO8601_DURATION, match]
+              end
+            end
+          end
+        end
+
+      end # of Common
+
+      module DADL
+        # c.f. http://www.openehr.org/svn/ref_impl_eiffel/TRUNK/components/adl_parser/src/syntax/adl/parser/adl_scanner.l
+        RESERVED = {
+          'true' => :SYM_TRUE, #[Tt][Rr][Uu][Ee] -- -> SYM_TRUE 
+          'false' => :SYM_FALSE, # [Ff][Aa][Ll][Ss][Ee] -- -> SYM_FALSE 
+          'infinity' => :SYM_INFINITY # [Ii][Nn][Ff][Ii][Nn][Ii][Tt][Yy] -- -> SYM_INFINITY 
+        }
+
+        class RootScanner
+          include Yaparc::Parsable
+          def initialize
+            @parser = lambda do |input|
+              Yaparc::Alt.new(Reserved.new,
+                              OpenEHR::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF.new,
+                              OpenEHR::ADL::Scanner::Common::V_LOCAL_TERM_CODE_REF.new,
+                              OpenEHR::ADL::Scanner::Common::ERR_V_QUALIFIED_TERM_CODE_REF.new,
+                              OpenEHR::ADL::Scanner::Common::V_TYPE_IDENTIFIER.new,
+                              OpenEHR::ADL::Scanner::Common::V_GENERIC_TYPE_IDENTIFIER.new,
+                              OpenEHR::ADL::Scanner::Common::V_STRING.new,
+                              OpenEHR::ADL::Scanner::Common::V_LOCAL_CODE.new,
+                              OpenEHR::ADL::Scanner::Common::V_REAL.new,
+                              OpenEHR::ADL::Scanner::Common::V_ISO8601_DURATION.new
+                              )
+            end
+          end
+        end
+=begin <DADL::Reserved class>
+=end
+        class Reserved
+          include Yaparc::Parsable
+          
+          def initialize
+            @parser = lambda do |input|
+              reserved_parsers = OpenEHR::ADL::Scanner::DADL::RESERVED.map do |keyword| 
+                Yaparc::Tokenize.new(
+                                     Yaparc::Literal.new(keyword[0],false)
+                                     )
+              end
+              Yaparc::Alt.new(Yaparc::Apply.new(Yaparc::Alt.new(*reserved_parsers)) do |match|
+                                OpenEHR::LOG.debug("Reserved: #{match}")
+                                [OpenEHR::ADL::Scanner::DADL::RESERVED[match], OpenEHR::ADL::Scanner::DADL::RESERVED[match]]
+                              end,
+                              Yaparc::Apply.new(Yaparc::Regex.new(/\A[a-z][a-zA-Z0-9_]*/)) do |match|
+                                OpenEHR::LOG.debug("V_ATTRIBUTE_IDENTIFIER: #{match}")
+                                [:V_ATTRIBUTE_IDENTIFIER, match]
+                              end)
+            end
+          end
+        end
+
+
+
+      end # of DADL
+
+      module CADL
+        # c.f. http://www.openehr.org/svn/ref_impl_eiffel/TRUNK/components/adl_parser/src/syntax/cadl/parser/cadl_scanner.l
+        RESERVED = {
+          'ordered' => :SYM_ORDERED, # [Oo][Rr][Dd][Ee][Rr][Ee][Dd]
+          'unordered' => :SYM_UNORDERED, # [Uu][Nn][Oo][Rr][Dd][Ee][Rr][Ee][Dd]
+          'then' => :SYM_THEN, # [Tt][Hh][Ee][Nn]
+          'else' => :SYM_ELSE, # [Ee][Ll][Ss][Ee]
+          'and' => :SYM_AND, # [Aa][Nn][Dd]
+          'or' => :SYM_OR, # [Oo][Rr]
+          'xor' => :SYM_XOR, # [Xx][Oo][Rr]
+          'not' => :SYM_NOT, # [Nn][Oo][Tt]
+          'implies' => :SYM_IMPLIES, # [Ii][Mm][Pp][Ll][Ii][Ee][Ss]
+          'true' => :SYM_TRUE, #[Tt][Rr][Uu][Ee] -- -> SYM_TRUE 
+          'false' => :SYM_FALSE, # [Ff][Aa][Ll][Ss][Ee] -- -> SYM_FALSE 
+          'forall' => :SYM_FORALL, # [Ff][Oo][Rr][_][Aa][Ll][Ll]
+          'exists' => :SYM_EXISTS, # [Ee][Xx][Ii][Ss][Tt][Ss]
+          'existence' => :SYM_EXISTENCE, # [Ee][Xx][Iu][Ss][Tt][Ee][Nn][Cc][Ee]
+          'occurrences' => :SYM_OCCURRENCES, # [Oo][Cc][Cc][Uu][Rr][Rr][Ee][Nn][Cc][Ee][Ss]
+          'cardinality' => :SYM_CARDINALITY, # [Cc][Aa][Rr][Dd][Ii][Nn][Aa][Ll][Ii][Tt][Yy]
+          'unique' => :SYM_UNIQUE, # [Uu][Nn][Ii][Qq][Uu][Ee]
+          'matches' => :SYM_MATCHES, # [Mm][Aa][Tt][Cc][Hh][Ee][Ss]
+          'is_in' => :SYM_MATCHES, # [Ii][Ss][_][Ii][Nn]
+          'invariant' => :SYM_INVARIANT, # [Ii][Nn][Vv][Aa][Rr][Ii][Aa][Nn][Tt]
+          'infinity' => :SYM_INFINITY, # [Ii][Nn][Ff][Ii][Nn][Ii][Tt][Yy] -- -> SYM_INFINITY 
+          'use_node' => :SYM_USE_NODE, # [Uu][Ss][Ee][_][Nn][Oo][Dd][Ee]
+          'use_archetype' => :SYM_ALLOW_ARCHETYPE, # [Uu][Ss][Ee][_][Aa][Rr][Cc][Hh][Ee][Tt][Yy][Pp][Ee]
+          'allow_archetype' => :SYM_ALLOW_ARCHETYPE, # [Aa][Ll][Ll][Oo][Ww][_][Aa][Rr][Cc][Hh][Ee][Tt][Yy][Pp][Ee]
+          'include' => :SYM_INCLUDE, # [Ii][Nn][Cc][Ll][Uu][Dd][Ee]
+          'exclude' => :SYM_EXCLUDE # [Ee][Xx][Cc][Ll][Uu][Dd][Ee]
+        }
+
+        #V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN, /\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]/
+        class V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN
+          include Yaparc::Parsable
+          def initialize
+            @parser = lambda do |input|
+              Yaparc::Apply.new(Yaparc::Regex.new(/\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]/)) do |match|
+                OpenEHR::LOG.debug("V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN: #{match}")
+                [:V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN, match]
+              end
+            end
+          end
+        end
+
+        #V_ISO8601_DATE_CONSTRAINT_PATTERN  /\A[yY][yY][yY][yY]-[mM?X][mM?X]-[dD?X][dD?X]/
+        class V_ISO8601_DATE_CONSTRAINT_PATTERN
+          include Yaparc::Parsable
+          def initialize
+            @parser = lambda do |input|
+              Yaparc::Apply.new(Yaparc::Regex.new(/\A[yY][yY][yY][yY]-[mM?X][mM?X]-[dD?X][dD?X]/)) do |match|
+                OpenEHR::LOG.debug("V_ISO8601_DATE_CONSTRAINT_PATTERN: #{match}")
+                [:V_ISO8601_DATE_CONSTRAINT_PATTERN, match]
+              end
+            end
+          end
+        end
+
+        #V_ISO8601_TIME_CONSTRAINT_PATTERN /\A[hH][hH]:[mM?X][mM?X]:[sS?X][sS?X]/
+        class V_ISO8601_TIME_CONSTRAINT_PATTERN
+          include Yaparc::Parsable
+          def initialize
+            @parser = lambda do |input|
+              Yaparc::Apply.new(Yaparc::Regex.new(/\A[hH][hH]:[mM?X][mM?X]:[sS?X][sS?X]/)) do |match|
+                OpenEHR::LOG.debug("V_ISO8601_TIME_CONSTRAINT_PATTERN: #{match}")
+                [:V_ISO8601_TIME_CONSTRAINT_PATTERN, match]
+              end
+            end
+          end
+        end
+
+        #V_ISO8601_DURATION_CONSTRAINT_PATTERN 
+        class V_ISO8601_DURATION_CONSTRAINT_PATTERN
+          include Yaparc::Parsable
+          def initialize
+            @parser = lambda do |input|
+              Yaparc::Apply.new(Yaparc::Alt.new(Yaparc::Regex.new(/\AP[yY]?[mM]?[wW]?[dD]?T[hH]?[mM]?[sS]?/),
+                                                Yaparc::Regex.new(/\AP[yY]?[mM]?[wW]?[dD]?/))) do |match|
+                OpenEHR::LOG.debug("V_ISO8601_DURATION_CONSTRAINT_PATTERN: #{match}")
+                [:V_ISO8601_DURATION_CONSTRAINT_PATTERN, match]
+              end
+            end
+          end
+        end
+
+        #V_C_DOMAIN_TYPE /\A[A-Z][a-zA-Z0-9_]*[ \n]*\</
+        class V_C_DOMAIN_TYPE
+          include Yaparc::Parsable
+          def initialize
+            @parser = lambda do |input|
+              Yaparc::Apply.new(Yaparc::Regex.new(/\A[A-Z][a-zA-Z0-9_]*[ \n]*\</)) do |match|
+                OpenEHR::LOG.debug("V_C_DOMAIN_TYPE: #{match}")
+                [:START_V_C_DOMAIN_TYPE_BLOCK, match]
+              end
+            end
+          end
+        end
+
+        class RootScanner
+          include Yaparc::Parsable
+          def initialize
+            @parser = lambda do |input|
+              Yaparc::Alt.new(V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN.new,
+                              V_ISO8601_DATE_CONSTRAINT_PATTERN.new,
+                              V_ISO8601_TIME_CONSTRAINT_PATTERN.new,
+                              OpenEHR::ADL::Scanner::Common::V_ISO8601_DURATION.new,
+                              V_C_DOMAIN_TYPE.new,
+                              V_ISO8601_DURATION_CONSTRAINT_PATTERN.new,
+                              Reserved.new,
+                              OpenEHR::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF.new,
+                              OpenEHR::ADL::Scanner::Common::V_LOCAL_TERM_CODE_REF.new,
+                              OpenEHR::ADL::Scanner::Common::ERR_V_QUALIFIED_TERM_CODE_REF.new,
+                              OpenEHR::ADL::Scanner::Common::V_TYPE_IDENTIFIER.new,
+                              OpenEHR::ADL::Scanner::Common::V_GENERIC_TYPE_IDENTIFIER.new,
+                              OpenEHR::ADL::Scanner::Common::V_STRING.new,
+                              OpenEHR::ADL::Scanner::Common::V_LOCAL_CODE.new,
+                              OpenEHR::ADL::Scanner::Common::V_REAL.new,
+                              OpenEHR::ADL::Scanner::Common::V_ISO8601_DURATION.new
+                              )
+            end
+          end
+        end
+
+=begin <CADL::Reserved class>
+=end
+        class Reserved
+          include Yaparc::Parsable
+          
+          def initialize
+            @parser = lambda do |input|
+              orderd_reserved = RESERVED.keys.sort{|x,y| y.length <=> x.length  }
+              reserved_parsers = orderd_reserved.map do |keyword| 
+                Yaparc::Literal.new(keyword,false)
+              end
+              Yaparc::Alt.new(Yaparc::Apply.new(Yaparc::Alt.new(*reserved_parsers)) do |match|
+                                OpenEHR::LOG.debug("Reserved: #{match}")
+                                [OpenEHR::ADL::Scanner::CADL::RESERVED[match], OpenEHR::ADL::Scanner::CADL::RESERVED[match]]
+                              end,
+                              Yaparc::Apply.new(Yaparc::Regex.new(/\A[a-z][a-zA-Z0-9_]*/)) do |match|
+                                OpenEHR::LOG.debug("V_ATTRIBUTE_IDENTIFIER: #{match}")
+                                [:V_ATTRIBUTE_IDENTIFIER, match]
+                              end)
+            end
+          end
+        end
+
+      end
+    end
+  end
+end
Index: ruby/trunk/lib/adl_parser/lib/shell.rb
===================================================================
--- ruby/trunk/lib/adl_parser/lib/shell.rb	(revision 49)
+++ ruby/trunk/lib/adl_parser/lib/shell.rb	(revision 49)
@@ -0,0 +1,35 @@
+$:.unshift File.join(File.dirname(__FILE__))
+require 'validator.rb'
+require 'stringio'
+
+module OpenEHR
+  module Application
+    class Shell
+      def run
+        raise 'not implemented'
+      end
+    end
+
+    class ADLValidator < Shell
+      def initialize(validator)
+        @validator = validator
+      end
+
+      def run(input, name = nil)
+        input_stream = case input
+                       when String
+                         StringIO.new(input)
+                       when File
+                         input
+                       when StringIO
+                         input
+                       else
+                         raise
+                       end
+        @validator.validate(input_stream.read, name)
+        input_stream.close
+      end
+    end
+  end
+end
+
Index: ruby/trunk/lib/adl_parser/lib/util.rb
===================================================================
--- ruby/trunk/lib/adl_parser/lib/util.rb	(revision 49)
+++ ruby/trunk/lib/adl_parser/lib/util.rb	(revision 49)
@@ -0,0 +1,6 @@
+
+def assert_at(file,line, message = "")
+  unless yield
+    raise "Assertion failed !: #{file}, #{line}: #{message}"
+  end
+end
Index: ruby/trunk/lib/adl_parser/lib/validator.rb
===================================================================
--- ruby/trunk/lib/adl_parser/lib/validator.rb	(revision 49)
+++ ruby/trunk/lib/adl_parser/lib/validator.rb	(revision 49)
@@ -0,0 +1,20 @@
+$:.unshift File.join(File.dirname(__FILE__))
+require 'parser.rb'
+
+
+module OpenEHR
+  module ADL
+
+    class Validator
+      def initialize(parser)
+        @parser = parser
+      end
+
+      def validate(input_string, name = nil)
+        @parser.parse(input_string, name)
+      end
+    end
+
+  end
+end
+
Index: ruby/trunk/lib/adl_parser/parser.rb
===================================================================
--- ruby/trunk/lib/adl_parser/parser.rb	(revision 48)
+++ 	(revision )
@@ -1,3595 +1,0 @@
-#
-# DO NOT MODIFY!!!!
-# This file is automatically generated by racc 1.4.5
-# from racc grammer file "parser.y".
-#
-
-require 'racc/parser'
-
-
-
-$:.unshift File.join(File.dirname(__FILE__))
-require 'logger'
-require 'util.rb'
-require 'scanner.rb'
-require 'rubygems'
-require '../models/am.rb'
-$DEBUG = true
-
-
-
-
-module OpenEHR
-
-  module ADL
-
-    class Parser < Racc::Parser
-
-module_eval <<'..end lib/parser.y modeval..idf8b8df4140', 'lib/parser.y', 1175
-
-def assert_at(file,line, message = "")
-  unless yield
-    raise "Assertion failed !: #{file}, #{line}: #{message}"
-  end
-end
-
-@@log = Logger.new('log/parser.log','daily')
-@@dadl_scanner = OpenEHR::ADL::Scanner::DADL::RootScanner.new
-@@cadl_scanner = OpenEHR::ADL::Scanner::CADL::RootScanner.new
-
-###----------/* keywords */ --------------------------------------------- 
-@@adl_reserved = {
-    'archetype' => :SYM_ARCHETYPE,
-    'adl_version' => :SYM_ADL_VERSION,
-    'controlled' => :SYM_IS_CONTROLLED,
-    'specialize' => :SYM_SPECIALIZE,
-    'concept' => :SYM_CONCEPT,
-    'language' => :SYM_LANGUAGE,
-    'description' => :SYM_DESCRIPTION,
-    'definition' => :SYM_DEFINITION,
-    'invariant' => :SYM_INVARIANT,
-    'ontology' => :SYM_ONTOLOGY,
-    'matches' => :SYM_MATCHES,
-    'is_in' => :SYM_MATCHES,
-    'occurrences' => :SYM_OCCURRENCES,
-    'true' => :SYM_TRUE, #[Tt][Rr][Uu][Ee] -- -> SYM_TRUE 
-    'false' => :SYM_FALSE, # [Ff][Aa][Ll][Ss][Ee] -- -> SYM_FALSE 
-    'infinity' => :SYM_INFINITY # [Ii][Nn][Ff][Ii][Nn][Ii][Tt][Yy] -- -> SYM_INFINITY 
-}
-
-@@dadl_reserved = {
-  'true' => :SYM_TRUE, #[Tt][Rr][Uu][Ee] -- -> SYM_TRUE 
-  'false' => :SYM_FALSE, # [Ff][Aa][Ll][Ss][Ee] -- -> SYM_FALSE 
-  'infinity' => :SYM_INFINITY # [Ii][Nn][Ff][Ii][Nn][Ii][Tt][Yy] -- -> SYM_INFINITY 
-}
-
-@@cadl_reserved = {
-  'then' => :SYM_THEN, # [Tt][Hh][Ee][Nn]
-  'else' => :SYM_ELSE, # [Ee][Ll][Ss][Ee]
-  'and' => :SYM_AND, # [Aa][Nn][Dd]
-  'or' => :SYM_OR, # [Oo][Rr]
-  'xor' => :SYM_XOR, # [Xx][Oo][Rr]
-  'not' => :SYM_NOT, # [Nn][Oo][Tt]
-  'implies' => :SYM_IMPLIES, # [Ii][Mm][Pp][Ll][Ii][Ee][Ss]
-  'true' => :SYM_TRUE, #[Tt][Rr][Uu][Ee] -- -> SYM_TRUE 
-  'false' => :SYM_FALSE, # [Ff][Aa][Ll][Ss][Ee] -- -> SYM_FALSE 
-  'forall' => :SYM_FORALL, # [Ff][Oo][Rr][_][Aa][Ll][Ll]
-  'exists' => :SYM_EXISTS, # [Ee][Xx][Ii][Ss][Tt][Ss]
-  'existence' => :SYM_EXISTENCE, # [Ee][Xx][Iu][Ss][Tt][Ee][Nn][Cc][Ee]
-  'occurrences' => :SYM_OCCURRENCES, # [Oo][Cc][Cc][Uu][Rr][Rr][Ee][Nn][Cc][Ee][Ss]
-  'cardinality' => :SYM_CARDINALITY, # [Cc][Aa][Rr][Dd][Ii][Nn][Aa][Ll][Ii][Tt][Yy]
-  'ordered' => :SYM_ORDERED, # [Oo][Rr][Dd][Ee][Rr][Ee][Dd]
-  'unordered' => :SYM_UNORDERED, # [Uu][Nn][Oo][Rr][Dd][Ee][Rr][Ee][Dd]
-  'unique' => :SYM_UNIQUE, # [Uu][Nn][Ii][Qq][Uu][Ee]
-  'matches' => :SYM_MATCHES, # [Mm][Aa][Tt][Cc][Hh][Ee][Ss]
-  'is_in' => :SYM_MATCHES, # [Ii][Ss][_][Ii][Nn]
-  'invariant' => :SYM_INVARIANT, # [Ii][Nn][Vv][Aa][Rr][Ii][Aa][Nn][Tt]
-  'infinity' => :SYM_INFINITY, # [Ii][Nn][Ff][Ii][Nn][Ii][Tt][Yy] -- -> SYM_INFINITY 
-  'use_node' => :SYM_USE_NODE, # [Uu][Ss][Ee][_][Nn][Oo][Dd][Ee]
-  'use_archetype' => :SYM_ALLOW_ARCHETYPE, # [Uu][Ss][Ee][_][Aa][Rr][Cc][Hh][Ee][Tt][Yy][Pp][Ee]
-  'allow_archetype' => :SYM_ALLOW_ARCHETYPE, # [Aa][Ll][Ll][Oo][Ww][_][Aa][Rr][Cc][Hh][Ee][Tt][Yy][Pp][Ee]
-  'include' => :SYM_INCLUDE, # [Ii][Nn][Cc][Ll][Uu][Dd][Ee]
-  'exclude' => :SYM_EXCLUDE # [Ee][Xx][Cc][Ll][Uu][Dd][Ee]
-}
-
-
-###----------/* Scanner */ ----------------------------------------------- 
-
-def scan
-  until @data.nil?  do
-    case @adl_type.last
-    when :adl
-      @data = scan_adl(@data) do |sym, val|
-        yield sym, val
-      end
-    when :dadl
-      @data = scan_dadl(@data) do |sym, val|
-        yield sym, val
-      end
-    when :cadl
-      @data = scan_cadl(@data) do |sym, val|
-        yield sym, val
-      end
-    when :regexp
-      @data = scan_regexp(@data) do |sym, val|
-        yield sym, val
-      end
-    else
-      raise
-    end
-    @data = $' # variable $' receives the string after the match
-  end
-  yield :EOF, nil
-  yield false, '$'
-end # of scan
-
-def scan_adl(data)
-  until data.nil?  do
-    case @adl_type.last
-    when :adl
-#      puts "Entering scan_adl"
-      case data
-      when /\A\n/ # carriage return
-        @lineno += 1
-        ;
-      when /\A[ \t\r\f]+/ #just drop it
-        ;
-      when /\A--.*\n/ # single line comment
-        @lineno += 1
-        @@log.info("#{__FILE__}:#{__LINE__}: scan_adl: COMMENT = #{$&} at #{@filename}:#{@lineno}")
-        ;
-      when /\Adescription/   # description
-        yield :SYM_DESCRIPTION, :SYM_DESCRIPTION
-      when /\Adefinition/   # definition
-        yield :SYM_DEFINITION, :SYM_DEFINITION
-#        @adl_type.push(:cadl)
-        ###----------/* symbols */ ------------------------------------------------- 
-      when /\A[A-Z][a-zA-Z0-9_]*/
-        yield :V_TYPE_IDENTIFIER, $&
-      when /\A[a-zA-Z][a-zA-Z0-9_-]+\.[a-zA-Z][a-zA-Z0-9_-]+\.[a-zA-Z0-9]+/   #V_ARCHETYPE_ID
-        yield :V_ARCHETYPE_ID, $&
-      when /\A[a-z][a-zA-Z0-9_]*/
-#        word = $&.downcase
-        word = $&
-        if @@adl_reserved[word]
-          @@log.info("#{__FILE__}:#{__LINE__}: scan_adl: @@adl_reserved = #{@@adl_reserved[word]} at #{@filename}:#{@lineno}")
-          yield @@adl_reserved[word], @@adl_reserved[word]
-        elsif #/\A[A-Z][a-zA-Z0-9_]*/
-          @@log.info("#{__FILE__}:#{__LINE__}: scan_adl: V_ATTRIBUTE_IDENTIFIER = #{$&} at #{@filename}:#{@lineno}")
-          yield :V_ATTRIBUTE_IDENTIFIER, $&
-        end
-      when /\A\=/   # =
-        yield :SYM_EQ, :SYM_EQ
-      when /\A\>=/   # >=
-        yield :SYM_GE, :SYM_GE
-      when /\A\<=/   # <=
-        yield :SYM_LE, :SYM_LE
-      when /\A\</   # <
-        if @in_interval
-#          @start_block_received = false
-          yield :SYM_LT, :SYM_LT
-        else
-#          @start_block_received = true
-          @adl_type.push(:dadl)
-          yield :SYM_START_DBLOCK,  $&
-        end
-      when /\A\>/   # >
-        if @in_interval
-          yield :SYM_GT, :SYM_GT
-        else
-          adl_type = @adl_type.pop
-#          puts "Escaping #{adl_type}"
-          assert_at(__FILE__,__LINE__){adl_type == :dadl}
-          yield :SYM_END_DBLOCK, :SYM_END_DBLOCK
-        end
-      when /\A\{/   # {
-        @adl_type.push(:cadl)
-        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: entering cADL at #{@filename}:#{@lineno}")
-        yield :SYM_START_CBLOCK, :SYM_START_CBLOCK
-      when /\A\}/   # }
-        adl_type = @adl_type.pop
-#        puts "Escaping #{adl_type}"
-        assert_at(__FILE__,__LINE__){adl_type == :cadl}
-        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: exiting cADL at #{@filename}:#{@lineno}")
-        yield :SYM_END_CBLOCK, $&
-      when /\A\-/   # -
-        yield :Minus_code, :Minus_code
-      when /\A\+/   # +
-        yield :Plus_code, :Plus_code
-      when /\A\*/   # *
-        yield :Star_code, :Star_code
-      when /\A\//   # /
-        yield :Slash_code, :Slash_code
-      when /\A\^/   # ^
-        yield :Caret_code, :Caret_code
-      when /\A\=/   # =
-        yield :Equal_code, :Equal_code
-      when /\A\.\.\./   # ...
-        yield :SYM_LIST_CONTINUE, :SYM_LIST_CONTINUE
-      when /\A\.\./   # ..
-        yield :SYM_ELLIPSIS, :SYM_ELLIPSIS
-      when /\A\./   # .
-        yield :Dot_code, :Dot_code
-      when /\A\;/   # ;
-        yield :Semicolon_code, :Semicolon_code
-      when /\A\,/   # ,
-        yield :Comma_code, :Comma_code
-      when /\A\:/   # :
-        yield :Colon_code, :Colon_code
-      when /\A\!/   # !
-        yield :Exclamation_code, :Exclamation_code
-      when /\A\(/   # (
-        yield :Left_parenthesis_code, :Left_parenthesis_code
-      when /\A\)/   # )
-        yield :Right_parenthesis_code, :Right_parenthesis_code
-      when /\A\$/   # $
-        yield :Dollar_code, :Dollar_code
-      when /\A\?\?/   # ??
-        yield :SYM_DT_UNKNOWN, :SYM_DT_UNKNOWN
-      when /\A\?/   # ?
-        yield :Question_mark_code, :Question_mark_code
-      when /\A[0-9]+\.[0-9]+(\.[0-9]+)*/   # ?
-        yield :V_VERSION_STRING, :V_VERSION_STRING
-      when /\A\|/   # |
-        if @in_interval
-          @in_interval = false
-        else
-          @in_interval = true
-        end
-        yield :SYM_INTERVAL_DELIM, :SYM_INTERVAL_DELIM
-      when /\A\[[a-zA-Z0-9()\._-]+::[a-zA-Z0-9\._-]+\]/
-#      when /\A\[[a-zA-Z0-9()\._-]+\:\:[a-zA-Z0-9\._-]+\]/   #V_QUALIFIED_TERM_CODE_REF form [ICD10AM(1998)::F23]
-        yield :V_QUALIFIED_TERM_CODE_REF, $&
-      when /\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/   #V_LOCAL_TERM_CODE_REF
-        yield :V_LOCAL_TERM_CODE_REF, $&
-      when /\A\[/   # [
-        yield :Left_bracket_code, :Left_bracket_code
-      when /\A\]/   # ]
-        yield :Right_bracket_code, :Right_bracket_code
-
-      when /\A\[[a-zA-Z0-9._\- ]+::[a-zA-Z0-9._\- ]+\]/   #ERR_V_QUALIFIED_TERM_CODE_REF
-        yield :ERR_V_QUALIFIED_TERM_CODE_REF, $&
-      when /\Aa[ct][0-9.]+/   #V_LOCAL_CODE
-        yield :V_LOCAL_CODE, $&
-      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-]-
-        yield :V_ISO8601_EXTENDED_DATE_TIME, $&
-      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]
-        yield :V_ISO8601_EXTENDED_TIME, $&
-      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
-        yield :V_ISO8601_EXTENDED_DATE, $&
-      when /\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/   #V_GENERIC_TYPE_IDENTIFIER
-        yield :V_GENERIC_TYPE_IDENTIFIER, $&
-      when /\A[0-9]+|[0-9]+[eE][+-]?[0-9]+/   #V_INTEGER
-        yield :V_INTEGER, $&
-      when /\A[0-9]+\.[0-9]+|[0-9]+\.[0-9]+[eE][+-]?[0-9]+ /   #V_REAL
-        yield :V_REAL, $&
-        #    when /\A"((?:[^"\\]+|\\.)*)"/ #V_STRING
-      when /\A"([^"]*)"/m #V_STRING
-        yield :V_STRING, $1
-      when /\A[a-z]+:\/\/[^<>|\\{}^~"\[\] ]*/ #V_URI
-        yield :V_URI, $&
-      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
-        yield :V_ISO8601_DURATION, $&
-      when /\A\S/ #UTF8CHAR
-        yield :UTF8CHAR, $&
-      end
-      data = $' # variable $' receives the string after the match
-    when :dadl
-#      puts "Entering scan_dadl"
-      data = scan_dadl(data) do |sym, val|
-        yield sym, val
-      end
-    when :cadl
-#      puts "Entering scan_cadl"
-      data = scan_cadl(data) do |sym, val|
-        yield sym, val
-      end
-    when :regexp
-#      puts "Entering scan_regexp"
-      data = scan_regexp(data) do |sym, val|
-        yield sym, val
-      end
-    when :term_constraint
-#      puts "Entering scan_term_constraint"
-      data = scan_term_constraint(data) do |sym, val|
-        yield sym, val
-      end
-    else
-      raise
-    end
-  end
-end # scan_adl
-
-
-def scan_cadl(data)
-  until data.nil?  do
-    case @adl_type.last
-    when :cadl
-#      puts "Entering scan_cadl"
-      case scanned = @@cadl_scanner.parse(data)
-      when Yaparc::Result::OK
-        if scanned.value[0] == :START_V_C_DOMAIN_TYPE_BLOCK
-          @in_c_domain_type = true
-          @adl_type.push(:dadl)
-          yield scanned.value
-        else
-          yield scanned.value
-        end
-        data = scanned.input
-      end
-
-      case data
-      when /\A\n/ # carriage return
-        @lineno += 1
-        ;
-      when /\A[ \t\r\f]+/ #just drop it
-        ;
-      when /\A--.*\n/ # single line comment
-        @lineno += 1
-        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: COMMENT = #{$&} at #{@filename}:#{@lineno}")
-        ;
-        ###----------/* symbols */ ------------------------------------------------- 
-      when /\A\=/   # =
-        yield :SYM_EQ, :SYM_EQ
-      when /\A\>=/   # >=
-        yield :SYM_GE, :SYM_GE
-      when /\A\<=/   # <=
-        yield :SYM_LE, :SYM_LE
-###       when /\A[A-Z][a-zA-Z0-9_]*[ \n]*\</   # V_C_DOMAIN_TYPE
-###         @in_c_domain_type = true
-###         @adl_type.push(:dadl)
-###         yield :START_V_C_DOMAIN_TYPE_BLOCK, $&
-      when /\A\</   # <
-        if @in_interval
-          yield :SYM_LT, :SYM_LT
-        else
-          @adl_type.push(:dadl)
-          yield :SYM_START_DBLOCK,  $&
-        end
-      when /\A\>/   # >
-        if @in_interval
-          yield :SYM_GT, :SYM_GT
-        else
-          adl_type = @adl_type.pop
-#          puts "Escaping #{adl_type}"
-          assert_at(__FILE__,__LINE__){adl_type == :dadl}
-          yield :SYM_END_DBLOCK, :SYM_END_DBLOCK
-        end
-      when /\A\-/   # -
-        yield :Minus_code, :Minus_code
-      when /\A\+/   # +
-        yield :Plus_code, :Plus_code
-      when /\A\*/   # *
-        yield :Star_code, :Star_code
-      when /\A\//   # /
-        yield :Slash_code, :Slash_code
-      when /\A\^/   # ^
-        yield :Caret_code, :Caret_code
-      when /\A\.\.\./   # ...
-        yield :SYM_LIST_CONTINUE, :SYM_LIST_CONTINUE
-      when /\A\.\./   # ..
-        yield :SYM_ELLIPSIS, :SYM_ELLIPSIS
-      when /\A\./   # .
-        yield :Dot_code, :Dot_code
-      when /\A\;/   # ;
-        yield :Semicolon_code, :Semicolon_code
-      when /\A\,/   # ,
-        yield :Comma_code, :Comma_code
-      when /\A\:/   # :
-        yield :Colon_code, :Colon_code
-      when /\A\!/   # !
-        yield :Exclamation_code, :Exclamation_code
-      when /\A\(/   # (
-        yield :Left_parenthesis_code, :Left_parenthesis_code
-      when /\A\)/   # )
-        yield :Right_parenthesis_code, :Right_parenthesis_code
-      when /\A\{\// #V_REGEXP
-        if @adl_type.last != :regexp
-          @in_regexp = true
-          @adl_type.push(:regexp)
-          yield :START_REGEXP_BLOCK, :START_REGEXP_BLOCK
-        else
-          raise
-        end
-#        yield :V_REGEXP, :V_REGEXP
-      when /\A\{/   # {
-        @adl_type.push(:cadl)
-        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: entering cADL at #{@filename}:#{@lineno}")
-        yield :SYM_START_CBLOCK, :SYM_START_CBLOCK
-      when /\A\}/   # }
-        adl_type = @adl_type.pop
-#        puts "Escaping #{adl_type}"
-        assert_at(__FILE__,__LINE__){adl_type == :cadl}
-        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: exiting cADL at #{@filename}:#{@lineno}")
-        yield :SYM_END_CBLOCK, :SYM_END_CBLOCK
-      when /\A\$/   # $
-        yield :Dollar_code, :Dollar_code
-      when /\A\?\?/   # ??
-        yield :SYM_DT_UNKNOWN, :SYM_DT_UNKNOWN
-      when /\A\?/   # ?
-        yield :Question_mark_code, :Question_mark_code
-      when /\A\|/   # |
-        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: @in_interval = #{@in_interval} at #{@filename}:#{@lineno}")
-        if @in_interval
-          @in_interval = false
-        else
-#          @in_interval = false
-          @in_interval = true
-        end
-        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: SYM_INTERVAL_DELIM at #{@filename}:#{@lineno}")
-        yield :SYM_INTERVAL_DELIM, :SYM_INTERVAL_DELIM
-
-      when /\A\[[a-zA-Z0-9._\-]+::[a-zA-Z0-9._\-]+\]/   #V_QUALIFIED_TERM_CODE_REF form [ICD10AM(1998)::F23]
-        yield :V_QUALIFIED_TERM_CODE_REF, $&
-      when /\A\[[a-zA-Z0-9._\- ]+::[a-zA-Z0-9._\- ]+\]/   #ERR_V_QUALIFIED_TERM_CODE_REF
-        yield :ERR_V_QUALIFIED_TERM_CODE_REF, $&
-      when /\A\[([a-zA-Z0-9()._\-]+::[a-zA-Z0-9._\_-]+)\]/
-        yield :V_TERM_CODE_CONSTRAINT, :V_TERM_CODE_CONSTRAINT
-      when /\A\[[a-zA-Z0-9\(\)\._\-]+::[ \t\n]*/
-        @adl_type.push(:term_constraint)
-        yield :START_TERM_CODE_CONSTRAINT, $&
-      when /\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/   #V_LOCAL_TERM_CODE_REF
-        yield :V_LOCAL_TERM_CODE_REF, $&
-      when /\A\[/   # [
-        yield :Left_bracket_code, :Left_bracket_code
-      when /\A\]/   # ]
-        yield :Right_bracket_code, :Right_bracket_code
-      when /\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/   #V_GENERIC_TYPE_IDENTIFIER
-        yield :V_GENERIC_TYPE_IDENTIFIER, $&
-      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]/
-        yield :V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN, $&
-      when /\A[yY][yY][yY][yY]-[mM?X][mM?X]-[dD?X][dD?X]/
-        yield :V_ISO8601_DATE_CONSTRAINT_PATTERN, $&
-      when /\A[hH][hH]:[mM?X][mM?X]:[sS?X][sS?X]/
-        yield :V_ISO8601_TIME_CONSTRAINT_PATTERN, $&
-      when /\A[a-z][a-zA-Z0-9_]*/
-        word = $&.dup
-        if @@cadl_reserved[word.downcase]
-          yield @@cadl_reserved[word.downcase], @@cadl_reserved[word.downcase]
-        else
-          @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: V_ATTRIBUTE_IDENTIFIER = #{word} at #{@filename}:#{@lineno}")
-          yield :V_ATTRIBUTE_IDENTIFIER, word #V_ATTRIBUTE_IDENTIFIER /\A[a-z][a-zA-Z0-9_]*/
-        end
-      when /\A[A-Z][a-zA-Z0-9_]*/
-        word = $&.dup
-        if @@cadl_reserved[word.downcase]
-          yield @@cadl_reserved[word.downcase], @@cadl_reserved[word.downcase]
-        else
-          yield :V_TYPE_IDENTIFIER, $&
-        end
-      when /\Aa[ct][0-9.]+/   #V_LOCAL_CODE
-        yield :V_LOCAL_CODE, $&
-      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-]-
-        yield :V_ISO8601_EXTENDED_DATE_TIME, $&
-      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]
-        yield :V_ISO8601_EXTENDED_TIME, $&
-      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
-        yield :V_ISO8601_EXTENDED_DATE, $&
-      when /\A[0-9]+|[0-9]+[eE][+-]?[0-9]+/   #V_INTEGER
-        yield :V_INTEGER, $&
-      when /\A[0-9]+\.[0-9]+|[0-9]+\.[0-9]+[eE][+-]?[0-9]+ /   #V_REAL
-        yield :V_REAL, $&
-           when /\A"((?:[^"\\]+|\\.)*)"/ #V_STRING
-      when /\A"([^"]*)"/m #V_STRING
-        yield :V_STRING, $1
-      when /\A[a-z]+:\/\/[^<>|\\{}^~"\[\] ]*/ #V_URI
-        yield :V_URI, $&
-###       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
-###         yield :V_ISO8601_DURATION, $&
-      when /\A\S/ #UTF8CHAR
-        yield :UTF8CHAR, $&
-      else
-        raise
-      end
-      data = $' # variable $' receives the string after the match
-    when :adl
-#      puts "Entering scan_adl"
-      data = scan_adl(data) do |sym, val|
-        yield sym, val
-      end
-    when :dadl
-#      puts "Entering scan_dadl"
-      data = scan_dadl(data) do |sym, val|
-        yield sym, val
-      end
-    when :regexp
-#      puts "Entering scan_regexp"
-      data = scan_regexp(data) do |sym, val|
-        yield sym, val
-      end
-    when :term_constraint
-#      puts "Entering scan_term_constraint"
-      data = scan_term_constraint(data) do |sym, val|
-        yield sym, val
-      end
-    else
-      raise
-    end
-  end # of until
-end # of scan_cadl
-
-def scan_dadl(data)
-  until data.nil?  do
-    case @adl_type.last
-    when :dadl
-#      puts "Entering scan_dadl"
-      case scanned = @@dadl_scanner.parse(data)
-      when Yaparc::Result::OK
-        yield scanned.value
-        data = scanned.input
-      else
-      end
-
-      case data
-      when /\A\n/ # carriage return
-        @lineno += 1
-        ;
-      when /\A[ \t\r\f]+/ #just drop it
-        ;
-      when /\A--.*\n/ # single line comment
-        @lineno += 1
-        @@log.info("#{__FILE__}:#{__LINE__}: scan_dadl: COMMENT = #{$&} at #{@filename}:#{@lineno}")
-        ;
-        ###----------/* symbols */ ------------------------------------------------- 
-      when /\A\=/   # =
-        yield :SYM_EQ, :SYM_EQ
-      when /\A\>\=/   # >=
-        yield :SYM_GE, :SYM_GE
-      when /\A\<\=/   # <=
-        yield :SYM_LE, :SYM_LE
-      when /\A\</   # <
-        if @in_interval
-          yield :SYM_LT, :SYM_LT
-        else
-          @adl_type.push(:dadl)
-          yield :SYM_START_DBLOCK, :SYM_START_DBLOCK
-        end
-      when /\A\>/   # >
-        if @in_interval
-#          @in_interval = false
-          yield :SYM_GT, :SYM_GT
-        elsif @in_c_domain_type == true
-          assert_at(__FILE__,__LINE__){@adl_type.last == :dadl}
-          adl_type = @adl_type.pop
-          if @adl_type.last == :cadl
-            @in_c_domain_type = false
-            yield :END_V_C_DOMAIN_TYPE_BLOCK, $&
-          else
-            yield :SYM_END_DBLOCK, $&
-          end
-        elsif @in_c_domain_type == false
-          adl_type = @adl_type.pop
-#          puts "Escaping #{adl_type}"
-          assert_at(__FILE__,__LINE__){adl_type == :dadl}
-          yield :SYM_END_DBLOCK, $&
-        else
-          raise
-        end
-      when /\A\-/   # -
-        yield :Minus_code, :Minus_code
-      when /\A\+/   # +
-        yield :Plus_code, :Plus_code
-      when /\A\*/   # *
-        yield :Star_code, :Star_code
-      when /\A\//   # /
-        yield :Slash_code, :Slash_code
-      when /\A\^/   # ^
-        yield :Caret_code, :Caret_code
-      when /\A\.\.\./   # ...
-        yield :SYM_LIST_CONTINUE, :SYM_LIST_CONTINUE
-      when /\A\.\./   # ..
-        yield :SYM_ELLIPSIS, :SYM_ELLIPSIS
-      when /\A\./   # .
-        yield :Dot_code, :Dot_code
-      when /\A\;/   # ;
-        yield :Semicolon_code, :Semicolon_code
-      when /\A\,/   # ,
-        yield :Comma_code, :Comma_code
-      when /\A\:/   # :
-        yield :Colon_code, :Colon_code
-      when /\A\!/   # !
-        yield :Exclamation_code, :Exclamation_code
-      when /\A\(/   # (
-        yield :Left_parenthesis_code, :Left_parenthesis_code
-      when /\A\)/   # )
-        yield :Right_parenthesis_code, :Right_parenthesis_code
-      when /\A\$/   # $
-        yield :Dollar_code, :Dollar_code
-      when /\A\?\?/   # ??
-        yield :SYM_DT_UNKNOWN, :SYM_DT_UNKNOWN
-      when /\A\?/   # ?
-        yield :Question_mark_code, :Question_mark_code
-      when /\A\|/   # |
-        @@log.info("#{__FILE__}:#{__LINE__}: scan_dadl: @in_interval = #{@in_interval} at #{@filename}:#{@lineno}")
-        if @in_interval
-          @in_interval = false
-        else
-#          @in_interval = false
-          @in_interval = true
-        end
-        @@log.info("#{__FILE__}:#{__LINE__}: scan_dadl: SYM_INTERVAL_DELIM at #{@filename}:#{@lineno}")
-        yield :SYM_INTERVAL_DELIM, :SYM_INTERVAL_DELIM
-###       when /\A\[[a-zA-Z0-9()\._-]+::[a-zA-Z0-9\._-]+\]/   #V_QUALIFIED_TERM_CODE_REF form [ICD10AM(1998)::F23]
-###         yield :V_QUALIFIED_TERM_CODE_REF, $&
-###       when /\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/   #V_LOCAL_TERM_CODE_REF
-###         yield :V_LOCAL_TERM_CODE_REF, $&
-###       when /\A\[[a-zA-Z0-9._\- ]+::[a-zA-Z0-9._\- ]+\]/   #ERR_V_QUALIFIED_TERM_CODE_REF
-###         yield :ERR_V_QUALIFIED_TERM_CODE_REF, $&
-      when /\A\[/   # [
-        yield :Left_bracket_code, :Left_bracket_code
-      when /\A\]/   # ]
-        yield :Right_bracket_code, :Right_bracket_code
-###       when /\A[A-Z][a-zA-Z0-9_-]*/
-###         yield :V_TYPE_IDENTIFIER, $&
-###       when /\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/   #V_GENERIC_TYPE_IDENTIFIER
-###         yield :V_GENERIC_TYPE_IDENTIFIER, $&
-###       when /\A[a-z][a-zA-Z0-9_]*/
-###         word = $&.downcase
-###         if @@dadl_reserved[word]
-###           yield @@dadl_reserved[word], @@dadl_reserved[word]
-###         else
-###           yield :V_ATTRIBUTE_IDENTIFIER, $&
-###         end
-###       when /\Aa[ct][0-9.]+/   #V_LOCAL_CODE
-###         yield :V_LOCAL_CODE, $&
-      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-]-
-        yield :V_ISO8601_EXTENDED_DATE_TIME, $&
-      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]
-        yield :V_ISO8601_EXTENDED_TIME, $&
-      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
-        yield :V_ISO8601_EXTENDED_DATE, $&
-      when /\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/   #V_GENERIC_TYPE_IDENTIFIER
-        yield :V_GENERIC_TYPE_IDENTIFIER, $&
-      when /\A[0-9]+|[0-9]+[eE][+-]?[0-9]+/   #V_INTEGER
-        yield :V_INTEGER, $&
-###       when /\A[0-9]+\.[0-9]+|[0-9]+\.[0-9]+[eE][+-]?[0-9]+ /   #V_REAL
-###         yield :V_REAL, $&
-        #    when /\A"((?:[^"\\]+|\\.)*)"/ #V_STRING
-###       when /\A"([^"]*)"/m #V_STRING
-###         yield :V_STRING, $1
-      when /\A[a-z]+:\/\/[^<>|\\{}^~"\[\] ]*/ #V_URI
-        yield :V_URI, $&
-###       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
-###         yield :V_ISO8601_DURATION, $&
-      when /\A\S/ #UTF8CHAR
-        yield :UTF8CHAR, $&
-      end
-      data = $' # variable $' receives the string after the match
-    when :adl
-#      puts "Entering scan_adl"
-      data = scan_adl(data) do |sym, val|
-        yield sym, val
-      end
-    when :cadl
-#      puts "Entering scan_cadl"
-      data = scan_cadl(data) do |sym, val|
-        yield sym, val
-      end
-    when :regexp
-#      puts "Entering scan_regexp"
-      data = scan_regexp(data) do |sym, val|
-        yield sym, val
-      end
-    when :term_constraint
-#      puts "Entering scan_term_constraint"
-      data = scan_term_constraint(data) do |sym, val|
-        yield sym, val
-      end
-    else
-      raise
-    end
-  end
-end # of scan_dadl
-
-def scan_regexp(data)
-  until data.nil?  do
-    case @adl_type.last
-    when :regexp
-#      puts "Entering scan_regexp"
-      case data
-      when /\A\/\}/ #V_REGEXP
-        if @adl_type.last == :regexp
-          @in_regexp = false
-          @adl_type.pop
-          yield :END_REGEXP_BLOCK, :END_REGEXP_BLOCK
-        else
-          raise
-        end
-      when /\A(.*)(\/\})/ #V_REGEXP
-        yield :REGEXP_BODY, $1
-        if @adl_type.last == :regexp
-          @in_regexp = false
-          @adl_type.pop
-          yield :END_REGEXP_BLOCK, :END_REGEXP_BLOCK
-        else
-          raise
-        end
-      else
-        raise data
-      end
-      data = $' # variable $' receives the string after the match
-    when :adl
-#      puts "Entering scan_adl"
-      data = scan_adl(data) do |sym, val|
-        yield sym, val
-      end
-    when :dadl
-#      puts "Entering scan_dadl"
-      data = scan_dadl(data) do |sym, val|
-        yield sym, val
-      end
-    when :cadl
-#      puts "Entering scan_cadl"
-      data = scan_cadl(data) do |sym, val|
-        yield sym, val
-      end
-    when :term_constraint
-#      puts "Entering scan_term_constraint"
-      data = scan_term_constraint(data) do |sym, val|
-        yield sym, val
-      end
-    else
-      raise
-    end
-  end
-end # of scan_regexp
-
-def scan_term_constraint(data)
-  until data.nil?  do
-    case @adl_type.last
-    when :term_constraint
-#      puts "Entering scan_term_constraint"
-      case data
-      when /\A\n/ # carriage return
-        @lineno += 1
-        ;
-      when /\A[ \t\r\f]+/ #just drop it
-        ;
-      when /\A--.*$/ # single line comment
-        @lineno += 1
-        @@log.info("#{__FILE__}:#{__LINE__}: scan_term_constraint: COMMENT = #{$&} at #{@filename}:#{@lineno}")
-        ;
-      when /\A[a-zA-Z0-9\._\-]+[ \t]*,/ # match any line, with ',' termination
-        yield :TERM_CODE, $&
-      when /\A[a-zA-Z0-9\._\-]+[ \t]*;/ #match second last line with ';' termination (assumed value)
-        yield :TERM_CODE, $&
-#      when /\A[a-zA-Z0-9\._\-]+[ \t]*\]/ # match final line, terminating in ']'
-      when /\A[a-zA-Z0-9\._\-]*[ \t]*\]/ # match final line, terminating in ']'
-        adl_type = @adl_type.pop
-        assert_at(__FILE__,__LINE__){adl_type == :term_constraint}
-        yield :END_TERM_CODE_CONSTRAINT, $&
-      else
-        raise "data = #{data}"
-      end
-      data = $' # variable $' receives the string after the match
-    when :adl
-#      puts "Entering scan_adl"
-      data = scan_adl(data) do |sym, val|
-        yield sym, val
-      end
-    when :dadl
-#      puts "Entering scan_dadl"
-      data = scan_dadl(data) do |sym, val|
-        yield sym, val
-      end
-    when :cadl
-#      puts "Entering scan_cadl"
-      data = scan_cadl(data) do |sym, val|
-        yield sym, val
-      end
-    else
-      raise
-    end
-  end
-end # of scan_term_constraint
-
-
-def parse(data, filename, lineno = 1, debug = false)
-  @yydebug = true
-  @parsestring = data
-  @data = data
-  @lineno = lineno
-  @filename = filename
-  @adl_type = [:adl] # {:adl, :cadl, :dadl}
-  @in_regexp = false
-  @in_interval = false
-  @in_c_domain_type = false
-  yyparse self, :scan
-end
-
-def on_error( t, v, values)
-  raise Racc::ParseError, "#{@filename}:#{@lineno}: Inline syntax error on #{v.inspect}"
-end
-
-
-
-
-
-
-
-### Local Variables:
-### mode:ruby
-### mode:font-lock
-### comment-column:0
-### comment-start: "### "
-### comment-end:"" 
-### End:
-
-
-
-
-..end lib/parser.y modeval..idf8b8df4140
-
-##### racc 1.4.5 generates ###
-
-racc_reduce_table = [
- 0, 0, :racc_error,
- 2, 96, :_reduce_1,
- 1, 96, :_reduce_none,
- 8, 97, :_reduce_3,
- 2, 98, :_reduce_4,
- 2, 98, :_reduce_5,
- 1, 106, :_reduce_6,
- 2, 106, :_reduce_7,
- 3, 107, :_reduce_8,
- 1, 108, :_reduce_9,
- 3, 108, :_reduce_10,
- 3, 109, :_reduce_11,
- 1, 109, :_reduce_12,
- 0, 99, :_reduce_none,
- 2, 99, :_reduce_none,
- 2, 99, :_reduce_none,
- 2, 100, :_reduce_16,
- 2, 100, :_reduce_none,
- 0, 101, :_reduce_18,
- 2, 101, :_reduce_19,
- 2, 101, :_reduce_none,
- 0, 102, :_reduce_none,
- 2, 102, :_reduce_22,
- 2, 102, :_reduce_none,
- 2, 103, :_reduce_24,
- 2, 103, :_reduce_none,
- 1, 111, :_reduce_26,
- 1, 111, :_reduce_27,
- 5, 112, :_reduce_28,
- 5, 112, :_reduce_29,
- 2, 114, :_reduce_30,
- 1, 116, :_reduce_31,
- 2, 116, :_reduce_32,
- 1, 115, :_reduce_none,
- 1, 115, :_reduce_34,
- 1, 121, :_reduce_35,
- 1, 121, :_reduce_36,
- 1, 121, :_reduce_37,
- 1, 121, :_reduce_38,
- 1, 121, :_reduce_39,
- 1, 121, :_reduce_40,
- 1, 121, :_reduce_41,
- 1, 121, :_reduce_42,
- 1, 121, :_reduce_none,
- 1, 121, :_reduce_none,
- 3, 122, :_reduce_45,
- 4, 123, :_reduce_46,
- 3, 123, :_reduce_none,
- 6, 124, :_reduce_48,
- 2, 130, :_reduce_49,
- 2, 133, :_reduce_50,
- 3, 133, :_reduce_none,
- 2, 133, :_reduce_none,
- 1, 128, :_reduce_53,
- 1, 134, :_reduce_54,
- 1, 134, :_reduce_55,
- 1, 134, :_reduce_56,
- 1, 134, :_reduce_57,
- 1, 134, :_reduce_58,
- 1, 134, :_reduce_59,
- 1, 134, :_reduce_60,
- 1, 134, :_reduce_61,
- 1, 119, :_reduce_none,
- 1, 120, :_reduce_63,
- 2, 120, :_reduce_64,
- 5, 143, :_reduce_65,
- 5, 143, :_reduce_66,
- 5, 143, :_reduce_67,
- 2, 144, :_reduce_68,
- 3, 144, :_reduce_69,
- 1, 145, :_reduce_70,
- 2, 145, :_reduce_71,
- 1, 145, :_reduce_72,
- 0, 131, :_reduce_none,
- 2, 131, :_reduce_74,
- 0, 132, :_reduce_none,
- 2, 132, :_reduce_76,
- 1, 148, :_reduce_none,
- 2, 148, :_reduce_none,
- 3, 149, :_reduce_none,
- 1, 149, :_reduce_none,
- 3, 149, :_reduce_none,
- 0, 104, :_reduce_none,
- 2, 104, :_reduce_none,
- 2, 104, :_reduce_none,
- 2, 105, :_reduce_85,
- 2, 105, :_reduce_none,
- 1, 110, :_reduce_none,
- 1, 152, :_reduce_none,
- 1, 152, :_reduce_none,
- 1, 153, :_reduce_90,
- 2, 153, :_reduce_91,
- 3, 153, :_reduce_92,
- 3, 155, :_reduce_93,
- 1, 156, :_reduce_94,
- 2, 156, :_reduce_none,
- 1, 157, :_reduce_96,
- 1, 157, :_reduce_97,
- 1, 154, :_reduce_98,
- 1, 154, :_reduce_99,
- 1, 160, :_reduce_100,
- 2, 160, :_reduce_101,
- 3, 161, :_reduce_102,
- 1, 162, :_reduce_103,
- 1, 163, :_reduce_104,
- 2, 163, :_reduce_105,
- 3, 164, :_reduce_106,
- 3, 165, :_reduce_107,
- 1, 159, :_reduce_108,
- 2, 159, :_reduce_109,
- 2, 167, :_reduce_110,
- 3, 167, :_reduce_111,
- 1, 168, :_reduce_none,
- 1, 158, :_reduce_113,
- 2, 158, :_reduce_114,
- 3, 169, :_reduce_115,
- 1, 170, :_reduce_116,
- 1, 170, :_reduce_117,
- 1, 170, :_reduce_118,
- 1, 170, :_reduce_119,
- 1, 170, :_reduce_120,
- 1, 166, :_reduce_121,
- 1, 166, :_reduce_122,
- 1, 166, :_reduce_123,
- 1, 166, :_reduce_124,
- 1, 166, :_reduce_125,
- 1, 166, :_reduce_126,
- 1, 166, :_reduce_127,
- 1, 166, :_reduce_128,
- 1, 166, :_reduce_129,
- 1, 166, :_reduce_130,
- 1, 171, :_reduce_none,
- 1, 171, :_reduce_none,
- 1, 171, :_reduce_none,
- 1, 171, :_reduce_none,
- 1, 171, :_reduce_none,
- 1, 171, :_reduce_none,
- 1, 171, :_reduce_none,
- 1, 171, :_reduce_none,
- 1, 171, :_reduce_none,
- 1, 172, :_reduce_none,
- 1, 172, :_reduce_none,
- 1, 172, :_reduce_none,
- 1, 172, :_reduce_none,
- 1, 172, :_reduce_none,
- 1, 172, :_reduce_none,
- 1, 118, :_reduce_146,
- 1, 118, :_reduce_147,
- 1, 175, :_reduce_148,
- 3, 185, :_reduce_none,
- 3, 185, :_reduce_none,
- 3, 185, :_reduce_none,
- 1, 176, :_reduce_152,
- 2, 176, :_reduce_153,
- 2, 176, :_reduce_154,
- 3, 186, :_reduce_none,
- 3, 186, :_reduce_none,
- 3, 186, :_reduce_none,
- 5, 194, :_reduce_none,
- 6, 194, :_reduce_none,
- 6, 194, :_reduce_none,
- 7, 194, :_reduce_none,
- 4, 194, :_reduce_none,
- 4, 194, :_reduce_none,
- 4, 194, :_reduce_none,
- 4, 194, :_reduce_none,
- 3, 194, :_reduce_none,
- 1, 177, :_reduce_167,
- 2, 177, :_reduce_168,
- 2, 177, :_reduce_169,
- 3, 187, :_reduce_none,
- 3, 187, :_reduce_none,
- 3, 187, :_reduce_none,
- 5, 195, :_reduce_none,
- 6, 195, :_reduce_none,
- 6, 195, :_reduce_none,
- 7, 195, :_reduce_none,
- 4, 195, :_reduce_none,
- 4, 195, :_reduce_none,
- 4, 195, :_reduce_none,
- 4, 195, :_reduce_none,
- 3, 195, :_reduce_none,
- 1, 178, :_reduce_182,
- 1, 178, :_reduce_183,
- 3, 188, :_reduce_none,
- 3, 188, :_reduce_none,
- 3, 188, :_reduce_none,
- 1, 179, :_reduce_none,
- 3, 189, :_reduce_none,
- 3, 189, :_reduce_none,
- 3, 189, :_reduce_none,
- 1, 180, :_reduce_none,
- 3, 190, :_reduce_none,
- 3, 190, :_reduce_none,
- 3, 190, :_reduce_none,
- 5, 196, :_reduce_none,
- 6, 196, :_reduce_none,
- 6, 196, :_reduce_none,
- 7, 196, :_reduce_none,
- 4, 196, :_reduce_none,
- 4, 196, :_reduce_none,
- 4, 196, :_reduce_none,
- 4, 196, :_reduce_none,
- 3, 196, :_reduce_none,
- 1, 181, :_reduce_none,
- 3, 191, :_reduce_none,
- 3, 191, :_reduce_none,
- 3, 191, :_reduce_none,
- 5, 197, :_reduce_none,
- 6, 197, :_reduce_none,
- 6, 197, :_reduce_none,
- 7, 197, :_reduce_none,
- 4, 197, :_reduce_none,
- 4, 197, :_reduce_none,
- 4, 197, :_reduce_none,
- 4, 197, :_reduce_none,
- 3, 197, :_reduce_none,
- 1, 182, :_reduce_none,
- 3, 192, :_reduce_none,
- 3, 192, :_reduce_none,
- 3, 192, :_reduce_none,
- 5, 198, :_reduce_none,
- 6, 198, :_reduce_none,
- 6, 198, :_reduce_none,
- 7, 198, :_reduce_none,
- 4, 198, :_reduce_none,
- 4, 198, :_reduce_none,
- 4, 198, :_reduce_none,
- 4, 198, :_reduce_none,
- 3, 198, :_reduce_none,
- 1, 183, :_reduce_230,
- 3, 193, :_reduce_none,
- 3, 193, :_reduce_none,
- 3, 193, :_reduce_none,
- 5, 199, :_reduce_none,
- 6, 199, :_reduce_none,
- 6, 199, :_reduce_none,
- 7, 199, :_reduce_none,
- 4, 199, :_reduce_none,
- 4, 199, :_reduce_none,
- 4, 199, :_reduce_none,
- 4, 199, :_reduce_none,
- 3, 199, :_reduce_none,
- 1, 173, :_reduce_243,
- 3, 174, :_reduce_none,
- 3, 174, :_reduce_none,
- 3, 174, :_reduce_none,
- 1, 184, :_reduce_247,
- 1, 113, :_reduce_none,
- 2, 113, :_reduce_none,
- 3, 200, :_reduce_none,
- 1, 200, :_reduce_none,
- 3, 200, :_reduce_none,
- 1, 151, :_reduce_none,
- 1, 151, :_reduce_none,
- 2, 202, :_reduce_none,
- 2, 202, :_reduce_none,
- 5, 202, :_reduce_none,
- 5, 202, :_reduce_none,
- 2, 202, :_reduce_none,
- 3, 202, :_reduce_none,
- 3, 202, :_reduce_none,
- 3, 202, :_reduce_none,
- 3, 202, :_reduce_none,
- 3, 202, :_reduce_none,
- 3, 202, :_reduce_none,
- 3, 202, :_reduce_none,
- 3, 202, :_reduce_none,
- 3, 202, :_reduce_none,
- 3, 202, :_reduce_none,
- 3, 201, :_reduce_none,
- 1, 201, :_reduce_none,
- 1, 201, :_reduce_none,
- 1, 204, :_reduce_none,
- 1, 204, :_reduce_none,
- 3, 206, :_reduce_none,
- 3, 206, :_reduce_none,
- 3, 206, :_reduce_none,
- 3, 206, :_reduce_none,
- 3, 206, :_reduce_none,
- 3, 205, :_reduce_none,
- 1, 205, :_reduce_none,
- 1, 205, :_reduce_none,
- 1, 205, :_reduce_none,
- 1, 129, :_reduce_none,
- 2, 129, :_reduce_none,
- 1, 203, :_reduce_none,
- 3, 203, :_reduce_none,
- 2, 207, :_reduce_288,
- 1, 207, :_reduce_289,
- 0, 146, :_reduce_290,
- 5, 146, :_reduce_291,
- 1, 208, :_reduce_292,
- 3, 208, :_reduce_293,
- 5, 147, :_reduce_294,
- 1, 209, :_reduce_none,
- 3, 209, :_reduce_none,
- 3, 209, :_reduce_none,
- 3, 209, :_reduce_none,
- 5, 209, :_reduce_none,
- 5, 209, :_reduce_none,
- 5, 209, :_reduce_none,
- 5, 209, :_reduce_none,
- 1, 211, :_reduce_none,
- 1, 211, :_reduce_none,
- 0, 117, :_reduce_none,
- 5, 117, :_reduce_306,
- 2, 117, :_reduce_none,
- 1, 210, :_reduce_none,
- 3, 210, :_reduce_none,
- 1, 212, :_reduce_none,
- 1, 212, :_reduce_none,
- 1, 212, :_reduce_none,
- 1, 135, :_reduce_none,
- 3, 135, :_reduce_none,
- 3, 135, :_reduce_none,
- 1, 213, :_reduce_none,
- 1, 213, :_reduce_none,
- 1, 213, :_reduce_none,
- 1, 136, :_reduce_none,
- 3, 136, :_reduce_none,
- 3, 136, :_reduce_none,
- 1, 214, :_reduce_none,
- 1, 214, :_reduce_none,
- 1, 214, :_reduce_none,
- 1, 137, :_reduce_none,
- 3, 137, :_reduce_none,
- 3, 137, :_reduce_none,
- 1, 215, :_reduce_none,
- 1, 215, :_reduce_none,
- 1, 215, :_reduce_none,
- 1, 138, :_reduce_none,
- 3, 138, :_reduce_none,
- 3, 138, :_reduce_none,
- 1, 216, :_reduce_none,
- 1, 216, :_reduce_none,
- 1, 216, :_reduce_none,
- 1, 139, :_reduce_none,
- 3, 139, :_reduce_none,
- 3, 139, :_reduce_none,
- 1, 217, :_reduce_none,
- 3, 217, :_reduce_none,
- 1, 217, :_reduce_none,
- 1, 217, :_reduce_none,
- 1, 140, :_reduce_none,
- 3, 140, :_reduce_none,
- 3, 140, :_reduce_none,
- 1, 219, :_reduce_none,
- 1, 219, :_reduce_none,
- 3, 219, :_reduce_none,
- 1, 141, :_reduce_none,
- 3, 141, :_reduce_none,
- 3, 141, :_reduce_none,
- 1, 220, :_reduce_353,
- 1, 220, :_reduce_354,
- 3, 220, :_reduce_355,
- 3, 220, :_reduce_356,
- 1, 142, :_reduce_357,
- 3, 142, :_reduce_358,
- 3, 142, :_reduce_359,
- 1, 127, :_reduce_none,
- 3, 127, :_reduce_none,
- 3, 127, :_reduce_none,
- 1, 221, :_reduce_none,
- 3, 221, :_reduce_none,
- 3, 222, :_reduce_365,
- 1, 126, :_reduce_366,
- 1, 126, :_reduce_367,
- 3, 223, :_reduce_none,
- 0, 224, :_reduce_none,
- 1, 224, :_reduce_none,
- 2, 224, :_reduce_none,
- 1, 125, :_reduce_372,
- 1, 150, :_reduce_373,
- 1, 150, :_reduce_374,
- 1, 218, :_reduce_375 ]
-
-racc_reduce_n = 376
-
-racc_shift_n = 633
-
-racc_action_table = [
-   576,   483,   147,   164,   476,   594,   474,    59,   215,   472,
-   131,   470,   452,   578,   575,   464,   462,    29,   383,   341,
-   387,    67,   385,   321,   155,   157,    25,    26,   526,   114,
-   119,   216,    73,   500,   190,   121,    36,   513,   515,   463,
-   518,   519,    36,   517,   502,    30,    62,   574,   148,   155,
-   157,   434,    49,    51,   284,   112,   444,    81,    84,    87,
-   194,   160,    97,   309,   314,   238,   114,   117,   119,   121,
-   534,   526,   121,   121,   119,    73,   117,   114,   128,   129,
-   513,   515,    79,   518,   519,   277,   160,   281,   286,   288,
-   537,   163,   119,   298,    75,    49,    51,   284,   152,   153,
-    81,    84,    87,   194,   121,    97,   309,   314,   114,   114,
-   117,   119,   121,   534,   102,   119,   436,   230,   232,   494,
-   168,   498,   134,   152,   153,     9,    73,   496,   155,   157,
-   281,   286,   288,   537,   155,   157,   298,    71,   102,   338,
-   249,   322,   631,   323,   344,    11,    49,    51,   111,   248,
-   231,    81,    84,    87,   467,   117,    97,   100,   101,   155,
-   157,   140,   102,   100,   101,   160,    91,    95,   325,   326,
-   135,   160,    97,    79,   117,    81,    84,    87,   468,   117,
-    97,   100,   101,   389,   114,   140,   190,   155,   157,   138,
-    91,    95,   173,   155,   157,   121,   160,    79,   392,    81,
-    84,    87,   152,   153,    97,   100,   101,  -374,   152,   153,
-  -373,    81,   329,   330,    91,    95,   155,   157,   219,   158,
-   161,    79,   571,   151,   160,    22,   154,   156,   155,   157,
-   160,   158,   161,   152,   153,   151,   325,   326,   154,   156,
-    97,   219,   242,    23,   238,   544,   103,   573,   541,   394,
-   601,   542,   543,   160,     1,    81,    84,    87,   602,   603,
-    97,   152,   153,   263,   109,   160,   256,   152,   153,   259,
-   261,   395,    67,     4,    49,    51,   103,    79,    81,    84,
-    87,   144,    16,    97,    17,   159,   145,   102,    49,    51,
-   152,   153,   333,    36,   325,   326,   219,   159,    97,   149,
-    79,   396,   152,   153,   150,   121,   219,    81,   329,   330,
-   140,    81,    84,    87,   102,    16,    97,    17,    49,    51,
-   114,   117,   119,   121,    81,    84,    87,   128,   129,    97,
-   100,   101,   219,    81,    84,    87,   420,   140,    97,    91,
-    95,   272,   219,    81,    84,    87,    79,   416,    97,   277,
-   272,    81,    84,    87,   398,    79,    97,   100,   101,   389,
-   102,   481,   415,   329,   330,    79,    91,    95,   335,    81,
-    84,    87,   102,    79,    97,   128,   129,   212,   241,    81,
-    84,    87,   242,    71,    97,   325,   326,    35,   240,    97,
-   244,    79,    49,    51,   399,   140,   400,    81,    84,    87,
-   102,    79,    97,   100,   101,   401,   418,   402,   219,    81,
-    84,    87,    91,    95,    97,   100,   101,   403,    40,    79,
-    36,   629,   630,    71,    91,    95,   404,   219,    35,    49,
-    51,    79,    49,    51,    81,   329,   330,    81,    84,    87,
-   102,   405,    97,   100,   101,    81,    84,    87,   431,   432,
-    97,   406,    91,    95,    81,   329,   330,   492,   102,    79,
-   407,    36,   408,    71,    81,    84,    87,    79,   409,    97,
-    49,    51,    49,    51,   429,   430,   219,    81,    84,    87,
-   410,    71,    97,   100,   101,   102,    79,    81,   329,   330,
-    49,    51,    91,    95,   270,    81,    84,    87,   411,    79,
-    97,   100,   101,   102,   239,    81,   329,   330,   140,   247,
-    91,    95,   246,    81,    84,    87,   145,    79,    97,    81,
-   329,   330,    81,    84,    87,   150,   140,    97,   100,   101,
-   144,   102,   611,   612,   613,    79,   416,    91,    95,   219,
-    81,    84,    87,   149,    79,    97,   100,   101,   245,   219,
-   244,   415,   329,   330,    71,    91,    95,   219,   172,   169,
-   170,   171,    79,    49,    51,   346,   347,    35,    81,    84,
-    87,   348,   349,    97,   100,   101,    81,    84,    87,   251,
-   102,    97,    56,    91,    95,   252,    81,    84,    87,   416,
-    79,    97,    35,   253,    81,    84,    87,   264,    79,    97,
-    36,   427,   428,   140,    81,   329,   330,   265,    79,    49,
-    51,   325,   326,   356,   357,    97,    79,    81,    84,    87,
-   358,   359,    97,   100,   101,    36,   325,   326,   425,   426,
-    97,   119,    91,    95,    49,    51,   243,   284,   242,    79,
-    81,    84,    87,   194,   437,    97,   309,   314,   438,   114,
-   117,   119,   121,    81,    84,    87,   325,   326,    97,   439,
-    97,   440,   114,   117,   119,   121,   172,   169,   170,   171,
-   281,   286,   288,  -103,   366,   367,   298,   176,   423,   424,
-    81,    84,    87,   194,   441,    97,   128,   129,   111,   114,
-   117,   119,   121,   190,   124,   112,   374,   375,    81,    84,
-    87,   421,   422,    97,   128,   129,   111,   114,   117,   119,
-   121,   442,   124,    81,    84,    87,    49,    51,    97,    81,
-   329,   330,   114,   117,   119,   121,    81,    84,    87,   241,
-   445,    97,   446,   447,   448,   114,   117,   119,   121,    81,
-    84,    87,   449,   450,    97,   240,   453,   454,   114,   117,
-   119,   121,   172,   169,   170,   171,   172,   169,   170,   171,
-   328,    81,   329,   330,   172,   169,   170,   171,   172,   169,
-   170,   171,   172,   169,   170,   171,   172,   169,   170,   171,
-   172,   169,   170,   171,   455,   456,   457,   458,   460,   461,
-   140,   214,   148,   138,   213,   210,   103,   166,   478,   480,
-   266,   482,   163,   485,   486,   487,   117,   489,   146,   140,
-   139,   136,    36,   110,    69,   503,   114,   505,   117,   507,
-   119,   509,   121,   511,   512,    35,   540,    62,    58,   546,
-   547,   548,   267,   550,    57,   552,   114,   554,   117,   556,
-   119,   558,   121,   560,   561,   562,   563,   564,   565,   163,
-  -103,   569,   250,    54,   173,    34,   114,    31,   580,   581,
-   582,   121,   121,    28,   121,   583,   584,   585,   586,   587,
-   588,   268,   591,   592,   593,    24,   596,   597,   111,    21,
-   269,   604,   605,   606,   607,    79,   573,   609,   270,   271,
-   619,   620,   621,   622,    15,   624,    14,   625,    12,   627,
-   628,   319,     8,     7,   121 ]
-
-racc_action_check = [
-   531,   410,    86,    91,   405,   570,   404,    43,   147,   403,
-    63,   402,   375,   531,   529,   398,   395,    21,   265,   250,
-   267,    52,   266,   231,   222,   222,    18,    18,   531,   250,
-   265,   147,   531,   430,   267,   266,    43,   531,   531,   395,
-   531,   531,    52,   462,   432,    21,    63,   529,    86,   320,
-   320,   357,   531,   531,   531,   410,   367,   531,   531,   531,
-   531,   222,   531,   531,   531,   320,   531,   531,   531,   531,
-   531,   462,   375,   405,   404,   462,   403,   402,   398,   398,
-   462,   462,    91,   462,   462,   462,   320,   531,   531,   531,
-   531,   570,   430,   531,    54,   462,   462,   462,   222,   222,
-   462,   462,   462,   462,   432,   462,   462,   462,   357,   462,
-   462,   462,   462,   462,    54,   367,   359,   163,   166,   424,
-    95,   428,    69,   320,   320,     4,    54,   426,   227,   227,
-   462,   462,   462,   462,   229,   229,   462,    54,   166,   248,
-   188,   240,   624,   240,   252,     4,    54,    54,   248,   187,
-   163,    54,    54,    54,   400,   252,    54,    54,    54,   224,
-   224,   166,   624,    95,    95,   227,    54,    54,   424,   424,
-    69,   229,   424,    54,   359,   166,   166,   166,   401,   428,
-   166,   166,   166,   268,   426,   624,   269,   218,   218,    71,
-   166,   166,    98,   226,   226,   264,   224,   166,   271,   624,
-   624,   624,   227,   227,   624,   624,   624,    71,   229,   229,
-    98,   400,   400,   400,   624,   624,    88,    88,   157,    88,
-    88,   624,   519,    88,   218,    14,    88,    88,   174,   174,
-   226,   174,   174,   224,   224,   174,   401,   401,   174,   174,
-   401,   152,   522,    14,   174,   480,   110,   522,   480,   272,
-   575,   480,   480,    88,     0,   157,   157,   157,   579,   579,
-   157,   218,   218,   194,    60,   174,   194,   226,   226,   194,
-   194,   274,    60,     0,   519,   519,    58,   157,   152,   152,
-   152,    84,    11,   152,    11,    88,    84,   171,   110,   110,
-    88,    88,   244,    60,   244,   244,   153,   174,   244,    87,
-   152,   275,   174,   174,    87,   480,   161,   575,   575,   575,
-   171,   194,   194,   194,   168,    26,   194,    26,    58,    58,
-   194,   194,   194,   194,   171,   171,   171,   243,   243,   171,
-   171,   171,   160,   153,   153,   153,   349,   168,   153,   171,
-   171,   278,   159,   161,   161,   161,   171,   321,   161,   214,
-   214,   168,   168,   168,   279,   153,   168,   168,   168,   408,
-   626,   408,   321,   321,   321,   161,   168,   168,   246,   160,
-   160,   160,   170,   168,   160,   246,   246,   136,   282,   159,
-   159,   159,   283,   626,   159,   349,   349,   136,   284,   349,
-   287,   160,   626,   626,   289,   170,   290,   626,   626,   626,
-   619,   159,   626,   626,   626,   293,   347,   296,   158,   170,
-   170,   170,   626,   626,   170,   170,   170,   300,    28,   626,
-   136,   622,   622,   619,   170,   170,   303,   151,    28,   136,
-   136,   170,   619,   619,   270,   270,   270,   619,   619,   619,
-    82,   306,   619,   619,   619,   158,   158,   158,   355,   355,
-   158,   309,   619,   619,   347,   347,   347,   422,   614,   619,
-   310,    28,   312,    82,   151,   151,   151,   158,   314,   151,
-    28,    28,    82,    82,   354,   354,   154,    82,    82,    82,
-   315,   614,    82,    82,    82,   169,   151,   574,   574,   574,
-   614,   614,    82,    82,   317,   614,   614,   614,   319,    82,
-   614,   614,   614,   102,   175,   422,   422,   422,   169,   186,
-   614,   614,   185,   154,   154,   154,   325,   614,   154,   418,
-   418,   418,   169,   169,   169,   326,   102,   169,   169,   169,
-   329,   609,   606,   606,   606,   154,   564,   169,   169,   219,
-   102,   102,   102,   330,   169,   102,   102,   102,   184,   156,
-   182,   564,   564,   564,   609,   102,   102,   155,   175,   175,
-   175,   175,   102,   609,   609,   254,   254,   515,   609,   609,
-   609,   255,   255,   609,   609,   609,   219,   219,   219,   191,
-   172,   219,    34,   609,   609,   192,   156,   156,   156,   486,
-   609,   156,    34,   193,   155,   155,   155,   195,   219,   155,
-   515,   353,   353,   172,   486,   486,   486,   196,   156,   515,
-   515,   420,   420,   257,   257,   420,   155,   172,   172,   172,
-   258,   258,   172,   172,   172,    34,   494,   494,   352,   352,
-   494,   251,   172,   172,    34,    34,   181,   215,   179,   172,
-   215,   215,   215,   215,   360,   215,   215,   215,   361,   215,
-   215,   215,   215,   263,   263,   263,   241,   241,   263,   362,
-   241,   363,   263,   263,   263,   263,    96,    96,    96,    96,
-   215,   215,   215,   103,   260,   260,   215,   103,   351,   351,
-   103,   103,   103,   103,   364,   103,   103,   103,   103,   103,
-   103,   103,   103,   103,   103,    62,   262,   262,    62,    62,
-    62,   350,   350,    62,    62,    62,    62,    62,    62,    62,
-    62,   365,    62,   256,   256,   256,   518,   518,   256,   492,
-   492,   492,   256,   256,   256,   256,   261,   261,   261,   178,
-   368,   261,   369,   370,   371,   261,   261,   261,   261,   259,
-   259,   259,   372,   373,   259,   176,   376,   377,   259,   259,
-   259,   259,   237,   237,   237,   237,   234,   234,   234,   234,
-   242,   242,   242,   242,   236,   236,   236,   236,   617,   617,
-   617,   617,   235,   235,   235,   235,   233,   233,   233,   233,
-   632,   632,   632,   632,   378,   379,   380,   381,   393,   394,
-   148,   146,   141,   140,   139,   116,   108,    92,   406,   407,
-   199,   409,    89,   413,   415,   417,   249,   419,    85,    79,
-    73,    70,    67,    61,    53,   433,   434,   435,   436,   443,
-   444,   451,   452,   460,   461,    48,   463,    47,    42,   488,
-   490,   491,   202,   493,    36,   495,   496,   497,   498,   499,
-   500,   501,   502,   504,   506,   508,   510,   511,   512,   514,
-    35,   517,   189,    33,   520,    27,   247,    24,   537,   538,
-   540,   541,   542,    20,   544,   549,   551,   553,   555,   557,
-   559,   204,   565,   566,   568,    16,   572,   573,   245,    13,
-   205,   581,   589,   590,   591,   595,   598,   604,   207,   213,
-   610,   611,   612,   613,     8,   616,     6,   618,     5,   620,
-   621,   216,     3,     2,   543 ]
-
-racc_action_pointer = [
-   253,   nil,   884,   902,   124,   880,   869,   nil,   894,   nil,
-   nil,   258,   nil,   851,   224,   nil,   867,   nil,     4,   nil,
-   833,    16,   nil,   nil,   832,   nil,   291,   824,   417,   nil,
-   nil,   nil,   nil,   821,   581,   799,   833,   nil,   nil,   nil,
-   nil,   nil,   820,    -8,   nil,   nil,   nil,   776,   814,   nil,
-   nil,   nil,    -2,   766,    93,   nil,   nil,   nil,   265,   nil,
-   249,   805,   640,    -5,   nil,   nil,   nil,   768,   nil,   121,
-   761,   160,   nil,   776,   nil,   nil,   nil,   nil,   nil,   765,
-   nil,   nil,   419,   nil,   223,   774,   -32,   241,   210,   715,
-   nil,     2,   750,   nil,   nil,    99,   590,   nil,   163,   nil,
-   nil,   nil,   482,   622,   nil,   nil,   nil,   nil,   785,   nil,
-   235,   nil,   nil,   nil,   nil,   nil,   743,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,   nil,   376,   nil,   nil,   759,
-   764,   712,   nil,   nil,   nil,   nil,   779,    -4,   746,   nil,
-   nil,   406,   220,   275,   455,   536,   528,   197,   387,   321,
-   311,   285,   nil,   116,   nil,   nil,   117,   nil,   293,   464,
-   351,   266,   559,   nil,   222,   482,   689,   nil,   673,   582,
-   nil,   580,   494,   nil,   492,   456,   453,    93,    84,   796,
-   nil,   523,   529,   578,   253,   541,   551,   nil,   nil,   744,
-   nil,   nil,   776,   nil,   815,   824,   nil,   832,   nil,   nil,
-   nil,   nil,   nil,   853,   306,   582,   865,   nil,   181,   518,
-   nil,   nil,    18,   nil,   153,   nil,   187,   122,   nil,   128,
-   nil,    11,   nil,   700,   680,   696,   688,   676,   nil,   nil,
-    86,   597,   703,   263,   235,   812,   311,   789,    82,   738,
-   -38,   562,    87,   nil,   504,   510,   655,   552,   559,   681,
-   613,   668,   635,   595,   125,   -39,   -35,   -37,   128,   115,
-   376,   161,   167,   nil,   237,   287,   nil,   nil,   297,   331,
-   nil,   nil,   322,   326,   332,   nil,   nil,   334,   nil,   380,
-   373,   nil,   nil,   382,   nil,   nil,   384,   nil,   nil,   nil,
-   394,   nil,   nil,   403,   nil,   nil,   418,   nil,   nil,   395,
-   380,   nil,   406,   nil,   412,   457,   nil,   438,   nil,   461,
-    43,   304,   nil,   nil,   nil,   453,   462,   nil,   nil,   472,
-   485,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,   nil,   nil,   396,   nil,   326,
-   640,   617,   567,   540,   413,   387,   nil,    41,   nil,   106,
-   583,   587,   598,   600,   623,   650,   nil,    46,   669,   671,
-   672,   673,   681,   682,   nil,     2,   685,   686,   723,   724,
-   725,   726,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   nil,   nil,   nil,   705,   755,     4,   nil,   nil,    14,   nil,
-   153,   177,    10,     8,     5,     3,   733,   738,   304,   737,
-     0,   nil,   nil,   789,   nil,   742,   nil,   744,   461,   746,
-   552,   nil,   447,   nil,   109,   nil,   117,   nil,   111,   nil,
-    23,   nil,    34,   754,   749,   756,   750,   nil,   nil,   nil,
-   nil,   nil,   nil,   758,   751,   nil,   nil,   nil,   nil,   nil,
-   nil,   760,   752,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   789,   812,    42,   790,   nil,   nil,   nil,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   235,   nil,   nil,   nil,   nil,   nil,   546,   nil,   768,   nil,
-   769,   770,   661,   772,   567,   774,   769,   776,   770,   778,
-   771,   780,   772,   nil,   782,   nil,   783,   nil,   784,   nil,
-   785,   835,   790,   nil,   762,   556,   nil,   837,   663,   221,
-   825,   nil,   186,   nil,   nil,   nil,   nil,   nil,   nil,    -9,
-   nil,    -1,   nil,   nil,   nil,   nil,   nil,   765,   825,   nil,
-   823,   791,   792,   834,   794,   nil,   nil,   nil,   nil,   804,
-   nil,   805,   nil,   806,   nil,   807,   nil,   808,   nil,   809,
-   nil,   nil,   nil,   nil,   493,   810,   859,   nil,   834,   nil,
-     4,   nil,   847,   806,   429,   249,   nil,   nil,   nil,   166,
-   nil,   869,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   868,
-   860,   826,   nil,   nil,   nil,   805,   nil,   nil,   825,   nil,
-   nil,   nil,   nil,   nil,   842,   nil,   448,   nil,   nil,   510,
-   844,   868,   869,   870,   437,   nil,   848,   692,   883,   379,
-   813,   814,   337,   nil,   141,   nil,   339,   nil,   nil,   nil,
-   nil,   nil,   704 ]
-
-racc_action_default = [
-  -376,    -2,  -376,  -376,    -6,  -376,   -13,    -4,  -376,    -5,
-    -7,  -376,    -1,  -376,  -376,   633,  -376,   -12,  -376,    -9,
-   -18,  -376,   -15,   -14,  -376,    -8,  -376,   -21,  -376,   -17,
-   -16,   -11,   -10,  -376,  -376,  -112,   -94,   -89,   -19,   -90,
-   -20,  -108,  -376,  -376,   -98,   -99,  -100,  -376,  -376,  -146,
-   -87,  -147,   -88,   -82,  -376,   -22,   -23,   -95,  -376,  -110,
-  -376,  -376,  -376,  -376,  -104,  -109,  -101,  -376,   -91,  -376,
-  -376,  -289,  -281,  -376,  -282,   -25,   -24,  -248,   -26,  -284,
-  -253,  -152,   -27,  -254,  -376,  -376,  -376,  -376,  -376,  -305,
-  -273,  -376,  -376,  -283,  -274,  -376,  -251,  -167,   -31,  -286,
-  -271,  -272,  -376,  -112,   -96,   -93,  -113,   -97,  -376,  -111,
-  -376,  -187,  -148,  -122,  -191,  -123,  -376,  -204,  -124,  -217,
-  -125,  -230,  -126,  -127,  -247,  -128,  -129,  -130,  -182,  -183,
-  -121,  -102,  -105,   -92,   -84,   -83,  -376,    -3,  -288,  -376,
-  -289,  -285,  -249,  -373,  -153,  -168,  -376,  -376,  -376,  -154,
-  -169,  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,
-  -376,  -376,   -30,  -376,  -256,  -255,  -376,  -259,  -376,  -376,
-  -376,  -376,  -376,   -32,  -376,  -376,  -148,  -144,  -133,  -122,
-  -145,  -134,  -123,  -116,  -135,  -124,  -136,  -125,  -137,  -126,
-  -243,  -138,  -127,  -376,  -376,  -139,  -128,  -117,  -140,  -129,
-  -118,  -141,  -119,  -142,  -131,  -120,  -143,  -132,  -114,  -106,
-  -107,   -85,   -86,  -376,  -376,  -376,  -376,  -287,  -263,  -376,
-  -278,  -279,  -264,  -275,  -265,  -276,  -261,  -260,  -277,  -262,
-  -307,  -376,  -252,  -250,  -267,  -268,  -269,  -266,  -280,  -270,
-  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,
-  -376,  -376,  -376,  -115,  -376,  -376,  -376,  -376,  -376,  -376,
-  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,
-  -376,  -376,  -290,   -63,  -376,  -376,   -33,   -62,   -34,  -357,
-  -336,  -322,  -317,  -310,  -347,  -343,  -328,  -316,  -334,  -376,
-  -313,   -54,  -323,  -319,   -55,  -329,  -325,   -56,  -375,  -335,
-  -331,   -57,  -342,  -337,  -312,   -58,  -344,  -318,   -59,  -353,
-  -340,  -324,  -348,   -60,  -354,  -350,  -330,  -311,   -61,  -376,
-  -376,  -376,  -149,  -151,  -171,  -376,  -376,  -155,  -157,  -376,
-  -376,  -185,  -170,  -172,  -189,  -186,  -184,  -193,  -190,  -188,
-  -206,  -194,  -192,  -219,  -207,  -205,  -166,  -376,  -181,  -376,
-  -376,  -376,  -376,  -376,  -376,  -376,  -203,  -376,  -216,  -376,
-  -376,  -376,  -376,  -376,  -376,  -376,  -229,  -376,  -376,  -376,
-  -376,  -376,  -376,  -376,  -242,  -376,  -376,  -376,  -376,  -376,
-  -376,  -376,  -232,  -220,  -218,  -233,  -231,  -246,  -244,  -150,
-  -245,  -156,   -28,   -68,  -376,  -376,   -29,   -64,  -376,  -257,
-  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,
-  -376,  -258,  -303,  -376,  -308,  -152,  -304,  -376,  -376,  -376,
-  -376,  -164,  -376,  -179,  -376,  -201,  -376,  -214,  -376,  -227,
-  -376,  -240,  -376,  -376,  -376,  -376,  -376,  -163,  -178,  -200,
-  -213,  -226,  -239,  -376,  -376,  -165,  -180,  -202,  -215,  -228,
-  -241,  -376,  -376,  -162,  -177,  -199,  -212,  -225,  -238,   -69,
-  -376,  -376,  -376,  -376,  -359,  -358,  -314,  -315,  -321,  -320,
-  -327,  -326,  -333,  -332,  -339,  -338,  -346,  -345,  -355,  -341,
-  -376,  -349,  -356,  -352,  -351,  -306,  -376,  -158,  -376,  -173,
-  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,  -376,
-  -376,  -376,  -376,  -195,  -376,  -208,  -376,  -221,  -376,  -234,
-  -376,  -376,  -376,   -43,  -305,  -376,   -53,   -44,  -376,  -376,
-   -31,   -72,  -310,   -70,   -35,   -37,  -372,   -38,   -39,  -360,
-   -40,  -376,  -363,   -41,  -367,  -366,   -42,  -369,  -376,   -36,
-  -376,  -376,  -376,  -376,  -376,  -309,  -160,  -175,  -159,  -376,
-  -174,  -376,  -196,  -376,  -209,  -376,  -222,  -376,  -235,  -376,
-  -197,  -210,  -223,  -236,  -376,  -292,  -376,   -49,  -376,   -67,
-  -305,   -52,   -50,  -376,  -376,  -376,   -44,   -71,   -65,  -376,
-  -370,  -376,   -66,  -161,  -176,  -198,  -211,  -224,  -237,  -376,
-  -295,  -376,  -291,   -45,   -47,  -376,   -51,  -365,  -376,  -364,
-  -361,  -362,  -368,  -371,   -73,  -294,  -376,  -293,   -46,  -376,
-   -75,  -296,  -297,  -298,   -74,   -77,  -376,   -80,  -376,  -376,
-  -376,  -376,  -376,   -78,  -376,   -48,   -76,  -299,  -300,  -301,
-  -302,   -81,   -79 ]
-
-racc_goto_table = [
-    96,   113,   165,    38,   162,    48,   118,   180,   276,    55,
-   413,    48,   202,   120,   523,   104,    65,   273,   105,   126,
-   116,    92,    77,   174,    66,   125,    68,    64,    96,    19,
-   614,    98,     3,   115,    68,   108,   393,   531,    60,   623,
-   626,   133,   179,   132,    32,   289,   618,   185,   175,    92,
-   142,   623,   610,   123,   187,   278,    63,   275,   459,    82,
-   199,   183,   208,   193,   197,   200,   196,   104,    78,   205,
-   209,   484,   218,    76,   182,   222,    65,   224,   122,   226,
-   227,   397,   229,   577,    66,   220,   221,   108,   223,    18,
-   225,    10,     2,   228,   192,   137,    70,    53,    33,   204,
-   207,   178,   181,   184,   186,   188,   191,   195,   198,   201,
-   203,   211,   233,    48,   175,   234,   235,   236,   237,   189,
-   206,   177,    27,    20,   167,   141,    13,     6,   217,   566,
-   589,     5,   545,   254,   599,   579,   nil,   nil,   nil,   nil,
-   320,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   nil,   262,   nil,   nil,   283,   nil,   nil,   260,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,   255,   nil,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,   nil,   388,   nil,   390,   nil,
-   nil,   327,   nil,   nil,   nil,   258,   287,   331,   nil,   nil,
-   336,   nil,   nil,   nil,   nil,   350,   334,   nil,   360,   339,
-   368,   nil,   376,   nil,   nil,   nil,   nil,   nil,   nil,   391,
-   257,   nil,   324,   355,   343,   332,   365,   nil,   373,   354,
-   381,   382,   364,   386,   372,   nil,   380,   351,   384,   nil,
-   361,   nil,   369,   nil,   377,   nil,   nil,   nil,   nil,   nil,
-   340,   nil,   nil,   345,   nil,   nil,   nil,   353,   nil,   nil,
-   363,   nil,   371,   590,   379,   nil,   521,   nil,   nil,   nil,
-   412,   nil,   nil,   337,   nil,   nil,   342,   nil,   nil,   nil,
-   nil,   nil,   352,   nil,   nil,   362,   nil,   370,   nil,   378,
-   nil,   nil,   nil,   nil,   nil,   nil,   417,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   nil,   479,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   419,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   443,   nil,   451,   nil,   nil,   nil,   nil,   nil,   nil,   466,
-   nil,   nil,   465,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   435,   nil,   nil,   nil,   nil,   nil,   nil,   488,   nil,   nil,
-   nil,   491,   477,   nil,   nil,   nil,   nil,   475,   nil,   nil,
-   nil,   nil,   469,   433,   nil,   nil,   nil,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   501,
-   nil,   490,   nil,   499,   473,   493,   nil,   nil,   nil,   nil,
-   nil,   522,   nil,   nil,   nil,   nil,   nil,   508,   nil,   510,
-   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   471,   497,
-   nil,   nil,   nil,   nil,   nil,   412,   nil,   506,   nil,   567,
-   nil,   549,   nil,   287,   nil,   nil,   nil,   262,   nil,   520,
-   nil,   nil,   495,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   504,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   559,
-   nil,   nil,   nil,   557,   nil,   551,   nil,   nil,   nil,   nil,
-   522,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,   595,   nil,   nil,   nil,   555,
-   568,   nil,    48,   nil,   nil,   570,   572,   nil,   355,   365,
-   373,   381,   287,   412,   nil,   nil,   608,   nil,   520,   nil,
-   nil,   nil,   553,   598,   600,   nil,   nil,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   632 ]
-
-racc_goto_check = [
-    56,    81,    34,    15,    22,    23,    83,   104,    24,    15,
-   115,    23,    78,    84,    26,    59,    72,    48,    62,    88,
-    71,    55,   105,   109,    66,    87,    60,    69,    56,    14,
-    53,    23,     1,    82,    60,    23,    51,    50,    58,    54,
-    53,    60,    81,    69,    14,    39,    37,    83,    56,    55,
-   105,    54,    36,    86,    84,    25,    68,    20,    52,    18,
-    88,    71,    74,    75,    76,    77,    87,    59,    17,    79,
-    62,    80,   109,    16,    82,   109,    72,   109,    85,   109,
-   109,    48,   109,    26,    66,   110,   110,    23,   110,    13,
-   110,    12,    11,   110,    86,    10,     9,     8,     7,    90,
-    91,    92,    93,    94,    95,    96,    97,    98,    99,   100,
-   101,    15,    56,    23,    56,    56,    56,    56,    56,    85,
-   102,   103,     6,     5,   106,   108,     4,     3,   112,   113,
-   114,     2,   116,    81,   127,   129,   nil,   nil,   nil,   nil,
-   109,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   nil,    88,   nil,   nil,    81,   nil,   nil,    87,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,    82,   nil,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,   nil,    78,   nil,    78,   nil,
-   nil,    81,   nil,   nil,   nil,    86,    82,    83,   nil,   nil,
-    83,   nil,   nil,   nil,   nil,    81,    84,   nil,    81,    84,
-    81,   nil,    81,   nil,   nil,   nil,   nil,   nil,   nil,    81,
-    85,   nil,    82,    88,    87,    82,    88,   nil,    88,    87,
-    88,    88,    87,    88,    87,   nil,    87,    82,    87,   nil,
-    82,   nil,    82,   nil,    82,   nil,   nil,   nil,   nil,   nil,
-    86,   nil,   nil,    86,   nil,   nil,   nil,    86,   nil,   nil,
-    86,   nil,    86,   115,    86,   nil,    24,   nil,   nil,   nil,
-    81,   nil,   nil,    85,   nil,   nil,    85,   nil,   nil,   nil,
-   nil,   nil,    85,   nil,   nil,    85,   nil,    85,   nil,    85,
-   nil,   nil,   nil,   nil,   nil,   nil,    81,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   nil,   104,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-    82,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-    87,   nil,    88,   nil,   nil,   nil,   nil,   nil,   nil,    81,
-   nil,   nil,    83,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-    86,   nil,   nil,   nil,   nil,   nil,   nil,    81,   nil,   nil,
-   nil,    81,    88,   nil,   nil,   nil,   nil,    87,   nil,   nil,
-   nil,   nil,    82,    85,   nil,   nil,   nil,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,    88,
-   nil,    82,   nil,    87,    86,    82,   nil,   nil,   nil,   nil,
-   nil,    81,   nil,   nil,   nil,   nil,   nil,    87,   nil,    88,
-   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,    85,    86,
-   nil,   nil,   nil,   nil,   nil,    81,   nil,    86,   nil,    22,
-   nil,    81,   nil,    82,   nil,   nil,   nil,    88,   nil,    23,
-   nil,   nil,    85,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-    85,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,    88,
-   nil,   nil,   nil,    87,   nil,    82,   nil,   nil,   nil,   nil,
-    81,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,    22,   nil,   nil,   nil,    86,
-    15,   nil,    23,   nil,   nil,    23,    23,   nil,    88,    88,
-    88,    88,    82,    81,   nil,   nil,    34,   nil,    23,   nil,
-   nil,   nil,    85,    81,    81,   nil,   nil,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-    56 ]
-
-racc_goto_pointer = [
-   nil,    32,   131,   127,   120,   110,   102,    71,    64,    43,
-    25,    92,    87,    78,    18,   -25,    19,    14,     5,   nil,
-  -157,   nil,   -85,   -23,  -206,  -159,  -448,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   -89,   nil,  -552,  -564,   nil,  -170,
-   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,  -197,   nil,
-  -425,  -236,  -335,  -579,  -575,   -33,   -54,   nil,    -5,   -43,
-   -26,   nil,   -40,   nil,   nil,   nil,   -24,   nil,     9,   -20,
-   nil,   -42,   -32,   nil,   -46,   -40,   -39,   -38,   -91,   -34,
-  -339,   -61,   -29,   -56,   -49,    16,    -9,   -37,   -43,   nil,
-    -4,    -3,    -2,    -1,     0,     1,     2,     3,     4,     5,
-     6,     7,    17,    18,   -96,   -32,    29,   nil,    46,   -79,
-   -67,   nil,   -20,  -383,  -434,  -311,  -354,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,   nil,   nil,  -440,   nil,  -402 ]
-
-racc_goto_default = [
-   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,   nil,
-   nil,   nil,   nil,   nil,   nil,   nil,   nil,   539,   nil,    85,
-   nil,    89,   nil,   143,   nil,   nil,   nil,   524,   525,   527,
-   528,   530,   533,   536,    93,   538,   nil,   nil,   514,   516,
-   291,   294,   297,   301,   305,   308,   313,   318,   nil,   274,
-   nil,   nil,   nil,   nil,   615,   616,   617,    50,    52,    37,
-    39,    42,   nil,   107,    44,    45,    46,    47,   nil,   nil,
-    61,   nil,    41,    43,   106,   nil,   nil,   nil,   nil,   nil,
-   130,    72,    74,   nil,   nil,   292,   295,   299,   302,   127,
-   312,   317,   282,   nil,   nil,   nil,   nil,   nil,   nil,   304,
-   307,   311,   316,   280,   285,   nil,    80,    83,    86,    88,
-    90,    94,    99,   nil,   nil,   nil,   414,   290,   293,   296,
-   300,   303,   306,   310,   315,   279,   529,   532,   535,   nil ]
-
-racc_token_table = {
- false => 0,
- Object.new => 1,
- :UMINUS => 2,
- :UPLUS => 3,
- "*" => 4,
- "/" => 5,
- "+" => 6,
- "-" => 7,
- :SYM_EQ => 8,
- :SYM_NE => 9,
- :SYM_LT => 10,
- :SYM_START_DBLOCK => 11,
- :SYM_START_CBLOCK => 12,
- :SYM_GT => 13,
- :SYM_END_CBLOCK => 14,
- :SYM_END_DBLOCK => 15,
- :SYM_LE => 16,
- :SYM_GE => 17,
- :EOF => 18,
- :V_ARCHETYPE_ID => 19,
- :SYM_ARCHETYPE => 20,
- :Left_parenthesis_code => 21,
- :Right_parenthesis_code => 22,
- :Semicolon_code => 23,
- :SYM_ADL_VERSION => 24,
- :V_VERSION_STRING => 25,
- :SYM_IS_CONTROLLED => 26,
- :SYM_SPECIALIZE => 27,
- :SYM_CONCEPT => 28,
- :V_LOCAL_TERM_CODE_REF => 29,
- :SYM_LANGUAGE => 30,
- :SYM_DESCRIPTION => 31,
- :SYM_DEFINITION => 32,
- :c_complx_object_head => 33,
- :SYM_MATCHES => 34,
- :START_REGEXP_BLOCK => 35,
- :REGEXP_BODY => 36,
- :END_REGEXP_BLOCK => 37,
- :ERR_C_DOMAIN_TYPE => 38,
- :START_V_C_DOMAIN_TYPE_BLOCK => 39,
- :END_V_C_DOMAIN_TYPE_BLOCK => 40,
- :SYM_USE_NODE => 41,
- :SYM_ALLOW_ARCHETYPE => 42,
- :Star_code => 43,
- :V_ATTRIBUTE_IDENTIFIER => 44,
- :SYM_INCLUDE => 45,
- :SYM_EXCLUDE => 46,
- ":" => 47,
- :SYM_INVARIANT => 48,
- :V_ASSERTION_TEXT => 49,
- :SYM_ONTOLOGY => 50,
- :Left_bracket_code => 51,
- :Right_bracket_code => 52,
- :V_TYPE_IDENTIFIER => 53,
- :V_GENERIC_TYPE_IDENTIFIER => 54,
- :V_STRING => 55,
- :Comma_code => 56,
- :SYM_LIST_CONTINUE => 57,
- :V_INTEGER => 58,
- :Plus_code => 59,
- :Minus_code => 60,
- :SYM_INTERVAL_DELIM => 61,
- :SYM_ELLIPSIS => 62,
- :V_REAL => 63,
- :SYM_TRUE => 64,
- :SYM_FALSE => 65,
- :V_CHARACTER => 66,
- :V_ISO8601_EXTENDED_DATE => 67,
- :V_ISO8601_EXTENDED_TIME => 68,
- :V_ISO8601_EXTENDED_DATE_TIME => 69,
- :V_ISO8601_DURATION => 70,
- :V_QUALIFIED_TERM_CODE_REF => 71,
- :V_URI => 72,
- :SYM_EXISTS => 73,
- :SYM_NOT => 74,
- "=" => 75,
- :SYM_AND => 76,
- :SYM_OR => 77,
- :SYM_XOR => 78,
- :SYM_IMPLIES => 79,
- :Slash_code => 80,
- "^" => 81,
- :SYM_EXISTENCE => 82,
- :SYM_CARDINALITY => 83,
- :SYM_ORDERED => 84,
- :SYM_UNORDERED => 85,
- :SYM_UNIQUE => 86,
- :SYM_OCCURRENCES => 87,
- :V_ISO8601_DATE_CONSTRAINT_PATTERN => 88,
- :V_ISO8601_TIME_CONSTRAINT_PATTERN => 89,
- :V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN => 90,
- :START_TERM_CODE_CONSTRAINT => 91,
- :END_TERM_CODE_CONSTRAINT => 92,
- :TERM_CODE => 93,
- :V_ISO8601_DURATION_CONSTRAINT_PATTERN => 94 }
-
-racc_use_result_var = true
-
-racc_nt_base = 95
-
-Racc_arg = [
- racc_action_table,
- racc_action_check,
- racc_action_default,
- racc_action_pointer,
- racc_goto_table,
- racc_goto_check,
- racc_goto_default,
- racc_goto_pointer,
- racc_nt_base,
- racc_reduce_table,
- racc_token_table,
- racc_shift_n,
- racc_reduce_n,
- racc_use_result_var ]
-
-Racc_token_to_s_table = [
-'$end',
-'error',
-'UMINUS',
-'UPLUS',
-'"*"',
-'"/"',
-'"+"',
-'"-"',
-'SYM_EQ',
-'SYM_NE',
-'SYM_LT',
-'SYM_START_DBLOCK',
-'SYM_START_CBLOCK',
-'SYM_GT',
-'SYM_END_CBLOCK',
-'SYM_END_DBLOCK',
-'SYM_LE',
-'SYM_GE',
-'EOF',
-'V_ARCHETYPE_ID',
-'SYM_ARCHETYPE',
-'Left_parenthesis_code',
-'Right_parenthesis_code',
-'Semicolon_code',
-'SYM_ADL_VERSION',
-'V_VERSION_STRING',
-'SYM_IS_CONTROLLED',
-'SYM_SPECIALIZE',
-'SYM_CONCEPT',
-'V_LOCAL_TERM_CODE_REF',
-'SYM_LANGUAGE',
-'SYM_DESCRIPTION',
-'SYM_DEFINITION',
-'c_complx_object_head',
-'SYM_MATCHES',
-'START_REGEXP_BLOCK',
-'REGEXP_BODY',
-'END_REGEXP_BLOCK',
-'ERR_C_DOMAIN_TYPE',
-'START_V_C_DOMAIN_TYPE_BLOCK',
-'END_V_C_DOMAIN_TYPE_BLOCK',
-'SYM_USE_NODE',
-'SYM_ALLOW_ARCHETYPE',
-'Star_code',
-'V_ATTRIBUTE_IDENTIFIER',
-'SYM_INCLUDE',
-'SYM_EXCLUDE',
-'":"',
-'SYM_INVARIANT',
-'V_ASSERTION_TEXT',
-'SYM_ONTOLOGY',
-'Left_bracket_code',
-'Right_bracket_code',
-'V_TYPE_IDENTIFIER',
-'V_GENERIC_TYPE_IDENTIFIER',
-'V_STRING',
-'Comma_code',
-'SYM_LIST_CONTINUE',
-'V_INTEGER',
-'Plus_code',
-'Minus_code',
-'SYM_INTERVAL_DELIM',
-'SYM_ELLIPSIS',
-'V_REAL',
-'SYM_TRUE',
-'SYM_FALSE',
-'V_CHARACTER',
-'V_ISO8601_EXTENDED_DATE',
-'V_ISO8601_EXTENDED_TIME',
-'V_ISO8601_EXTENDED_DATE_TIME',
-'V_ISO8601_DURATION',
-'V_QUALIFIED_TERM_CODE_REF',
-'V_URI',
-'SYM_EXISTS',
-'SYM_NOT',
-'"="',
-'SYM_AND',
-'SYM_OR',
-'SYM_XOR',
-'SYM_IMPLIES',
-'Slash_code',
-'"^"',
-'SYM_EXISTENCE',
-'SYM_CARDINALITY',
-'SYM_ORDERED',
-'SYM_UNORDERED',
-'SYM_UNIQUE',
-'SYM_OCCURRENCES',
-'V_ISO8601_DATE_CONSTRAINT_PATTERN',
-'V_ISO8601_TIME_CONSTRAINT_PATTERN',
-'V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN',
-'START_TERM_CODE_CONSTRAINT',
-'END_TERM_CODE_CONSTRAINT',
-'TERM_CODE',
-'V_ISO8601_DURATION_CONSTRAINT_PATTERN',
-'$start',
-'input',
-'archetype',
-'arch_identification',
-'arch_specialisation',
-'arch_concept',
-'arch_language',
-'arch_description',
-'arch_definition',
-'arch_invariant',
-'arch_ontology',
-'arch_head',
-'arch_meta_data',
-'arch_meta_data_items',
-'arch_meta_data_item',
-'dadl_section',
-'cadl_section',
-'c_complex_object',
-'assertions',
-'c_complex_object_head',
-'c_complex_object_body',
-'c_complex_object_id',
-'c_occurrences',
-'type_identifier',
-'c_any',
-'c_attributes',
-'c_object',
-'v_c_domain_type',
-'archetype_internal_ref',
-'archetype_slot',
-'constraint_ref',
-'c_code_phrase',
-'c_ordinal',
-'c_primitive_object',
-'absolute_path',
-'c_archetype_slot_head',
-'c_includes',
-'c_excludes',
-'c_archetype_slot_id',
-'c_primitive',
-'c_integer',
-'c_real',
-'c_date',
-'c_time',
-'c_date_time',
-'c_duration',
-'c_string',
-'c_boolean',
-'c_attribute',
-'c_attr_head',
-'c_attr_values',
-'c_existence',
-'c_cardinality',
-'invariants',
-'invariant',
-'any_identifier',
-'boolean_expression',
-'dadl_input',
-'attr_vals',
-'complex_object_block',
-'attr_val',
-'attr_id',
-'object_block',
-'primitive_object_block',
-'single_attr_object_block',
-'multiple_attr_object_block',
-'untyped_multiple_attr_object_block',
-'multiple_attr_object_block_head',
-'keyed_objects',
-'keyed_object',
-'object_key',
-'simple_value',
-'untyped_single_attr_object_block',
-'single_attr_object_complex_head',
-'untyped_primitive_object_block',
-'primitive_object_value',
-'simple_list_value',
-'simple_interval_value',
-'term_code',
-'term_code_list_value',
-'string_value',
-'integer_value',
-'real_value',
-'boolean_value',
-'character_value',
-'date_value',
-'time_value',
-'date_time_value',
-'duration_value',
-'uri_value',
-'string_list_value',
-'integer_list_value',
-'real_list_value',
-'boolean_list_value',
-'character_list_value',
-'date_list_value',
-'time_list_value',
-'date_time_list_value',
-'duration_list_value',
-'integer_interval_value',
-'real_interval_value',
-'date_interval_value',
-'time_interval_value',
-'date_time_interval_value',
-'duration_interval_value',
-'assertion',
-'boolean_leaf',
-'boolean_node',
-'relative_path',
-'arithmetic_expression',
-'arithmetic_leaf',
-'arithmetic_node',
-'path_segment',
-'existence_spec',
-'cardinality_spec',
-'occurrence_spec',
-'cardinality_limit_value',
-'c_integer_spec',
-'c_real_spec',
-'c_date_constraint',
-'c_time_constraint',
-'c_date_time_constraint',
-'c_duration_constraint',
-'duration_pattern',
-'c_string_spec',
-'c_boolean_spec',
-'c_ordinal_spec',
-'ordinal',
-'term_code_constraint_section',
-'term_code_body']
-
-Racc_debug_parser = false
-
-##### racc system variables end #####
-
- # reduce 0 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 32
-  def _reduce_1( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
- # reduce 2 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 57
-  def _reduce_3( val, _values, result )
-    assert_at(__FILE__,__LINE__) do
-      val[4].instance_of?(OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION) and val[5].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT) and val[7].instance_of?(OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY) 
-    end
-    
-    archetype_id = val[0][:archetype_id]
-    adl_version = val[0][:arch_head][:arch_meta_data][:adl_version]
-    concept = val[2]
-    language = val[3][:arch_language]
-    archetype = OpenEHR::AM::Archetype::ARCHETYPE.create(
-                                                         :archetype_id => archetype_id,
-                                                         :adl_version => adl_version,
-                                                         :concept => concept,
-                                                         :description => val[4],
-                                                         :definition => val[5],
-                                                         :ontology => val[7]
-                                                         ) do |archetype|
-      archetype.original_language = language
-    end
-    @@log.info("#{__FILE__}:#{__LINE__}: archetype = #{archetype} at #{@filename}:#{@lineno}")
-    result = archetype
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 63
-  def _reduce_4( val, _values, result )
-    result = {:arch_head => val[0], :archetype_id => val[1] }
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 67
-  def _reduce_5( val, _values, result )
-    raise
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 72
-  def _reduce_6( val, _values, result )
-    result = {:arch_meta_data => nil }
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 76
-  def _reduce_7( val, _values, result )
-    result = val[1]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 81
-  def _reduce_8( val, _values, result )
-    result = {:arch_meta_data => val[1] }
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 86
-  def _reduce_9( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 90
-  def _reduce_10( val, _values, result )
-    result = val[0].merge(val[2])
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 96
-  def _reduce_11( val, _values, result )
-    result = {:adl_version => val[2], :is_controlled => false }
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 100
-  def _reduce_12( val, _values, result )
-    result = {:is_controlled => true }
-   result
-  end
-.,.,
-
- # reduce 13 omitted
-
- # reduce 14 omitted
-
- # reduce 15 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 111
-  def _reduce_16( val, _values, result )
-    result = {:arch_concept => val[1] }
-   result
-  end
-.,.,
-
- # reduce 17 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 121
-  def _reduce_18( val, _values, result )
-    result = {:arch_language => nil}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 125
-  def _reduce_19( val, _values, result )
-    result = {:arch_language => val[1]}
-   result
-  end
-.,.,
-
- # reduce 20 omitted
-
- # reduce 21 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 136
-  def _reduce_22( val, _values, result )
-    result = OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION.new(:details => val[1])
-   result
-  end
-.,.,
-
- # reduce 23 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 144
-  def _reduce_24( val, _values, result )
-    result = val[1]
-   result
-  end
-.,.,
-
- # reduce 25 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 154
-  def _reduce_26( val, _values, result )
-    assert_at(__FILE__,__LINE__){val[0].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT)}
-    @@log.info("#{__FILE__}:#{__LINE__}: c_complex_object = #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 158
-  def _reduce_27( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 169
-  def _reduce_28( val, _values, result )
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.create(:attributes => val[3]) do |c_complex_object|
-      c_complex_object.node_id = val[0][:c_complex_object_id][:local_term_code_ref]
-      c_complex_object.rm_type_name = val[0][:c_complex_object_id][:type_identifier]
-      c_complex_object.occurrences = val[0][:c_occurrences]
-    end
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 177
-  def _reduce_29( val, _values, result )
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.create(:attributes => val[3]) do |c_complex_object|
-      c_complex_object.node_id = val[0][:c_complex_object_id][:local_term_code_ref]
-      c_complex_object.rm_type_name = val[0][:c_complex_object_id][:type_identifier]
-      c_complex_object.occurrences = val[0][:c_occurrences]
-    end
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 184
-  def _reduce_30( val, _values, result )
-    result = {:c_complex_object_id => val[0], :c_occurrences => val[1]}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 189
-  def _reduce_31( val, _values, result )
-    result = {:type_identifier => val[0]}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 193
-  def _reduce_32( val, _values, result )
-    result = {:type_identifier => val[0], :local_term_code_ref => val[1]}
-   result
-  end
-.,.,
-
- # reduce 33 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 199
-  def _reduce_34( val, _values, result )
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new(:attributes => val[0])
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 207
-  def _reduce_35( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 212
-  def _reduce_36( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: c_complex_object = #{val[0].inspect} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 220
-  def _reduce_37( val, _values, result )
-    result = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF.create do |archetype_internal_ref|
-      archetype_internal_ref.target_path = val[0][:absolute_path]
-      archetype_internal_ref.rm_type_name = val[0][:type_identifier]
-      archetype_internal_ref.occurrences = val[0][:c_occurrences]
-    end
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 224
-  def _reduce_38( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 230
-  def _reduce_39( val, _values, result )
-    result = OpenEHR::AM::Archetype::Constraint_Model::CONSTRAINT_REF.create do |constraint_ref|
-      constraint_ref.reference = val[0]
-    end
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 234
-  def _reduce_40( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 238
-  def _reduce_41( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 242
-  def _reduce_42( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
- # reduce 43 omitted
-
- # reduce 44 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 257
-  def _reduce_45( val, _values, result )
-    result = val[1]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 263
-  def _reduce_46( val, _values, result )
-    result = {:type_identifier => val[1], :c_occurrences => val[2], :absolute_path => val[3] }
-   result
-  end
-.,.,
-
- # reduce 47 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 275
-  def _reduce_48( val, _values, result )
-    result = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT.create do |archetype_slot|
-      archetype_slot.includes = val[3]
-      archetype_slot.excludes = val[4]
-      archetype_slot.rm_type_name = val[0][:c_archetype_slot_id]
-      archetype_slot.occurrences = val[0][:c_occurrences]
-    end
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 279
-  def _reduce_49( val, _values, result )
-    result = {:c_archetype_slot_id => val[0],:c_occurrences => val[1]}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 284
-  def _reduce_50( val, _values, result )
-    result = val[1]
-   result
-  end
-.,.,
-
- # reduce 51 omitted
-
- # reduce 52 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 295
-  def _reduce_53( val, _values, result )
-    assert_at(__FILE__,__LINE__){val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_PRIMITIVE)}
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_PRIMITIVE_OBJECT.create do |c_primitive_object|
-      c_primitive_object.item = val[0]
-    end
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 305
-  def _reduce_54( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: c_integer = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_INTEGER.create do |c_integer|
-      c_integer.list
-      c_integer.range
-      c_integer.assumed_value
-    end
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 310
-  def _reduce_55( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: c_real = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_REAL.new
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 315
-  def _reduce_56( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: c_date = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE.new
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 320
-  def _reduce_57( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: c_time = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_TIME.new
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 325
-  def _reduce_58( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: c_date_time = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME.new
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 330
-  def _reduce_59( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: c_duration = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DURATION.new
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 335
-  def _reduce_60( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: c_string = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_STRING.new
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 341
-  def _reduce_61( val, _values, result )
-    assert_at(__FILE__,__LINE__){val[0].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN)}
-    @@log.info("#{__FILE__}:#{__LINE__}: c_boolean = #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
- # reduce 62 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 351
-  def _reduce_63( val, _values, result )
-    result = [val[0]]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 355
-  def _reduce_64( val, _values, result )
-    result = (val[0] << val[1])
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 364
-  def _reduce_65( val, _values, result )
-    assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
-    c_attribute = val[0]
-    c_attribute.children = val[3]
-    result = c_attribute
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 369
-  def _reduce_66( val, _values, result )
-    assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 374
-  def _reduce_67( val, _values, result )
-    assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 385
-  def _reduce_68( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]}, c_existence = #{val[1]} at #{@filename}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE.new(
-                                                                              :rm_attribute_name => val[0],
-                                                                              :existence => val[1]
-                                                                              )
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 395
-  def _reduce_69( val, _values, result )
-    assert_at(__FILE__,__LINE__){ val[2].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY) }
-    @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER: #{val[0]}, c_existence = #{val[1]}, c_cardinality = #{val[2]} at #{@filename}") 
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE.new(
-                                                                                :rm_attribute_name => val[0],
-                                                                                :existence => val[1],
-                                                                                :cardinality => val[2]
-                                                                                )
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 400
-  def _reduce_70( val, _values, result )
-    result = Array[val[0]]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 404
-  def _reduce_71( val, _values, result )
-    result = (val[0] << val[1])
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 408
-  def _reduce_72( val, _values, result )
-    result = Array[val[0]]
-   result
-  end
-.,.,
-
- # reduce 73 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 416
-  def _reduce_74( val, _values, result )
-    result = val[1]
-   result
-  end
-.,.,
-
- # reduce 75 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 424
-  def _reduce_76( val, _values, result )
-    result = val[1]
-   result
-  end
-.,.,
-
- # reduce 77 omitted
-
- # reduce 78 omitted
-
- # reduce 79 omitted
-
- # reduce 80 omitted
-
- # reduce 81 omitted
-
- # reduce 82 omitted
-
- # reduce 83 omitted
-
- # reduce 84 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 445
-  def _reduce_85( val, _values, result )
-    dadl_section = val[1]
-    result = OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY.new
-   result
-  end
-.,.,
-
- # reduce 86 omitted
-
- # reduce 87 omitted
-
- # reduce 88 omitted
-
- # reduce 89 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 459
-  def _reduce_90( val, _values, result )
-    result = Array[val[0]]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 463
-  def _reduce_91( val, _values, result )
-    result = (val[0] << val[1])
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 467
-  def _reduce_92( val, _values, result )
-    result = (val[0] << val[2])
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 473
-  def _reduce_93( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: attr_id = #{val[0]}, object_block = #{val[2]} at #{@filename}:#{@lineno}")
-    result = {:attr_id => val[0], :object_block => val[2]}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 479
-  def _reduce_94( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
- # reduce 95 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 485
-  def _reduce_96( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 489
-  def _reduce_97( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 494
-  def _reduce_98( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 498
-  def _reduce_99( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 503
-  def _reduce_100( val, _values, result )
-    result = {:untyped_multiple_attr_object_block => val[0]}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 507
-  def _reduce_101( val, _values, result )
-    result = {:type_identifier => val[0], :untyped_multiple_attr_object_block => val[1]}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 512
-  def _reduce_102( val, _values, result )
-    result = {:multiple_attr_object_block_head => val[0], :keyed_objects => val[1]}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 518
-  def _reduce_103( val, _values, result )
-    @@log.info("SYM_START_DBLOCK: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 523
-  def _reduce_104( val, _values, result )
-    result = Array[val[0]]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 527
-  def _reduce_105( val, _values, result )
-    result = (val[0] << val[1])
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 533
-  def _reduce_106( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: keyed_object = #{val[0]}, object_block = #{val[2]} at #{@filename}:#{@lineno}")
-    result = {:object_key => val[0], :object_block => val[1]}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 539
-  def _reduce_107( val, _values, result )
-    @@log.info("object_key: [#{val[1]}] at #{@filename}:#{@lineno}")
-    result = val[1]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 544
-  def _reduce_108( val, _values, result )
-    result = {:untyped_single_attr_object_block => val[0]}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 548
-  def _reduce_109( val, _values, result )
-    result = {:type_identifier => val[0], :untyped_single_attr_object_block => val[1]}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 554
-  def _reduce_110( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: single_attr_object_complex_head = #{val[0]} at #{@filename}:#{@lineno}")
-    result = {:single_attr_object_complex_head => val[0]}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 559
-  def _reduce_111( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: single_attr_object_complex_head = #{val[0]}, attr_vals = #{val[1]} at #{@filename}:#{@lineno}")
-    result = {:single_attr_object_complex_head => val[0], :attr_vals => val[1]}
-   result
-  end
-.,.,
-
- # reduce 112 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 565
-  def _reduce_113( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: untyped_primitive_object_block = #{val[0]} at #{@filename}:#{@lineno}")
-    result = {:untyped_primitive_object_block => val[0]}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 570
-  def _reduce_114( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: type_identifier = #{val[0]}, untyped_primitive_object_block = #{val[1]} at #{@filename}:#{@lineno}")
-    result = {:type_identifier => val[0], :untyped_primitive_object_block => val[1]}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 575
-  def _reduce_115( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: primitive_object_block = <#{val[1]}> at #{@filename}:#{@lineno}")
-    result = val[1]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 579
-  def _reduce_116( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 583
-  def _reduce_117( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 587
-  def _reduce_118( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 591
-  def _reduce_119( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 595
-  def _reduce_120( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 600
-  def _reduce_121( val, _values, result )
-    @@log.info("string_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 605
-  def _reduce_122( val, _values, result )
-    @@log.info("integer_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 610
-  def _reduce_123( val, _values, result )
-    @@log.info("real_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 615
-  def _reduce_124( val, _values, result )
-    @@log.info("boolean_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 620
-  def _reduce_125( val, _values, result )
-    @@log.info("character_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 625
-  def _reduce_126( val, _values, result )
-    @@log.info("date_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 630
-  def _reduce_127( val, _values, result )
-    @@log.info("time_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 635
-  def _reduce_128( val, _values, result )
-    @@log.info("date_time_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 640
-  def _reduce_129( val, _values, result )
-    @@log.info("duration_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 645
-  def _reduce_130( val, _values, result )
-    @@log.info("uri_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
- # reduce 131 omitted
-
- # reduce 132 omitted
-
- # reduce 133 omitted
-
- # reduce 134 omitted
-
- # reduce 135 omitted
-
- # reduce 136 omitted
-
- # reduce 137 omitted
-
- # reduce 138 omitted
-
- # reduce 139 omitted
-
- # reduce 140 omitted
-
- # reduce 141 omitted
-
- # reduce 142 omitted
-
- # reduce 143 omitted
-
- # reduce 144 omitted
-
- # reduce 145 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 668
-  def _reduce_146( val, _values, result )
-    @@log.info("V_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 673
-  def _reduce_147( val, _values, result )
-    @@log.info("V_GENERIC_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 679
-  def _reduce_148( val, _values, result )
-    @@log.info("V_STRING: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
- # reduce 149 omitted
-
- # reduce 150 omitted
-
- # reduce 151 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 693
-  def _reduce_152( val, _values, result )
-    begin
-      integer = Integer(val[0])
-    rescue
-      raise
-    end
-    result = integer
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 702
-  def _reduce_153( val, _values, result )
-    begin
-      integer = Integer(val[0])
-    rescue
-      raise
-    end
-    result = integer
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 711
-  def _reduce_154( val, _values, result )
-    begin
-      integer = Integer(val[0])
-    rescue
-      raise
-    end
-    result = - integer
-   result
-  end
-.,.,
-
- # reduce 155 omitted
-
- # reduce 156 omitted
-
- # reduce 157 omitted
-
- # reduce 158 omitted
-
- # reduce 159 omitted
-
- # reduce 160 omitted
-
- # reduce 161 omitted
-
- # reduce 162 omitted
-
- # reduce 163 omitted
-
- # reduce 164 omitted
-
- # reduce 165 omitted
-
- # reduce 166 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 737
-  def _reduce_167( val, _values, result )
-    begin
-      real = Float(val[0])
-    rescue
-      raise
-    end
-    result = real
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 746
-  def _reduce_168( val, _values, result )
-    begin
-      real = Float(val[1])
-    rescue
-      raise
-    end
-    result = real
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 755
-  def _reduce_169( val, _values, result )
-    begin
-      real = Float(val[1])
-    rescue
-      raise
-    end
-    result = - real
-   result
-  end
-.,.,
-
- # reduce 170 omitted
-
- # reduce 171 omitted
-
- # reduce 172 omitted
-
- # reduce 173 omitted
-
- # reduce 174 omitted
-
- # reduce 175 omitted
-
- # reduce 176 omitted
-
- # reduce 177 omitted
-
- # reduce 178 omitted
-
- # reduce 179 omitted
-
- # reduce 180 omitted
-
- # reduce 181 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 775
-  def _reduce_182( val, _values, result )
-    result = true
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 779
-  def _reduce_183( val, _values, result )
-    result = false
-   result
-  end
-.,.,
-
- # reduce 184 omitted
-
- # reduce 185 omitted
-
- # reduce 186 omitted
-
- # reduce 187 omitted
-
- # reduce 188 omitted
-
- # reduce 189 omitted
-
- # reduce 190 omitted
-
- # reduce 191 omitted
-
- # reduce 192 omitted
-
- # reduce 193 omitted
-
- # reduce 194 omitted
-
- # reduce 195 omitted
-
- # reduce 196 omitted
-
- # reduce 197 omitted
-
- # reduce 198 omitted
-
- # reduce 199 omitted
-
- # reduce 200 omitted
-
- # reduce 201 omitted
-
- # reduce 202 omitted
-
- # reduce 203 omitted
-
- # reduce 204 omitted
-
- # reduce 205 omitted
-
- # reduce 206 omitted
-
- # reduce 207 omitted
-
- # reduce 208 omitted
-
- # reduce 209 omitted
-
- # reduce 210 omitted
-
- # reduce 211 omitted
-
- # reduce 212 omitted
-
- # reduce 213 omitted
-
- # reduce 214 omitted
-
- # reduce 215 omitted
-
- # reduce 216 omitted
-
- # reduce 217 omitted
-
- # reduce 218 omitted
-
- # reduce 219 omitted
-
- # reduce 220 omitted
-
- # reduce 221 omitted
-
- # reduce 222 omitted
-
- # reduce 223 omitted
-
- # reduce 224 omitted
-
- # reduce 225 omitted
-
- # reduce 226 omitted
-
- # reduce 227 omitted
-
- # reduce 228 omitted
-
- # reduce 229 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 843
-  def _reduce_230( val, _values, result )
-    @@log.info("V_ISO8601_DURATION: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
- # reduce 231 omitted
-
- # reduce 232 omitted
-
- # reduce 233 omitted
-
- # reduce 234 omitted
-
- # reduce 235 omitted
-
- # reduce 236 omitted
-
- # reduce 237 omitted
-
- # reduce 238 omitted
-
- # reduce 239 omitted
-
- # reduce 240 omitted
-
- # reduce 241 omitted
-
- # reduce 242 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 863
-  def _reduce_243( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: V_QUALIFIED_TERM_CODE_REF = #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
- # reduce 244 omitted
-
- # reduce 245 omitted
-
- # reduce 246 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 873
-  def _reduce_247( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: V_URI = #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
- # reduce 248 omitted
-
- # reduce 249 omitted
-
- # reduce 250 omitted
-
- # reduce 251 omitted
-
- # reduce 252 omitted
-
- # reduce 253 omitted
-
- # reduce 254 omitted
-
- # reduce 255 omitted
-
- # reduce 256 omitted
-
- # reduce 257 omitted
-
- # reduce 258 omitted
-
- # reduce 259 omitted
-
- # reduce 260 omitted
-
- # reduce 261 omitted
-
- # reduce 262 omitted
-
- # reduce 263 omitted
-
- # reduce 264 omitted
-
- # reduce 265 omitted
-
- # reduce 266 omitted
-
- # reduce 267 omitted
-
- # reduce 268 omitted
-
- # reduce 269 omitted
-
- # reduce 270 omitted
-
- # reduce 271 omitted
-
- # reduce 272 omitted
-
- # reduce 273 omitted
-
- # reduce 274 omitted
-
- # reduce 275 omitted
-
- # reduce 276 omitted
-
- # reduce 277 omitted
-
- # reduce 278 omitted
-
- # reduce 279 omitted
-
- # reduce 280 omitted
-
- # reduce 281 omitted
-
- # reduce 282 omitted
-
- # reduce 283 omitted
-
- # reduce 284 omitted
-
- # reduce 285 omitted
-
- # reduce 286 omitted
-
- # reduce 287 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 942
-  def _reduce_288( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}")
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 946
-  def _reduce_289( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}")
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 957
-  def _reduce_290( val, _values, result )
-    result = Range.new(1,1)
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 961
-  def _reduce_291( val, _values, result )
-    result = val[3]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 971
-  def _reduce_292( val, _values, result )
-    begin
-      integer = Integer(val[0])
-    rescue
-      raise
-    end
-    result = integer
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 981
-  def _reduce_293( val, _values, result )
-    begin
-      from_integer = Integer(val[0])
-      to_integer = Integer(val[2])
-    rescue
-      raise
-    end
-    result = Range.new(from_integer,to_integer)
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 986
-  def _reduce_294( val, _values, result )
-    result = OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY.new
-   result
-  end
-.,.,
-
- # reduce 295 omitted
-
- # reduce 296 omitted
-
- # reduce 297 omitted
-
- # reduce 298 omitted
-
- # reduce 299 omitted
-
- # reduce 300 omitted
-
- # reduce 301 omitted
-
- # reduce 302 omitted
-
- # reduce 303 omitted
-
- # reduce 304 omitted
-
- # reduce 305 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 1005
-  def _reduce_306( val, _values, result )
-    result = val[3]
-   result
-  end
-.,.,
-
- # reduce 307 omitted
-
- # reduce 308 omitted
-
- # reduce 309 omitted
-
- # reduce 310 omitted
-
- # reduce 311 omitted
-
- # reduce 312 omitted
-
- # reduce 313 omitted
-
- # reduce 314 omitted
-
- # reduce 315 omitted
-
- # reduce 316 omitted
-
- # reduce 317 omitted
-
- # reduce 318 omitted
-
- # reduce 319 omitted
-
- # reduce 320 omitted
-
- # reduce 321 omitted
-
- # reduce 322 omitted
-
- # reduce 323 omitted
-
- # reduce 324 omitted
-
- # reduce 325 omitted
-
- # reduce 326 omitted
-
- # reduce 327 omitted
-
- # reduce 328 omitted
-
- # reduce 329 omitted
-
- # reduce 330 omitted
-
- # reduce 331 omitted
-
- # reduce 332 omitted
-
- # reduce 333 omitted
-
- # reduce 334 omitted
-
- # reduce 335 omitted
-
- # reduce 336 omitted
-
- # reduce 337 omitted
-
- # reduce 338 omitted
-
- # reduce 339 omitted
-
- # reduce 340 omitted
-
- # reduce 341 omitted
-
- # reduce 342 omitted
-
- # reduce 343 omitted
-
- # reduce 344 omitted
-
- # reduce 345 omitted
-
- # reduce 346 omitted
-
- # reduce 347 omitted
-
- # reduce 348 omitted
-
- # reduce 349 omitted
-
- # reduce 350 omitted
-
- # reduce 351 omitted
-
- # reduce 352 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 1075
-  def _reduce_353( val, _values, result )
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true)
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 1079
-  def _reduce_354( val, _values, result )
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => false)
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 1083
-  def _reduce_355( val, _values, result )
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true,:false_valid => false)
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 1087
-  def _reduce_356( val, _values, result )
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => false,:false_valid => true)
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 1092
-  def _reduce_357( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 1096
-  def _reduce_358( val, _values, result )
-    raise 'Not implemented yet'
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 1100
-  def _reduce_359( val, _values, result )
-    raise 'Not implemented yet'
-   result
-  end
-.,.,
-
- # reduce 360 omitted
-
- # reduce 361 omitted
-
- # reduce 362 omitted
-
- # reduce 363 omitted
-
- # reduce 364 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 1113
-  def _reduce_365( val, _values, result )
-    @in_interval = false
-    @@log.info("#{__FILE__}:#{__LINE__}, #{val[0]}|#{val[2]} at #{@filename}")
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 1119
-  def _reduce_366( val, _values, result )
-      result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 1123
-  def _reduce_367( val, _values, result )
-      result = val[0]
-   result
-  end
-.,.,
-
- # reduce 368 omitted
-
- # reduce 369 omitted
-
- # reduce 370 omitted
-
- # reduce 371 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 1138
-  def _reduce_372( val, _values, result )
-      result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 1143
-  def _reduce_373( val, _values, result )
-      result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 1148
-  def _reduce_374( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{word} at #{@filename}")
-      result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 1158
-  def _reduce_375( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
- def _reduce_none( val, _values, result )
-  result
- end
-
-    end   # class Parser
-
-  end   # module ADL
-
-end   # module OpenEHR
Index: ruby/trunk/lib/adl_parser/parser.y
===================================================================
--- ruby/trunk/lib/adl_parser/parser.y	(revision 48)
+++ 	(revision )
@@ -1,1972 +1,0 @@
-
-class OpenEHR::ADL::Parser
-
-#options omit_action_call
-
-prechigh
-
-  nonassoc UMINUS UPLUS
-  left '*' '/'
-  left '+' '-'
-
-  nonassoc SYM_EQ
-  nonassoc SYM_NE
-  nonassoc SYM_LT
-  nonassoc SYM_START_DBLOCK
-  nonassoc SYM_START_CBLOCK
-  nonassoc SYM_GT
-  nonassoc SYM_END_CBLOCK
-  nonassoc SYM_END_DBLOCK
-  nonassoc SYM_LE
-  nonassoc SYM_GE
-
-preclow
-
-
-rule
-### http://svn.openehr.org/ref_impl_eiffel/TRUNK/components/adl_parser/src/syntax/adl/parser/adl_validator.y
-
-input: archetype EOF
-  { 
-    result = val[0]
-  }
-  | error
-
-archetype: arch_identification arch_specialisation arch_concept arch_language arch_description arch_definition arch_invariant arch_ontology
-  { 
-    assert_at(__FILE__,__LINE__) do
-      val[4].instance_of?(OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION) and val[5].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT) and val[7].instance_of?(OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY) 
-    end
-    
-    archetype_id = val[0][:archetype_id]
-    adl_version = val[0][:arch_head][:arch_meta_data][:adl_version]
-    concept = val[2]
-    language = val[3][:arch_language]
-    archetype = OpenEHR::AM::Archetype::ARCHETYPE.create(
-                                                         :archetype_id => archetype_id,
-                                                         :adl_version => adl_version,
-                                                         :concept => concept,
-                                                         :description => val[4],
-                                                         :definition => val[5],
-                                                         :ontology => val[7]
-                                                         ) do |archetype|
-      archetype.original_language = language
-    end
-    @@log.info("#{__FILE__}:#{__LINE__}: archetype = #{archetype} at #{@filename}:#{@lineno}")
-    result = archetype
-  }
-
-
-arch_identification: arch_head V_ARCHETYPE_ID
-  { 
-    result = {:arch_head => val[0], :archetype_id => val[1] }
-  }
-  | SYM_ARCHETYPE error
-  { 
-    raise
-  }
-
-arch_head: SYM_ARCHETYPE
-  { 
-    result = {:arch_meta_data => nil }
-  }
-  | SYM_ARCHETYPE arch_meta_data
-  { 
-    result = val[1]
-  }
-
-arch_meta_data: Left_parenthesis_code arch_meta_data_items Right_parenthesis_code
-  { 
-    result = {:arch_meta_data => val[1] }
-  }
-
-arch_meta_data_items: arch_meta_data_item
-  { 
-    result = val[0]
-  }
-  | arch_meta_data_items Semicolon_code arch_meta_data_item
-  { 
-    result = val[0].merge(val[2])
-  }
-
-
-arch_meta_data_item: SYM_ADL_VERSION SYM_EQ V_VERSION_STRING
-  { 
-    result = {:adl_version => val[2], :is_controlled => false }
-  }
-  | SYM_IS_CONTROLLED
-  { 
-    result = {:is_controlled => true }
-  }
-
-# Define specialization in which its constraints are narrower than those of the parent.
-# Any data created via the use of the specialized archetype shall be conformant both to it and its parent.
-arch_specialisation: #-- empty is ok
-  | SYM_SPECIALIZE V_ARCHETYPE_ID
-  | SYM_SPECIALIZE error
-
-arch_concept: SYM_CONCEPT V_LOCAL_TERM_CODE_REF
-  { 
-    result = {:arch_concept => val[1] }
-  }
-  | SYM_CONCEPT error
-
-#arch_language: #-- empty is ok for ADL 1.4 tools
-#    | SYM_LANGUAGE V_DADL_TEXT
-#  | SYM_LANGUAGE error
-
-arch_language: #-- empty is ok for ADL 1.4 tools
-  {
-    result = {:arch_language => nil}
-  }
-    | SYM_LANGUAGE dadl_section
-  {
-    result = {:arch_language => val[1]}
-  }
-  | SYM_LANGUAGE error
-
-#arch_description: #-- no meta-data ok
-#    | SYM_DESCRIPTION V_DADL_TEXT
-#  | SYM_DESCRIPTION error
-
-arch_description: #-- no meta-data ok
-    | SYM_DESCRIPTION dadl_section
-  { 
-    result = OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION.new(:details => val[1])
-  }
-  | SYM_DESCRIPTION error
-  
-#arch_definition: SYM_DEFINITION V_CADL_TEXT
-#  | SYM_DEFINITION error
-arch_definition: SYM_DEFINITION cadl_section
-  { 
-    result = val[1]
-  }
-  | SYM_DEFINITION error
-
-
-### cADL section
-cadl_section: c_complex_object
-  {
-    assert_at(__FILE__,__LINE__){val[0].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT)}
-    @@log.info("#{__FILE__}:#{__LINE__}: c_complex_object = #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-  }
-  | assertions
-  { 
-    result = val[0]
-  }
-#  | error
-
-#c_complex_object: c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body SYM_END_CBLOCK
-c_complex_object: c_complx_object_head SYM_MATCHES START_REGEXP_BLOCK REGEXP_BODY END_REGEXP_BLOCK # added by akimichi
-  { 
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.create(:attributes => val[3]) do |c_complex_object|
-      c_complex_object.node_id = val[0][:c_complex_object_id][:local_term_code_ref]
-      c_complex_object.rm_type_name = val[0][:c_complex_object_id][:type_identifier]
-      c_complex_object.occurrences = val[0][:c_occurrences]
-    end
-  }
-    | c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body SYM_END_CBLOCK
-  { 
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.create(:attributes => val[3]) do |c_complex_object|
-      c_complex_object.node_id = val[0][:c_complex_object_id][:local_term_code_ref]
-      c_complex_object.rm_type_name = val[0][:c_complex_object_id][:type_identifier]
-      c_complex_object.occurrences = val[0][:c_occurrences]
-    end
-  }
-#    | c_complex_object_head error SYM_END_CBLOCK
-#    | c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body c_invariants SYM_END_CBLOCK
-
-c_complex_object_head: c_complex_object_id c_occurrences
-  {
-    result = {:c_complex_object_id => val[0], :c_occurrences => val[1]}
-  }
-
-c_complex_object_id: type_identifier
-  {
-    result = {:type_identifier => val[0]}
-  }
-  | type_identifier V_LOCAL_TERM_CODE_REF
-  {
-    result = {:type_identifier => val[0], :local_term_code_ref => val[1]}
-  }
-
-c_complex_object_body: c_any #-- used to indicate that any value of a type is ok
-  | c_attributes
-  { 
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new(:attributes => val[0])
-  }
-
-
-#------------------------- node types -----------------------
-
-c_object: v_c_domain_type
-  {
-    result = val[0]
-  }
-  | c_complex_object
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: c_complex_object = #{val[0].inspect} at #{@filename}:#{@lineno}")
-    result = val[0]
-  }
-  | archetype_internal_ref
-  {
-    result = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF.create do |archetype_internal_ref|
-      archetype_internal_ref.target_path = val[0][:absolute_path]
-      archetype_internal_ref.rm_type_name = val[0][:type_identifier]
-      archetype_internal_ref.occurrences = val[0][:c_occurrences]
-    end
-  }
-  | archetype_slot
-  {
-    result = val[0]
-  }
-  | constraint_ref
-  {
-    result = OpenEHR::AM::Archetype::Constraint_Model::CONSTRAINT_REF.create do |constraint_ref|
-      constraint_ref.reference = val[0]
-    end
-  }
-  | c_code_phrase
-  {
-    result = val[0]
-  }
-  | c_ordinal
-  {
-    result = val[0]
-  }
-  | c_primitive_object
-  {
-    result = val[0]
-  }
-#  | v_c_domain_type
-#  | V_C_DOMAIN_TYPE
-  #   this is an attempt to match a dADL section inside cADL. It will
-  #   probably never work 100% properly since there can be '>' inside "||"
-  #   ranges, and also strings containing any character, e.g. units string
-  #   contining "{}" chars. The real solution is to use the dADL parser on
-  #   the buffer from the current point on and be able to fast-forward the
-  #   cursor to the last character matched by the dADL scanner
-  | ERR_C_DOMAIN_TYPE
-  | error
-
-v_c_domain_type: START_V_C_DOMAIN_TYPE_BLOCK dadl_section END_V_C_DOMAIN_TYPE_BLOCK
-  { 
-    result = val[1]
-  }
-
-# 'archetype_internal_ref' is a node that refers to a previously defined object node in the same archetype.
-archetype_internal_ref: SYM_USE_NODE type_identifier c_occurrences absolute_path
-  {
-    result = {:type_identifier => val[1], :c_occurrences => val[2], :absolute_path => val[3] }
-  }
-  | SYM_USE_NODE type_identifier error
-
-# 'archetype_slot' is a node whose statements define a constraint that determines which other archetypes may appear at that point in the current archetype.
-archetype_slot: c_archetype_slot_head SYM_MATCHES SYM_START_CBLOCK c_includes c_excludes SYM_END_CBLOCK
-  {
-    result = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT.create do |archetype_slot|
-      archetype_slot.includes = val[3]
-      archetype_slot.excludes = val[4]
-      archetype_slot.rm_type_name = val[0][:c_archetype_slot_id]
-      archetype_slot.occurrences = val[0][:c_occurrences]
-    end
-  }
-c_archetype_slot_head: c_archetype_slot_id c_occurrences
-  {
-    result = {:c_archetype_slot_id => val[0],:c_occurrences => val[1]}
-  }
-
-c_archetype_slot_id: SYM_ALLOW_ARCHETYPE type_identifier
-  {
-    result = val[1]
-  }
-  | SYM_ALLOW_ARCHETYPE type_identifier V_LOCAL_TERM_CODE_REF
-  | SYM_ALLOW_ARCHETYPE error
-
-# 'c_primitive_object' is an node representing a constraint on a primitive object type.
-c_primitive_object: c_primitive
-  {
-    assert_at(__FILE__,__LINE__){val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_PRIMITIVE)}
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_PRIMITIVE_OBJECT.create do |c_primitive_object|
-      c_primitive_object.item = val[0]
-    end
-  }
-
-c_primitive: c_integer
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: c_integer = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_INTEGER.create do |c_integer|
-      c_integer.list
-      c_integer.range
-      c_integer.assumed_value
-    end
-  }
-  | c_real
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: c_real = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_REAL.new
-  }
-  | c_date
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: c_date = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE.new
-  }
-  | c_time
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: c_time = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_TIME.new
-  }
-  | c_date_time
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: c_date_time = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME.new
-  }
-  | c_duration
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: c_duration = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DURATION.new
-  }
-  | c_string
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: c_string = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_STRING.new
-  }
-  | c_boolean
-  {
-    assert_at(__FILE__,__LINE__){val[0].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN)}
-    @@log.info("#{__FILE__}:#{__LINE__}: c_boolean = #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-  }
-
-c_any: Star_code
-#c_any: '*'
-
-#---------------- BODY - relationships ----------------
-
-c_attributes: c_attribute
-  { 
-    result = [val[0]]
-  }
-  | c_attributes c_attribute
-  { 
-    result = (val[0] << val[1])
-  }
-
-# 'c_attribute' is a node representing a constraint on an attribute in an object model.
-c_attribute: c_attr_head SYM_MATCHES SYM_START_CBLOCK c_attr_values SYM_END_CBLOCK
-  { 
-    assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
-    c_attribute = val[0]
-    c_attribute.children = val[3]
-    result = c_attribute
-  }
-  | c_attr_head SYM_MATCHES START_REGEXP_BLOCK REGEXP_BODY END_REGEXP_BLOCK # added by akimichi
-  { 
-    assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
-    result = val[0]
-  }
-  | c_attr_head SYM_MATCHES SYM_START_CBLOCK error SYM_END_CBLOCK
-  { 
-    assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
-    result = val[0]
-  }
-
-
-c_attr_head: V_ATTRIBUTE_IDENTIFIER c_existence
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]}, c_existence = #{val[1]} at #{@filename}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE.new(
-                                                                              :rm_attribute_name => val[0],
-                                                                              :existence => val[1]
-                                                                              )
-
-  }
-  | V_ATTRIBUTE_IDENTIFIER c_existence c_cardinality
-  {
-    assert_at(__FILE__,__LINE__){ val[2].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY) }
-    @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER: #{val[0]}, c_existence = #{val[1]}, c_cardinality = #{val[2]} at #{@filename}") 
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE.new(
-                                                                                :rm_attribute_name => val[0],
-                                                                                :existence => val[1],
-                                                                                :cardinality => val[2]
-                                                                                )
-  }
-
-c_attr_values: c_object
-  { 
-    result = Array[val[0]]
-  }
-  | c_attr_values c_object
-  { 
-    result = (val[0] << val[1])
-  }
-  | c_any #	-- to allow a property to have any value
-  { 
-    result = Array[val[0]]
-  }
-
-### c_includes: #-- Empty
-###     | SYM_INCLUDE assertions
-c_includes: #-- Empty
-    | SYM_INCLUDE invariants
-{
-    result = val[1]
-}
-
-### c_excludes: #-- Empty
-###     | SYM_EXCLUDE assertions
-c_excludes: #-- Empty
-    | SYM_EXCLUDE invariants
-{
-    result = val[1]
-}
-
-invariants: invariant
-  | invariants invariant
-
-invariant: any_identifier ':' boolean_expression
-  | boolean_expression
-  | any_identifier ':' error
-
-arch_invariant: #-- no invariant ok
-    | SYM_INVARIANT V_ASSERTION_TEXT
-    | SYM_INVARIANT error
-
-# define all linguistic entries in this part as dADL.
-#arch_ontology: SYM_ONTOLOGY V_DADL_TEXT
-#  | SYM_ONTOLOGY error
-
-arch_ontology: SYM_ONTOLOGY dadl_section
-  { 
-    dadl_section = val[1]
-    result = OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY.new
-  }
-  | SYM_ONTOLOGY error
-
-
-### dADL section
-dadl_section: dadl_input
-
-dadl_input: attr_vals
-  | complex_object_block
-#  | error
-
-attr_vals: attr_val
-  {
-    result = Array[val[0]]
-  }
-  | attr_vals attr_val
-  {
-    result = (val[0] << val[1])
-  }
-  | attr_vals Semicolon_code attr_val
-  {
-    result = (val[0] << val[2])
-  }
-
-attr_val: attr_id SYM_EQ object_block
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: attr_id = #{val[0]}, object_block = #{val[2]} at #{@filename}:#{@lineno}")
-    result = {:attr_id => val[0], :object_block => val[2]}
-  }
-
-attr_id: V_ATTRIBUTE_IDENTIFIER
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-  }
-  | V_ATTRIBUTE_IDENTIFIER error
-
-object_block: complex_object_block
-  { 
-    result = val[0]
-  }
-  | primitive_object_block
-  { 
-    result = val[0]
-  }
-
-complex_object_block: single_attr_object_block
-  { 
-    result = val[0]
-  }
-  | multiple_attr_object_block
-  { 
-    result = val[0]
-  }
-
-multiple_attr_object_block: untyped_multiple_attr_object_block
-  { 
-    result = {:untyped_multiple_attr_object_block => val[0]}
-  }
-  | type_identifier untyped_multiple_attr_object_block
-  { 
-    result = {:type_identifier => val[0], :untyped_multiple_attr_object_block => val[1]}
-  }
-
-untyped_multiple_attr_object_block: multiple_attr_object_block_head keyed_objects SYM_END_DBLOCK
-  { 
-    result = {:multiple_attr_object_block_head => val[0], :keyed_objects => val[1]}
-  }
-
-multiple_attr_object_block_head: SYM_START_DBLOCK
-  { 
-    @@log.info("SYM_START_DBLOCK: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-  }
-
-keyed_objects: keyed_object
-  { 
-    result = Array[val[0]]
-  }
-  | keyed_objects keyed_object
-  { 
-    result = (val[0] << val[1])
-  }
-
-keyed_object: object_key SYM_EQ object_block
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: keyed_object = #{val[0]}, object_block = #{val[2]} at #{@filename}:#{@lineno}")
-    result = {:object_key => val[0], :object_block => val[1]}
-  }
-
-object_key: Left_bracket_code simple_value Right_bracket_code
-  {
-    @@log.info("object_key: [#{val[1]}] at #{@filename}:#{@lineno}")
-    result = val[1]
-  }
-
-single_attr_object_block: untyped_single_attr_object_block
-  {
-    result = {:untyped_single_attr_object_block => val[0]}
-  }
-  | type_identifier untyped_single_attr_object_block
-  {
-    result = {:type_identifier => val[0], :untyped_single_attr_object_block => val[1]}
-  }
-
-untyped_single_attr_object_block: single_attr_object_complex_head SYM_END_DBLOCK # <>
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: single_attr_object_complex_head = #{val[0]} at #{@filename}:#{@lineno}")
-    result = {:single_attr_object_complex_head => val[0]}
-  }
-  | single_attr_object_complex_head attr_vals SYM_END_DBLOCK
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: single_attr_object_complex_head = #{val[0]}, attr_vals = #{val[1]} at #{@filename}:#{@lineno}")
-    result = {:single_attr_object_complex_head => val[0], :attr_vals => val[1]}
-  }
-single_attr_object_complex_head: SYM_START_DBLOCK
-primitive_object_block: untyped_primitive_object_block
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: untyped_primitive_object_block = #{val[0]} at #{@filename}:#{@lineno}")
-    result = {:untyped_primitive_object_block => val[0]}
-  }
-  | type_identifier untyped_primitive_object_block
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: type_identifier = #{val[0]}, untyped_primitive_object_block = #{val[1]} at #{@filename}:#{@lineno}")
-    result = {:type_identifier => val[0], :untyped_primitive_object_block => val[1]}
-  }
-untyped_primitive_object_block: SYM_START_DBLOCK primitive_object_value SYM_END_DBLOCK
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: primitive_object_block = <#{val[1]}> at #{@filename}:#{@lineno}")
-    result = val[1]
-  }
-primitive_object_value: simple_value
-  {
-    result = val[0]
-  }
-  | simple_list_value
-  {
-    result = val[0]
-  }
-  | simple_interval_value
-  {
-    result = val[0]
-  }
-  | term_code
-  {
-    result = val[0]
-  }
-  | term_code_list_value
-  {
-    result = val[0]
-  }
-simple_value: string_value
-  {
-    @@log.info("string_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-  }
-  | integer_value
-  {
-    @@log.info("integer_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-  }
-  | real_value
-  {
-    @@log.info("real_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-  }
-  | boolean_value
-  {
-    @@log.info("boolean_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-  }
-  | character_value
-  {
-    @@log.info("character_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-  }
-  | date_value
-  {
-    @@log.info("date_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-  }
-  | time_value
-  {
-    @@log.info("time_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-  }
-  | date_time_value
-  {
-    @@log.info("date_time_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-  }
-  | duration_value
-  {
-    @@log.info("duration_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-  }
-  | uri_value
-  {
-    @@log.info("uri_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-  }
-
-simple_list_value: string_list_value
-  | integer_list_value
-  | real_list_value
-  | boolean_list_value
-  | character_list_value
-  | date_list_value
-  | time_list_value
-  | date_time_list_value
-  | duration_list_value
-
-simple_interval_value: integer_interval_value
-  | real_interval_value
-  | date_interval_value
-  | time_interval_value
-  | date_time_interval_value
-  | duration_interval_value
-
-type_identifier: V_TYPE_IDENTIFIER
-  {
-    @@log.info("V_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-  }
-  | V_GENERIC_TYPE_IDENTIFIER
-  {
-    @@log.info("V_GENERIC_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-  }
-
-string_value: V_STRING
-  {
-    @@log.info("V_STRING: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-  }
-
-string_list_value: V_STRING Comma_code V_STRING
-  | string_list_value Comma_code V_STRING
-  | V_STRING Comma_code SYM_LIST_CONTINUE
-
-integer_value: V_INTEGER
-  { 
-    begin
-      integer = Integer(val[0])
-    rescue
-      raise
-    end
-    result = integer
-  }
-  | Plus_code V_INTEGER
-  {
-    begin
-      integer = Integer(val[0])
-    rescue
-      raise
-    end
-    result = integer
-  }
-  | Minus_code V_INTEGER
-  {
-    begin
-      integer = Integer(val[0])
-    rescue
-      raise
-    end
-    result = - integer
-  }
-###   | '+' V_INTEGER
-###   | '-' V_INTEGER
-
-integer_list_value: integer_value Comma_code integer_value
-  | integer_list_value Comma_code integer_value
-  | integer_value Comma_code SYM_LIST_CONTINUE
-
-integer_interval_value: SYM_INTERVAL_DELIM integer_value SYM_ELLIPSIS integer_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT integer_value SYM_ELLIPSIS integer_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM integer_value SYM_ELLIPSIS SYM_LT integer_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT integer_value SYM_ELLIPSIS SYM_LT integer_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LT integer_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LE integer_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT integer_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GE integer_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM integer_value SYM_INTERVAL_DELIM
-
-real_value: V_REAL
-  {
-    begin
-      real = Float(val[0])
-    rescue
-      raise
-    end
-    result = real
-  }
-  | Plus_code V_REAL
-  {
-    begin
-      real = Float(val[1])
-    rescue
-      raise
-    end
-    result = real
-  }
-  | Minus_code V_REAL
-  {
-    begin
-      real = Float(val[1])
-    rescue
-      raise
-    end
-    result = - real
-  }
-
-real_list_value: real_value Comma_code real_value
-  | real_list_value Comma_code real_value
-  | real_value Comma_code SYM_LIST_CONTINUE
-
-real_interval_value: SYM_INTERVAL_DELIM real_value SYM_ELLIPSIS real_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT real_value SYM_ELLIPSIS real_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM real_value SYM_ELLIPSIS SYM_LT real_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT real_value SYM_ELLIPSIS SYM_LT real_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LT real_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LE real_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT real_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GE real_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM real_value SYM_INTERVAL_DELIM
-
-
-boolean_value: SYM_TRUE
-  { 
-    result = true
-  }
-  | SYM_FALSE
-  { 
-    result = false
-  }
-
-boolean_list_value: boolean_value Comma_code boolean_value
-  | boolean_list_value Comma_code boolean_value
-  | boolean_value Comma_code SYM_LIST_CONTINUE
-
-character_value: V_CHARACTER
-
-character_list_value: character_value Comma_code character_value
-  | character_list_value Comma_code character_value
-  | character_value Comma_code SYM_LIST_CONTINUE
-
-date_value: V_ISO8601_EXTENDED_DATE
-
-date_list_value: date_value Comma_code date_value
-  | date_list_value Comma_code date_value
-  | date_value Comma_code SYM_LIST_CONTINUE
-
-date_interval_value: SYM_INTERVAL_DELIM date_value SYM_ELLIPSIS date_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT date_value SYM_ELLIPSIS date_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM date_value SYM_ELLIPSIS SYM_LT date_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT date_value SYM_ELLIPSIS SYM_LT date_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LT date_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LE date_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT date_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GE date_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM date_value SYM_INTERVAL_DELIM
-
-time_value: V_ISO8601_EXTENDED_TIME
-
-time_list_value: time_value Comma_code time_value
-  | time_list_value Comma_code time_value
-  | time_value Comma_code SYM_LIST_CONTINUE
-
-time_interval_value: SYM_INTERVAL_DELIM time_value SYM_ELLIPSIS time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT time_value SYM_ELLIPSIS time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM time_value SYM_ELLIPSIS SYM_LT time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT time_value SYM_ELLIPSIS SYM_LT time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LT time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LE time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GE time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM time_value SYM_INTERVAL_DELIM
-
-date_time_value: V_ISO8601_EXTENDED_DATE_TIME
-
-date_time_list_value: date_time_value Comma_code date_time_value
-  | date_time_list_value Comma_code date_time_value
-  | date_time_value Comma_code SYM_LIST_CONTINUE
-
-date_time_interval_value: SYM_INTERVAL_DELIM date_time_value SYM_ELLIPSIS date_time_value  SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT date_time_value SYM_ELLIPSIS date_time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM date_time_value SYM_ELLIPSIS SYM_LT date_time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT date_time_value SYM_ELLIPSIS SYM_LT date_time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LT date_time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LE date_time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT date_time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GE date_time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM date_time_value SYM_INTERVAL_DELIM
-
-duration_value: V_ISO8601_DURATION
-  {
-    @@log.info("V_ISO8601_DURATION: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-  }
-
-duration_list_value: duration_value Comma_code duration_value
-  | duration_list_value Comma_code duration_value
-  | duration_value Comma_code SYM_LIST_CONTINUE
-
-duration_interval_value: SYM_INTERVAL_DELIM duration_value SYM_ELLIPSIS duration_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT duration_value SYM_ELLIPSIS duration_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM duration_value SYM_ELLIPSIS SYM_LT duration_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT duration_value SYM_ELLIPSIS SYM_LT duration_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LT duration_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LE duration_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT duration_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GE duration_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM duration_value SYM_INTERVAL_DELIM
-
-term_code: V_QUALIFIED_TERM_CODE_REF
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: V_QUALIFIED_TERM_CODE_REF = #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-  }
-
-term_code_list_value: term_code Comma_code term_code
-  | term_code_list_value Comma_code term_code
-  | term_code Comma_code SYM_LIST_CONTINUE
-
-uri_value: V_URI
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: V_URI = #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-  }
-
-
-#---------------------- ASSERTIONS ------------------------
-
-assertions: assertion
-  | assertions assertion
-
-assertion: any_identifier ':' boolean_expression
-  | boolean_expression
-  | any_identifier ':' error
-
-#---------------------- expressions ---------------------
-
-boolean_expression: boolean_leaf
-  | boolean_node
-
-boolean_node: SYM_EXISTS absolute_path
-#  | absolute_path
-  | SYM_EXISTS error
-  | relative_path SYM_MATCHES SYM_START_CBLOCK c_primitive SYM_END_CBLOCK
-  | relative_path SYM_MATCHES START_REGEXP_BLOCK REGEXP_BODY END_REGEXP_BLOCK # added by akimichi
-  | SYM_NOT boolean_leaf
-  | arithmetic_expression '=' arithmetic_expression
-  | arithmetic_expression SYM_NE arithmetic_expression
-  | arithmetic_expression SYM_LT arithmetic_expression
-  | arithmetic_expression SYM_GT arithmetic_expression
-  | arithmetic_expression SYM_LE arithmetic_expression
-  | arithmetic_expression SYM_GE arithmetic_expression
-  | boolean_expression SYM_AND boolean_expression
-  | boolean_expression SYM_OR boolean_expression
-  | boolean_expression SYM_XOR boolean_expression
-  | boolean_expression SYM_IMPLIES boolean_expression
-
-boolean_leaf: Left_parenthesis_code boolean_expression Right_parenthesis_code
-  | SYM_TRUE
-  | SYM_FALSE
-
-arithmetic_expression: arithmetic_leaf
-  | arithmetic_node
-
-arithmetic_node: arithmetic_expression '+' arithmetic_leaf
-  | arithmetic_expression '-' arithmetic_leaf
-  | arithmetic_expression Star_code arithmetic_leaf
-  | arithmetic_expression Slash_code arithmetic_leaf
-  | arithmetic_expression '^' arithmetic_leaf
-
-arithmetic_leaf:  Left_parenthesis_code arithmetic_expression Right_parenthesis_code
-  | integer_value
-  | real_value
-  | absolute_path
-
-
-#--------------- THE FOLLOWING SOURCE TAKEN FROM OG_PATH_VALIDATOR.Y -------------
-#--------------- except to remove movable_path ----------------------------------------------------
-
-
-absolute_path: Slash_code
-  | Slash_code relative_path
-#  | absolute_path Slash_code relative_path
-
-
-
-relative_path: path_segment
-  | relative_path Slash_code path_segment
-
-path_segment: V_ATTRIBUTE_IDENTIFIER V_LOCAL_TERM_CODE_REF
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}") 
-  }
-  | V_ATTRIBUTE_IDENTIFIER
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}") 
-  }
-
-
-#-------------------------------- END SOURCE TAKEN FROM OG_PATH_VALIDATOR.Y ----------------------
-
-
-#---------------- existence, occurrences, cardinality ----------------
-
-c_existence: #-- default to 1..1
-    { 
-    result = Range.new(1,1)
-  }
-  | SYM_EXISTENCE SYM_MATCHES SYM_START_CBLOCK existence_spec SYM_END_CBLOCK
-  { 
-    result = val[3]
-  }
-
-existence_spec:  V_INTEGER #-- can only be 0 or 1
-  { 
-    begin
-      integer = Integer(val[0])
-    rescue
-      raise
-    end
-    result = integer
-  }
-  | V_INTEGER SYM_ELLIPSIS V_INTEGER #-- can only be 0..0, 0..1, 1..1
-  { 
-    begin
-      from_integer = Integer(val[0])
-      to_integer = Integer(val[2])
-    rescue
-      raise
-    end
-    result = Range.new(from_integer,to_integer)
-  }
-
-c_cardinality: SYM_CARDINALITY SYM_MATCHES SYM_START_CBLOCK cardinality_spec SYM_END_CBLOCK
-  { 
-    result = OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY.new
-  }
-
-cardinality_spec: occurrence_spec
-  | occurrence_spec Semicolon_code SYM_ORDERED
-  | occurrence_spec Semicolon_code SYM_UNORDERED
-  | occurrence_spec Semicolon_code SYM_UNIQUE
-  | occurrence_spec Semicolon_code SYM_ORDERED Semicolon_code SYM_UNIQUE
-  | occurrence_spec Semicolon_code SYM_UNORDERED Semicolon_code SYM_UNIQUE
-  | occurrence_spec Semicolon_code SYM_UNIQUE Semicolon_code SYM_ORDERED
-  | occurrence_spec Semicolon_code SYM_UNIQUE Semicolon_code SYM_UNORDERED
-
-cardinality_limit_value: integer_value
-  {
-    result = val[0]
-  }
-  | Star_code # '*'
-  {
-    result = val[0]
-  }
-
-
-c_occurrences:  #-- default to 1..1
-  | SYM_OCCURRENCES SYM_MATCHES SYM_START_CBLOCK occurrence_spec SYM_END_CBLOCK
-  { 
-    result = val[3]
-  }
-  | SYM_OCCURRENCES error
-
-occurrence_spec: cardinality_limit_value #-- single integer or '*'
-  | V_INTEGER SYM_ELLIPSIS cardinality_limit_value
-
-#---------------------- leaf constraint types -----------------------
-
-c_integer_spec: integer_value
-  | integer_list_value
-  | integer_interval_value
-
-c_integer: c_integer_spec
-  | c_integer_spec Semicolon_code integer_value
-  | c_integer_spec Semicolon_code error
-
-c_real_spec: real_value
-  | real_list_value
-  | real_interval_value
-
-c_real: c_real_spec
-  | c_real_spec Semicolon_code real_value
-  | c_real_spec Semicolon_code error
-
-c_date_constraint: V_ISO8601_DATE_CONSTRAINT_PATTERN
-  | date_value
-  | date_interval_value
-
-c_date: c_date_constraint
-  | c_date_constraint Semicolon_code date_value
-  | c_date_constraint Semicolon_code error
-
-c_time_constraint: V_ISO8601_TIME_CONSTRAINT_PATTERN
-  | time_value
-  | time_interval_value
-
-c_time: c_time_constraint
-  | c_time_constraint Semicolon_code time_value
-  | c_time_constraint Semicolon_code error
-
-c_date_time_constraint: V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN
-  | date_time_value
-  | date_time_interval_value
-
-c_date_time: c_date_time_constraint
-  | c_date_time_constraint Semicolon_code date_time_value
-  | c_date_time_constraint Semicolon_code error
-
-c_duration_constraint: duration_pattern
-  | duration_pattern Slash_code duration_interval_value
-  | duration_value
-  | duration_interval_value
-
-c_duration: c_duration_constraint
-  | c_duration_constraint Semicolon_code duration_value
-  | c_duration_constraint Semicolon_code error
-
-c_string_spec:  V_STRING #-- single value, generates closed list
-  | string_list_value #-- closed list
-  | string_list_value Comma_code SYM_LIST_CONTINUE #-- open list
-#  | string_list_value ',' SYM_LIST_CONTINUE #-- open list
-#  | V_REGEXP #-- regular expression with "//" or "^^" delimiters
-
-c_string: c_string_spec
-  | c_string_spec Semicolon_code string_value
-  | c_string_spec Semicolon_code error
-
-c_boolean_spec: SYM_TRUE
-  { 
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true)
-  }
-  | SYM_FALSE
-  { 
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => false)
-  }
-  | SYM_TRUE Comma_code SYM_FALSE
-  { 
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true,:false_valid => false)
-  }
-  | SYM_FALSE Comma_code SYM_TRUE
-  { 
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => false,:false_valid => true)
-  }
-
-c_boolean: c_boolean_spec
-  { 
-    result = val[0]
-  }
-  | c_boolean_spec Semicolon_code boolean_value
-  {
-    raise 'Not implemented yet'
-  }
-  | c_boolean_spec Semicolon_code error
-  {
-    raise 'Not implemented yet'
-  }
-
-c_ordinal: c_ordinal_spec
-  | c_ordinal_spec Semicolon_code integer_value
-  | c_ordinal_spec Semicolon_code error
-
-c_ordinal_spec: ordinal
-  | c_ordinal_spec Comma_code ordinal
-
-ordinal: integer_value SYM_INTERVAL_DELIM V_QUALIFIED_TERM_CODE_REF
-  {
-    @in_interval = false
-    @@log.info("#{__FILE__}:#{__LINE__}, #{val[0]}|#{val[2]} at #{@filename}") 
-  }
-
-#c_code_phrase: V_TERM_CODE_CONSTRAINT #-- e.g. "[local::at0040, at0041; at0040]"
-c_code_phrase: term_code_constraint_section #-- e.g. "[local::at0040, at0041; at0040]"
-  {
-      result = val[0]
-  }
-  | V_QUALIFIED_TERM_CODE_REF
-  {
-      result = val[0]
-  }
-
-#term_code_constraint_section: START_TERM_CODE_CONSTRAINT term_code_body Right_bracket_code
-term_code_constraint_section: START_TERM_CODE_CONSTRAINT term_code_body END_TERM_CODE_CONSTRAINT
-term_code_body: # empty
-  | TERM_CODE
-  | term_code_body TERM_CODE
-### term_code_constraint_section: START_TERM_CODE_CONSTRAINT term_code_body END_TERM_CODE_CONSTRAINT
-### term_code_body: TERM_CODE
-###   | term_code_body TERM_CODE
-
-# A Constraint_Ref is a proxy for a set of constraints on an object.
-constraint_ref: V_LOCAL_TERM_CODE_REF #-- e.g. "ac0003"
-  {
-      result = val[0]
-  }
-
-any_identifier: type_identifier
-  {
-      result = val[0]
-  }
-  | V_ATTRIBUTE_IDENTIFIER
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{word} at #{@filename}")
-      result = val[0]
-  }
-
-
-#----------------- TAKEN FROM DADL_VALIDATOR.Y -------------------
-#-----------------        DO NOT MODIFY        -------------------
-#---------------------- BASIC DATA VALUES -----------------------
-
-duration_pattern: V_ISO8601_DURATION_CONSTRAINT_PATTERN
-  { 
-    result = val[0]
-  }
-
-
-
----- header
-
-$:.unshift File.join(File.dirname(__FILE__))
-require 'logger'
-require 'lib/util.rb'
-require 'lib/scanner.rb'
-require 'rubygems'
-require 'am.rb'
-$DEBUG = true
-
-
-
----- inner
-
-def assert_at(file,line, message = "")
-  unless yield
-    raise "Assertion failed !: #{file}, #{line}: #{message}"
-  end
-end
-
-@@log = Logger.new('log/parser.log','daily')
-@@dadl_scanner = OpenEHR::ADL::Scanner::DADL::RootScanner.new
-@@cadl_scanner = OpenEHR::ADL::Scanner::CADL::RootScanner.new
-
-###----------/* keywords */ --------------------------------------------- 
-@@adl_reserved = {
-    'archetype' => :SYM_ARCHETYPE,
-    'adl_version' => :SYM_ADL_VERSION,
-    'controlled' => :SYM_IS_CONTROLLED,
-    'specialize' => :SYM_SPECIALIZE,
-    'concept' => :SYM_CONCEPT,
-    'language' => :SYM_LANGUAGE,
-    'description' => :SYM_DESCRIPTION,
-    'definition' => :SYM_DEFINITION,
-    'invariant' => :SYM_INVARIANT,
-    'ontology' => :SYM_ONTOLOGY,
-    'matches' => :SYM_MATCHES,
-    'is_in' => :SYM_MATCHES,
-    'occurrences' => :SYM_OCCURRENCES,
-    'true' => :SYM_TRUE, #[Tt][Rr][Uu][Ee] -- -> SYM_TRUE 
-    'false' => :SYM_FALSE, # [Ff][Aa][Ll][Ss][Ee] -- -> SYM_FALSE 
-    'infinity' => :SYM_INFINITY # [Ii][Nn][Ff][Ii][Nn][Ii][Tt][Yy] -- -> SYM_INFINITY 
-}
-
-@@dadl_reserved = {
-  'true' => :SYM_TRUE, #[Tt][Rr][Uu][Ee] -- -> SYM_TRUE 
-  'false' => :SYM_FALSE, # [Ff][Aa][Ll][Ss][Ee] -- -> SYM_FALSE 
-  'infinity' => :SYM_INFINITY # [Ii][Nn][Ff][Ii][Nn][Ii][Tt][Yy] -- -> SYM_INFINITY 
-}
-
-@@cadl_reserved = {
-  'then' => :SYM_THEN, # [Tt][Hh][Ee][Nn]
-  'else' => :SYM_ELSE, # [Ee][Ll][Ss][Ee]
-  'and' => :SYM_AND, # [Aa][Nn][Dd]
-  'or' => :SYM_OR, # [Oo][Rr]
-  'xor' => :SYM_XOR, # [Xx][Oo][Rr]
-  'not' => :SYM_NOT, # [Nn][Oo][Tt]
-  'implies' => :SYM_IMPLIES, # [Ii][Mm][Pp][Ll][Ii][Ee][Ss]
-  'true' => :SYM_TRUE, #[Tt][Rr][Uu][Ee] -- -> SYM_TRUE 
-  'false' => :SYM_FALSE, # [Ff][Aa][Ll][Ss][Ee] -- -> SYM_FALSE 
-  'forall' => :SYM_FORALL, # [Ff][Oo][Rr][_][Aa][Ll][Ll]
-  'exists' => :SYM_EXISTS, # [Ee][Xx][Ii][Ss][Tt][Ss]
-  'existence' => :SYM_EXISTENCE, # [Ee][Xx][Iu][Ss][Tt][Ee][Nn][Cc][Ee]
-  'occurrences' => :SYM_OCCURRENCES, # [Oo][Cc][Cc][Uu][Rr][Rr][Ee][Nn][Cc][Ee][Ss]
-  'cardinality' => :SYM_CARDINALITY, # [Cc][Aa][Rr][Dd][Ii][Nn][Aa][Ll][Ii][Tt][Yy]
-  'ordered' => :SYM_ORDERED, # [Oo][Rr][Dd][Ee][Rr][Ee][Dd]
-  'unordered' => :SYM_UNORDERED, # [Uu][Nn][Oo][Rr][Dd][Ee][Rr][Ee][Dd]
-  'unique' => :SYM_UNIQUE, # [Uu][Nn][Ii][Qq][Uu][Ee]
-  'matches' => :SYM_MATCHES, # [Mm][Aa][Tt][Cc][Hh][Ee][Ss]
-  'is_in' => :SYM_MATCHES, # [Ii][Ss][_][Ii][Nn]
-  'invariant' => :SYM_INVARIANT, # [Ii][Nn][Vv][Aa][Rr][Ii][Aa][Nn][Tt]
-  'infinity' => :SYM_INFINITY, # [Ii][Nn][Ff][Ii][Nn][Ii][Tt][Yy] -- -> SYM_INFINITY 
-  'use_node' => :SYM_USE_NODE, # [Uu][Ss][Ee][_][Nn][Oo][Dd][Ee]
-  'use_archetype' => :SYM_ALLOW_ARCHETYPE, # [Uu][Ss][Ee][_][Aa][Rr][Cc][Hh][Ee][Tt][Yy][Pp][Ee]
-  'allow_archetype' => :SYM_ALLOW_ARCHETYPE, # [Aa][Ll][Ll][Oo][Ww][_][Aa][Rr][Cc][Hh][Ee][Tt][Yy][Pp][Ee]
-  'include' => :SYM_INCLUDE, # [Ii][Nn][Cc][Ll][Uu][Dd][Ee]
-  'exclude' => :SYM_EXCLUDE # [Ee][Xx][Cc][Ll][Uu][Dd][Ee]
-}
-
-
-###----------/* Scanner */ ----------------------------------------------- 
-
-def scan
-  until @data.nil?  do
-    case @adl_type.last
-    when :adl
-      @data = scan_adl(@data) do |sym, val|
-        yield sym, val
-      end
-    when :dadl
-      @data = scan_dadl(@data) do |sym, val|
-        yield sym, val
-      end
-    when :cadl
-      @data = scan_cadl(@data) do |sym, val|
-        yield sym, val
-      end
-    when :regexp
-      @data = scan_regexp(@data) do |sym, val|
-        yield sym, val
-      end
-    else
-      raise
-    end
-    @data = $' # variable $' receives the string after the match
-  end
-  yield :EOF, nil
-  yield false, '$'
-end # of scan
-
-def scan_adl(data)
-  until data.nil?  do
-    case @adl_type.last
-    when :adl
-#      puts "Entering scan_adl"
-      case data
-      when /\A\n/ # carriage return
-        @lineno += 1
-        ;
-      when /\A[ \t\r\f]+/ #just drop it
-        ;
-      when /\A--.*\n/ # single line comment
-        @lineno += 1
-        @@log.info("#{__FILE__}:#{__LINE__}: scan_adl: COMMENT = #{$&} at #{@filename}:#{@lineno}")
-        ;
-      when /\Adescription/   # description
-        yield :SYM_DESCRIPTION, :SYM_DESCRIPTION
-      when /\Adefinition/   # definition
-        yield :SYM_DEFINITION, :SYM_DEFINITION
-#        @adl_type.push(:cadl)
-        ###----------/* symbols */ ------------------------------------------------- 
-      when /\A[A-Z][a-zA-Z0-9_]*/
-        yield :V_TYPE_IDENTIFIER, $&
-      when /\A[a-zA-Z][a-zA-Z0-9_-]+\.[a-zA-Z][a-zA-Z0-9_-]+\.[a-zA-Z0-9]+/   #V_ARCHETYPE_ID
-        yield :V_ARCHETYPE_ID, $&
-      when /\A[a-z][a-zA-Z0-9_]*/
-#        word = $&.downcase
-        word = $&
-        if @@adl_reserved[word]
-          @@log.info("#{__FILE__}:#{__LINE__}: scan_adl: @@adl_reserved = #{@@adl_reserved[word]} at #{@filename}:#{@lineno}")
-          yield @@adl_reserved[word], @@adl_reserved[word]
-        elsif #/\A[A-Z][a-zA-Z0-9_]*/
-          @@log.info("#{__FILE__}:#{__LINE__}: scan_adl: V_ATTRIBUTE_IDENTIFIER = #{$&} at #{@filename}:#{@lineno}")
-          yield :V_ATTRIBUTE_IDENTIFIER, $&
-        end
-      when /\A\=/   # =
-        yield :SYM_EQ, :SYM_EQ
-      when /\A\>=/   # >=
-        yield :SYM_GE, :SYM_GE
-      when /\A\<=/   # <=
-        yield :SYM_LE, :SYM_LE
-      when /\A\</   # <
-        if @in_interval
-#          @start_block_received = false
-          yield :SYM_LT, :SYM_LT
-        else
-#          @start_block_received = true
-          @adl_type.push(:dadl)
-          yield :SYM_START_DBLOCK,  $&
-        end
-      when /\A\>/   # >
-        if @in_interval
-          yield :SYM_GT, :SYM_GT
-        else
-          adl_type = @adl_type.pop
-#          puts "Escaping #{adl_type}"
-          assert_at(__FILE__,__LINE__){adl_type == :dadl}
-          yield :SYM_END_DBLOCK, :SYM_END_DBLOCK
-        end
-      when /\A\{/   # {
-        @adl_type.push(:cadl)
-        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: entering cADL at #{@filename}:#{@lineno}")
-        yield :SYM_START_CBLOCK, :SYM_START_CBLOCK
-      when /\A\}/   # }
-        adl_type = @adl_type.pop
-#        puts "Escaping #{adl_type}"
-        assert_at(__FILE__,__LINE__){adl_type == :cadl}
-        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: exiting cADL at #{@filename}:#{@lineno}")
-        yield :SYM_END_CBLOCK, $&
-      when /\A\-/   # -
-        yield :Minus_code, :Minus_code
-      when /\A\+/   # +
-        yield :Plus_code, :Plus_code
-      when /\A\*/   # *
-        yield :Star_code, :Star_code
-      when /\A\//   # /
-        yield :Slash_code, :Slash_code
-      when /\A\^/   # ^
-        yield :Caret_code, :Caret_code
-      when /\A\=/   # =
-        yield :Equal_code, :Equal_code
-      when /\A\.\.\./   # ...
-        yield :SYM_LIST_CONTINUE, :SYM_LIST_CONTINUE
-      when /\A\.\./   # ..
-        yield :SYM_ELLIPSIS, :SYM_ELLIPSIS
-      when /\A\./   # .
-        yield :Dot_code, :Dot_code
-      when /\A\;/   # ;
-        yield :Semicolon_code, :Semicolon_code
-      when /\A\,/   # ,
-        yield :Comma_code, :Comma_code
-      when /\A\:/   # :
-        yield :Colon_code, :Colon_code
-      when /\A\!/   # !
-        yield :Exclamation_code, :Exclamation_code
-      when /\A\(/   # (
-        yield :Left_parenthesis_code, :Left_parenthesis_code
-      when /\A\)/   # )
-        yield :Right_parenthesis_code, :Right_parenthesis_code
-      when /\A\$/   # $
-        yield :Dollar_code, :Dollar_code
-      when /\A\?\?/   # ??
-        yield :SYM_DT_UNKNOWN, :SYM_DT_UNKNOWN
-      when /\A\?/   # ?
-        yield :Question_mark_code, :Question_mark_code
-      when /\A[0-9]+\.[0-9]+(\.[0-9]+)*/   # ?
-        yield :V_VERSION_STRING, :V_VERSION_STRING
-      when /\A\|/   # |
-        if @in_interval
-          @in_interval = false
-        else
-          @in_interval = true
-        end
-        yield :SYM_INTERVAL_DELIM, :SYM_INTERVAL_DELIM
-      when /\A\[[a-zA-Z0-9()\._-]+::[a-zA-Z0-9\._-]+\]/
-#      when /\A\[[a-zA-Z0-9()\._-]+\:\:[a-zA-Z0-9\._-]+\]/   #V_QUALIFIED_TERM_CODE_REF form [ICD10AM(1998)::F23]
-        yield :V_QUALIFIED_TERM_CODE_REF, $&
-      when /\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/   #V_LOCAL_TERM_CODE_REF
-        yield :V_LOCAL_TERM_CODE_REF, $&
-      when /\A\[/   # [
-        yield :Left_bracket_code, :Left_bracket_code
-      when /\A\]/   # ]
-        yield :Right_bracket_code, :Right_bracket_code
-
-      when /\A\[[a-zA-Z0-9._\- ]+::[a-zA-Z0-9._\- ]+\]/   #ERR_V_QUALIFIED_TERM_CODE_REF
-        yield :ERR_V_QUALIFIED_TERM_CODE_REF, $&
-      when /\Aa[ct][0-9.]+/   #V_LOCAL_CODE
-        yield :V_LOCAL_CODE, $&
-      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-]-
-        yield :V_ISO8601_EXTENDED_DATE_TIME, $&
-      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]
-        yield :V_ISO8601_EXTENDED_TIME, $&
-      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
-        yield :V_ISO8601_EXTENDED_DATE, $&
-      when /\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/   #V_GENERIC_TYPE_IDENTIFIER
-        yield :V_GENERIC_TYPE_IDENTIFIER, $&
-      when /\A[0-9]+|[0-9]+[eE][+-]?[0-9]+/   #V_INTEGER
-        yield :V_INTEGER, $&
-      when /\A[0-9]+\.[0-9]+|[0-9]+\.[0-9]+[eE][+-]?[0-9]+ /   #V_REAL
-        yield :V_REAL, $&
-        #    when /\A"((?:[^"\\]+|\\.)*)"/ #V_STRING
-      when /\A"([^"]*)"/m #V_STRING
-        yield :V_STRING, $1
-      when /\A[a-z]+:\/\/[^<>|\\{}^~"\[\] ]*/ #V_URI
-        yield :V_URI, $&
-      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
-        yield :V_ISO8601_DURATION, $&
-      when /\A\S/ #UTF8CHAR
-        yield :UTF8CHAR, $&
-      end
-      data = $' # variable $' receives the string after the match
-    when :dadl
-#      puts "Entering scan_dadl"
-      data = scan_dadl(data) do |sym, val|
-        yield sym, val
-      end
-    when :cadl
-#      puts "Entering scan_cadl"
-      data = scan_cadl(data) do |sym, val|
-        yield sym, val
-      end
-    when :regexp
-#      puts "Entering scan_regexp"
-      data = scan_regexp(data) do |sym, val|
-        yield sym, val
-      end
-    when :term_constraint
-#      puts "Entering scan_term_constraint"
-      data = scan_term_constraint(data) do |sym, val|
-        yield sym, val
-      end
-    else
-      raise
-    end
-  end
-end # scan_adl
-
-
-def scan_cadl(data)
-  until data.nil?  do
-    case @adl_type.last
-    when :cadl
-#      puts "Entering scan_cadl"
-      case scanned = @@cadl_scanner.parse(data)
-      when Yaparc::Result::OK
-        if scanned.value[0] == :START_V_C_DOMAIN_TYPE_BLOCK
-          @in_c_domain_type = true
-          @adl_type.push(:dadl)
-          yield scanned.value
-        else
-          yield scanned.value
-        end
-        data = scanned.input
-      end
-
-      case data
-      when /\A\n/ # carriage return
-        @lineno += 1
-        ;
-      when /\A[ \t\r\f]+/ #just drop it
-        ;
-      when /\A--.*\n/ # single line comment
-        @lineno += 1
-        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: COMMENT = #{$&} at #{@filename}:#{@lineno}")
-        ;
-        ###----------/* symbols */ ------------------------------------------------- 
-      when /\A\=/   # =
-        yield :SYM_EQ, :SYM_EQ
-      when /\A\>=/   # >=
-        yield :SYM_GE, :SYM_GE
-      when /\A\<=/   # <=
-        yield :SYM_LE, :SYM_LE
-###       when /\A[A-Z][a-zA-Z0-9_]*[ \n]*\</   # V_C_DOMAIN_TYPE
-###         @in_c_domain_type = true
-###         @adl_type.push(:dadl)
-###         yield :START_V_C_DOMAIN_TYPE_BLOCK, $&
-      when /\A\</   # <
-        if @in_interval
-          yield :SYM_LT, :SYM_LT
-        else
-          @adl_type.push(:dadl)
-          yield :SYM_START_DBLOCK,  $&
-        end
-      when /\A\>/   # >
-        if @in_interval
-          yield :SYM_GT, :SYM_GT
-        else
-          adl_type = @adl_type.pop
-#          puts "Escaping #{adl_type}"
-          assert_at(__FILE__,__LINE__){adl_type == :dadl}
-          yield :SYM_END_DBLOCK, :SYM_END_DBLOCK
-        end
-      when /\A\-/   # -
-        yield :Minus_code, :Minus_code
-      when /\A\+/   # +
-        yield :Plus_code, :Plus_code
-      when /\A\*/   # *
-        yield :Star_code, :Star_code
-      when /\A\//   # /
-        yield :Slash_code, :Slash_code
-      when /\A\^/   # ^
-        yield :Caret_code, :Caret_code
-      when /\A\.\.\./   # ...
-        yield :SYM_LIST_CONTINUE, :SYM_LIST_CONTINUE
-      when /\A\.\./   # ..
-        yield :SYM_ELLIPSIS, :SYM_ELLIPSIS
-      when /\A\./   # .
-        yield :Dot_code, :Dot_code
-      when /\A\;/   # ;
-        yield :Semicolon_code, :Semicolon_code
-      when /\A\,/   # ,
-        yield :Comma_code, :Comma_code
-      when /\A\:/   # :
-        yield :Colon_code, :Colon_code
-      when /\A\!/   # !
-        yield :Exclamation_code, :Exclamation_code
-      when /\A\(/   # (
-        yield :Left_parenthesis_code, :Left_parenthesis_code
-      when /\A\)/   # )
-        yield :Right_parenthesis_code, :Right_parenthesis_code
-      when /\A\{\// #V_REGEXP
-        if @adl_type.last != :regexp
-          @in_regexp = true
-          @adl_type.push(:regexp)
-          yield :START_REGEXP_BLOCK, :START_REGEXP_BLOCK
-        else
-          raise
-        end
-#        yield :V_REGEXP, :V_REGEXP
-      when /\A\{/   # {
-        @adl_type.push(:cadl)
-        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: entering cADL at #{@filename}:#{@lineno}")
-        yield :SYM_START_CBLOCK, :SYM_START_CBLOCK
-      when /\A\}/   # }
-        adl_type = @adl_type.pop
-#        puts "Escaping #{adl_type}"
-        assert_at(__FILE__,__LINE__){adl_type == :cadl}
-        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: exiting cADL at #{@filename}:#{@lineno}")
-        yield :SYM_END_CBLOCK, :SYM_END_CBLOCK
-      when /\A\$/   # $
-        yield :Dollar_code, :Dollar_code
-      when /\A\?\?/   # ??
-        yield :SYM_DT_UNKNOWN, :SYM_DT_UNKNOWN
-      when /\A\?/   # ?
-        yield :Question_mark_code, :Question_mark_code
-      when /\A\|/   # |
-        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: @in_interval = #{@in_interval} at #{@filename}:#{@lineno}")
-        if @in_interval
-          @in_interval = false
-        else
-#          @in_interval = false
-          @in_interval = true
-        end
-        @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: SYM_INTERVAL_DELIM at #{@filename}:#{@lineno}")
-        yield :SYM_INTERVAL_DELIM, :SYM_INTERVAL_DELIM
-
-      when /\A\[[a-zA-Z0-9._\-]+::[a-zA-Z0-9._\-]+\]/   #V_QUALIFIED_TERM_CODE_REF form [ICD10AM(1998)::F23]
-        yield :V_QUALIFIED_TERM_CODE_REF, $&
-      when /\A\[[a-zA-Z0-9._\- ]+::[a-zA-Z0-9._\- ]+\]/   #ERR_V_QUALIFIED_TERM_CODE_REF
-        yield :ERR_V_QUALIFIED_TERM_CODE_REF, $&
-      when /\A\[([a-zA-Z0-9()._\-]+::[a-zA-Z0-9._\_-]+)\]/
-        yield :V_TERM_CODE_CONSTRAINT, :V_TERM_CODE_CONSTRAINT
-      when /\A\[[a-zA-Z0-9\(\)\._\-]+::[ \t\n]*/
-        @adl_type.push(:term_constraint)
-        yield :START_TERM_CODE_CONSTRAINT, $&
-      when /\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/   #V_LOCAL_TERM_CODE_REF
-        yield :V_LOCAL_TERM_CODE_REF, $&
-      when /\A\[/   # [
-        yield :Left_bracket_code, :Left_bracket_code
-      when /\A\]/   # ]
-        yield :Right_bracket_code, :Right_bracket_code
-      when /\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/   #V_GENERIC_TYPE_IDENTIFIER
-        yield :V_GENERIC_TYPE_IDENTIFIER, $&
-      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]/
-        yield :V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN, $&
-      when /\A[yY][yY][yY][yY]-[mM?X][mM?X]-[dD?X][dD?X]/
-        yield :V_ISO8601_DATE_CONSTRAINT_PATTERN, $&
-      when /\A[hH][hH]:[mM?X][mM?X]:[sS?X][sS?X]/
-        yield :V_ISO8601_TIME_CONSTRAINT_PATTERN, $&
-      when /\A[a-z][a-zA-Z0-9_]*/
-        word = $&.dup
-        if @@cadl_reserved[word.downcase]
-          yield @@cadl_reserved[word.downcase], @@cadl_reserved[word.downcase]
-        else
-          @@log.info("#{__FILE__}:#{__LINE__}: scan_cadl: V_ATTRIBUTE_IDENTIFIER = #{word} at #{@filename}:#{@lineno}")
-          yield :V_ATTRIBUTE_IDENTIFIER, word #V_ATTRIBUTE_IDENTIFIER /\A[a-z][a-zA-Z0-9_]*/
-        end
-      when /\A[A-Z][a-zA-Z0-9_]*/
-        word = $&.dup
-        if @@cadl_reserved[word.downcase]
-          yield @@cadl_reserved[word.downcase], @@cadl_reserved[word.downcase]
-        else
-          yield :V_TYPE_IDENTIFIER, $&
-        end
-      when /\Aa[ct][0-9.]+/   #V_LOCAL_CODE
-        yield :V_LOCAL_CODE, $&
-      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-]-
-        yield :V_ISO8601_EXTENDED_DATE_TIME, $&
-      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]
-        yield :V_ISO8601_EXTENDED_TIME, $&
-      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
-        yield :V_ISO8601_EXTENDED_DATE, $&
-      when /\A[0-9]+|[0-9]+[eE][+-]?[0-9]+/   #V_INTEGER
-        yield :V_INTEGER, $&
-      when /\A[0-9]+\.[0-9]+|[0-9]+\.[0-9]+[eE][+-]?[0-9]+ /   #V_REAL
-        yield :V_REAL, $&
-           when /\A"((?:[^"\\]+|\\.)*)"/ #V_STRING
-      when /\A"([^"]*)"/m #V_STRING
-        yield :V_STRING, $1
-      when /\A[a-z]+:\/\/[^<>|\\{}^~"\[\] ]*/ #V_URI
-        yield :V_URI, $&
-###       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
-###         yield :V_ISO8601_DURATION, $&
-      when /\A\S/ #UTF8CHAR
-        yield :UTF8CHAR, $&
-      else
-        raise
-      end
-      data = $' # variable $' receives the string after the match
-    when :adl
-#      puts "Entering scan_adl"
-      data = scan_adl(data) do |sym, val|
-        yield sym, val
-      end
-    when :dadl
-#      puts "Entering scan_dadl"
-      data = scan_dadl(data) do |sym, val|
-        yield sym, val
-      end
-    when :regexp
-#      puts "Entering scan_regexp"
-      data = scan_regexp(data) do |sym, val|
-        yield sym, val
-      end
-    when :term_constraint
-#      puts "Entering scan_term_constraint"
-      data = scan_term_constraint(data) do |sym, val|
-        yield sym, val
-      end
-    else
-      raise
-    end
-  end # of until
-end # of scan_cadl
-
-def scan_dadl(data)
-  until data.nil?  do
-    case @adl_type.last
-    when :dadl
-#      puts "Entering scan_dadl"
-      case scanned = @@dadl_scanner.parse(data)
-      when Yaparc::Result::OK
-        yield scanned.value
-        data = scanned.input
-      else
-      end
-
-      case data
-      when /\A\n/ # carriage return
-        @lineno += 1
-        ;
-      when /\A[ \t\r\f]+/ #just drop it
-        ;
-      when /\A--.*\n/ # single line comment
-        @lineno += 1
-        @@log.info("#{__FILE__}:#{__LINE__}: scan_dadl: COMMENT = #{$&} at #{@filename}:#{@lineno}")
-        ;
-        ###----------/* symbols */ ------------------------------------------------- 
-      when /\A\=/   # =
-        yield :SYM_EQ, :SYM_EQ
-      when /\A\>\=/   # >=
-        yield :SYM_GE, :SYM_GE
-      when /\A\<\=/   # <=
-        yield :SYM_LE, :SYM_LE
-      when /\A\</   # <
-        if @in_interval
-          yield :SYM_LT, :SYM_LT
-        else
-          @adl_type.push(:dadl)
-          yield :SYM_START_DBLOCK, :SYM_START_DBLOCK
-        end
-      when /\A\>/   # >
-        if @in_interval
-#          @in_interval = false
-          yield :SYM_GT, :SYM_GT
-        elsif @in_c_domain_type == true
-          assert_at(__FILE__,__LINE__){@adl_type.last == :dadl}
-          adl_type = @adl_type.pop
-          if @adl_type.last == :cadl
-            @in_c_domain_type = false
-            yield :END_V_C_DOMAIN_TYPE_BLOCK, $&
-          else
-            yield :SYM_END_DBLOCK, $&
-          end
-        elsif @in_c_domain_type == false
-          adl_type = @adl_type.pop
-#          puts "Escaping #{adl_type}"
-          assert_at(__FILE__,__LINE__){adl_type == :dadl}
-          yield :SYM_END_DBLOCK, $&
-        else
-          raise
-        end
-      when /\A\-/   # -
-        yield :Minus_code, :Minus_code
-      when /\A\+/   # +
-        yield :Plus_code, :Plus_code
-      when /\A\*/   # *
-        yield :Star_code, :Star_code
-      when /\A\//   # /
-        yield :Slash_code, :Slash_code
-      when /\A\^/   # ^
-        yield :Caret_code, :Caret_code
-      when /\A\.\.\./   # ...
-        yield :SYM_LIST_CONTINUE, :SYM_LIST_CONTINUE
-      when /\A\.\./   # ..
-        yield :SYM_ELLIPSIS, :SYM_ELLIPSIS
-      when /\A\./   # .
-        yield :Dot_code, :Dot_code
-      when /\A\;/   # ;
-        yield :Semicolon_code, :Semicolon_code
-      when /\A\,/   # ,
-        yield :Comma_code, :Comma_code
-      when /\A\:/   # :
-        yield :Colon_code, :Colon_code
-      when /\A\!/   # !
-        yield :Exclamation_code, :Exclamation_code
-      when /\A\(/   # (
-        yield :Left_parenthesis_code, :Left_parenthesis_code
-      when /\A\)/   # )
-        yield :Right_parenthesis_code, :Right_parenthesis_code
-      when /\A\$/   # $
-        yield :Dollar_code, :Dollar_code
-      when /\A\?\?/   # ??
-        yield :SYM_DT_UNKNOWN, :SYM_DT_UNKNOWN
-      when /\A\?/   # ?
-        yield :Question_mark_code, :Question_mark_code
-      when /\A\|/   # |
-        @@log.info("#{__FILE__}:#{__LINE__}: scan_dadl: @in_interval = #{@in_interval} at #{@filename}:#{@lineno}")
-        if @in_interval
-          @in_interval = false
-        else
-#          @in_interval = false
-          @in_interval = true
-        end
-        @@log.info("#{__FILE__}:#{__LINE__}: scan_dadl: SYM_INTERVAL_DELIM at #{@filename}:#{@lineno}")
-        yield :SYM_INTERVAL_DELIM, :SYM_INTERVAL_DELIM
-###       when /\A\[[a-zA-Z0-9()\._-]+::[a-zA-Z0-9\._-]+\]/   #V_QUALIFIED_TERM_CODE_REF form [ICD10AM(1998)::F23]
-###         yield :V_QUALIFIED_TERM_CODE_REF, $&
-###       when /\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/   #V_LOCAL_TERM_CODE_REF
-###         yield :V_LOCAL_TERM_CODE_REF, $&
-###       when /\A\[[a-zA-Z0-9._\- ]+::[a-zA-Z0-9._\- ]+\]/   #ERR_V_QUALIFIED_TERM_CODE_REF
-###         yield :ERR_V_QUALIFIED_TERM_CODE_REF, $&
-      when /\A\[/   # [
-        yield :Left_bracket_code, :Left_bracket_code
-      when /\A\]/   # ]
-        yield :Right_bracket_code, :Right_bracket_code
-###       when /\A[A-Z][a-zA-Z0-9_-]*/
-###         yield :V_TYPE_IDENTIFIER, $&
-###       when /\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/   #V_GENERIC_TYPE_IDENTIFIER
-###         yield :V_GENERIC_TYPE_IDENTIFIER, $&
-###       when /\A[a-z][a-zA-Z0-9_]*/
-###         word = $&.downcase
-###         if @@dadl_reserved[word]
-###           yield @@dadl_reserved[word], @@dadl_reserved[word]
-###         else
-###           yield :V_ATTRIBUTE_IDENTIFIER, $&
-###         end
-###       when /\Aa[ct][0-9.]+/   #V_LOCAL_CODE
-###         yield :V_LOCAL_CODE, $&
-      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-]-
-        yield :V_ISO8601_EXTENDED_DATE_TIME, $&
-      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]
-        yield :V_ISO8601_EXTENDED_TIME, $&
-      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
-        yield :V_ISO8601_EXTENDED_DATE, $&
-      when /\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/   #V_GENERIC_TYPE_IDENTIFIER
-        yield :V_GENERIC_TYPE_IDENTIFIER, $&
-      when /\A[0-9]+|[0-9]+[eE][+-]?[0-9]+/   #V_INTEGER
-        yield :V_INTEGER, $&
-###       when /\A[0-9]+\.[0-9]+|[0-9]+\.[0-9]+[eE][+-]?[0-9]+ /   #V_REAL
-###         yield :V_REAL, $&
-        #    when /\A"((?:[^"\\]+|\\.)*)"/ #V_STRING
-###       when /\A"([^"]*)"/m #V_STRING
-###         yield :V_STRING, $1
-      when /\A[a-z]+:\/\/[^<>|\\{}^~"\[\] ]*/ #V_URI
-        yield :V_URI, $&
-###       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
-###         yield :V_ISO8601_DURATION, $&
-      when /\A\S/ #UTF8CHAR
-        yield :UTF8CHAR, $&
-      end
-      data = $' # variable $' receives the string after the match
-    when :adl
-#      puts "Entering scan_adl"
-      data = scan_adl(data) do |sym, val|
-        yield sym, val
-      end
-    when :cadl
-#      puts "Entering scan_cadl"
-      data = scan_cadl(data) do |sym, val|
-        yield sym, val
-      end
-    when :regexp
-#      puts "Entering scan_regexp"
-      data = scan_regexp(data) do |sym, val|
-        yield sym, val
-      end
-    when :term_constraint
-#      puts "Entering scan_term_constraint"
-      data = scan_term_constraint(data) do |sym, val|
-        yield sym, val
-      end
-    else
-      raise
-    end
-  end
-end # of scan_dadl
-
-def scan_regexp(data)
-  until data.nil?  do
-    case @adl_type.last
-    when :regexp
-#      puts "Entering scan_regexp"
-      case data
-      when /\A\/\}/ #V_REGEXP
-        if @adl_type.last == :regexp
-          @in_regexp = false
-          @adl_type.pop
-          yield :END_REGEXP_BLOCK, :END_REGEXP_BLOCK
-        else
-          raise
-        end
-      when /\A(.*)(\/\})/ #V_REGEXP
-        yield :REGEXP_BODY, $1
-        if @adl_type.last == :regexp
-          @in_regexp = false
-          @adl_type.pop
-          yield :END_REGEXP_BLOCK, :END_REGEXP_BLOCK
-        else
-          raise
-        end
-      else
-        raise data
-      end
-      data = $' # variable $' receives the string after the match
-    when :adl
-#      puts "Entering scan_adl"
-      data = scan_adl(data) do |sym, val|
-        yield sym, val
-      end
-    when :dadl
-#      puts "Entering scan_dadl"
-      data = scan_dadl(data) do |sym, val|
-        yield sym, val
-      end
-    when :cadl
-#      puts "Entering scan_cadl"
-      data = scan_cadl(data) do |sym, val|
-        yield sym, val
-      end
-    when :term_constraint
-#      puts "Entering scan_term_constraint"
-      data = scan_term_constraint(data) do |sym, val|
-        yield sym, val
-      end
-    else
-      raise
-    end
-  end
-end # of scan_regexp
-
-def scan_term_constraint(data)
-  until data.nil?  do
-    case @adl_type.last
-    when :term_constraint
-#      puts "Entering scan_term_constraint"
-      case data
-      when /\A\n/ # carriage return
-        @lineno += 1
-        ;
-      when /\A[ \t\r\f]+/ #just drop it
-        ;
-      when /\A--.*$/ # single line comment
-        @lineno += 1
-        @@log.info("#{__FILE__}:#{__LINE__}: scan_term_constraint: COMMENT = #{$&} at #{@filename}:#{@lineno}")
-        ;
-      when /\A[a-zA-Z0-9\._\-]+[ \t]*,/ # match any line, with ',' termination
-        yield :TERM_CODE, $&
-      when /\A[a-zA-Z0-9\._\-]+[ \t]*;/ #match second last line with ';' termination (assumed value)
-        yield :TERM_CODE, $&
-#      when /\A[a-zA-Z0-9\._\-]+[ \t]*\]/ # match final line, terminating in ']'
-      when /\A[a-zA-Z0-9\._\-]*[ \t]*\]/ # match final line, terminating in ']'
-        adl_type = @adl_type.pop
-        assert_at(__FILE__,__LINE__){adl_type == :term_constraint}
-        yield :END_TERM_CODE_CONSTRAINT, $&
-      else
-        raise "data = #{data}"
-      end
-      data = $' # variable $' receives the string after the match
-    when :adl
-#      puts "Entering scan_adl"
-      data = scan_adl(data) do |sym, val|
-        yield sym, val
-      end
-    when :dadl
-#      puts "Entering scan_dadl"
-      data = scan_dadl(data) do |sym, val|
-        yield sym, val
-      end
-    when :cadl
-#      puts "Entering scan_cadl"
-      data = scan_cadl(data) do |sym, val|
-        yield sym, val
-      end
-    else
-      raise
-    end
-  end
-end # of scan_term_constraint
-
-
-def parse(data, filename, lineno = 1, debug = false)
-  @yydebug = true
-  @parsestring = data
-  @data = data
-  @lineno = lineno
-  @filename = filename
-  @adl_type = [:adl] # {:adl, :cadl, :dadl}
-  @in_regexp = false
-  @in_interval = false
-  @in_c_domain_type = false
-  yyparse self, :scan
-end
-
-def on_error( t, v, values)
-  raise Racc::ParseError, "#{@filename}:#{@lineno}: Inline syntax error on #{v.inspect}"
-end
-
-
-
-
-
-
-
-### Local Variables:
-### mode:ruby
-### mode:font-lock
-### comment-column:0
-### comment-start: "### "
-### comment-end:"" 
-### End:
-
-
-
-
Index: ruby/trunk/lib/adl_parser/scanner.rb
===================================================================
--- ruby/trunk/lib/adl_parser/scanner.rb	(revision 48)
+++ 	(revision )
@@ -1,329 +1,0 @@
-require 'logger'
-require 'rubygems'
-gem 'yaparc'
-require 'yaparc'
-
-
-module OpenEHR
-  module ADL
-    module Scanner
-      module Common
-        LOG = Logger.new('log/scanner.log','daily')
-
-        class V_QUALIFIED_TERM_CODE_REF
-          include Yaparc::Parsable
-          def initialize
-            @parser = lambda do |input|
-              Yaparc::Apply.new(Yaparc::Regex.new(/\A\[[a-zA-Z0-9()\._-]+::[a-zA-Z0-9\._-]+\]/)) do |match|
-                LOG.info("V_QUALIFIED_TERM_CODE_REF: #{match}")
-                [:V_QUALIFIED_TERM_CODE_REF, match]
-              end
-            end
-          end
-        end
-        
-        class V_LOCAL_TERM_CODE_REF
-          include Yaparc::Parsable
-          def initialize
-            @parser = lambda do |input|
-              Yaparc::Apply.new(Yaparc::Regex.new(/\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/)) do |match|
-                LOG.info("V_TERM_CODE_REF: #{match}")
-                [:V_LOCAL_TERM_CODE_REF, match]
-              end
-            end
-          end
-        end
-
-        class ERR_V_QUALIFIED_TERM_CODE_REF
-          include Yaparc::Parsable
-          def initialize
-            @parser = lambda do |input|
-              Yaparc::Apply.new(Yaparc::Regex.new(/\A\[[a-zA-Z0-9._\- ]+::[a-zA-Z0-9._\- ]+\]/)) do |match|
-                LOG.info("ERR_V_QUALIFIED_TERM_CODE_REF: #{match}")
-                [:ERR_V_QUALIFIED_TERM_CODE_REF, match]
-              end
-            end
-          end
-        end
-
-        class V_TYPE_IDENTIFIER
-          include Yaparc::Parsable
-          def initialize
-            @parser = lambda do |input|
-              Yaparc::Apply.new(Yaparc::Regex.new(/\A[A-Z][a-zA-Z0-9_]*/)) do |match|
-                LOG.info("V_TYPE_IDENTIFIER: #{match}")
-                [:V_TYPE_IDENTIFIER, match]
-              end
-            end
-          end
-        end
-
-        class V_GENERIC_TYPE_IDENTIFIER
-          include Yaparc::Parsable
-          def initialize
-            @parser = lambda do |input|
-              Yaparc::Apply.new(Yaparc::Regex.new(/\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/)) do |match|
-                LOG.info("V_GENERIC_TYPE_IDENTIFIER: #{match}")
-                [:V_GENERIC_TYPE_IDENTIFIER, match]
-              end
-            end
-          end
-        end
-
-
-        class V_LOCAL_CODE
-          include Yaparc::Parsable
-          def initialize
-            @parser = lambda do |input|
-              Yaparc::Apply.new(Yaparc::Regex.new(/\Aa[ct][0-9.]+/)) do |match|
-                LOG.info("V_LOCAL_CODE: #{match}")
-                [:V_LOCAL_CODE, match]
-              end
-            end
-          end
-        end
-
-        class V_STRING
-          include Yaparc::Parsable
-          def initialize
-            @parser = lambda do |input|
-              Yaparc::Apply.new(Yaparc::Regex.new(/\A"([^"]*)"/m)) do |match|
-                LOG.info("V_STRING: #{match}")
-                [:V_STRING, match]
-              end
-            end
-          end
-        end
-
-        class V_REAL
-          include Yaparc::Parsable
-          def initialize
-            @parser = lambda do |input|
-              Yaparc::Apply.new(Yaparc::Regex.new(/\A[0-9]+\.[0-9]+|[0-9]+\.[0-9]+[eE][+-]?[0-9]+/)) do |match|
-                LOG.info("V_REAL: #{match}")
-                [:V_REAL, match]
-              end
-            end
-          end
-        end
-
-        #V_ISO8601_DURATION PnYnMnWnDTnnHnnMnnS
-        class V_ISO8601_DURATION
-          include Yaparc::Parsable
-          def initialize
-            @parser = lambda do |input|
-              Yaparc::Apply.new(
-                                Yaparc::Alt.new(Yaparc::Regex.new(/\AP([0-9]+|[yY])?([0-9]+|[mM])?([0-9]+|[wW])?([0-9]+|[dD])?T([0-9]+|[hH])?([0-9]+|[mM])?([0-9]+|[sS])?/),
-                                                Yaparc::Regex.new(/\AP([0-9]+|[yY])?([0-9]+|[mM])?([0-9]+|[wW])?([0-9]+|[dD])?/))) do |match|
-                LOG.info("V_ISO8601_DURATION: #{match}")
-                [:V_ISO8601_DURATION, match]
-              end
-            end
-          end
-        end
-
-      end # of Common
-
-      module DADL
-        # c.f. http://www.openehr.org/svn/ref_impl_eiffel/TRUNK/components/adl_parser/src/syntax/adl/parser/adl_scanner.l
-        RESERVED = {
-          'true' => :SYM_TRUE, #[Tt][Rr][Uu][Ee] -- -> SYM_TRUE 
-          'false' => :SYM_FALSE, # [Ff][Aa][Ll][Ss][Ee] -- -> SYM_FALSE 
-          'infinity' => :SYM_INFINITY # [Ii][Nn][Ff][Ii][Nn][Ii][Tt][Yy] -- -> SYM_INFINITY 
-        }
-
-        class RootScanner
-          include Yaparc::Parsable
-          def initialize
-            @parser = lambda do |input|
-              Yaparc::Alt.new(Reserved.new,
-                              OpenEHR::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF.new,
-                              OpenEHR::ADL::Scanner::Common::V_LOCAL_TERM_CODE_REF.new,
-                              OpenEHR::ADL::Scanner::Common::ERR_V_QUALIFIED_TERM_CODE_REF.new,
-                              OpenEHR::ADL::Scanner::Common::V_TYPE_IDENTIFIER.new,
-                              OpenEHR::ADL::Scanner::Common::V_GENERIC_TYPE_IDENTIFIER.new,
-                              OpenEHR::ADL::Scanner::Common::V_STRING.new,
-                              OpenEHR::ADL::Scanner::Common::V_LOCAL_CODE.new,
-                              OpenEHR::ADL::Scanner::Common::V_REAL.new,
-                              OpenEHR::ADL::Scanner::Common::V_ISO8601_DURATION.new
-                              )
-            end
-          end
-        end
-=begin <DADL::Reserved class>
-=end
-        class Reserved
-          include Yaparc::Parsable
-          
-          def initialize
-            @parser = lambda do |input|
-              reserved_parsers = OpenEHR::ADL::Scanner::DADL::RESERVED.map do |keyword| 
-                Yaparc::Tokenize.new(
-                                     Yaparc::Literal.new(keyword[0],false)
-                                     )
-              end
-              Yaparc::Alt.new(Yaparc::Apply.new(Yaparc::Alt.new(*reserved_parsers)) do |match|
-                                OpenEHR::ADL::Scanner::Common::LOG.info("Reserved: #{match}")
-                                [OpenEHR::ADL::Scanner::DADL::RESERVED[match], OpenEHR::ADL::Scanner::DADL::RESERVED[match]]
-                              end,
-                              Yaparc::Apply.new(Yaparc::Regex.new(/\A[a-z][a-zA-Z0-9_]*/)) do |match|
-                                OpenEHR::ADL::Scanner::Common::LOG.info("V_ATTRIBUTE_IDENTIFIER: #{match}")
-                                [:V_ATTRIBUTE_IDENTIFIER, match]
-                              end)
-            end
-          end
-        end
-
-
-
-      end # of DADL
-
-      module CADL
-        # c.f. http://www.openehr.org/svn/ref_impl_eiffel/TRUNK/components/adl_parser/src/syntax/cadl/parser/cadl_scanner.l
-        RESERVED = {
-          'ordered' => :SYM_ORDERED, # [Oo][Rr][Dd][Ee][Rr][Ee][Dd]
-          'unordered' => :SYM_UNORDERED, # [Uu][Nn][Oo][Rr][Dd][Ee][Rr][Ee][Dd]
-          'then' => :SYM_THEN, # [Tt][Hh][Ee][Nn]
-          'else' => :SYM_ELSE, # [Ee][Ll][Ss][Ee]
-          'and' => :SYM_AND, # [Aa][Nn][Dd]
-          'or' => :SYM_OR, # [Oo][Rr]
-          'xor' => :SYM_XOR, # [Xx][Oo][Rr]
-          'not' => :SYM_NOT, # [Nn][Oo][Tt]
-          'implies' => :SYM_IMPLIES, # [Ii][Mm][Pp][Ll][Ii][Ee][Ss]
-          'true' => :SYM_TRUE, #[Tt][Rr][Uu][Ee] -- -> SYM_TRUE 
-          'false' => :SYM_FALSE, # [Ff][Aa][Ll][Ss][Ee] -- -> SYM_FALSE 
-          'forall' => :SYM_FORALL, # [Ff][Oo][Rr][_][Aa][Ll][Ll]
-          'exists' => :SYM_EXISTS, # [Ee][Xx][Ii][Ss][Tt][Ss]
-          'existence' => :SYM_EXISTENCE, # [Ee][Xx][Iu][Ss][Tt][Ee][Nn][Cc][Ee]
-          'occurrences' => :SYM_OCCURRENCES, # [Oo][Cc][Cc][Uu][Rr][Rr][Ee][Nn][Cc][Ee][Ss]
-          'cardinality' => :SYM_CARDINALITY, # [Cc][Aa][Rr][Dd][Ii][Nn][Aa][Ll][Ii][Tt][Yy]
-          'unique' => :SYM_UNIQUE, # [Uu][Nn][Ii][Qq][Uu][Ee]
-          'matches' => :SYM_MATCHES, # [Mm][Aa][Tt][Cc][Hh][Ee][Ss]
-          'is_in' => :SYM_MATCHES, # [Ii][Ss][_][Ii][Nn]
-          'invariant' => :SYM_INVARIANT, # [Ii][Nn][Vv][Aa][Rr][Ii][Aa][Nn][Tt]
-          'infinity' => :SYM_INFINITY, # [Ii][Nn][Ff][Ii][Nn][Ii][Tt][Yy] -- -> SYM_INFINITY 
-          'use_node' => :SYM_USE_NODE, # [Uu][Ss][Ee][_][Nn][Oo][Dd][Ee]
-          'use_archetype' => :SYM_ALLOW_ARCHETYPE, # [Uu][Ss][Ee][_][Aa][Rr][Cc][Hh][Ee][Tt][Yy][Pp][Ee]
-          'allow_archetype' => :SYM_ALLOW_ARCHETYPE, # [Aa][Ll][Ll][Oo][Ww][_][Aa][Rr][Cc][Hh][Ee][Tt][Yy][Pp][Ee]
-          'include' => :SYM_INCLUDE, # [Ii][Nn][Cc][Ll][Uu][Dd][Ee]
-          'exclude' => :SYM_EXCLUDE # [Ee][Xx][Cc][Ll][Uu][Dd][Ee]
-        }
-
-        #V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN, /\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]/
-        class V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN
-          include Yaparc::Parsable
-          def initialize
-            @parser = lambda do |input|
-              Yaparc::Apply.new(Yaparc::Regex.new(/\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]/)) do |match|
-                OpenEHR::ADL::Scanner::Common::LOG.info("V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN: #{match}")
-                [:V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN, match]
-              end
-            end
-          end
-        end
-
-        #V_ISO8601_DATE_CONSTRAINT_PATTERN  /\A[yY][yY][yY][yY]-[mM?X][mM?X]-[dD?X][dD?X]/
-        class V_ISO8601_DATE_CONSTRAINT_PATTERN
-          include Yaparc::Parsable
-          def initialize
-            @parser = lambda do |input|
-              Yaparc::Apply.new(Yaparc::Regex.new(/\A[yY][yY][yY][yY]-[mM?X][mM?X]-[dD?X][dD?X]/)) do |match|
-                OpenEHR::ADL::Scanner::Common::LOG.info("V_ISO8601_DATE_CONSTRAINT_PATTERN: #{match}")
-                [:V_ISO8601_DATE_CONSTRAINT_PATTERN, match]
-              end
-            end
-          end
-        end
-
-        #V_ISO8601_TIME_CONSTRAINT_PATTERN /\A[hH][hH]:[mM?X][mM?X]:[sS?X][sS?X]/
-        class V_ISO8601_TIME_CONSTRAINT_PATTERN
-          include Yaparc::Parsable
-          def initialize
-            @parser = lambda do |input|
-              Yaparc::Apply.new(Yaparc::Regex.new(/\A[hH][hH]:[mM?X][mM?X]:[sS?X][sS?X]/)) do |match|
-                OpenEHR::ADL::Scanner::Common::LOG.info("V_ISO8601_TIME_CONSTRAINT_PATTERN: #{match}")
-                [:V_ISO8601_TIME_CONSTRAINT_PATTERN, match]
-              end
-            end
-          end
-        end
-
-        #V_ISO8601_DURATION_CONSTRAINT_PATTERN 
-        class V_ISO8601_DURATION_CONSTRAINT_PATTERN
-          include Yaparc::Parsable
-          def initialize
-            @parser = lambda do |input|
-              Yaparc::Apply.new(Yaparc::Alt.new(Yaparc::Regex.new(/\AP[yY]?[mM]?[wW]?[dD]?T[hH]?[mM]?[sS]?/),
-                                                Yaparc::Regex.new(/\AP[yY]?[mM]?[wW]?[dD]?/))) do |match|
-                OpenEHR::ADL::Scanner::Common::LOG.info("V_ISO8601_DURATION_CONSTRAINT_PATTERN: #{match}")
-                [:V_ISO8601_DURATION_CONSTRAINT_PATTERN, match]
-              end
-            end
-          end
-        end
-
-        #V_C_DOMAIN_TYPE /\A[A-Z][a-zA-Z0-9_]*[ \n]*\</
-        class V_C_DOMAIN_TYPE
-          include Yaparc::Parsable
-          def initialize
-            @parser = lambda do |input|
-              Yaparc::Apply.new(Yaparc::Regex.new(/\A[A-Z][a-zA-Z0-9_]*[ \n]*\</)) do |match|
-                OpenEHR::ADL::Scanner::Common::LOG.info("V_C_DOMAIN_TYPE: #{match}")
-                [:START_V_C_DOMAIN_TYPE_BLOCK, match]
-              end
-            end
-          end
-        end
-
-        class RootScanner
-          include Yaparc::Parsable
-          def initialize
-            @parser = lambda do |input|
-              Yaparc::Alt.new(V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN.new,
-                              V_ISO8601_DATE_CONSTRAINT_PATTERN.new,
-                              V_ISO8601_TIME_CONSTRAINT_PATTERN.new,
-                              OpenEHR::ADL::Scanner::Common::V_ISO8601_DURATION.new,
-                              V_C_DOMAIN_TYPE.new,
-                              V_ISO8601_DURATION_CONSTRAINT_PATTERN.new,
-                              Reserved.new,
-                              OpenEHR::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF.new,
-                              OpenEHR::ADL::Scanner::Common::V_LOCAL_TERM_CODE_REF.new,
-                              OpenEHR::ADL::Scanner::Common::ERR_V_QUALIFIED_TERM_CODE_REF.new,
-                              OpenEHR::ADL::Scanner::Common::V_TYPE_IDENTIFIER.new,
-                              OpenEHR::ADL::Scanner::Common::V_GENERIC_TYPE_IDENTIFIER.new,
-                              OpenEHR::ADL::Scanner::Common::V_STRING.new,
-                              OpenEHR::ADL::Scanner::Common::V_LOCAL_CODE.new,
-                              OpenEHR::ADL::Scanner::Common::V_REAL.new,
-                              OpenEHR::ADL::Scanner::Common::V_ISO8601_DURATION.new
-                              )
-            end
-          end
-        end
-
-=begin <CADL::Reserved class>
-=end
-        class Reserved
-          include Yaparc::Parsable
-          
-          def initialize
-            @parser = lambda do |input|
-              orderd_reserved = RESERVED.keys.sort{|x,y| y.length <=> x.length  }
-              reserved_parsers = orderd_reserved.map do |keyword| 
-                Yaparc::Literal.new(keyword,false)
-              end
-              Yaparc::Alt.new(Yaparc::Apply.new(Yaparc::Alt.new(*reserved_parsers)) do |match|
-                                OpenEHR::ADL::Scanner::Common::LOG.info("Reserved: #{match}")
-                                [OpenEHR::ADL::Scanner::CADL::RESERVED[match], OpenEHR::ADL::Scanner::CADL::RESERVED[match]]
-                              end,
-                              Yaparc::Apply.new(Yaparc::Regex.new(/\A[a-z][a-zA-Z0-9_]*/)) do |match|
-                                OpenEHR::ADL::Scanner::Common::LOG.info("V_ATTRIBUTE_IDENTIFIER: #{match}")
-                                [:V_ATTRIBUTE_IDENTIFIER, match]
-                              end)
-            end
-          end
-        end
-
-      end
-    end
-  end
-end
Index: ruby/trunk/lib/adl_parser/shell.rb
===================================================================
--- ruby/trunk/lib/adl_parser/shell.rb	(revision 48)
+++ 	(revision )
@@ -1,35 +1,0 @@
-$:.unshift File.join(File.dirname(__FILE__))
-require 'validator.rb'
-require 'stringio'
-
-module OpenEHR
-  module Application
-    class Shell
-      def run
-        raise 'not implemented'
-      end
-    end
-
-    class ADLValidator < Shell
-      def initialize(validator)
-        @validator = validator
-      end
-
-      def run(input, name = nil)
-        input_stream = case input
-                       when String
-                         StringIO.new(input)
-                       when File
-                         input
-                       when StringIO
-                         input
-                       else
-                         raise
-                       end
-        @validator.validate(input_stream.read, name)
-        input_stream.close
-      end
-    end
-  end
-end
-
Index: ruby/trunk/lib/adl_parser/util.rb
===================================================================
--- ruby/trunk/lib/adl_parser/util.rb	(revision 48)
+++ 	(revision )
@@ -1,6 +1,0 @@
-
-def assert_at(file,line, message = "")
-  unless yield
-    raise "Assertion failed !: #{file}, #{line}: #{message}"
-  end
-end
Index: ruby/trunk/lib/adl_parser/validator.rb
===================================================================
--- ruby/trunk/lib/adl_parser/validator.rb	(revision 48)
+++ 	(revision )
@@ -1,20 +1,0 @@
-$:.unshift File.join(File.dirname(__FILE__))
-require 'parser.rb'
-
-
-module OpenEHR
-  module ADL
-
-    class Validator
-      def initialize(parser)
-        @parser = parser
-      end
-
-      def validate(input_string, name = nil)
-        @parser.parse(input_string, name)
-      end
-    end
-
-  end
-end
-
