Index: ruby/trunk/adl_parser/lib/parser.rb
===================================================================
--- ruby/trunk/adl_parser/lib/parser.rb	(revision 20)
+++ ruby/trunk/adl_parser/lib/parser.rb	(revision 21)
@@ -13,5 +13,7 @@
 require 'lib/util.rb'
 require 'lib/scanner.rb'
-require 'lib/model.rb'
+#require 'lib/model.rb'
+require 'rubygems'
+require 'am.rb'
 $DEBUG = true
 
@@ -25,5 +27,5 @@
     class Parser < Racc::Parser
 
-module_eval <<'..end lib/parser.y modeval..id134a7f5a66', 'lib/parser.y', 739
+module_eval <<'..end lib/parser.y modeval..id0eaae3c06b', 'lib/parser.y', 758
 
 @@log = Logger.new('log/parser.log','daily')
@@ -812,5 +814,5 @@
 
 
-..end lib/parser.y modeval..id134a7f5a66
+..end lib/parser.y modeval..id0eaae3c06b
 
 ##### racc 1.4.5 generates ###
@@ -818,7 +820,7 @@
 racc_reduce_table = [
  0, 0, :racc_error,
- 2, 95, :_reduce_none,
+ 2, 95, :_reduce_1,
  1, 95, :_reduce_none,
- 8, 96, :_reduce_none,
+ 8, 96, :_reduce_3,
  2, 97, :_reduce_none,
  2, 97, :_reduce_none,
@@ -839,12 +841,12 @@
  2, 100, :_reduce_none,
  0, 101, :_reduce_none,
+ 2, 101, :_reduce_22,
  2, 101, :_reduce_none,
- 2, 101, :_reduce_none,
+ 2, 102, :_reduce_24,
  2, 102, :_reduce_none,
- 2, 102, :_reduce_none,
+ 1, 110, :_reduce_26,
  1, 110, :_reduce_none,
- 1, 110, :_reduce_none,
- 5, 111, :_reduce_none,
- 5, 111, :_reduce_none,
+ 5, 111, :_reduce_28,
+ 5, 111, :_reduce_29,
  2, 113, :_reduce_none,
  1, 115, :_reduce_31,
@@ -871,5 +873,5 @@
  2, 132, :_reduce_none,
  1, 127, :_reduce_none,
- 1, 133, :_reduce_none,
+ 1, 133, :_reduce_54,
  1, 133, :_reduce_none,
  1, 133, :_reduce_none,
@@ -2012,9 +2014,22 @@
  # reduce 0 omitted
 
- # reduce 1 omitted
+module_eval <<'.,.,', 'lib/parser.y', 32
+  def _reduce_1( val, _values, result )
+    result = val[0]
+   result
+  end
+.,.,
 
  # reduce 2 omitted
 
- # reduce 3 omitted
+module_eval <<'.,.,', 'lib/parser.y', 41
+  def _reduce_3( val, _values, result )
+    result = OpenEHR::AM::Archetype::ARCHETYPE.new(
+                                                   :description => val[4],
+                                                   :definition => val[5]
+                                                   )
+   result
+  end
+.,.,
 
  # reduce 4 omitted
@@ -2048,5 +2063,5 @@
  # reduce 18 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 74
+module_eval <<'.,.,', 'lib/parser.y', 76
   def _reduce_19( val, _values, result )
     result = {:language => val[1]}
@@ -2059,23 +2074,48 @@
  # reduce 21 omitted
 
- # reduce 22 omitted
+module_eval <<'.,.,', 'lib/parser.y', 87
+  def _reduce_22( val, _values, result )
+    result = OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION.new(:details => val[1])
+   result
+  end
+.,.,
 
  # reduce 23 omitted
 
- # reduce 24 omitted
+module_eval <<'.,.,', 'lib/parser.y', 95
+  def _reduce_24( val, _values, result )
+    result = val[1]
+   result
+  end
+.,.,
 
  # reduce 25 omitted
 
- # reduce 26 omitted
+module_eval <<'.,.,', 'lib/parser.y', 103
+  def _reduce_26( val, _values, result )
+    result = val[0]
+   result
+  end
+.,.,
 
  # reduce 27 omitted
 
- # reduce 28 omitted
-
- # reduce 29 omitted
+module_eval <<'.,.,', 'lib/parser.y', 111
+  def _reduce_28( val, _values, result )
+    result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 115
+  def _reduce_29( val, _values, result )
+    result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new
+   result
+  end
+.,.,
 
  # reduce 30 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 111
+module_eval <<'.,.,', 'lib/parser.y', 124
   def _reduce_31( val, _values, result )
     result = {:c_complex_object_id => {:type_identifier => val[0]}}
@@ -2084,5 +2124,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 115
+module_eval <<'.,.,', 'lib/parser.y', 128
   def _reduce_32( val, _values, result )
     result = {:c_complex_object_id => {:type_identifier => val[0], :V_LOCAL_TERM_CODE_REF => val[1]}}
@@ -2133,5 +2173,11 @@
  # reduce 53 omitted
 
- # reduce 54 omitted
+module_eval <<'.,.,', 'lib/parser.y', 177
+  def _reduce_54( val, _values, result )
+    @@log.info("#{__FILE__}:#{__LINE__}: c_integer = #{val[0]} at #{@filename}")
+    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_Integer.new
+   result
+  end
+.,.,
 
  # reduce 55 omitted
@@ -2161,5 +2207,5 @@
  # reduce 67 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 186
+module_eval <<'.,.,', 'lib/parser.y', 203
   def _reduce_68( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]}, c_existence = #{val[1]} at #{@filename}")
