Index: ruby/trunk/adl_parser/lib/parser.rb
===================================================================
--- ruby/trunk/adl_parser/lib/parser.rb	(revision 19)
+++ ruby/trunk/adl_parser/lib/parser.rb	(revision 20)
@@ -25,5 +25,5 @@
     class Parser < Racc::Parser
 
-module_eval <<'..end lib/parser.y modeval..ide0b42f72dd', 'lib/parser.y', 720
+module_eval <<'..end lib/parser.y modeval..id134a7f5a66', 'lib/parser.y', 739
 
 @@log = Logger.new('log/parser.log','daily')
@@ -227,8 +227,6 @@
         if @in_interval
           @in_interval = false
-#        elsif @start_block_received
         else
           @in_interval = true
-#          @start_block_received = false
         end
         yield :SYM_INTERVAL_DELIM, :SYM_INTERVAL_DELIM
@@ -405,10 +403,12 @@
         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
+#          @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
 
@@ -534,5 +534,4 @@
         if @in_interval
           yield :SYM_LT, :SYM_LT
-#        elsif
         else
           @adl_type.push(:dadl)
@@ -541,5 +540,5 @@
       when /\A\>/   # >
         if @in_interval
-          @in_interval = false
+#          @in_interval = false
           yield :SYM_GT, :SYM_GT
         elsif @in_c_domain_type == true
@@ -595,10 +594,12 @@
         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
+#          @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]
@@ -811,5 +812,5 @@
 
 
-..end lib/parser.y modeval..ide0b42f72dd
+..end lib/parser.y modeval..id134a7f5a66
 
 ##### racc 1.4.5 generates ###
@@ -919,8 +920,8 @@
  2, 159, :_reduce_none,
  3, 160, :_reduce_none,
- 1, 161, :_reduce_none,
+ 1, 161, :_reduce_103,
  1, 162, :_reduce_none,
  2, 162, :_reduce_none,
- 3, 163, :_reduce_none,
+ 3, 163, :_reduce_106,
  3, 164, :_reduce_107,
  1, 158, :_reduce_none,
@@ -931,5 +932,5 @@
  1, 157, :_reduce_none,
  2, 157, :_reduce_none,
- 3, 168, :_reduce_none,
+ 3, 168, :_reduce_115,
  1, 169, :_reduce_none,
  1, 169, :_reduce_none,
@@ -1059,9 +1060,9 @@
  4, 198, :_reduce_none,
  3, 198, :_reduce_none,
- 1, 172, :_reduce_none,
+ 1, 172, :_reduce_243,
  3, 173, :_reduce_none,
  3, 173, :_reduce_none,
  3, 173, :_reduce_none,
- 1, 183, :_reduce_none,
+ 1, 183, :_reduce_247,
  1, 112, :_reduce_none,
  2, 112, :_reduce_none,
@@ -1181,5 +1182,5 @@
  1, 220, :_reduce_none,
  3, 220, :_reduce_none,
- 3, 221, :_reduce_none,
+ 3, 221, :_reduce_365,
  1, 125, :_reduce_none,
  1, 125, :_reduce_none,
@@ -2222,5 +2223,5 @@
 module_eval <<'.,.,', 'lib/parser.y', 240
   def _reduce_93( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: attr_id = #{val[0]}, object_block = #{val[1]} at #{@filename}:#{@lineno}")
+    @@log.info("#{__FILE__}:#{__LINE__}: attr_id = #{val[0]}, object_block = #{val[2]} at #{@filename}:#{@lineno}")
    result
   end
@@ -2250,5 +2251,10 @@
  # reduce 102 omitted
 
- # reduce 103 omitted
+module_eval <<'.,.,', 'lib/parser.y', 262
+  def _reduce_103( val, _values, result )
+    @@log.info("SYM_START_DBLOCK: #{val[0]} at #{@filename}:#{@lineno}")
+   result
+  end
+.,.,
 
  # reduce 104 omitted
@@ -2256,7 +2262,12 @@
  # reduce 105 omitted
 
- # reduce 106 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 269
+module_eval <<'.,.,', 'lib/parser.y', 270
+  def _reduce_106( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}: keyed_object = #{val[0]}, object_block = #{val[2]} at #{@filename}:#{@lineno}")
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 275
   def _reduce_107( val, _values, result )
     @@log.info("object_key: [#{val[1]}] at #{@filename}:#{@lineno}")
@@ -2279,5 +2290,10 @@
  # reduce 114 omitted
 
- # reduce 115 omitted
+module_eval <<'.,.,', 'lib/parser.y', 287
+  def _reduce_115( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}: primitive_object_block = <#{val[2]}> at #{@filename}:#{@lineno}")
+   result
+  end
+.,.,
 
  # reduce 116 omitted
@@ -2291,5 +2307,5 @@
  # reduce 120 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 287
+module_eval <<'.,.,', 'lib/parser.y', 296
   def _reduce_121( val, _values, result )
     @@log.info("string_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2298,5 +2314,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 291
+module_eval <<'.,.,', 'lib/parser.y', 300
   def _reduce_122( val, _values, result )
     @@log.info("integer_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2305,5 +2321,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 295
+module_eval <<'.,.,', 'lib/parser.y', 304
   def _reduce_123( val, _values, result )
     @@log.info("real_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2312,5 +2328,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 299
+module_eval <<'.,.,', 'lib/parser.y', 308
   def _reduce_124( val, _values, result )
     @@log.info("boolean_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2319,5 +2335,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 303
+module_eval <<'.,.,', 'lib/parser.y', 312
   def _reduce_125( val, _values, result )
     @@log.info("character_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2326,5 +2342,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 307
+module_eval <<'.,.,', 'lib/parser.y', 316
   def _reduce_126( val, _values, result )
     @@log.info("date_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2333,5 +2349,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 311
+module_eval <<'.,.,', 'lib/parser.y', 320
   def _reduce_127( val, _values, result )
     @@log.info("time_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2340,5 +2356,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 315
+module_eval <<'.,.,', 'lib/parser.y', 324
   def _reduce_128( val, _values, result )
     @@log.info("date_time_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2347,5 +2363,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 319
+module_eval <<'.,.,', 'lib/parser.y', 328
   def _reduce_129( val, _values, result )
     @@log.info("duration_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2354,5 +2370,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 323
+module_eval <<'.,.,', 'lib/parser.y', 332
   def _reduce_130( val, _values, result )
     @@log.info("uri_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2391,5 +2407,5 @@
  # reduce 145 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 344
+module_eval <<'.,.,', 'lib/parser.y', 353
   def _reduce_146( val, _values, result )
     @@log.info("V_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2398,5 +2414,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 348
+module_eval <<'.,.,', 'lib/parser.y', 357
   def _reduce_147( val, _values, result )
     @@log.info("V_GENERIC_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2405,5 +2421,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 353
+module_eval <<'.,.,', 'lib/parser.y', 362
   def _reduce_148( val, _values, result )
     @@log.info("V_STRING: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2574,5 +2590,5 @@
  # reduce 229 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 464
+module_eval <<'.,.,', 'lib/parser.y', 473
   def _reduce_230( val, _values, result )
     @@log.info("V_ISO8601_DURATION: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2605,5 +2621,10 @@
  # reduce 242 omitted
 
- # reduce 243 omitted
+module_eval <<'.,.,', 'lib/parser.y', 492
+  def _reduce_243( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}: V_QUALIFIED_TERM_CODE_REF = #{val[0]} at #{@filename}:#{@lineno}")
+   result
+  end
+.,.,
 
  # reduce 244 omitted
@@ -2613,5 +2634,10 @@
  # reduce 246 omitted
 
- # reduce 247 omitted
+module_eval <<'.,.,', 'lib/parser.y', 501
+  def _reduce_247( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}: V_URI = #{val[0]} at #{@filename}:#{@lineno}")
+   result
+  end
+.,.,
 
  # reduce 248 omitted
@@ -2695,5 +2721,5 @@
  # reduce 287 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 555
+module_eval <<'.,.,', 'lib/parser.y', 570
   def _reduce_288( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}")
@@ -2702,5 +2728,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 559
+module_eval <<'.,.,', 'lib/parser.y', 574
   def _reduce_289( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}")
@@ -2859,5 +2885,11 @@
  # reduce 364 omitted
 
- # reduce 365 omitted
+module_eval <<'.,.,', 'lib/parser.y', 694
+  def _reduce_365( val, _values, result )
+    @in_interval = false
+    @@log.info("#{__FILE__}:#{__LINE__}, #{val[0]}|#{val[2]} at #{@filename}")
+   result
+  end
+.,.,
 
  # reduce 366 omitted
@@ -2877,5 +2909,5 @@
  # reduce 373 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 697
+module_eval <<'.,.,', 'lib/parser.y', 716
   def _reduce_374( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{word} at #{@filename}")
Index: ruby/trunk/adl_parser/lib/parser.y
===================================================================
--- ruby/trunk/adl_parser/lib/parser.y	(revision 19)
+++ ruby/trunk/adl_parser/lib/parser.y	(revision 20)
@@ -237,5 +237,5 @@
 attr_val: attr_id SYM_EQ object_block
   {
-    @@log.info("#{__FILE__}:#{__LINE__}: attr_id = #{val[0]}, object_block = #{val[1]} at #{@filename}:#{@lineno}")
+    @@log.info("#{__FILE__}:#{__LINE__}: attr_id = #{val[0]}, object_block = #{val[2]} at #{@filename}:#{@lineno}")
   }
 
@@ -258,4 +258,7 @@
 
 multiple_attr_object_block_head: SYM_START_DBLOCK
+  {
+    @@log.info("SYM_START_DBLOCK: #{val[0]} at #{@filename}:#{@lineno}")
+  }
 
 keyed_objects: keyed_object
@@ -263,4 +266,7 @@
 
 keyed_object: object_key SYM_EQ object_block
+  {
+    @@log.info("#{__FILE__}:#{__LINE__}: keyed_object = #{val[0]}, object_block = #{val[2]} at #{@filename}:#{@lineno}")
+  }
 
 object_key: Left_bracket_code simple_value Right_bracket_code
@@ -277,4 +283,7 @@
   | type_identifier untyped_primitive_object_block
 untyped_primitive_object_block: SYM_START_DBLOCK primitive_object_value SYM_END_DBLOCK
+  {
+    @@log.info("#{__FILE__}:#{__LINE__}: primitive_object_block = <#{val[2]}> at #{@filename}:#{@lineno}")
+  }
 primitive_object_value: simple_value
   | simple_list_value
@@ -479,4 +488,7 @@
 
 term_code: V_QUALIFIED_TERM_CODE_REF
+  {
+    @@log.info("#{__FILE__}:#{__LINE__}: V_QUALIFIED_TERM_CODE_REF = #{val[0]} at #{@filename}:#{@lineno}")
+  }
 
 term_code_list_value: term_code Comma_code term_code
@@ -485,4 +497,7 @@
 
 uri_value: V_URI
+  {
+    @@log.info("#{__FILE__}:#{__LINE__}: V_URI = #{val[0]} at #{@filename}:#{@lineno}")
+  }
 
 
@@ -674,4 +689,8 @@
 
 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]"
@@ -919,8 +938,6 @@
         if @in_interval
           @in_interval = false
-#        elsif @start_block_received
         else
           @in_interval = true
-#          @start_block_received = false
         end
         yield :SYM_INTERVAL_DELIM, :SYM_INTERVAL_DELIM
@@ -1097,10 +1114,12 @@
         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
+#          @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
 
@@ -1226,5 +1245,4 @@
         if @in_interval
           yield :SYM_LT, :SYM_LT
-#        elsif
         else
           @adl_type.push(:dadl)
@@ -1233,5 +1251,5 @@
       when /\A\>/   # >
         if @in_interval
-          @in_interval = false
+#          @in_interval = false
           yield :SYM_GT, :SYM_GT
         elsif @in_c_domain_type == true
@@ -1287,10 +1305,12 @@
         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
+#          @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]
Index: ruby/trunk/adl_parser/lib/scanner.rb
===================================================================
--- ruby/trunk/adl_parser/lib/scanner.rb	(revision 19)
+++ ruby/trunk/adl_parser/lib/scanner.rb	(revision 20)
@@ -114,6 +114,8 @@
             @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|
+                                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|
+#                                 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]
@@ -255,12 +257,4 @@
                 [:START_V_C_DOMAIN_TYPE_BLOCK, match]
               end
-#               parser = Yaparc::Regex.new(/\A[A-Z][a-zA-Z0-9_]*[ \n]*\</)
-#               case result = parser.parse(input)
-#               when Yaparc::Result::OK
-#                 OpenEHR::ADL::Scanner::Common::LOG.info("V_C_DOMAIN_TYPE: #{result.value}")
-#                 Yaparc::Result::Fail.new
-#               else
-#                 Yaparc::Result::Fail.new
-#               end
             end
           end