@@ -2168,5 +2214,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 190
+module_eval <<'.,.,', 'lib/parser.y', 207
   def _reduce_69( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER: #{val[0]}, c_existence = #{val[1]}, c_cardinality = #{val[2]} at #{@filename}")
@@ -2221,5 +2267,5 @@
  # reduce 92 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 240
+module_eval <<'.,.,', 'lib/parser.y', 257
   def _reduce_93( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: attr_id = #{val[0]}, object_block = #{val[2]} at #{@filename}:#{@lineno}")
@@ -2228,5 +2274,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 245
+module_eval <<'.,.,', 'lib/parser.y', 262
   def _reduce_94( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}:#{@lineno}")
@@ -2251,5 +2297,5 @@
  # reduce 102 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 262
+module_eval <<'.,.,', 'lib/parser.y', 279
   def _reduce_103( val, _values, result )
     @@log.info("SYM_START_DBLOCK: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2262,5 +2308,5 @@
  # reduce 105 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 270
+module_eval <<'.,.,', 'lib/parser.y', 287
   def _reduce_106( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: keyed_object = #{val[0]}, object_block = #{val[2]} at #{@filename}:#{@lineno}")
@@ -2269,5 +2315,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 275
+module_eval <<'.,.,', 'lib/parser.y', 292
   def _reduce_107( val, _values, result )
     @@log.info("object_key: [#{val[1]}] at #{@filename}:#{@lineno}")
@@ -2290,5 +2336,5 @@
  # reduce 114 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 287
+module_eval <<'.,.,', 'lib/parser.y', 304
   def _reduce_115( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: primitive_object_block = <#{val[2]}> at #{@filename}:#{@lineno}")
@@ -2307,5 +2353,5 @@
  # reduce 120 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 296
+module_eval <<'.,.,', 'lib/parser.y', 313
   def _reduce_121( val, _values, result )
     @@log.info("string_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2314,5 +2360,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 300
+module_eval <<'.,.,', 'lib/parser.y', 317
   def _reduce_122( val, _values, result )
     @@log.info("integer_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2321,5 +2367,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 304
+module_eval <<'.,.,', 'lib/parser.y', 321
   def _reduce_123( val, _values, result )
     @@log.info("real_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2328,5 +2374,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 308
+module_eval <<'.,.,', 'lib/parser.y', 325
   def _reduce_124( val, _values, result )
     @@log.info("boolean_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2335,5 +2381,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 312
+module_eval <<'.,.,', 'lib/parser.y', 329
   def _reduce_125( val, _values, result )
     @@log.info("character_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2342,5 +2388,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 316
+module_eval <<'.,.,', 'lib/parser.y', 333
   def _reduce_126( val, _values, result )
     @@log.info("date_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2349,5 +2395,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 320
+module_eval <<'.,.,', 'lib/parser.y', 337
   def _reduce_127( val, _values, result )
     @@log.info("time_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2356,5 +2402,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 324
+module_eval <<'.,.,', 'lib/parser.y', 341
   def _reduce_128( val, _values, result )
     @@log.info("date_time_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2363,5 +2409,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 328
+module_eval <<'.,.,', 'lib/parser.y', 345
   def _reduce_129( val, _values, result )
     @@log.info("duration_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2370,5 +2416,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 332
+module_eval <<'.,.,', 'lib/parser.y', 349
   def _reduce_130( val, _values, result )
     @@log.info("uri_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2407,5 +2453,5 @@
  # reduce 145 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 353
+module_eval <<'.,.,', 'lib/parser.y', 370
   def _reduce_146( val, _values, result )
     @@log.info("V_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2414,5 +2460,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 357
+module_eval <<'.,.,', 'lib/parser.y', 374
   def _reduce_147( val, _values, result )
     @@log.info("V_GENERIC_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2421,5 +2467,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 362
+module_eval <<'.,.,', 'lib/parser.y', 379
   def _reduce_148( val, _values, result )
     @@log.info("V_STRING: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2590,5 +2636,5 @@
  # reduce 229 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 473
+module_eval <<'.,.,', 'lib/parser.y', 490
   def _reduce_230( val, _values, result )
     @@log.info("V_ISO8601_DURATION: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2621,5 +2667,5 @@
  # reduce 242 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 492
+module_eval <<'.,.,', 'lib/parser.y', 509
   def _reduce_243( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: V_QUALIFIED_TERM_CODE_REF = #{val[0]} at #{@filename}:#{@lineno}")
@@ -2634,5 +2680,5 @@
  # reduce 246 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 501
+module_eval <<'.,.,', 'lib/parser.y', 518
   def _reduce_247( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: V_URI = #{val[0]} at #{@filename}:#{@lineno}")
@@ -2721,5 +2767,5 @@
  # reduce 287 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 570
+module_eval <<'.,.,', 'lib/parser.y', 587
   def _reduce_288( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}")
@@ -2728,5 +2774,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 574
+module_eval <<'.,.,', 'lib/parser.y', 591
   def _reduce_289( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}")
@@ -2885,5 +2931,5 @@
  # reduce 364 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 694
+module_eval <<'.,.,', 'lib/parser.y', 711
   def _reduce_365( val, _values, result )
     @in_interval = false
@@ -2909,5 +2955,5 @@
  # reduce 373 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 716
+module_eval <<'.,.,', 'lib/parser.y', 733
   def _reduce_374( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{word} at #{@filename}")
